Supply chain attacks are accelerating. Threat actors register malicious packages on npm and PyPI, wait for a CI runner to pull during a routine install, and leave with every secret that runner holds. The credential theft happens at the install step itself — before your build finishes. What follows is a cascade: stolen cloud keys provision infrastructure, stolen repository tokens modify other codebases, and the blast radius expands well past the original package pull.
How package repository attacks execute in a CI context
Three attack vectors dominate the current landscape.
Dependency confusion exploits how package managers resolve names. If your internal registry holds a package calledcompany-auth and an attacker publishes a higher-versioned package with the same name to a public registry, unconfigured install commands can pull the public, malicious version. This attack pattern has been exploited against production environments with internal package namespacing gaps.
Typosquatting is simpler: register requets or djnago-admin and wait for fat-finger installs or copy-pasted commands from AI coding assistants.
Maintainer account takeover is the hardest to detect. A legitimate package with a real install base receives a new version published by an attacker who compromised the maintainer through credential stuffing or phishing. The package name is trusted; only the newest version is hostile.
AI-enabled tooling is lowering the cost of operating across all three vectors at scale [source: https://phoenix.security/accelerating-supply-chain-attacks-npm-pypi-vsx-ai-enabled-2026/]. NPM and PyPI remain the highest-volume attack surfaces for software supply chain compromise [source: https://www.rapidfort.com/blog/pypi-npm-and-the-new-frontline-of-software-supply-chain-attacks].
Execution happens at install time, not at runtime. In npm, preinstall and postinstall lifecycle hooks run automatically during npm install without user confirmation. In Python, setup.py executes when installing a source distribution. A malicious package that triggers during build can enumerate every environment variable on the runner, reach the cloud instance metadata service at 169.254.169.254 to pull IAM credentials, and exfiltrate both over outbound HTTP before the job ends.
That is the cascade problem. Credential theft is step one. What the attacker does with valid AWS keys or a GitHub token in the following ten minutes is the actual damage: new IAM users, repository webhooks, or persistent backdoors planted in other pipelines.
What compliance frameworks require — and where the gaps are
SOC 2 and ISO 27001 both apply to CI/CD credential exposure. Most GRC programs do not map this surface correctly.
SOC 2 CC6.1 (logical access) requires that access to systems is restricted based on least privilege. If your CI runner holds an IAM key with write access to production S3 and full EC2 control, that is a CC6.1 finding whether or not your last auditor asked. CC6.3 (access management) requires a documented process for provisioning and deprovisioning access, which includes secret rotation schedules. ISO 27001 Annex A 8.2 covers privileged access management. CI credentials that can reach production systems are privileged access, by any reasonable definition. Annex A.8.8 (technical vulnerability management) applies to unpatched packages in your dependency tree. Annex A.8.20 (network security) applies to whether CI runners have unrestricted egress to the internet and to internal networks.The common gap: CI/CD secrets are not enumerated in the access inventory. No quarterly review covers what tokens the pipeline holds or what they can reach. When an auditor asks for CC6.1 evidence on CI credentials, the answer is often anecdotal.
Red Fox Security's 2026 incident analysis found that attacker dwell time within CI environments was brief in the supply chain compromises they investigated — not because detection responded quickly, but because credential exfiltration completes within minutes of a malicious package executing [source: https://www.redfoxsec.com/blog/software-supply-chain-attacks-2026-latest-incidents-analysis-and-how-to-protect-your-pipeline]. SANS 2026 threat reporting flags credential access via compromised build environments as a consistent precursor to ransomware deployment [source: https://www.sans.org/blog/stay-ahead-ransomware-what-2026-threat-reports-are-telling-us].
Four controls that contain the blast radius
These controls address different points in the attack chain. None is sufficient alone.
Block install-time code execution
npm's --ignore-scripts flag prevents lifecycle scripts from running during dependency installation. For most CI builds, these scripts are not needed. When one is legitimately required, allowlist it explicitly in the project configuration rather than enabling all scripts globally.
`
npm ci --ignore-scripts
`
For Python, prefer wheel distributions over source distributions where available — wheels do not execute setup.py during install. Use hash-pinned requirements with --require-hashes to verify each distribution before extraction.
These two controls remove the primary execution vector for the majority of package repository attacks without requiring changes to the packages themselves.
Eliminate static long-lived CI credentials
Static credentials stored in CI environment variables are a standing target. When a runner is compromised, the attacker reads the variable values immediately.
OIDC token exchange eliminates the static credential. GitHub Actions with AWS IAM OIDC federation means each job receives a short-lived token derived from the job context, scoped to what that job needs, and expired when the job ends. There is no long-lived AWS_ACCESS_KEY_ID to steal.
The same pattern is available across major CI platforms and cloud providers: GitLab CI, CircleCI, GCP Workload Identity Federation, and Azure Federated Credentials. If your CI system still uses static credentials for cloud access, OIDC migration is the highest-leverage credential hygiene action available right now.
Restrict CI runner network egress
A compromised runner that can reach the instance metadata endpoint (169.254.169.254) obtains IAM role credentials attached to the underlying host. A runner that can reach your internal network can pivot to databases and services not exposed publicly.
Egress controls for CI runners:
- Allow outbound only to known registry endpoints (registry.npmjs.org, pypi.org, your internal artifact store)
- Block cloud metadata endpoints explicitly, including 169.254.169.254, metadata.google.internal, and Azure equivalents
- Run runners in isolated subnets with no VPC peering to production environments
Lock file enforcement with hash verification
npm ci with a committed package-lock.json installs exactly what was audited. A package with a different hash fails the install. npm install, by contrast, accepts whatever the registry currently serves for a matching semver range, bypassing hash enforcement entirely.
The enforcement point is CI configuration, not developer laptops. Every CI job that installs dependencies must use the hash-verified install command. Running npm install in a CI job is a policy gap, not a preference.
For container base images, pin by digest rather than tag: FROM node:20.12.0@sha256:{digest} is immutable. FROM node:20-slim resolves to a different image on the next pull.
Building the audit evidence package
The controls above generate their own evidence when implemented correctly. Auditors evaluating CI/CD supply chain controls need:
- A secrets inventory: every CI credential — token, IAM role, static key — with its scope, owner, rotation date, and whether OIDC has replaced it
- CI configuration exports: showing
--ignore-scripts,npm ci, or Python hash-verification equivalents, extractable from your pipeline definition files - Network policy documents or security group rules: confirming CI runner egress is restricted to approved endpoints
- Lock file commit history: showing the lock file is maintained and checked in to version control across branches
- Dependency scan results: from Grype, Trivy, or OSV-Scanner attached to release builds, with CVE findings and triage status
The gap that shows up in audits is not missing controls. It is controls that exist in practice but are undocumented. If you run OIDC token exchange in GitHub Actions but never described it in your access management documentation, the auditor cannot credit it.
CI/CD credential theft turns a dependency install into a production incident before the build job finishes. CloudAnzen maps your pipeline access controls and secret management posture to SOC 2 and ISO 27001 requirements so the evidence is organized before your auditor asks. Talk to us.