Repository navigation
fix(@angular/build): use isSubDirectory in normalizeAssetPatterns and ignore nested .gitkeep - #34420
Merged
alan-agius4 merged 5 commits intoOct 20, 2026
Conversation
… ignore nested .gitkeep - Replace `.startsWith(...)` prefix checks in `normalizeAssetPatterns` with `isSubDirectory(...)` so sibling directories sharing a prefix with `sourceRoot`, `projectRoot`, or `workspaceRoot` (such as `src-assets` when `sourceRoot` is `src`) are resolved against the proper parent directory instead of producing a `..` output path error. - Update `DEFAULT_ASSET_IGNORE` in `resolve-assets.ts` from `'.gitkeep'` to `'**/.gitkeep'` so nested `.gitkeep` files are also ignored, matching `'**/.DS_Store'` and `'**/Thumbs.db'`. - Validate that resolved asset `destination` paths in `resolveAssets` do not escape the output root via `..`.
…rns and ignore nested .gitkeep
alan-agius4
marked this pull request as ready for review
October 20, 2026 09:37
There was a problem hiding this comment.
Code Review
This pull request enhances asset path normalization and resolution by utilizing isSubDirectory checks and introducing a resolveDestination helper to prevent assets from escaping the output directory. It also updates the default asset ignore patterns to ignore .gitkeep files globally and adds comprehensive unit tests. Feedback was provided regarding a potential path traversal vulnerability on Windows if the destination path becomes absolute, suggesting an additional check for absolute paths to prevent escaping the output directory.
…rns and ignore nested .gitkeep
…rns and ignore nested .gitkeep
…rns and ignore nested .gitkeep
clydin
approved these changes
Oct 20, 2026
Collaborator
Author
|
This PR was merged into the repository. The changes were merged into the following branches:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.startsWith(...)checks innormalizeAssetPatternswithisSubDirectory(...)to prevent sibling directory prefix collisions (e.g.src-assetswhensourceRootissrc).'.gitkeep'to'**/.gitkeep'inDEFAULT_ASSET_IGNORE(resolve-assets.ts) so.gitkeepfiles in nested subdirectories are also ignored.resolveAssetsthat resolveddestinationpaths do not escape the output root via..(e.g. whenglobcontains..).