Skip to content

fix: prevent path traversal through hashed asset routes - #833

Merged
tdurieux merged 1 commit into
mainfrom
fix/hashed-asset-path-traversal
Sep 15, 2026
Merged

tdurieux merged 1 commit into
mainfrom
fix/hashed-asset-path-traversal

Conversation

@tdurieux

Copy link
Copy Markdown
Owner

Unauthenticated requests to the hashed asset routes could read files outside public/ through raw or URL-encoded traversal paths. Validate decoded filename components and check that the resolved path stays inside the selected asset directory before serving it. Invalid paths return 404; valid assets retain immutable caching.

Regression tests execute the production route with temporary files and cover both asset directories, encoded traversal, sibling-directory escapes, valid assets, missing assets, and static fallback. Before the fix, 10 traversal cases returned 200 instead of 404.

Validation:

  • 20 focused route and asset-build tests pass; targeted ESLint and diff checks pass.
  • Full suite: 655 passing, 49 pending, 6 failures in runtime regression and legacy Vue hashbang tests outside this change.
  • TypeScript checking reports errors in unchanged anonymize-utils, GitHubDownload, and webview files.

@tdurieux
tdurieux merged commit 4eba507 into main Sep 15, 2026
2 checks passed
@tdurieux
tdurieux deleted the fix/hashed-asset-path-traversal branch September 15, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant