Shipmark / Guides

npm audit vs OSV-Scanner for React Native apps: what each one checks and what it misses

Updated 26 November 2026 · 8 min read

In short

  • Both tools match the exact package versions in a lockfile against a database of known vulnerabilities. Neither tells you whether your app actually reaches the vulnerable code.
  • npm audit is already installed and only needs npm's package-lock.json. OSV-Scanner also reads yarn.lock, pnpm-lock.yaml and bun.lock, and the Android gradle.lockfile.
  • A React Native app has a second supply chain, the native iOS and Android libraries. A scan of the JavaScript lockfile alone leaves that half unchecked.

What both tools do, and what neither does

A vulnerability advisory names a package and the versions it affects. A lockfile records the exact version of every package in your build. A scanner joins the two. That is useful, because it turns hundreds of transitive packages into a short list of advisories that apply to the build you ship.

It is also all that either tool does. The npm audit documentation describes a report of known vulnerabilities for the dependencies in your project and does not describe any analysis of whether your code calls the affected function. OSV-Scanner documents call analysis only for Go and, as an experimental feature, Rust. For a React Native app, every finding is a prompt for a person to decide, not a verdict.

What npm audit checks

According to the npm CLI documentation, npm audit "submits a description of the dependencies configured in your project to your default registry and asks for a report of known vulnerabilities". Three details matter for an app team:

The options you will use most:

Command or optionWhat it does (from the npm documentation)
npm audit --omit=devLeaves development dependencies out of the report. The omitted packages are still resolved and recorded in the lockfile; they are just not part of the check.
--audit-level=highSets the minimum severity at which the command exits with a non-zero code. It does not filter the output. Levels run from info to critical.
--jsonWrites JSON instead of the normal output, which is what you keep as a record: npm audit --json > audit-4.2.0.json
npm audit fixRuns a full install to apply fixes. The documentation says some vulnerabilities cannot be fixed automatically and need manual review.
npm audit fix --forceAllows changes outside your stated version ranges, including major versions. The documentation strongly recommends against it if you do not have a clear idea of what you want.
npm audit signaturesA different check: it verifies the registry signatures and provenance attestations of the packages you downloaded. It tells you a package is what the registry says it is, not that the package is free of vulnerabilities.

By default, npm audit exits with a non-zero code if it finds any vulnerability, so it already works as a gate in CI. Note that the default scope includes development dependencies. Decide deliberately whether your gate should look at everything or only at what ships.

What OSV-Scanner checks

OSV-Scanner checks lockfiles against the OSV database. Its list of supported lockfiles includes, for the parts of a React Native project that matter here:

Part of the appFiles OSV-Scanner lists as supported
JavaScriptpackage-lock.json, yarn.lock, pnpm-lock.yaml, bun.lock
Android (Gradle)gradle.lockfile, buildscript-gradle.lockfile, gradle/verification-metadata.xml
iOSNeither Podfile.lock nor Package.resolved appears on the supported-lockfiles page.

The documented syntax for a specific lockfile is:

osv-scanner scan source --lockfile=package-lock.json --lockfile=android/gradle.lockfile

The documentation recommends scanning a resolved lockfile, and a fully pinned manifest only when there is none, because manifest files "can declare version ranges and do not necessarily record the versions installed in an environment". That is the same reason you should never scan package.json alone.

The exit codes are more specific than npm's:

Exit codeMeaning
0Packages were found and nothing matches a known vulnerability.
1Packages were found, and there are vulnerabilities or findings.
127General error.
128No packages found, likely because the scan did not pick up any files.

Treat 128 as a failure in CI. A scan that finds no files looks exactly like a clean app. Output formats include table (the default), json, sarif, html, markdown, CycloneDX and SPDX. To silence a finding you have triaged, put an osv-scanner.toml next to the lockfile and give a reason:

[[IgnoredVulns]]
id = "CVE-2022-24713"
reason = "Dev dependency, does not ship in the app"

The ID above is the documentation's example; use your own advisory and a reason someone else can check.

Side by side

npm auditOSV-Scanner
InstallationPart of npmSeparate tool to install in CI
JavaScript lockfilespackage-lock.json, npm-shrinkwrap.jsonpackage-lock.json, yarn.lock, pnpm-lock.yaml, bun.lock
Android native librariesNot coveredgradle.lockfile and related files
iOS native librariesNot coveredNot listed as supported
Where the data comes fromYour configured npm registryThe OSV database
Reachability analysisNot described in the documentationGo and Rust only
Automatic fixnpm audit fixNo, it reports
Machine-readable output--jsonJSON, SARIF, CycloneDX, SPDX and more

What both of them miss in a React Native app

  1. Native iOS libraries. React Native libraries with native code bring CocoaPods into ios/Podfile.lock. npm audit works on the npm tree, and OSV-Scanner does not list Podfile.lock as supported. Check the iOS side with a tool that reads that file, such as the Shipmark free scanner, which accepts Podfile.lock. See the React Native SBOM guide for the files to collect.
  2. Reachability. A finding in a package you ship is not the same as an exploitable app. Decide each one yourself: does the package ship (a development tool does not), is the affected version the one you use, is there a fixed version, and if there is none, what will you do instead.
  3. Unknown vulnerabilities. Both tools find known advisories only. They say nothing about flaws in your own code or about vulnerabilities nobody has reported.
  4. Code that is not in a package. Vendored copies of a library, or a library copied into the repository, are not matched by a lockfile scan.

A practical setup

To get the SBOM and a lockfile check against OSV.dev in one step, including Podfile.lock, the free Shipmark SBOM action runs on every build:

- uses: actions/checkout@v4
- uses: shipmark-eu/sbom-action@v1

The same step-by-step triage routine is described for another stack in how to check a Flutter app's dependencies for known vulnerabilities.

How this fits the CRA

You publish the app under your name, so under Regulation (EU) 2024/2847 you are the manufacturer, even if an agency writes and maintains the code. A lockfile scan serves several points of Annex I and one article:

CRA textWhat a dependency scan gives you
Annex I, Part I, point (2)(a): made available on the market without known exploitable vulnerabilitiesA check of what is known at the time you ship.
Annex I, Part II, point (1): identify and document vulnerabilities and components, including an SBOM covering at least the top-level dependenciesThe lockfile that your SBOM is built from is the same file you scan.
Annex I, Part II, point (2): address and remediate vulnerabilities without delayA trigger for the upgrade and a dated record of how you responded.
Annex I, Part II, point (3): effective and regular tests and reviews of the product's securityA repeated, documented test of your dependencies.
Article 13(5): due diligence when integrating components sourced from third partiesEvidence that you looked at the components you integrated, not only at your own code.

A scan is one input, not proof of conformity. For what to do when a finding is being actively exploited, see CRA vulnerability reporting for app teams, and for the day-to-day process around findings see CRA vulnerability handling.

Common questions

Is npm audit enough for a React Native app?

For the npm packages, it is a reasonable start if you use npm. It does not cover the native iOS and Android libraries that React Native libraries bring in, and its documentation mentions only npm's own lockfiles.

Does OSV-Scanner replace npm audit?

For checking, it can: it reads the npm, Yarn, pnpm and Bun lockfiles. It does not apply fixes. You still upgrade packages with your package manager.

Should I scan devDependencies?

They do not ship in the app, so a finding there is rarely an issue for your users, but it can matter for your build pipeline. Scan everything, and mark development-only findings as not affecting the released product, with the reason, rather than hiding them.

Our agency maintains the app. Who runs the scan?

The agency can run it, but you are the manufacturer and you decide what is acceptable. Ask for the scan result with every release, and put that in the contract: see what to ask for in the maintenance contract.

Check your package-lock.json, yarn.lock or Podfile.lock against OSV.dev now. No account, and the file stays in your browser.

Open the free scanner

Sources

Also see: How to generate an SBOM for a React Native app. This guide summarises Regulation (EU) 2024/2847 for practical use. It is not legal advice.