Summary
Zip extraction in three places validates output paths with:
if (!targetPath.startsWith(root)) { ... }
without ensuring root ends with a path separator. The .. substring check catches most traversal attempts, but package:path provides p.isWithin(base, path) for correct boundary checks (e.g. /tmp/abc vs /tmp/abcd edge cases on some platforms).
Affected code
lib/core/market/http_marketplace_repository.dart (~line 160)
lib/core/extensions/local_extension_installer.dart (~line 229)
lib/core/updater/installers/update_install_utils.dart (~line 31)
Proposed fix
Replace startsWith(root) checks with p.isWithin(root, targetPath) (or equivalent helper with trailing separator). Add regression test for prefix-boundary case if feasible on CI OS.
Acceptance criteria
Severity
Low — defense-in-depth; primary .. guard likely sufficient today.
Related
Summary
Zip extraction in three places validates output paths with:
without ensuring
rootends with a path separator. The..substring check catches most traversal attempts, butpackage:pathprovidesp.isWithin(base, path)for correct boundary checks (e.g./tmp/abcvs/tmp/abcdedge cases on some platforms).Affected code
lib/core/market/http_marketplace_repository.dart(~line 160)lib/core/extensions/local_extension_installer.dart(~line 229)lib/core/updater/installers/update_install_utils.dart(~line 31)Proposed fix
Replace
startsWith(root)checks withp.isWithin(root, targetPath)(or equivalent helper with trailing separator). Add regression test for prefix-boundary case if feasible on CI OS.Acceptance criteria
isWithin(or shared helper).Severity
Low — defense-in-depth; primary
..guard likely sufficient today.Related