jfrog / jfrog/jfrog-cli-security

XRay doesn't scan dependencies in NPM builds

Open
#321 27 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Go
Stars
13
Forks
50
Avg merge
3d 48m
Merged PRs (30d)
26

Description

I'm trying to integrate build scan feature to CI for our npm-based projects. Here're the steps in my pipeline

script:
    - curl -fL https://install-cli.jfrog.io | sh
    - CI=true jf config add my-server --url https://my-server.jfrog.io --user ${ARTIFACTORY_USERNAME} --password ${ARTIFACTORY_PASSWORD}
    - jf npm-config --server-id-resolve my-server --server-id-deploy my-server --repo-resolve npm-local --repo-deploy npm-local
    - npm install
    - jf npm install --build-name=my-build --build-number=$CI_COMMIT_SHORT_SHA
    - jf npm publish --build-name=my-build --build-number=$CI_COMMIT_SHORT_SHA
    - jf rt build-publish my-build $CI_COMMIT_SHORT_SHA
    - jf build-scan my-build $CI_COMMIT_SHORT_SHA

I have to do plain npm install first to pull dependencies from the public registry (registry.npmjs.org) because my artifactory repo is empty and jf npm install fails with 404 error

All my dependencies are listed in package.json file and if I run npm audit it says that I have some vulnerabilities. However, when I publishing build to artifactory and scan it with an XRay, no vulnerabilities/licenses found. Looks like XRay doesn't scan dependencies.

Is it because I download dependencies from public registry? How can I manage to scan dependencies in this case?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the pipeline with package.json, plain npm install, jf npm install, build-publish, and build-scan, then compare the published build with the npm audit results. Trace how dependencies obtained from the public registry are represented in the build, and consider the issue done when those dependencies are included in the XRay scan with their vulnerabilities and licenses reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
ci-cd, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.