Log date · Tue
How do npm malware scans affect obfuscation packages?
Dual-use npm packages need a declaration and an approved publishing path; inspect the tarball before release.
Does npm scanning affect obfuscation packages?
Yes. An npm package that contains dual-use content needs a declaration, but declaring it does not guarantee publication. With npm 10.8.2, we packed the same local sample twice: both tarballs retained contentPolicy; the code-only file list produced 2 files and omitted DISCLOSURE, while explicitly including it produced 3 files and included the disclosure.
| Question | Finding |
|---|---|
| When is scanning performed? | Before a new package is installable; it may be released, reviewed or blocked. |
| Is a local file enough? | No; the sample files list excluded DISCLOSURE. |
| Does declaration ensure acceptance? | No; npm can still scan and review it. |
On 28 July 2026 (UTC), GitHub announced publish-time scanning. Availability typically takes around five minutes and may take 15 minutes or more at peak times or for large packages; those figures are not a service guarantee. [1] The npm policy updated that day names code-obfuscation, penetration-testing and security research tools as dual-use examples. [2]
A local packaging comparison
The registry scanning service is not in our local toolchain. We used the npm CLI to pack a harmless sample we wrote, illustrating a pre-release file check rather than testing the online scanner or its release. Both variants had the same plain-text disclosure, code and metadata; only the files list changed.
{"contentPolicy":{"class":"dual-use"},"files":["index.js","DISCLOSURE"]}== omitted ==
files=index.js,package.json
file count=2
contentPolicy.class=dual-use
DISCLOSURE in tarball=no
== included ==
files=DISCLOSURE,index.js,package.json
file count=3
contentPolicy.class=dual-use
DISCLOSURE in tarball=yesThe npm files field selects entries for the tarball; package.json and certain other files have special inclusion rules, but DISCLOSURE is not on that list. [5] A file in the repository and correct metadata therefore do not establish that the artifact contains it. Inspect the actual tarball, not just the working directory.
Declaration and the publishing path
The policy requires contentPolicy.class set to dual-use in package.json and a plain-text DISCLOSURE at the published tarball root explaining the functionality and its intended legitimate use. [2] Describe what the tool does and the authorized context in which it is intended to be used, rather than merely calling it a security tool. After publication the declaration must persist; removal requires npm Trust & Safety review.
A declaration may trigger additional scanning suited to dual-use content or a case-by-case review; it does not permit malware. The policy requires two-factor authentication at direct publication or staged promotion: an interactive direct publish can use 2FA, while OIDC or a bypass-2FA token can stage a package for promotion with 2FA. [2]
The announcement also lists trusted publishing with OIDC as an example, while the policy explicitly prohibits direct OIDC publishing for dual-use packages. [1][2] Because the wording differs, plan around the more specific policy and recheck the current requirements before release.
Recommendations by situation
These are recommendations based on the policy and our packaging test, not measured scanner outcomes.
| Situation | Recommendation |
|---|---|
| Publishing a dual-use package | Check the policy, complete both declarations and inspect each tarball and 2FA path. |
| Installing immediately after publish | Add bounded waiting and status handling; use the notification appeal path if blocked. |
| Consuming dependencies | Pin the lockfile, review provenance and obfuscated code, and enable malware alerts. |
| Protecting application logic | Assess app protection separately; registry scanning protects installers and is not a copy-protection mechanism. |
That day GitHub also announced ingestion of OpenSSF malicious-packages advisories into the GitHub Advisory Database; Dependabot with malware alerts enabled can match dependencies across ecosystems including npm and PyPI. [3] This complements publish-time scanning, but neither known-advisory matching nor registry detection proves a dependency harmless. A lockfile fixes the resolved dependency set; review updates, limit build permissions and isolate builds as well.
Check your own npm package
From your package directory, pack and inspect the resulting tarball before release. npm pack uses the current package by default; --ignore-scripts avoids running lifecycle scripts during this check. [4] If your release lifecycle generates files, inspect the artifact after your normal build too. Do not blindly run scripts from an unknown package.
npm pack --ignore-scripts --json
tar -tzf ./YOUR-PACKAGE-VERSION.tgz
tar -xOf ./YOUR-PACKAGE-VERSION.tgz package/package.jsonConfirm package/DISCLOSURE appears in the listing, inspect package.json inside the tarball, and review the disclosure text for accuracy. Make both checks part of every version build. In the release pipeline handle pending scans, manual review, blocks and possible appeals rather than treating every timeout as either a failed publication or a security approval.
Your checklist
- Assess the package against the dual-use policy.
- Add and retain metadata and a root disclosure.
- Inspect files and disclosure text in every release tarball.
- Verify 2FA for publishing or staged promotion.
- Handle scan delays, review and blocks; enable dependency malware alerts.
Primary sources
- GitHub Changelog: npm publish-time malware scanning and dual-use metadata · Source date 2026-07-28 · Checked 2026-10-12
- npm Docs: npm Dual-Use Content Policy · Source date 2026-07-28 · Checked 2026-10-12
- GitHub Changelog: Dependabot alerts on malicious packages across more ecosystems · Source date 2026-07-28 · Checked 2026-10-12
- npm CLI: npm pack · Checked 2026-11-11
- npm CLI: package.json files · Checked 2026-11-11