Add section 13: Verify documentation examples before copying#2094
Merged
mackowski merged 1 commit intoOWASP:masterfrom Apr 26, 2026
Merged
Add section 13: Verify documentation examples before copying#2094mackowski merged 1 commit intoOWASP:masterfrom
mackowski merged 1 commit intoOWASP:masterfrom
Conversation
mackowski
approved these changes
Apr 26, 2026
Collaborator
|
Thanks @ekreloff! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new section to the NPM Security Cheat Sheet covering the documentation attack surface — a class of vulnerability where library README examples teach insecure patterns, even when the library's internal code uses secure defaults.
This pattern has been documented across 5 popular npm packages with combined weekly downloads exceeding 195 million, including findings in encryption libraries (weak key derivation), HTTP clients (credential exposure on redirect), authentication libraries (regex anchoring bypasses), and file upload libraries (insecure randomness).
Why this belongs here
The current cheat sheet thoroughly covers supply chain security (sections 1-12: secrets, lockfiles, run-scripts, auditing, 2FA, typosquatting, etc.) but does not address the risk of copying insecure code patterns from official documentation. This is a distinct attack surface — audit tools won't flag it because the library code itself is safe, only the copy-pasted usage pattern is insecure.
Evidence
Format
Follows the existing numbered section format. No library names are used in the section text to keep it evergreen — the patterns are described generically with the security-wg discussion linked for specific cases.