Skip to content

Add support in new scan results CDX upload via Xray - #864

Merged
eranturgeman merged 16 commits into
jfrog:devfrom
eranturgeman:migrate-cdx-upload-to-xray
Sep 8, 2026
Merged

eranturgeman merged 16 commits into
jfrog:devfrom
eranturgeman:migrate-cdx-upload-to-xray

Conversation

@eranturgeman

Copy link
Copy Markdown
Contributor
  • 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.

This PR adds support in performing scan-cdx upload via Xray instead of a direct 'rt upload' call.
The existing mechanism uploads and creates the designated repo if doesnt exist. This requires an Artifactory ADMIN token.
This feature allows the user to keep providing only an Xray ADMIN token (like we used to provide in V2) and the entire process happens internally in Xray

@eranturgeman eranturgeman added new feature Automatically generated release notes safe to test Approve running integration tests on a pull request labels Aug 27, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Aug 27, 2026
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Aug 27, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Aug 27, 2026
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Aug 27, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Aug 27, 2026
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Aug 27, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Aug 27, 2026
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Sep 1, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Sep 1, 2026
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Sep 1, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Sep 1, 2026
@eranturgeman
eranturgeman requested a review from a team September 1, 2026 12:18
Comment thread go.sum Resolved
Comment thread utils/utils.go Resolved
Comment thread utils/results/output/reportartifact.go Resolved
Comment thread utils/results/output/reportartifact.go Resolved
@Jordanh1996

Copy link
Copy Markdown
Contributor

Heads up: this came out of an automated review pass in my harness, not from me reading the diff line by line — and I don't fully follow it myself, so please sanity-check it rather than take it at face value.

The claim is about RepoName: rtResultRepository in uploadViaXrayApi:

--upload-repo-path is documented as "Artifactory repository name or path" (cli/docs/flags.go:355), so cli-scan-results/myteam is valid input. The old flow handled that: reportartifact.go joined repo+path into one string, and createRepositoryIfNeededAndUploadFile split the repo name back out with strings.Split(scanResultsRepository, "/")[0] — repo cli-scan-results, artifact under myteam/....

The new call passes the value straight into RepoName, and the server rejects it (repo_name must not contain '/' in verifyBodyFields) → 400 → AddGeneralError fails the whole scan. Also, myteam isn't moved into RepoPath, so even if the server accepted it the artifact would land somewhere else than before.

Separately: the server whitelists only frogbot / cli-scan-results (+ project prefix), so any custom repo name that works today (the CLI creates the repo if missing) also 400s on 3.154+.

Frogbot itself is fine — it hardcodes "frogbot" — and the flag is hidden, so this is only jf audit --static-sca / jf git audit users who set it. Either split like the old code did, or narrow the flag's contract to "name only, one of the two allowed". Right now the code and the help text disagree.

Comment thread utils/results/output/reportartifact.go Resolved
@eranturgeman

eranturgeman commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Heads up: this came out of an automated review pass in my harness, not from me reading the diff line by line — and I don't fully follow it myself, so please sanity-check it rather than take it at face value.

The claim is about RepoName: rtResultRepository in uploadViaXrayApi:

--upload-repo-path is documented as "Artifactory repository name or path" (cli/docs/flags.go:355), so cli-scan-results/myteam is valid input. The old flow handled that: reportartifact.go joined repo+path into one string, and createRepositoryIfNeededAndUploadFile split the repo name back out with strings.Split(scanResultsRepository, "/")[0] — repo cli-scan-results, artifact under myteam/....

The new call passes the value straight into RepoName, and the server rejects it (repo_name must not contain '/' in verifyBodyFields) → 400 → AddGeneralError fails the whole scan. Also, myteam isn't moved into RepoPath, so even if the server accepted it the artifact would land somewhere else than before.

Separately: the server whitelists only frogbot / cli-scan-results (+ project prefix), so any custom repo name that works today (the CLI creates the repo if missing) also 400s on 3.154+.

Frogbot itself is fine — it hardcodes "frogbot" — and the flag is hidden, so this is only jf audit --static-sca / jf git audit users who set it. Either split like the old code did, or narrow the flag's contract to "name only, one of the two allowed". Right now the code and the help text disagree.

@Jordanh1996 Due to security hardening considerations and the fact that this is an implementation details and not for the user to control we dont allow any custom names in this flow anymore.
The users provide EXACTLY one out of 4 options: frogbot, -frogbot, cli-scan-results, -cli-scan-results.
I will block any other option here and the --upload-repo-path is removed completely

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 54185abd-ea2c-4758-859b-6f7ce08909e0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Sep 7, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Sep 7, 2026
@eranturgeman eranturgeman added the safe to test Approve running integration tests on a pull request label Sep 8, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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


@eranturgeman
eranturgeman merged commit c9136c0 into jfrog:dev Sep 8, 2026
66 checks passed

This branch was previously deployed

1 inactive deployment
frogbot — ffa15d32 Deployed Sep 8, 2026 by eranturgeman via scan-pull-request #4487
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