perf(@angular/cli): avoid redundant package version resolution in ng add#32715
Open
clydin wants to merge 1 commit intoangular:mainfrom
Open
perf(@angular/cli): avoid redundant package version resolution in ng add#32715clydin wants to merge 1 commit intoangular:mainfrom
clydin wants to merge 1 commit intoangular:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request optimizes the ng add command by preventing redundant package version resolutions, ensuring subsequent operations use the exact resolved version and eliminating unnecessary registry lookups. However, the current implementation introduces a security risk by trusting the name and version fields from the package manifest to update the package identifier. This could lead to package substitution or path traversal attacks if a malicious manifest is provided. A validation check is required to ensure the manifest data aligns with the requested package.
c18d934 to
05c4898
Compare
The `ng add` command would previously resolve the package version from the registry multiple times during execution. This change updates the package identifier with the exact version from the manifest once it has been fetched from the registry, preventing subsequent redundant lookups. Additionally, the already-parsed package identifier is now passed directly to the package manager's `getManifest` method.
05c4898 to
7040590
Compare
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.
The
ng addcommand would previously resolve the package version from the registry multiple times during execution. This change updates the package identifier with the exact version from the manifest once it has been fetched from the registry, preventing subsequent redundant lookups. Additionally, the already-parsed package identifier is now passed directly to the package manager'sgetManifestmethod.