feat: bewaak dat een pad uit FilePicker achter een platformpoort staat #527
No reviewers
Labels
No labels
accepted
bug
declined
docs
duplicate
enhancement
good first issue
in-progress
needs-info
privacy
security
triage
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
LibreKAT/Ocideck!527
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/filepicker-poort"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
#150 came back as #506 because nothing guarded the fix. This adds the guard, in
tool/check_conventions.dartrather thantool/check_web_hardening.dart— the latter readsbuild/web, the output of a web build, and cannot reason about source at all.Closes #505
The rule
A file in
lib/that takes a filesystem path from the file picker must namesupportsLocalProjectFolders(orisWebPlatform) itself. Two shapes count:FilePicker.getDirectoryPath(— no web implementation; returnsnullwithout a sound. This was #150.FilePicker.pickFiles(whose.pathis read withoutwithData: true— works on web, but hands back ablob:URL that points nowhere after a reload. This was #506.saveFile(bytes:)is deliberately excluded: in a browser that is a download and does exactly what it promises.Why static and not a test
kIsWebis alwaysfalseunderflutter test, the flag arrives through a conditional import with no injection point, and there is no--platform chrometarget. A widget test sits green around the broken branch — which is worse than no test, because it buys confidence that is not there.The baseline is 7, not 0
I told the issue it would land on zero. It does not, and the reason matters: the class is wider than #150 and #506 suggested. Seven files take a path from the picker without naming the flag:
open_presentation,slide_finder,import_slides,save_destination) that are correctly gated at their caller — the file itself cannot prove it;lib/services/file_service.dart(2 sites) andlib/services/image_service.dart(3 sites), the latter being precisely the service that handlesmem:keys on web;image_carousel_picker_actions.dart, which is an open bug (#526).Baselining them is not approval — it is writing them down. Each needs its own decision (hide on web, or take the bytes route), and none of those decisions is safe to make unattended. A stale baseline entry is reported too: a baseline that no longer matches reality reads as "someone thought about this" when nobody did.
Follow-up filed to work the list down.
Verification, in four directions
getDirectoryPathin an ungated file;pickFilesthat reads.path;withData: true— the rule must not punish the correct pattern;Also in this PR
docs/CHECKS.mdsaidserviceUiImportBaselineis "currently 8"; the code says 4. Corrected while documenting the new rule — one word, in the section being edited.Gates
make checkgreen.make check-secrets/make saststill red for the pre-existing reasons in #522 and #521.Principles
No format, storage, dependency or outgoing traffic. Adds a gate, which is the cheap direction: it constrains us, not the user's files.