MyAIDevelopment · Product · Operations notes

Security and Supply Chain: Secrets · SBOM · SLSA · Dependencies

Today's products contain far more borrowed code and tools than code the team wrote itself. Attackers aim at the weakest link: dependency packages, CI actions, developer tokens.

Map of Attack Points

flowchart LR
    DEV[Developer accounts / tokens] --> SRC[Source Repository]
    DEP[External packages / actions] --> BLD[CI Build]
    SRC --> BLD
    BLD --> ART[Artifact / Registry]
    ART --> RUN[Production]
    SEC[Secret store] --> BLD
    SEC --> RUN

Every arrow is an attack path. Put defenses at the same points.

Point Typical risk Basic defense
Developer accounts Token leaks, takeover 2FA, short-lived tokens
Source Malicious commits, unauthorized changes Branch protection, required review
Dependencies Tampered packages Lockfiles, vulnerability scans, pinned versions
CI Tampered actions, secret exposure SHA pinning, least privilege, OIDC
Artifact Substitution Signing, provenance verification
Runtime Hard-coded secrets Secret manager, regular rotation

Learning from Real Incidents

When Incident Lesson
2025-03 The tj-actions/changed-files action was tampered with (CVE-2025-30066); secrets could leak through workflow logs Pin actions by SHA, rotate exposed secrets immediately
2025-09 npm ecosystem worm ("Shai-Hulud"): stolen developer credentials used to inject malicious code into other packages and republish them Remove long-lived publish tokens, minimize publish rights

npm had already made Trusted Publishing (OIDC) generally available on 2025-07-31, before the incident. After it, on 2025-11-05 npm capped write-enabled granular tokens at a 90-day maximum lifetime and set a 7-day default for new granular tokens, and on 2025-12-09 it revoked all remaining classic tokens. Publish with Trusted Publishing instead of long-lived tokens.

Managing Secrets

Bad:  Commit a .env file to the repository, and after the leak just revert the commit.
Good: Store it in a secret manager and inject it at runtime. If it leaks, "rotate", don't just "delete".

SBOM: What Is Inside

An SBOM (Software Bill of Materials) is a list of the components in a product. When a new vulnerability is announced, it lets you answer "do we ship this library?" within minutes.

SLSA: Who Built It, and How

SLSA is a specification that splits supply chain security into tracks and levels. v1.2, announced 2025-11-24, is the latest and is backward compatible with v1.1.

Track Focus
Build Track Verify that an artifact was built as expected. The lowest level only requires provenance to exist; higher levels add protection against tampering with the build and provenance
Source Track (new in v1.2) Threats in authoring, reviewing and managing source. Level 2 covers history and provenance; Level 3 covers continuous enforcement of technical controls

GitHub Artifact Attestations produce build provenance and, per GitHub's documentation, provide SLSA v1.0 Build Level 2.

Produce the SBOM and provenance together in the release build job.

permissions:
  contents: read
  id-token: write
  attestations: write
steps:
  - uses: actions/checkout@<commit-sha>
  - run: npm ci && npm run build
  - run: mkdir -p dist && tar -czf dist/app.tar.gz build
  - run: npm sbom --sbom-format cyclonedx > dist/sbom.cdx.json
  - uses: actions/attest-build-provenance@<commit-sha>
    with:
      subject-path: dist/app.tar.gz

The consumer verifies before deploying.

gh attestation verify ./dist/app.tar.gz --repo my-org/my-app

Dependency Health

Regulation: EU Cyber Resilience Act

If you sell products with digital elements in the EU, check the CRA.

Minimum Practice List

References