Skip to content

Feature/xray 138688 add yarn support for jf ca - #759

Merged
attiasas merged 6 commits into
jfrog:devfrom
gauriy-tech:feature/XRAY-138688-add-yarn-support
Jun 8, 2026
Merged

attiasas merged 6 commits into
jfrog:devfrom
gauriy-tech:feature/XRAY-138688-add-yarn-support

Conversation

@gauriy-tech

@gauriy-tech gauriy-tech commented May 21, 2026 •

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

Add Yarn V2/V3 support for jf curation-audit

Previously jf ca had no Yarn support — running it on a Yarn project would either silently resolve via the npm code path or produce incomplete results. This PR adds full Yarn Berry (V2/V3) support.

What changed:

Curation install via Artifactory — rewrites the Yarn registry URL in .yarnrc.yml to the api/curation/audit// endpoint before running yarn install --mode=update-lockfile, then restores the original config. This routes all Yarn resolution through the curation service so 403 responses surface blocked packages.

Blocked package detection when install fails — when a curation 403 aborts the lockfile write (Yarn V3 rolls back on any error), the code falls back to probing declared direct dependencies via HEAD requests and renders the same blocked-package table the normal path produces.

Workspace member support — jf ca --working-dirs= on a Yarn workspace member re-routes to the workspace root automatically (Yarn V2+ cannot operate from a non-root). A new DetectedTechnologiesListForCurationAudit() promotes npm-detected workspace members to Yarn so the correct code path runs.

Workspace member filtering in graph — local workspace member packages (identified by the Yarn Berry name-hash pattern, e.g. admin-ui-428bae:0.0.0) are skipped when probing Artifactory — they have no remote artifact.

Root-only dep scope — when jf ca is run from a workspace root without --working-dirs, only the root package.json direct deps are audited. Use --working-dirs to audit individual members.

--run-native guard — --run-native is explicitly rejected for non-npm techs with a clear error; only npm implements the matching native-config flow today.

Graceful non-JSON 403 handling — when Artifactory returns an HTML error page instead of a JSON curation envelope, the package is still recorded as blocked with unknown policy rather than being silently dropped.

Testing done is documented here
https://jfrog-int.atlassian.net/browse/XRAY-140292

Error screenshot reference
Screenshot 2026-05-29 at 7 46 50 PM

@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from a4242f6 to decd960 Compare May 25, 2026 16:39
@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from decd960 to 1d6bde3 Compare May 26, 2026 08:30
@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from 1d6bde3 to a15280f Compare May 27, 2026 04:18
@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from a15280f to f496cf0 Compare May 27, 2026 04:22
@gauriy-tech

Copy link
Copy Markdown
Collaborator Author

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

Comment thread commands/curation/curationaudit.go Resolved
Comment thread commands/audit/auditbasicparams.go Resolved
@gineshkumar

Copy link
Copy Markdown

Two new code paths in this PR handle the same upstream condition (a 403 with an unparseable or empty-Errors body) but produce very different report rows:

  • yarn V2 probe (yarn.go:857,911): row shows "Blocked by curation (response could not be parsed)" — honest.
  • General walker (curationaudit.go:1098,1109): row shows Policy violations with empty Policy / Explanation / Recommendation — looks identical to a real policy block.

The general walker runs for every tech (npm, pip, maven, gradle, yarn-V3-success-path, …), so the silent-collapse behaviour is the dominant case across the product. A support engineer triaging a later ticket has no way to tell "real policy block, empty payload" from "403 we couldn't decode."

Worth aligning the two paths before merge.

@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from f496cf0 to df3fcef Compare May 28, 2026 07:04
@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from df3fcef to 3e86548 Compare May 29, 2026 09:14
@gauriy-tech

Copy link
Copy Markdown
Collaborator Author

Two new code paths in this PR handle the same upstream condition (a 403 with an unparseable or empty-Errors body) but produce very different report rows:

  • yarn V2 probe (yarn.go:857,911): row shows "Blocked by curation (response could not be parsed)" — honest.
  • General walker (curationaudit.go:1098,1109): row shows Policy violations with empty Policy / Explanation / Recommendation — looks identical to a real policy block.

The general walker runs for every tech (npm, pip, maven, gradle, yarn-V3-success-path, …), so the silent-collapse behaviour is the dominant case across the product. A support engineer triaging a later ticket has no way to tell "real policy block, empty payload" from "403 we couldn't decode."

Worth aligning the two paths before merge.

@gauriy-tech

Copy link
Copy Markdown
Collaborator Author

#759 (comment)

Fixed. Added a guard after extractPoliciesFromMsg: when blockingReason == BlockingReasonPolicy but len(policies) == 0 (regex found no {policy,...} groups), we now fall back to BlockingReasonUnknown. All three unparseable-403 paths in getBlockedPackageDetails now consistently produce "Blocked by curation (response could not be parsed)", matching the yarn V2 probe path.

@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from 04b8267 to 64c40d7 Compare June 1, 2026 07:17

@attiasas attiasas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice job, see my comments

Comment thread utils/techutils/techutils.go Resolved
Comment thread commands/curation/curationaudit.go Resolved
Comment thread commands/curation/curationaudit.go Resolved
Comment thread commands/curation/curationaudit.go Resolved
Comment thread commands/curation/curationaudit.go Resolved
@gauriy-tech
gauriy-tech requested a review from attiasas June 4, 2026 10:28
@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from 64c40d7 to cafb533 Compare June 4, 2026 11:05
@attiasas attiasas added new feature Automatically generated release notes safe to test Approve running integration tests on a pull request labels Jun 8, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Jun 8, 2026
@gauriy-tech
gauriy-tech force-pushed the feature/XRAY-138688-add-yarn-support branch from 86833a3 to 839f709 Compare June 8, 2026 06:34
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Jun 8, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

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


@attiasas attiasas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@attiasas
attiasas merged commit 05bb72f into jfrog:dev Jun 8, 2026
130 of 168 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
jfrog-cli 2.108.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What changed in v2.108.0

> Auto-generated from 6 repositories · 2026-06-11  
> Comparing `v2.107.0` → `v2.108.0`

> ℹ️  No changes in: gofrog

### ✨ New Features

- **[build-info-go]** Added pnpm package support to recognise 403 Forbidden output [#389](jfrog/build-info-go#389) (@Phavya-jfrog)
- **[jfrog-cli]** Add jf mcp command to configure the remote JFrog MCP server [#3533](jfrog/jfrog-cli#3533) (@ehl-jf)
- **[jfrog-cli]** Add AI context description to commands [#3503](jfrog/jfrog-cli#3503) (@ehl-jf)
- **[jfrog-cli]** feat: add server id to login command [#3394](jfrog/jfrog-cli#3394) (@tim-goto)
- **[jfrog-cli]** RTECO-1021 - Enhance metrics visibility by including package manager context [#3534](jfrog/jfrog-cli#3534) (@fluxxBot)
- **[jfrog-cli]** Make nix command visible [#3539](jfrog/jfrog-cli#3539) (@reshmifrog)
- **[jfrog-cli]** Added Post Failure Run support for pnpm and Yarn [#3509](jfrog/jfrog-cli#3509) (@Phavya-jfrog)
- **[jfrog-cli-artifactory]** JGC-473 - Add AI-agent help text to artifactory commands [#455](jfrog/jfrog-cli-artifactory#455) (@ehl-jf)
- **[jfrog-cli-artifactory]** RTECO-1021 - Enhance metrics visibility by including package manager context [#481](jfrog/jfrog-cli-artifactory#481) (@fluxxBot)
- **[jfrog-cli-artifactory]** RTECO-1400 - Add path validation to prevent traversal attacks in artifact handling [#487](jfrog/jfrog-cli-artifactory#487) (@fluxxBot)
- **[jfrog-cli-core]** RTECO-1021 - Enhance metrics visibility by including package manager context [#1569](jfrog/jfrog-cli-core#1569) (@fluxxBot)
- **[jfrog-cli-security]** Support parsing SCA issues without components [#758](jfrog/jfrog-cli-security#758) (@attiasas)
- **[jfrog-cli-security]** JGC-473 - Add AI-agent help text to security commands [#760](jfrog/jfrog-cli-security#760) (@ehl-jf)
- **[jfrog-cli-security]** Feature/xray 138688 add yarn support for jf ca [#759](jfrog/jfrog-cli-security#759) (@gauriy-tech)
- **[jfrog-cli-security]** XRAY-144809 - CA command [Maven]: Add option to consider plugin deps [#771](jfrog/jfrog-cli-security#771) (@gauriy-tech)
- **[jfrog-cli-security]** Feature/xray 138688 add pnpm support for jf ca [#769](jfrog/jfrog-cli-security#769) (@gauriy-tech)

### 🐛 Bug Fixes

- **[build-info-go]** RTECO-1287 jf poetry install --only main captures all dependency  [#391](jfrog/build-info-go#391) (@reshmifrog)
- **[jfrog-cli]** RTECO 1296 fix repeated 401 errors before fallback authentication [#3537](jfrog/jfrog-cli#3537) (@reshmifrog)
- **[jfrog-cli]** RTECO-1287 jf poetry install --only main captures all dependency  [#3530](jfrog/jfrog-cli#3530) (@reshmifrog)
- **[jfrog-cli-artifactory]** Updated logic for extracting repository key in case of reverse proxy scenario [#458](jfrog/jfrog-cli-artifactory#458) (@naveenku-jfrog)
- **[jfrog-cli-core]** Revert "Fix reference token privilege escalation" [#1571](jfrog/jfrog-cli-core#1571) (@reshmifrog)
- **[jfrog-cli-security]** XRAY-140212 - Updated gradle dep tree jar with the missing deps fix [#751](jfrog/jfrog-cli-security#751) (@gauriy-tech)
- **[jfrog-cli-security]** fix: disable npm workspaces for native config reads [#762](jfrog/jfrog-cli-security#762) (@omribz156)

### 📦 Other Changes

- **[build-info-go]** RTECO-1365 Include e2e tests from jfrog cli to build-info-go [#390](jfrog/build-info-go#390) (@reshmifrog)
- **[jfrog-cli-artifactory]** pnpm update error output handling [#465](jfrog/jfrog-cli-artifactory#465) (@Phavya-jfrog)
- **[jfrog-cli-security]** Auto install Cocoapods when Podfile.lock not exist [#723](jfrog/jfrog-cli-security#723) (@attiasas)
- **[jfrog-client-go]** Use Windows system certificate store for CLI TLS transport [#1351](jfrog/jfrog-client-go#1351) (@RemiBou)

---

### 📊 Summary

| Repository | Changes |
|---|---|
| [jfrog-cli](https://github.com/jfrog/jfrog-cli) | 8 |
| [jfrog-cli-security](https://github.com/jfrog/jfrog-cli-security) | 8 |
| [jfrog-cli-artifactory](https://github.com/jfrog/jfrog-cli-artifactory) | 5 |
| [build-info-go](https://github.com/jfrog/build-info-go) | 3 |
| [jfrog-cli-core](https://github.com/jfrog/jfrog-cli-core) | 2 |
| [jfrog-client-go](https://github.com/jfrog/jfrog-client-go) | 1 |
| **Total** | **27** |

### 🔗 Module Version Changes

| Module | From | To |
|---|---|---|
| [build-info-go](https://github.com/jfrog/build-info-go) | `v1.13.1-0.20260528065004-80409c046540` | `v1.13.1-0.20260610071651-260ad6720e0d` |
| [jfrog-cli-artifactory](https://github.com/jfrog/jfrog-cli-artifactory) | `v0.8.1-0.20260603105750-3886c0f01286` | `v0.8.1-0.20260610074911-82ce7d90edbd` |
| [jfrog-cli-core](https://github.com/jfrog/jfrog-cli-core) | `v2.60.1-0.20260601130310-8d52a530da18` | `v2.60.1-0.20260609101026-df3091b39d06` |
| [jfrog-cli-security](https://github.com/jfrog/jfrog-cli-security) | `v1.29.3` | `v1.30.0` |
| [jfrog-client-go](https://github.com/jfrog/jfrog-client-go) | `v1.55.1-0.20260528115006-6ca9682a3255` | `v1.55.1-0.20260603130552-af1dd449b994` |
</pre>
  <p>View the full release notes at <a href="https://github.com/jfrog/jfrog-cli/releases/tag/v2.108.0">https://github.com/jfrog/jfrog-cli/releases/tag/v2.108.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!11303

This branch was previously deployed

1 inactive deployment
frogbot — 0ad2b619 Deployed Jun 8, 2026 by attiasas via scan-pull-request #3777
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.

3 participants