fix: disable npm workspaces for native config reads#762
Open
omribz156 wants to merge 2 commits into
Open
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
attiasas
reviewed
May 26, 2026
| const ( | ||
| IgnoreScriptsFlag = "--ignore-scripts" | ||
| LegacyPeerDepsFlag = "--legacy-peer-deps" | ||
| disableWorkspacesFlag = "--workspaces=false" |
Collaborator
There was a problem hiding this comment.
🟡 Documentation
Please add a one-line comment on disableWorkspacesFlag / npmConfigGetArgs noting that npm 7+ can return ENOWORKSPACES for npm config get when cwd is a workspace package (see jfrog/jfrog-cli#3473).
|
|
||
| func npmConfigGetArgs(key string) []string { | ||
| return []string{"config", "get", key, disableWorkspacesFlag} | ||
| } |
Collaborator
There was a problem hiding this comment.
What about users with npm versions lower than the new flag? It will result in an error if the flag is unknown. Should we add a guard?
b692c65 to
877cc0d
Compare
Author
|
Thanks for the review. I pushed
Verification:
CLA is still pending separately. This follow-up was Codex-assisted and manually checked before pushing. |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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
This patch fixes the native npm config lookup path used by
jf curation-audit --run-nativefor npm workspace packages.When curation audit runs from a workspace package directory, npm 10 can infer workspace mode and reject
npm config get registrywithENOWORKSPACES. The fix adds--workspaces=falseto the nativenpm config getcalls used for the registry and auth-token lookups, so curation can still read the project npm config without entering workspace mode.This is related to the report in jfrog/jfrog-cli#3473; the curation implementation lives in this repository.
Verification
npx npm@10.9.2 config get registryfails withENOWORKSPACESfrom an npm workspace package directory, while adding--workspaces=falsesucceeds.go test ./sca/bom/buildinfo/technologies/npmgo vet ./...git diff --checkImplemented with Codex assistance; I kept the patch focused and manually reviewed the final diff.
devbranch.go vet ./....go fmt ./....