Skip to content

fix(@angular/ssr): ensure public directory containment in CommonEngine - #33957

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-common-engine-path-containment-main
Aug 28, 2026
Merged

fix(@angular/ssr): ensure public directory containment in CommonEngine#33957
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-common-engine-path-containment-main

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

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.

@alan-agius4
alan-agius4 requested a review from clydin August 28, 2026 07:37
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Aug 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the path traversal protection in the Angular SSR CommonEngine. It replaces the previous startsWith(normalize(publicPath)) check with a more robust check using relative and isAbsolute from node:path, which is executed before attempting to read any pre-rendered pages. I have no feedback to provide as there are no review comments.

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`.
@alan-agius4
alan-agius4 force-pushed the fix-common-engine-path-containment-main branch from 4ffcaf9 to b2d30ea 比较 August 28, 2026 07:56
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 28, 2026
@alan-agius4
alan-agius4 merged commit bb72145 into angular:main Aug 28, 2026
40 checks passed
@alan-agius4
alan-agius4 deleted the fix-common-engine-path-containment-main branch August 28, 2026 15:44
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

action: merge The PR is ready for merge by the caretaker area: @angular/ssr target: patch This PR is targeted for the next patch release

项目

None yet

Development

Successfully merging this pull request may close these issues.

2 participants