Every day, thousands of new code packages emerge on npm; while previously available for installation almost immediately upon publication, they will now undergo rigorous malware scanning prior to release. GitHub-owned npm has announced the implementation of automated package scanning at the time of publication, simultaneously introducing a novel metadata requirement for dual-use packages.
These packages encompass code possessing legitimate security applications that simultaneously exhibit malware-like behavior. Examples include penetration testing instruments, vulnerability scanners, and programs designed to simulate adversary actions for validating system defenses. Because automated security mechanisms frequently mistake such code for genuine malware, npm decided to isolate these packages into a distinct category governed by specialized publication protocols.
Publication Delays and Rigorous Inspections
Under the newly established regulations, every new package must pass a comprehensive inspection before becoming available for installation. Based on the scanning outcomes, a package is either published normally, routed for manual review, or blocked entirely. Consequently, this introduces a mandatory delay between publication and registry availability. Typically lasting around five minutes, this waiting period can extend to fifteen minutes or more during peak traffic or for unusually large packages. Developers whose automated scripts rely on immediate package availability post-publication must carefully account for this newly introduced latency.
If the system blocks a package, the author receives a formal notification containing an avenue for appeal. Depending on the severity and credibility of the detected threat, the platform may enforce additional punitive measures against the author’s account in strict accordance with prevailing npm policies.
Handling Dual-Use Security Instruments
A distinct challenge arises with packages harboring legitimate yet potentially dangerous functionality, such as penetration testing or security analysis tools. Automated systems routinely flag this code as malicious. To address these scenarios, npm introduced a new “contentPolicy” field within the package.json file, alongside a mandatory DISCLOSURE text file. Within this file, the author must meticulously detail the purpose and legitimate application of their code. The npm Trust and Safety team utilizes this precise information during manual reviews; however, this declaration alone does not guarantee package publication.
Strict Two-Factor Authentication Mandates
Authors can only publish declared dual-use packages utilizing methods that strictly enforce two-factor authentication (2FA). Acceptable methods include trusted publishing via the OIDC protocol, interactive sessions fortified with 2FA, or staged publications. Traditional access tokens that bypass two-factor verification are strictly prohibited for the direct publication of these sensitive packages.
Furthermore, once an author declares a dual-use intent, they cannot remove the “contentPolicy” field or the DISCLOSURE file in subsequent package iterations. The system will automatically reject any such unauthorized publication attempts.
Phased Rollout and Developer Preparation
These stringent regulations are currently experiencing a phased rollout. For authors of dual-use packages who have not yet integrated the requisite metadata, npm has already initiated preemptive email notifications to prevent automatic package blocking. Developers distributing code encompassing security analysis elements through npm must proactively draft their DISCLOSURE file descriptions immediately. Additionally, they must rapidly transition to publication methods mandating robust two-factor authentication.
Support Our Threat Intelligence
If you find our technology report and cybersecurity news helpful, consider supporting our work.