Repository navigation
fix(@angular/ssr): ensure public directory containment in CommonEngine - #33959
alan-agius4 merged 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the path traversal prevention logic in CommonEngine by using relative and isAbsolute checks instead of startsWith(normalize(publicPath)), and moves this check before the SSG page lookup. The review feedback points out that relativePath.startsWith('..') can cause false positives for files or directories starting with .. (e.g., ..sibling) and suggests a more precise check to handle path separators correctly.
696cd24 to
f8cb013
Compare
Ensure that paths resolved in `retrieveSSGPage` strictly remain within the configured `publicPath` by checking `relative()` containment before evaluating the static file. Previously, a string `startsWith()` check was used, which could match sibling directories that share the same name prefix as `publicPath`.
f8cb013 to
82b9115
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Ensure that paths resolved in
retrieveSSGPagestrictly remain within the configuredpublicPathby checkingrelative()containment before evaluating the static file.Previously, a string
startsWith()check was used, which could match sibling directories that share the same name prefix aspublicPath.