审计依赖与软件供应链安全风险
追踪依赖解析、构建流程、CI权限与发布产物,梳理可验证的供应链攻击路径和整改方向。
完整提示词
# DEPENDENCY AND SUPPLY CHAIN SECURITY AUDIT I want you to perform a maximally deep, systematic, evidence-first, and production-oriented analysis of the project's entire software supply chain. Main goal: > Determine whether the project can be compromised via dependencies, transitive packages, package registries, build processes, lockfiles, installer/postinstall scripts, CI/CD workflows, release artifacts, dependency confusion, typosquatting, compromised maintainer accounts, unpinned external actions, package substitution, or other supply-chain pathways. This is not: - a generic `npm audit` run - automatically reporting every discovered CVE - automatically upgrading all dependencies - assuming every legacy package version is vulnerable - assuming packages with few maintainers are inherently insecure - an automatic demand to vendor all dependencies - merely generating an SBOM - merely reviewing GitHub Dependabot alerts - merely an npm, pip, or Maven security scan - merely a CI/CD audit The focus is on the complete chain: ```text developer selects dependency ↓ manifest ↓ registry resolution ↓ lockfile ↓ package download ↓ install scripts ↓ build environment ↓ CI/CD ↓ artifact ↓ deployment ``` Priority: **active exploitable vulnerable dependency > malicious/package substitution path > dependency confusion > compromised build execution > untrusted CI supply chain > release artifact integrity > lockfile/reproducibility weakness > package hygiene** It is better to identify 5 real supply-chain compromise pathways than to report 300 dependencies with outdated versions. --- # 1. ESTABLISH THE ECOSYSTEM Inventory all package ecosystems in use: - npm/pnpm/yarn/bun - pip/poetry/uv - Maven/Gradle - NuGet - Cargo - Go modules - Composer - RubyGems - SwiftPM - CocoaPods - system packages - Docker base images - GitHub Actions - Helm charts - Terraform providers/modules --- # 2. MANIFEST INVENTORY Locate: ```text package.json pnpm-workspace.yaml requirements.txt pyproject.toml poetry.lock pom.xml build.gradle Cargo.toml go.mod *.csproj composer.json Gemfile Package.swift ``` and all additional dependency source files. --- # 3. LOCKFILE INVENTORY Locate: - package-lock.json - pnpm-lock.yaml - yarn.lock - bun.lock - poetry.lock - uv.lock - Cargo.lock - composer.lock - packages.lock.json - Gradle dependency lock - equivalents --- # 4. MISSING LOCKFILES Not an automatic critical finding. However, for deployable applications it impairs build reproducibility and invites dependency resolution drift. --- # 5. COMMITTED LOCKFILES Verify that lockfiles are version-controlled in the repository. --- # 6. MULTIPLE COEXISTING LOCKFILES High-signal inconsistency: ```text package-lock.json + yarn.lock + pnpm-lock.yaml ``` Determine which package manager is authoritative. --- # 7. PACKAGE MANAGER DRIFT Local developers using npm, CI using yarn, production using pnpm. Can result in divergent resolved dependency trees. --- # 8. LOCKFILE BYPASS Installation commands in CI ignoring lockfiles. Example: ```text npm install ``` versus frozen or immutable install modes where supported by the ecosystem. --- # 9. FLOATING VERSIONS Manifest declarations: ```text * latest >= ``` allowing unpredictable future versions to enter builds. Severity depends on the ecosystem and lockfile enforcement. --- # 10. RANGE VERSIONS `^` or `~` ranges are not automatic defects. A committed lockfile stabilizes application builds. --- # 11. DIRECT DEPENDENCIES Inventory all direct production dependencies. --- # 12. DEVELOPMENT DEPENDENCIES Development packages remain supply-chain risks if executed during: - CI pipelines - production build stages - release packaging --- # 13. TRANSITIVE DEPENDENCIES Attacks frequently target deep transitive packages. Map the dependency tree across high-risk components. --- # 14. RUNTIME VERSUS BUILD-TIME Classify dependencies: ```text RUNTIME BUILD DEV TEST CI DEPLOY ``` --- # 15. DEPENDENCY ATTACK SURFACES A package performing compile-time type checking does not share the threat profile of: - HTTP parsers - image processing libraries - authentication frameworks - template engines - shell utilities --- # 16. REACHABILITY A published CVE does not equate to an exploitable vulnerability. Ask: > Does the application genuinely invoke the vulnerable function or execution path? --- # 17. INSTALLED VERSIONS Do not rely solely on manifest version ranges. Verify the exact resolved version from the lockfile or build output. --- # 18. DEPLOYED VERSIONS Repository lockfile versions may differ from actual production artifacts. If unverified: **DEPLOYED DEPENDENCY VERSION: NOT VERIFIED** --- # 19. VULNERABILITY ADVISORY SOURCES When consulting scanners and advisory databases: prioritize: - official vendor security advisories - ecosystem advisory databases - NVD/CVE records where relevant - upstream framework security bulletins --- # 20. CVE SCORES ARE NOT APPLICATION SEVERITIES An external CVSS score does not translate directly into a local P0 or P1 finding. Evaluate: - code reachability - network exposure - attack preconditions - application execution privileges --- # 21. VULNERABLE FUNCTIONS Identify the specific vulnerable code path and function call sites. --- # 22. CONFIGURATION-DEPENDENT CVES Certain vulnerabilities trigger only when specific features or flags are enabled. Inspect active configurations. --- # 23. PLATFORM-DEPENDENT CVES A Linux-specific flaw is not active on Windows-only deployments, and vice-versa. --- # 24. DEV-ONLY CVES If a package is excluded from runtime deployment artifacts: severity scales strictly to build or CI compromise paths. --- # 25. AVAILABLE FIXES Document: - patched versions - migration complexity - breaking API changes without performing automatic updates. --- # 26. UNPATCHED VULNERABILITIES If no upstream patch exists: evaluate: - code-level workarounds - package replacements - disabling affected features - sandboxing and isolation --- # 27. ABANDONED PACKAGES Do not report merely because the latest release is aged. Look for genuine risk signals: - unpatched known vulnerabilities - runtime ecosystem incompatibilities - compromised maintainership - abandoned upstream repositories --- # 28. PACKAGE OWNERSHIP For critical packages, monitor: - maintainer transitions - repository ownership transfers - namespace handovers where telemetry is available. --- # 29. MAINTAINER TAKEOVERS A package can transfer ownership without changing its public name. High-value supply-chain signal. --- # 30. SUDDEN MAJOR BEHAVIORAL CHANGES New releases unexpectedly introducing: - install-time scripts - outbound network requests - telemetry collection - obfuscated code sections Do not declare malicious without evidence. --- # 31. TYPOSQUATTING Inspect package manifests for names mimicking popular public libraries. --- # 32. INTERNAL PACKAGE NAMES Critical consideration for dependency confusion vectors. --- # 33. DEPENDENCY CONFUSION Scenario: ```text company uses: @internal/foo ``` or an unscoped private package name. Ask: > Can a public registry package with the identical name and a higher version number be selected? --- # 34. PRIVATE REGISTRIES Inspect: - registry routing rules - scoped registry namespaces - authentication tokens - fallback behavior --- # 35. PUBLIC REGISTRY FALLBACKS If private registry lookup fails, package managers must never silently fall back to public namesake packages. --- # 36. `.npmrc` CONFIGURATION Audit: - default registries - scoped registry bindings - access tokens - `always-auth` flags - fallback resolution settings --- # 37. PIP INDEX CONFIGURATION Audit: ```text --index-url --extra-index-url ``` Using `extra-index-url` significantly elevates dependency confusion risks. --- # 38. MAVEN REPOSITORIES Repository ordering and private artifact coordinate resolution. --- # 39. NUGET PACKAGE SOURCES Package source mapping and precedence rules where applicable. --- # 40. GO PRIVATE MODULES `GOPRIVATE`, Go proxy settings, and checksum database behavior. --- # 41. PACKAGE HASHES AND INTEGRITY CHECKS Lockfiles typically record cryptographic hashes or integrity checksums. Verify ecosystem semantics. --- # 42. MISSING INTEGRITY HASHES Reduces tamper detection capabilities. Do not rate as high severity without concrete registry or interception risks. --- # 43. GIT DEPENDENCIES Manifests specifying: ```text github:user/repo git+https://... ``` --- # 44. GIT BRANCH DEPENDENCIES Tracking `main`, `master`, or branch names represents floating unpinned code. --- # 45. GIT COMMIT PINNING Guarantees immutable and reproducible resolution. --- # 46. GIT TAGS Tags can be mutable in certain repository hosting platforms. Do not assume immutability without provider guarantees. --- # 47. DIRECT URL DEPENDENCIES Fetching remote tarballs or binary archives via URL. Verify: - TLS transport - checksum validation - resource immutability - domain ownership --- # 48. PIPE TO SHELL INSTALLERS High-signal installation anti-pattern: ```text curl https://... | sh ``` in CI and build scripts. --- # 49. UNPINNED REMOTE INSTALL SCRIPTS Without pinning and verification: an upstream server compromise instantly executes arbitrary code in the build environment. --- # 50. PACKAGE INSTALLATION SCRIPTS Inventory package lifecycle hooks: - preinstall - install - postinstall - prepare --- # 51. INSTALL SCRIPT PRIVILEGES Package scripts execute with the full OS privileges of the package manager process. --- # 52. UNNECESSARY INSTALL SCRIPTS A utility library that should not require install-time code execution warrants immediate review if scripts are present. --- # 53. `ignore-scripts` FLAGS Do not mandate globally without identifying dependencies that genuinely require compilation steps. --- # 54. NATIVE ADDON COMPILATION Node-gyp, Python C-extensions, Cargo build scripts, and native toolchains execute arbitrary code during builds. --- # 55. BUILD SCRIPTS EQUAL CODE EXECUTION A dependency does not need to be imported at runtime to compromise CI and developer systems. --- # 56. CI SECRETS ACCESSIBLE DURING INSTALL Running untrusted package install scripts in jobs containing production secrets enables direct credential exfiltration. --- # 57. INSTALLATION BEFORE SECRET INJECTION Installing dependencies in isolated stages before injecting sensitive credentials reduces blast radius. P4/P2 depending on CI threat profile. --- # 58. UNTRUSTED PULL REQUESTS AND INSTALLATION Contributors can modify package manifests or lockfiles. If privileged CI subsequently runs install scripts with secrets exposed: critical risk. --- # 59. LOCKFILE PULL REQUEST REVIEWS Malicious packages can be concealed within massive auto-generated lockfile diffs. --- # 60. MANIFEST AND LOCKFILE MISMATCHES Manifests appearing benign while lockfiles resolve completely different packages or versions. --- # 61. LOCKFILE TAMPERING Inspect resolved registry URLs and cryptographic integrity hashes. --- # 62. UNEXPECTED REGISTRY HOSTS Dependencies must not resolve from unauthorized external domains. --- # 63. ALTERNATE REGISTRY PACKAGES Lockfiles pinned to unapproved or compromised external registries. --- # 64. PACKAGE NAME COLLISIONS Monorepo workspace package names colliding with public registry packages. --- # 65. WORKSPACE RESOLUTION INTEGRITY Verify that builds consume local workspace packages when intended, rather than pulling public packages. --- # 66. MONOREPO HOISTING Package hoisting rules can alter resolved dependency versions across workspace packages. --- # 67. PEER DEPENDENCIES Can implicitly pull package versions that developers did not anticipate. --- # 68. OPTIONAL DEPENDENCIES May introduce OS-specific binaries that execute code only under targeted operating systems. --- # 69. PLATFORM BINARIES Packages downloading precompiled platform binaries during installation. --- # 70. BINARY DOWNLOADS Inspect: - download host domains - TLS transport - checksum and signature checks - strict version binding --- # 71. POSTINSTALL DOWNLOADS High-value supply-chain review surface. --- # 72. BROWSER BINARY DOWNLOADS Playwright and Puppeteer browser downloads are legitimate, but verify download sources, integrity checks, and CI execution privileges. --- # 73. TOOL BUNDLES Packages packaging or downloading tools like FFmpeg. --- # 74. PREBUILT NATIVE BINARIES Registry packages bundling compiled binary blobs without accompanying source inspection. --- # 75. DOCKER BASE IMAGES The supply chain includes: ```text FROM ... ``` --- # 76. `latest` TAGS Floating base image tags introduce unpredictable changes. --- # 77. IMAGE TAGS Tags are not inherently immutable. --- # 78. DIGEST PINNING Pinning by digest guarantees immutability. Do not mandate everywhere without evaluating update workflows. --- # 79. BASE IMAGE SOURCES Verify official and trusted image namespaces. --- # 80. ABANDONED BASE IMAGES Outdated operating systems and runtime images accumulate severe vulnerabilities. --- # 81. INHERITED IMAGE LAYERS Base image layers can introduce vulnerable packages even when application dependencies are up to date. --- # 82. OPERATING SYSTEM PACKAGES Audit: ```text apt apk yum dnf ``` package installations in container builds. --- # 83. `apt-get upgrade` IN BUILDS Reduces build determinism and reproducibility. --- # 84. PINNED SYSTEM PACKAGES Balancing reproducibility against timely security patching. Avoid blanket mandates. --- # 85. PACKAGE REPOSITORY KEYS Custom apt/yum package repository trust anchors. --- # 86. EXPIRED REPOSITORY KEYS Triggers build failures and operational workarounds. --- # 87. GITHUB ACTIONS DEPENDENCIES Every: ```text uses: owner/action@... ``` represents an external third-party dependency. --- # 88. ACTION TAGS `@v4` tags can be altered by upstream repository owners at any time. --- # 89. ACTION COMMIT SHA PINNING Provides strong immutability guarantees. --- # 90. FIRST-PARTY VERSUS THIRD-PARTY ACTIONS Third-party actions holding write tokens or secret access represent critical supply-chain trust boundaries. --- # 91. ACTION PERMISSION SCOPING Audit: ```text permissions: ``` blocks within workflow definitions. --- # 92. DEFAULT GITHUB TOKENS Never assume the default token is read-only. Inspect repository and workflow permission defaults. --- # 93. ACTION SECRET ACCESS Identify which specific steps receive sensitive secrets. --- # 94. THIRD-PARTY ACTIONS WITH PRODUCTION SECRETS High-risk vulnerability if the action lacks rigorous trust or commit SHA pinning. --- # 95. ACTION CODE UPDATES Major tag pointers can be updated to execute malicious code without producing diffs in your workflow files. --- # 96. COMPOSITE ACTIONS Composite actions can invoke additional remote tools and nested actions. --- # 97. REUSABLE WORKFLOWS Supply-chain trust boundaries apply equally to: ```text uses: org/repo/.github/workflows/...@ref ``` --- # 98. EXTERNAL WORKFLOW REFERENCES Pinning and integrity evaluated against operational risk. --- # 99. CI SCRIPT DOWNLOADS Workflows fetching utilities via curl or wget during pipeline runs. --- # 100. CHECKSUM VERIFICATION Downloading remote binaries without verifying checksums or digital signatures represents a critical review point. --- # 101. BUILD TOOLCHAINS Compilers, language runtimes, and setup actions are supply-chain dependencies. --- # 102. NODE.JS SETUP ACTIONS Version pinning and installation sources. --- # 103. PYTHON, JAVA, AND GO TOOLCHAINS Same toolchain pinning and integrity principles apply. --- # 104. FLOATING RUNTIME VERSIONS Building with floating runtime versions introduces unpredictable behavioral and output changes. --- # 105. CI RUNNER IMAGES Updates to hosted runner OS images can silently modify compiler and toolchain versions. --- # 106. SELF-HOSTED RUNNERS Elevated persistence risks across jobs if runners are not ephemeral. --- # 107. COMPROMISED RUNNERS Can compromise: - source code - environment secrets - code signing keys - compiled release artifacts --- # 108. UNTRUSTED PULL REQUESTS ON SELF-HOSTED RUNNERS Extremely dangerous configuration. --- # 109. BUILD ENVIRONMENT ISOLATION Untrusted code must never share persistent privileged environments with production release pipelines. --- # 110. RELEASE ARTIFACT PIPELINE Trace: ```text source commit ↓ build ↓ artifact ↓ registry/release ↓ deployment ``` --- # 111. BUILD PROVENANCE Can the team prove cryptographically which source commit produced the deployed artifact? --- # 112. ARTIFACT HASHES Generate and verify release checksums. --- # 113. ARTIFACT SIGNING Code, package, and container image signing improves integrity guarantees. Do not mandate as a blanket P1 without threat justification. --- # 114. SIGNING KEY SECURITY Where artifact signing is implemented: the private key is the ultimate crown jewel. --- # 115. SIGNING IN CI Who holds permissions to trigger signed production releases? --- # 116. UNTRUSTED CODE WITH ACCESS TO SIGNING KEYS Critical supply-chain compromise vector. --- # 117. PACKAGE PUBLISHING Who is authorized to publish to: - npm - PyPI - Maven Central - NuGet - container registries --- # 118. REGISTRY TOKEN SCOPING Review tokens: - read-only - publish rights - organization-wide - package-specific --- # 119. PUBLISHING TOKENS IN CI Covered under credential audits, but focus here on malicious release risks. --- # 120. MULTI-FACTOR AUTHENTICATION AND TRUSTED PUBLISHING Registry account security and automated trusted publishing integrations. P4/P2 depending on package criticality. --- # 121. NPM PROVENANCE AND EQUIVALENTS Record adoption of cryptographic provenance mechanisms where supported. Do not mandate as the sole acceptable method. --- # 122. PACKAGE IMMUTABILITY Does the package registry forbid overwriting existing release versions? --- # 123. UNPUBLISHING AND REPUBLISHING Can alter package availability and resolution trees in certain ecosystems. --- # 124. YANKED PACKAGE VERSIONS Builds may break or resolve divergent versions when dependencies are yanked. --- # 125. REGISTRY MIRRORS AND CACHES Internal proxies can: - improve build availability - isolate external dependencies yet can also serve stale or compromised artifacts. --- # 126. CACHE POISONING Occurs if internal caching proxies lack strict verification boundaries. --- # 127. PACKAGE NAMESPACE OWNERSHIP Proactively register internal package names on public registries to eliminate namespace hijacking. --- # 128. SOFTWARE BILL OF MATERIALS (SBOM) Generate or verify existing Software Bills of Materials. --- # 129. SBOM FORMATS Examples: - CycloneDX - SPDX Do not mandate specific formats if standard tooling employs another valid standard. --- # 130. SBOM COMPLETENESS Must encompass: - direct dependencies - transitive dependencies - runtime packages --- # 131. SBOM STALENESS An SBOM generated from a previous release cannot describe the current production artifact. --- # 132. ARTIFACT-SPECIFIC SBOMS Ideally bound directly to concrete build artifacts. P4/P2 depending on compliance and security requirements. --- # 133. DEPENDENCY LICENSING Licensing compliance differs fundamentally from security vulnerability analysis. Report separately to avoid distorting security priorities. --- # 134. END-OF-LIFE RUNTIMES Unsupported: - Node.js - Python - Java - frameworks cease receiving security patches. --- # 135. END-OF-LIFE DOES NOT EQUAL ACTIVE EXPLOITATION Rank as P2/P4 based on actual network exposure and known vulnerabilities. --- # 136. FRAMEWORK SECURITY SUPPORT Verify active branch support and patch release cadences. --- # 137. FORKED DEPENDENCIES Internal forks may incorporate custom security fixes or inadvertently lose upstream patches. --- # 138. PATCH-PACKAGE WORKFLOWS If applying local package patches: verify: - patch tracking in version control - deterministic application during build - no regression of upstream security fixes --- # 139. VENDORED CODE Vendored dependencies bypass automated vulnerability update notifications. --- # 140. COPY-PASTED LIBRARY CODE Vulnerability scanners frequently fail to detect raw copied source code. --- # 141. GENERATED CLIENT CODE Generated API client SDKs can package obsolete, vulnerable runtime dependencies. --- # 142. WEBASSEMBLY (WASM) MODULES WASM binaries are dependencies and mandate verified provenance and source traceability. --- # 143. CDN-HOSTED JAVASCRIPT Frontend scripts loaded via: ```html <script src="https://cdn..."> ``` represent direct runtime supply-chain dependencies. --- # 144. SUBRESOURCE INTEGRITY (SRI) SRI prevents execution of modified third-party static scripts. --- # 145. DYNAMIC THIRD-PARTY SCRIPTS Analytics, customer chat, and advertising scripts can alter executable code without triggering application deployments. --- # 146. THIRD-PARTY SCRIPT PRIVILEGES Scripts running under the application origin possess full access to the DOM, cookies, and client memory. --- # 147. CONTENT SECURITY POLICY (CSP) Restricts script sources, but cannot prevent compromised code originating from allowlisted vendor hosts. --- # 148. TAG MANAGERS Google Tag Manager and similar tools operate as remote supply-chain code execution channels. --- # 149. MARKETING TOOL DASHBOARDS Audit who holds permissions to publish arbitrary JavaScript to production sites via marketing dashboards. --- # 150. BROWSER EXTENSIONS Outside primary application supply-chain scope unless operating in managed enterprise environments. --- # 151. REMOTE CONFIGURATION FETCHES If applications fetch executable rules, expressions, or scripts dynamically: verify cryptographic integrity and publisher authenticity. --- # 152. FEATURE CONFIGURATIONS ARE NOT INHERENTLY CODE However, dynamic expression and template configurations can introduce remote code execution risks. --- # 153. PLUGIN ARCHITECTURES If the application supports third-party plugins: supply-chain boundaries become paramount. --- # 154. PLUGIN SIGNING If offering plugin marketplaces: verify publisher verification and permission isolation models. --- # 155. AUTO-UPDATERS Desktop and mobile update engines are critical software supply-chain conduits. --- # 156. UPDATE MANIFEST INTEGRITY Update manifests must be signed and protected against tampering. --- # 157. UPDATE TRANSPORT URLS HTTPS is mandatory, but digitally signed binaries provide essential assurance for desktop applications. --- # 158. SIGNATURE VERIFICATION BYPASSES If updaters accept unsigned binaries or fail open on signature errors: P0/P1 vulnerability. --- # 159. DOWNGRADE ATTACKS Attackers forcing update clients to revert to older, vulnerable releases. --- # 160. VERSION MONOTONICITY Enforce strict anti-rollback version checks. --- # 161. OFFICIAL APP STORES App stores provide proprietary code signing and distribution verification. Do not fabricate redundant custom update requirements. --- # 162. DESKTOP INSTALLER PACKAGING Installer code signing and binary provenance. --- # 163. BUILD OUTPUT TAMPERING Tampering risks when passing artifacts between distributed CI pipeline stages. --- # 164. ARTIFACT REPLACEMENT PERMISSIONS Who possesses access rights to replace published release artifacts? --- # 165. RELEASE TAG INTEGRITY Git tags are insufficient if released binary artifacts can be swapped manually. --- # 166. RELEASE APPROVAL WORKFLOWS Production deployment authorization controls. --- # 167. BRANCH PROTECTION POLICIES Supply-chain vulnerability if attackers can push malicious dependency changes directly to release branches. --- # 168. CODE REVIEW ENFORCEMENT Mandatory peer reviews on dependency and workflow modifications. Organizational hardening measure, not a standalone technical vulnerability. --- # 169. CODEOWNERS ENFORCEMENT Restricts modification of: - workflow files - lockfiles - package manifests P4/P2 depending on overall control environment. --- # 170. AUTOMATED BOT PULL REQUESTS Dependabot and Renovate PRs require testing and scrutiny. Bots are not infallible security authorities. --- # 171. AUTOMATIC MERGING OF UPDATES Auto-merging dependency upgrades without comprehensive tests elevates supply-chain risks. --- # 172. SECURITY PATCH REMEDIATION VELOCITY Conversely, overly bureaucratic processes leave known vulnerabilities unpatched in production. --- # 173. UPDATE STRATEGY MATURITY Ask: > How does the project discover, evaluate, and deploy security patches across dependencies? --- # 174. VULNERABILITY SCANNING TOOLS Inventory: - npm audit - pip-audit - osv-scanner - Dependabot - Snyk - Trivy - Grype - Maven and NuGet security scanners --- # 175. SCANNER COVERAGE GAPS A single scanner rarely covers: - OS container packages - base images - GitHub Actions - vendored codebases --- # 176. SCANNER FALSE POSITIVES Never file a P1 finding based solely on raw scanner output without contextual reachability analysis. --- # 177. VULNERABILITY SUPPRESSIONS Suppression and ignore lists may conceal active risks. --- # 178. SUPPRESSION EXPIRATION Every suppression must document a technical rationale, review date, and owner. --- # 179. TRANSITIVE DEPENDENCY FIXES Updating a direct parent dependency frequently resolves underlying transitive vulnerabilities. --- # 180. DEPENDENCY OVERRIDES AND RESOLUTIONS Package manager overrides can force transitive updates. Verify runtime compatibility. --- # 181. FORCED VERSION OVERRIDES Can cause runtime crashes if packages are incompatible. Do not recommend without automated test validation. --- # 182. SECURITY BACKPORTS Vendors may provide security patches on older minor versions without requiring major upgrades. --- # 183. MAJOR VERSION UPGRADES Not the sole viable remediation route. --- # 184. EXPLOITABILITY TRACE For every high or critical vulnerability advisory: ```text dependency ↓ vulnerable API ↓ our code path ↓ attacker-controlled input ↓ impact ``` --- # 185. PARSER LIBRARIES File, XML, image, and media parsers possess extreme exposure when handling untrusted user input. --- # 186. AUTHENTICATION LIBRARIES Critical vulnerability impact even in the absence of direct parser exploits. --- # 187. HTTP SERVER FRAMEWORKS Routing and framework vulnerabilities can be reachable on every incoming HTTP request. --- # 188. BUILD-ONLY PACKAGES Can compromise production releases if malicious code executes during builds. --- # 189. TEST-ONLY PACKAGES May compromise developer machines and CI runners, while remaining absent from runtime production artifacts. --- # 190. INTENTIONALLY MALICIOUS PACKAGES CVE scanners cannot detect a newly published malicious package with zero reported CVEs. Audits must incorporate trust, provenance, and behavioral checks. --- # 191. OBFUSCATED PACKAGE CODE A warning signal, but not absolute proof of malicious intent. --- # 192. EVALUATING NEW DEPENDENCIES Evaluate: - necessity of the package - maintainer reputation and ownership history - required permissions - transitive dependency footprint - presence of install scripts --- # 193. TRIVIAL UTILITY PACKAGES Adding large transitive trees for single-line helper functions expands attack surfaces. --- # 194. DEPENDENCY VOLUME Total package count is not an independent vulnerability metric. --- # 195. COMPONENT CRITICALITY SCORING Prioritize dependency reviews by: ```text privilege × exposure × execution stage ``` --- # 196. CI NETWORK ACCESS Malicious install scripts can exfiltrate credentials over outbound networks. --- # 197. CI EGRESS FILTERING Restricting outbound network traffic during builds represents advanced hardening. Do not demand universally. --- # 198. HERMETIC BUILDS Provides high assurance, but introduces substantial operational complexity. P4 except in high-assurance environments. --- # 199. REPRODUCIBLE BUILDS When identical sources, lockfiles, and compilers yield bit-for-bit identical outputs: tampering detection becomes straightforward. --- # 200. BUILD-TIME NETWORK FETCHES If build processes dynamically download unpinned remote assets: reproducibility and integrity degrade. --- # 201. CODE GENERATORS OpenAPI, Protobuf, and GraphQL client code generators can execute arbitrary code during builds. --- # 202. PREBUILD HOOKS Audit scripts declared as: ```text prebuild postbuild prepare generate ``` --- # 203. MONOREPO ROOT SCRIPTS Root `postinstall` hooks execute with broad privileges across all workspaces. --- # 204. WORKSPACE PACKAGE SCRIPTS Untrusted contributions within workspace subpackages can execute during installation or compilation. --- # 205. GIT HOOKS Husky and pre-commit hooks execute scripts locally on developer machines. Lower production severity, but represents a developer workstation supply-chain risk. --- # 206. RECOMMENDED IDE EXTENSIONS Repositories recommending extensions; auto-execution depends on the specific IDE configuration. --- # 207. DEVCONTAINER SPECIFICATIONS `.devcontainer` configurations execute setup scripts with full developer host privileges. --- # 208. GITHUB CODESPACES Audit secret exposure and repository access inside cloud development containers. --- # 209. POST-CREATE COMMANDS Dev container lifecycle commands executing code automatically on launch. --- # 210. MAKEFILES AND TASK RUNNERS Build scripts downloading unpinned external binaries and toolchains. --- # 211. BINARY CHECKSUMS Every externally fetched build tool binary warrants explicit checksum verification. --- # 212. RELEASE ASSETS Verify whether published GitHub release assets can be replaced after publication. --- # 213. MIRROR COMPROMISES Cryptographic signatures and checksums protect against compromised upstream mirrors. --- # 214. TLS DOES NOT PROVE ARTIFACT INTEGRITY HTTPS guarantees transport encryption, but provides no defense if the upstream origin server is compromised. --- # 215. SIGNED ARTIFACTS Digital signatures are only as trustworthy as the underlying verification keys and root certificates. --- # 216. SBOMS AND PROVENANCE Documentation does not prevent attacks in itself, but enables rapid discovery and impact auditing. --- # 217. INCIDENT RESPONSE CAPABILITY If a package is compromised upstream: can the team immediately determine: - where it is deployed - which past releases contain it - which environments are exposed --- # 218. COMPLETE DEPENDENCY INVENTORY Without an accurate inventory, blast-radius assessments during incidents are severely crippled. --- # 219. REMOVING UNUSED DEPENDENCIES Purging unneeded dependencies directly shrinks the attack surface. --- # 220. UNIMPORTED PACKAGES CAN STILL BE DANGEROUS A package can execute malicious code during installation even if never imported in application code. --- # 221. REMOVAL AUDITING Verify: - import statements - script executions - configuration references - build toolchain plugins prior to removing packages. --- # 222. PACKAGE EXECUTION PERMISSIONS Package managers do not run in operating system sandboxes by default. Install scripts run with the full permissions of the active user or CI runner. --- # 223. ROOT EXECUTION IN CONTAINER BUILDS Package installation often executes as `root` inside Docker builds. Malicious install scripts can alter the host container environment. --- # 224. FINAL IMAGE TAMPERING Build-time dependencies can inject backdoors into compiled outputs without remaining present as runtime packages. --- # 225. CLIENT BUNDLE INJECTIONS Compromised frontend build dependencies can inject malicious JavaScript directly into production web bundles. --- # 226. SERVER BUNDLE INJECTIONS The same tampering risk applies to server-side build and bundle pipelines. --- # 227. COMPILER TRANSFORM PLUGINS Babel, Vite, and Webpack plugins possess extensive power to rewrite source code during compilation. --- # 228. LINTER AND TEST UTILITIES Packages executing during CI runs with access to production secrets represent viable attack vectors. --- # 229. PACKAGE MANAGER INTEGRITY The package manager toolchain itself is a core supply-chain dependency. --- # 230. COREPACK Pin package manager versions where workflows utilize Corepack. --- # 231. `packageManager` MANIFEST FIELDS Improves deterministic package manager resolution across development and CI. --- # 232. PYTHON BUILD BACKENDS Build backend dependencies in `pyproject.toml` execute code during package installation. --- # 233. PEP 517 BUILDS Source distribution builds can execute arbitrary code during installation. --- # 234. WHEELS VERSUS SOURCE DISTRIBUTIONS Wheels eliminate local install-time compilation, but represent precompiled binary artifacts. --- # 235. MAVEN PLUGINS Build plugins execute arbitrary Java code during builds. --- # 236. GRADLE PLUGINS Gradle plugins carry sweeping build execution capabilities. --- # 237. TERRAFORM PROVIDERS Compiled binary plugins executing with extensive cloud credentials: critical supply-chain trust boundary. --- # 238. TERRAFORM MODULES Modules define infrastructure changes, altering cloud security postures. --- # 239. HELM CHARTS Can alter production workload configurations, network policies, and security contexts. --- # 240. ACTIONABLE FINDING FORMAT Every substantive finding must include: ```text ID: Severity: Category: Confidence: Status: Evidence tier: Dependency / component: Ecosystem: Resolved version: Environment: Execution stage: RUNTIME / BUILD / CI / DEPLOY Direct / transitive: Source registry: Lock status: Integrity/provenance: Vulnerability / supply-chain weakness: Attacker model: Preconditions: Reachability: Execution path: T0: T1: T2: T3: Current exploitability: Secrets available during execution: Privileges available: Production impact: Developer/CI impact: Blast radius: Known patched version: YES / NO / NOT VERIFIED Root cause: Recommended remediation: Regression/build verification: Production verification: Complexity: XS / S / M / L / XL ``` --- # 241. SEVERITY Use: ## P0 - CRITICAL - active dependency flaw enables unauthenticated production remote code execution via a confirmed reachable code path - untrusted contribution or dependency can access production code signing or cloud admin credentials, enabling malicious release distribution - package substitution or dependency confusion allows arbitrary code execution in privileged production build pipelines - application auto-updater accepts unsigned or attacker-controlled update binaries ## P1 - HIGH - high-impact vulnerability in an active dependency reachable from untrusted user input - unpinned or untrusted build code executes with access to production secrets - compromised internal package resolution hijacks privileged CI builds - third-party action or build plugin with elevated permissions and weak provenance poses a practical supply-chain compromise risk ## P2 - MEDIUM - meaningful vulnerable dependency requiring non-trivial preconditions for exploitation - significant gap in build or release artifact integrity verification - transitive package with reachable moderate-impact vulnerability - development or staging supply-chain flaw with plausible lateral path to production ## P3 - LOW - low-impact vulnerable dependency - constrained developer tooling flaw - build reproducibility weakness with negligible direct security impact ## P4 - HARDENING - SBOM generation, provenance attestations, commit SHA pinning, and review process improvements without confirmed compromise paths --- # 242. CONFIDENCE Use: ```text HIGH MEDIUM LOW ``` --- # 243. STATUS Use: ```text CONFIRMED LIKELY THEORETICAL NOT VERIFIED ``` --- # 244. EVIDENCE TIER Use: ```text A - reproduced / exact deployed vulnerable path confirmed B - complete dependency/build execution path C - strong manifest/lock/config/advisory evidence D - partial/inferred E - generic hardening ``` --- # 245. CATEGORY Use: ```text VULNERABLE DEPENDENCY TRANSITIVE DEPENDENCY DEPENDENCY CONFUSION TYPOSQUATTING REGISTRY TRUST LOCKFILE INSTALL SCRIPT REMOTE BINARY DOCKER BASE IMAGE CI ACTION BUILD TOOLCHAIN ARTIFACT INTEGRITY PUBLISHING UPDATER SBOM / PROVENANCE EOL ``` --- # 246. FALSE-POSITIVE PREVENTION Before reporting P0/P1/P2 findings, verify: 1. exact resolved version 2. deployed production or build version 3. documented vulnerability trigger conditions 4. actual source code reachability 5. untrusted input reachability 6. target operating system and configuration 7. execution lifecycle stage 8. privileges and secrets exposed during execution 9. available patch or mitigation status 10. relevance to runtime deployment artifacts --- # 247. DO NOT RELY SOLELY ON CVSS SCORES A CVE with a CVSS 9.8 score is benign if the application never invokes the vulnerable API. --- # 248. DO NOT REPORT PACKAGES MERELY FOR BEING AGED Age does not prove exploitability. --- # 249. DO NOT REPORT HIGH DEPENDENCY COUNTS AS SECURITY DEFECTS Package count is not an indicator of severity. --- # 250. DO NOT BLINDLY RECOMMEND MAJOR VERSION UPGRADES Security remediation must preserve application stability and compatibility. --- # 251. DO NOT RECOMMEND RIGID PINNING WITHOUT UPDATE PROCEDURES Pinning without a recurring update process permanently freezes vulnerable code in production. Both build reproducibility and proactive updates are necessary. --- # 252. DO NOT MANDATE DISABLING INSTALL SCRIPTS GLOBALLY Many legitimate packages mandate native compilation steps during installation. --- # 253. DO NOT DISMISS DEVELOPMENT DEPENDENCIES AS IRRELEVANT If dev packages execute in CI jobs possessing production credentials: they represent critical risks. --- # 254. DO NOT TREAT LOCKFILES AS ABSOLUTE SECURITY GUARANTEES A lockfile can itself be maliciously altered or compromised. --- # 255. DO NOT ASSUME PRIVATE REGISTRIES ARE INHERENTLY SECURE Account breaches and server compromises still occur. --- # 256. DO NOT RELY ON HASHES ALONE IF ATTACKERS CAN ALTER LOCKFILES Threat modeling must consider who holds permissions to modify manifests and lockfiles. --- # 257. DO NOT MODIFY DEPENDENCIES DURING AUDITING Do not: - upgrade packages - uninstall packages - regenerate lockfiles - alter registry configurations - rotate tokens - pin actions without explicit authorization. Complete the audit first. --- # 258. OUTPUT - DEPENDENCY_SUPPLY_CHAIN_SECURITY_AUDIT.md Structure the final report as follows: ## 1. Executive Summary - ecosystems - package managers - dependency count - critical dependency categories - top supply-chain risks ## 2. Dependency Architecture ## 3. Manifest / Lockfile Audit ## 4. Direct Dependency Audit ## 5. Transitive Dependency Audit ## 6. Reachable Vulnerability Audit ## 7. Registry / Source Trust Audit ## 8. Dependency Confusion Audit ## 9. Typosquatting / Namespace Audit ## 10. Package Install Script Audit ## 11. Remote Binary / Postinstall Download Audit ## 12. Build Toolchain Audit ## 13. Docker / OS Package Supply Chain ## 14. GitHub Actions / CI Dependency Audit ## 15. CI Secrets vs Dependency Execution Audit ## 16. Self-Hosted Runner Audit ## 17. Artifact Integrity Audit ## 18. Release / Package Publishing Audit ## 19. Auto-Update / Desktop Updater Audit If relevant. ## 20. Third-Party Browser Script Audit If relevant. ## 21. SBOM / Provenance Audit ## 22. EOL / Support Audit ## 23. Vulnerability Scanning Coverage ## 24. Dependency Update Process ## 25. Findings Summary | ID | Severity | Component | Version | Category | Exploitable | Confidence | |---|---|---|---|---|---|---| ## 26. P0 Findings ## 27. P1 Findings ## 28. P2 Findings ## 29. P3 Findings ## 30. P4 Hardening ## 31. Things Done Well ## 32. Not Applicable ## 33. Not Verified ## 34. Supply Chain Remediation Roadmap --- # 259. DEPENDENCY MATRIX | Package | Version | Direct | Stage | Exposure | Known issue | Reachable | |---|---|---|---|---|---|---| --- # 260. REGISTRY MATRIX | Ecosystem | Registry | Private scopes | Auth | Public fallback | Risk | |---|---|---|---|---|---| --- # 261. CI EXECUTION MATRIX | Step/dependency | Executes code | Secrets available | Write token | Trusted/pinned | |---|---|---|---|---| --- # 262. ARTIFACT MATRIX | Artifact | Source commit known | Hash | Signature | SBOM | Deploy target | |---|---|---|---|---|---| --- # 263. SECOND PASS - LOCKFILE FORENSICS Inspect exact resolved dependency trees for: - unexpected registry hostnames - unexpected packages - silent version drift - raw Git URLs - external tarball URLs - cryptographic integrity mismatches --- # 264. SECOND PASS - TRANSITIVE HOTSPOTS Prioritize auditing transitive packages beneath: - authentication modules - HTTP servers - parsers - file processors - template engines - cryptographic libraries - database drivers --- # 265. SECOND PASS - CVE REACHABILITY TRACING For every high or critical advisory, map: ```text vulnerable package ↓ vulnerable API/function ↓ our call site ↓ attacker input ↓ impact ``` If the execution chain is broken: do not label as a confirmed exploit. --- # 266. SECOND PASS - DEPENDENCY CONFUSION TESTING For every internal or private package: verify: - public namespace collisions - registry lookup priority - version precedence rules - package manager client configurations --- # 267. SECOND PASS - INSTALL SCRIPTS Inventory every dependency declaring lifecycle scripts. Prioritize: ```text script + network access + CI secrets ``` --- # 268. SECOND PASS - REMOTE DOWNLOADS Search for: ```text curl wget Invoke-WebRequest fetch binary download release ``` in: - Dockerfiles - CI workflows - setup scripts - package lifecycle hooks --- # 269. SECOND PASS - CHECKSUM VERIFICATION For every remotely fetched binary, ask: > How do we verify this is the authentic, expected artifact? --- # 270. SECOND PASS - CI ACTION PINNING Review all external GitHub Actions and reusable workflows. Document: - author/owner - reference type - commit SHA vs tag - requested permissions - exposed secrets --- # 271. SECOND PASS - UNTRUSTED PULL REQUESTS Scenario: ```text attacker changes package/lock/build script ↓ privileged CI executes changed code ↓ production secrets are available ``` Verify whether this attack path exists. --- # 272. SECOND PASS - DOCKER BASE IMAGES Review: - tag vs digest pinning - publisher authenticity - EOL runtime status - installed OS package vulnerabilities --- # 273. SECOND PASS - BUILD PLUGINS Inventory: - Babel - Webpack - Vite - Gradle - Maven - compiler plugins - code generators executing code during compilation. --- # 274. SECOND PASS - CLIENT-SIDE SUPPLY CHAINS Locate third-party client JavaScript: - analytics - tag managers - support chat widgets - advertising scripts Determine what data and actions a compromised vendor script can access. --- # 275. SECOND PASS - PACKAGE PUBLISHING For project-owned packages, verify who can: - publish new versions - yank existing releases - alter release workflows --- # 276. SECOND PASS - CODE SIGNING If artifacts are digitally signed: verify who and what holds access to the signing private keys. --- # 277. SECOND PASS - AUTO-UPDATE CHANNELS For desktop application updaters: verify: - signature validation - version binding - anti-rollback protections - error handling behaviors without installing untrusted binaries. --- # 278. SECOND PASS - SBOM RECONCILIATION Compare generated SBOMs against the actual dependency trees of built artifacts. --- # 279. SECOND PASS - UNUSED DEPENDENCY IDENTIFICATION Locate dependencies that may no longer be needed. Before removing, inspect: - scripts - build plugins - tool configurations --- # 280. SECOND PASS - ENVIRONMENT PARITY Compare: ```text local CI production build ``` package manager versions and dependency resolution outcomes. --- # 281. SECOND PASS - VULNERABILITY SUPPRESSIONS Review all ignored vulnerability scanner alerts. For each, document: - technical justification - affected version - reachability determination - date of review - responsible owner --- # 282. SECOND PASS - PATCH VERIFICATION If the repository claims a vulnerability has been patched: verify the resolved and deployed version, not merely the manifest edit. --- # 283. FINAL QUALITY GATE Before issuing the final report, verify: - all package ecosystems have been inventoried - resolved versions originate from actual lockfiles and build outputs - runtime, build, and development dependencies are classified separately - transitive dependencies have been audited - raw CVSS scores are not blindly equated to project severity - high-severity CVEs feature code reachability analyses - target platforms and configuration prerequisites are confirmed - dependency confusion has been evaluated for private packages - registry priorities and fallback behaviors are verified - package installation scripts are cataloged - build-time execution is evaluated as an active supply-chain risk - untrusted pull requests running with secret access are reviewed - CI actions and workflows are evaluated as dependencies - external actions feature reference, permission, and secret analyses - remotely downloaded binaries undergo integrity and provenance reviews - Docker base images and OS packages are audited - third-party frontend scripts are analyzed where present - desktop updaters are reviewed where implemented - artifact-to-source-commit traceability is verified - code signing key protections are audited where signatures are used - SBOMs are not treated as access controls in isolation - unsupported or EOL runtimes are not reported as exploitable without evidence - update and pinning guidance avoids permanently freezing vulnerable versions - every P0/P1 finding features a complete execution and reachability path - P4 reproducibility and provenance enhancements are isolated from active vulnerabilities --- # FINAL RULE Do not generate reports like: > Run npm audit, enable Dependabot, and update all packages. That is not a Dependency & Supply Chain Security Audit. I am looking for concrete defects such as: ```text internal package: company-utils ↓ CI uses: pip --extra-index-url private.registry ↓ same package name is available from public index ↓ public package has higher version ↓ package manager selects public package ↓ attacker-controlled setup/build code runs in CI ↓ CI has production deploy credentials ``` or: ```text frontend dependency has known RCE-style build compromise ↓ package executes postinstall ↓ CI install step has cloud credentials in environment ↓ malicious package code can exfiltrate credentials ↓ runtime reachability is irrelevant because compromise occurs during build ``` or: ```text workflow: uses: third-party/action@main ↓ action repository owner can change main at any time ↓ workflow job has production signing key ↓ changed external action code executes automatically ↓ release signing key compromise path ``` or: ```text Dockerfile downloads: https://vendor.example/tool-latest.tar.gz ↓ no fixed version ↓ no checksum/signature verification ↓ upstream response changes ↓ new binary becomes part of production image without repository diff ``` or: ```text dependency advisory: critical parser vulnerability ↓ resolved version is affected ↓ application passes unauthenticated uploaded files into vulnerable parser function ↓ vulnerable configuration enabled ↓ production worker executes parser ↓ confirmed reachable dependency vulnerability ``` or: ```text package.json looks normal ↓ lockfile resolves package tarball from unknown external host ↓ CI performs frozen install ↓ unexpected artifact is trusted because lockfile itself was maliciously changed ↓ lockfile pinning preserves compromise rather than preventing it ``` or: ```text desktop application updater downloads update over HTTPS ↓ installer package has no signature verification ↓ update endpoint/CDN compromise can replace binary ↓ client executes attacker-controlled update with user privileges ``` or: ```text pull_request_target workflow ↓ production package publish token available ↓ workflow checks out contributor-controlled PR commit ↓ runs npm install/build ↓ attacker modifies package lifecycle script ↓ publish credential can be exfiltrated ``` These are the supply-chain vulnerabilities you must uncover. Reason through: - who selects the dependency - where it resolves from - which exact version is pinned - who can alter the artifact - what executes during installation or build - which secrets are accessible during execution - whether the artifact has verified provenance - whether a vulnerability genuinely reaches attacker-controlled input - whether security updates are reliably deployed to production For every serious finding, you must be able to answer: > Which package, action, tool, or artifact introduces the risk? > What exact version or ref is in use? > Is it direct or transitive? > When does its code execute? > What privileges and secrets are accessible at that time? > Is the known vulnerability genuinely reachable? > Can an attacker manipulate package resolution or artifacts? > How do we verify that the build or release artifact matches expected source code? If deployed version cannot be confirmed: **DEPLOYED VERSION NOT VERIFIED.** If a known advisory is not reachable: **KNOWN VULNERABILITY, NOT CONFIRMED EXPLOITABLE.** If only a reproducibility or provenance enhancement without a confirmed attack path: **P4 - HARDENING.** It is far better to find 5 real supply-chain execution or reachable dependency vulnerability paths than to report hundreds of routine package updates lacking exploitability analysis. The objective is to produce a forensically precise Dependency & Supply Chain Security Audit that translates directly into: - dependency remediation - registry isolation - dependency-confusion prevention - CI permission reduction - action pinning - artifact verification - updater hardening - SBOM/provenance improvements - production supply-chain protection
分类与标签
编程开发、依赖安全审计、CI/CD安全、软件供应链