Skip to content

XRAY-171777 - Improve npm debug parser in npm debug jf ca flow - #958

Merged
attiasas merged 1 commit into
jfrog:devfrom
gauriy-tech:bugfix/XRAY-171777-fix-npm-etarget
Nov 25, 2026
Merged

attiasas merged 1 commit into
jfrog:devfrom
gauriy-tech:bugfix/XRAY-171777-fix-npm-etarget

Conversation

@gauriy-tech

@gauriy-tech gauriy-tech commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes XRAY-171777: jf curation-audit returned the raw npm
ETARGET error, with no blocked table, when a CVS-hidden version is exact-pinned and package.json has no
name or version.

Cause

npm logs a parent (OK for: <name>@<version>) in its placeDep debug line only when package.json has both a
name and a version. Otherwise it logs a blank parent (OK for: want: <spec>). npmPlaceDepRegex required a
parent, so the npm debug-log fallback parsed no entries, sent no probe, and returned the original error.

Change

  • npmPlaceDepRegex: the parent is optional, and its version may be blank ((\S*)).
  • buildGraphFromLogEntries: a blank parent can only be the root, so it maps to the root id. Without this, a
    name-only or version-only package.json leaves the graph with no children.

Tests

  • Parser test for the blank-parent line.
  • Fallback test for no name or version, name only, and version only, each asserting a blocked direct-dependency row.
  • Reproduced and verified locally on a curated npm remote (npm 10.5.0, nameless package.json).

Before

Screenshot 2026-11-25 at 12 00 56 AM Screenshot 2026-11-25 at 12 01 51 AM

After

Screenshot 2026-11-25 at 12 19 06 AM

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization, Workspace
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 687a3a09-0b71-4eab-89ad-4b985d2c5c4e

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

@gauriy-tech
gauriy-tech force-pushed the bugfix/XRAY-171777-fix-npm-etarget branch from 373fdc3 to 3c487e3 Compare November 24, 2026 19:22
@gauriy-tech gauriy-tech added the safe to test Approve running integration tests on a pull request label Nov 24, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Nov 24, 2026
Comment thread commands/curation/npmlogparser.go Resolved
@Phavya-jfrog

Copy link
Copy Markdown
Contributor

Question (non-blocking, likely a follow-up): while verifying this fix against npm 11.20, a parent that has no _id (a file: dependency or workspace member without a version) is logged as its bare location rather than name@version, e.g. placeDep ROOT z@1.0.0 OK for: a want: file:../z or OK for: pkgs/a want: .... Neither the old nor the new npmPlaceDepRegex matches that shape, so the line (and anything that hangs under that parent) is still dropped from the fallback, which can leave the raw ETARGET error for projects that combine such a dependency with a CVS-hidden pin. This is the same behaviour as on dev, so it doesn't look caused by this PR.

Is that shape intentionally out of scope here? If so, a separate ticket may be worthwhile. Mapping the bare location to the root would misattribute z as a direct dependency, so a fix would probably need to resolve the location to a node from the log itself.


Review generated by xray-pr-review

@gauriy-tech
gauriy-tech force-pushed the bugfix/XRAY-171777-fix-npm-etarget branch from 3c487e3 to f801bb4 Compare November 25, 2026 08:42
@gauriy-tech gauriy-tech added the safe to test Approve running integration tests on a pull request label Nov 25, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Nov 25, 2026
@gauriy-tech gauriy-tech added the bug Something isn't working label Nov 25, 2026
@attiasas attiasas added the safe to test Approve running integration tests on a pull request label Nov 25, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Nov 25, 2026
@github-actions

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 b723b30 into jfrog:dev Nov 25, 2026
105 of 134 checks passed

This branch was previously deployed

1 inactive deployment
frogbot — f801bb4e Deployed Nov 25, 2026 by gauriy-tech via scan-pull-request #4875
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants