Skip to content

XRAY-138687 - [Curation] Implementing support for additional flags#721

Merged
attiasas merged 3 commits intojfrog:devfrom
gauriy-tech:feature/XRAY-138687-add-flgs-support
Apr 28, 2026
Merged

XRAY-138687 - [Curation] Implementing support for additional flags#721
attiasas merged 3 commits intojfrog:devfrom
gauriy-tech:feature/XRAY-138687-add-flgs-support

Conversation

@gauriy-tech
Copy link
Copy Markdown
Contributor

@gauriy-tech gauriy-tech commented Apr 8, 2026

  • The pull request is targeting the dev branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....
  • All static analysis checks passed.
  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • Updated the Contributing page / ReadMe page / CI Workflow files if needed.
  • All changes are detailed at the description. if not already covered at JFrog Documentation, new documentation have been added.

Added support for --legacy-peer-deps Done

Benefits :- It unblocks curation auditing for npm projects that can't install cleanly under npm 7+, which is a very common real-world situation — many projects maintain older dependencies or have transitive peer conflicts they haven't resolved. Without this flag, those projects would simply be unable to run jf ca at all.

Screenshot 2026-04-13 at 3 15 48 PM Screenshot 2026-04-13 at 3 16 31 PM

--run-native flag for jf ca (Curation Audit)
Problem it solves
jf ca normally injects Artifactory as the npm registry during dependency resolution (writes .npmrc, runs npm install). This breaks for users who:

  1. Use Volta (a Node.js toolchain manager whose npm shim gets bypassed)
  2. Have a custom .npmrc that conflicts with JFrog's injection
  3. Don't want jf ca to modify their project's node_modules or package-lock.json

What --run-native does
When passed, jf ca hands off dependency resolution entirely to the user's native npm environment:

  1. Skips injecting Artifactory as the npm registry — npm runs as-is, respecting the user's .npmrc and Volta configuration
  2. Skips deleting node_modules/package-lock.json before running — no destructive side effects on the project
  3. No jf npm-config required — reads the Artifactory URL and repository name for Curation HEAD requests directly from the project's .npmrc (via npm config get registry), parsing /api/npm/ from it
  4. Auth still comes from jf c — credentials are sourced from ~/.jfrog/jfrog-cli.conf, not from .npmrc

Constraints
npm registry in .npmrc must be an Artifactory npm registry (URL must contain /api/npm/)
Supports both standard (/artifactory/api/npm/) and reverse-proxy URLs (where /artifactory context root is stripped)
If the registry is not Artifactory, the command fails with a clear error

Error handling
If authentication fails (401), the audit stops immediately with a descriptive error pointing the user to run jf c to fix their server configuration — no misleading "0 blocked packages" result is shown

Copy link
Copy Markdown
Collaborator

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

We already have:

DepType:      components.NewStringFlag(DepType, "[npm] Defines npm dependencies type. Possible values are: all, devOnly and prodOnly."),
func (abp *AuditBasicParams) SetNpmScope(depType string) *AuditBasicParams {
	switch depType {
	case "devOnly":
		abp.args = []string{"--dev"}
	case "prodOnly":
		abp.args = []string{"--prod"}
	}
	return abp
}

Why not extend that?

@attiasas attiasas changed the base branch from main to dev April 9, 2026 06:45
@attiasas attiasas added improvement Automatically generated release notes safe to test Approve running integration tests on a pull request labels Apr 9, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 9, 2026
@gauriy-tech
Copy link
Copy Markdown
Contributor Author

Collaborator

Implemented

@attiasas attiasas self-requested a review April 15, 2026 13:53
Copy link
Copy Markdown
Collaborator

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

If we use DepType Why do we also need the flag LegacyPeerDeps?
Why not adding DepType to CurationAudit and use it? (i.e support DepType in Curation Audit)
--legacy-peer-deps --> --dep-type=legacyPeerDeps

@gauriy-tech gauriy-tech force-pushed the feature/XRAY-138687-add-flgs-support branch from 11a31b8 to 8b1ffd0 Compare April 28, 2026 06:39
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
Copy link
Copy Markdown
Collaborator

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

Please check my comments.
In addition consider adding test cases for new options

Comment thread commands/audit/auditbasicparams.go Outdated
Comment thread cli/scancommands.go Outdated
Comment thread sca/bom/buildinfo/technologies/npm/npm.go Outdated
@gauriy-tech gauriy-tech force-pushed the feature/XRAY-138687-add-flgs-support branch from 5a664f5 to 090e4b7 Compare April 28, 2026 07:49
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@gauriy-tech
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@gauriy-tech gauriy-tech force-pushed the feature/XRAY-138687-add-flgs-support branch from 267ce1e to c2ba8cb Compare April 28, 2026 08:54
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@gauriy-tech gauriy-tech force-pushed the feature/XRAY-138687-add-flgs-support branch from 7b527a6 to c14b8a4 Compare April 28, 2026 10:01
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
Copy link
Copy Markdown
Collaborator

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

LGTM

@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@github-actions
Copy link
Copy Markdown

👍 Frogbot scanned this pull request and did not find any new security issues.


@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Apr 28, 2026
@attiasas attiasas merged commit a3f0211 into jfrog:dev Apr 28, 2026
216 of 274 checks passed
@attiasas attiasas added new feature Automatically generated release notes and removed improvement Automatically generated release notes labels Apr 28, 2026
@attiasas attiasas changed the title XRAY-138687 - Implementing support for additional flags XRAY-138687 - [Curation] Implementing support for additional flags Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants