Repository navigation
fix(@angular/ssr): ensure public directory containment in CommonEngine - #33958
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 the Angular SSR CommonEngine by replacing the startsWith(normalize(publicPath)) check with a check using relative(publicPath, pagePath). It also moves this validation step to run before checking if the page is pre-rendered. The feedback highlights a potential issue where checking relativePath.startsWith('..') can cause false positives for valid files or directories starting with .. (e.g., ..hidden), and suggests a more robust check that accounts for path separators.
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`.
c45c6c3 to
523e60d
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.