What Happened
On August 21, 2024, an attacker merged a pull request that altered the GitHub Actions workflow for the Nx monorepo toolchain, compromising the CI/CD pipeline. This led to the publication of four malicious packages to npm, which remained live for 5 hours and 20 minutes before removal.
The attack's novel aspect was its focus on AI coding agents. Developers using tools like Claude Code, Gemini CLI, or Amazon Q with unsafe flags found their environment variables and sensitive data exfiltrated to attacker-controlled infrastructure.
Timeline
August 21, 2024: Attacker submits a pull request modifying the GitHub Actions workflow. The PR passes review and merges.
Package publication window: Compromised workflow publishes malicious versions to the npm registry.
Detection: Snyk identifies and tracks the incident. All four malicious packages are removed from npm after 5 hours and 20 minutes of exposure.
Post-incident: Nx team revokes compromised credentials and implements additional workflow protections.
Which Controls Failed
Code Review Process
The pull request modifying the GitHub Actions workflow cleared review despite introducing malicious changes. Your team must treat CI/CD configuration files with the same scrutiny as production code. PCI DSS v4.0.1 Requirement 6.3.2 mandates code reviews before merging to production, specifically for "unintended access or changes to the code environment."
Credential Scope and Rotation
The compromised credentials had permissions to publish packages to npm. Once the attacker controlled the workflow, they controlled the publishing process. ISO/IEC 27001:2022 control A.5.15 requires limiting access rights to the minimum necessary. Your npm publishing tokens should be scoped to specific packages, not organization-wide.
Supply Chain Provenance
The malicious packages lacked provenance attestation. If your dependency management tooling verified package provenance, these packages would have failed validation. NIST 800-53 Rev 5 control SA-10 requires establishing configuration management throughout the system development lifecycle.
AI Agent Safety Controls
The attack exploited AI coding agents running with --unsafe flags that disable sandboxing. When developers grant AI tools unrestricted environment access, those tools become exfiltration vectors. NIST CSF v2.0 function PR.DS-5 applies: "Protections against data leaks are implemented."
What the Standards Require
For CI/CD Pipelines
PCI DSS v4.0.1 Requirement 6.4.3: Protect production environments from unauthorized access. Apply controls such as requiring approval for workflow changes, limiting who can approve modifications, auditing all executions, and alerting on changes that touch credential access.
SOC 2 Type II CC6.6: Implement logical access controls over system components. Document who can access your npm publishing token, when they accessed it, and what they published with it.
For Dependency Management
NIST 800-53 Rev 5 SR-3: Employ supply chain protections to limit harm from potential adversaries. Implement technical controls like verifying package provenance, pinning dependencies to specific versions, and maintaining a software bill of materials (SBOM).
ISO/IEC 27001:2022 A.8.30: Manage security risks in outsourced development by assessing the security posture of your dependencies and monitoring for security advisories.
Lessons and Action Items
1. Protect Your CI/CD Configuration
Treat your .github/workflows directory as infrastructure code. Implement branch protection rules, use a CODEOWNERS file, and require separate approval for changes affecting credential access. Set up alerts in your SIEM for workflow modifications.
2. Scope Your Publishing Credentials
Regenerate your automation tokens with granular scopes. Create separate tokens per package, use short-lived tokens, implement token-based access controls, and audit token usage monthly.
3. Implement Package Provenance
Enable npm provenance for your published packages. Configure your package manager to verify provenance and reject packages without valid attestations.
4. Sandbox Your AI Coding Agents
Never run AI coding agents with unsafe flags in production environments. Create a policy to run AI agents in isolated containers, exclude environment variables containing secrets, monitor network egress, and log all AI agent activity.
5. Monitor for Anomalous Package Updates
Implement automated monitoring to alert on dependency updates outside maintenance windows, flag packages that change maintainers, and detect packages that add network calls in patch versions.
6. Review Your Incident Response Plan
Ensure your incident response plan can quickly identify which systems installed a malicious version, what data was accessed, and what credentials were exposed. Document your dependency inventory and map dependencies to systems.
The Nx incident highlights that supply chain attacks now target the tools you use to write code, not just the code itself. Your AI coding agents have the same access you do. Treat them accordingly.



