CI/CD Hardening Checklist

 



1. Workspace Trust & Input Safety (Highest Priority)

  • Never auto‑trust workspaces in CI

    • Require explicit trust configuration for any repo contents before loading configs or env files.
    • Mandatory for AI agents running in headless mode (e.g., Gemini CLI).

  • Treat forks, PRs, issues, and comments as untrusted

    • Especially dangerous when pipelines run on pull_request_target.
    • Never load .env, .gemini/, or agent config from untrusted inputs.
  • Block configuration discovery

    • Disable recursive discovery of agent configs unless explicitly allow‑listed.

2. AI Agent–Specific Controls (Gemini CLI, Claude Code, etc.)

  • Upgrade all agent tools

    • Gemini CLI ≥ 0.39.1
    • run-gemini-cli Action ≥ 0.1.22

  • Disable unrestricted execution modes

    • Avoid --yolo or equivalent autonomous modes.
    • If required, enforce strict command allowlists.

  • Separate “analysis” from “execution”

    • Let agents review or suggest changes.
    • Require a human gate or isolated job for command execution.
  • No agent runs with contributor‑level privileges

    • AI agents should never hold the same rights as a trusted developer.

3. Tool Allowlisting & Command Execution

  • Explicit command allowlists

    • Allow only exact binaries + arguments.
    • No wildcards (*, shell expansion, pipes).

  • Disable shell by default

    • Prefer structured tools over run_shell_command.
  • Fail closed

    • Any unknown or malformed command should hard‑fail the job.

4. Secrets & Credential Protection

  • Do not expose secrets to untrusted workflows

    • Especially on fork PRs and external contributions.

  • Use short‑lived, scoped credentials

    • Replace static tokens with OIDC or ephemeral secrets.
  • Automatic secret revocation

    • Rotate credentials after any compromised run or failed trust check.


5. Execution Environment Isolation

  • Ephemeral CI runners

    • Destroy runners after each job.
    • No shared disk or persistent state.
  • Network egress restrictions

    • Default‑deny outbound access.
    • Block data exfiltration paths.

  • Filesystem sandboxing

    • Read‑only source directories.
    • Writable temp directories only.

6. Dependency & Action Supply‑Chain Security

  • Pin all GitHub Actions

    • Use SHA commits, not tags.
  • Enable Dependabot / Renovate

    • Monitor toolchain and agent dependencies for security advisories.

  • Review AI agent updates as breaking changes

    • Treat behavior changes (trust, sandboxing) as security‑impacting.


7. Pipeline Logic & Permissions

  • Principle of least privilege

    • Separate jobs for:
      • Lint / analysis
      • Build
      • Deployment
      • Agent activity
  • No deployment from untrusted branches

    • Require protected branches + manual approval.
  • Explicit environment protection rules

    • Require reviewers for prod‑level secrets.

8. Logging, Detection & Audit

  • Log every executed command

    • Include AI‑initiated commands.

  • Preserve artifacts for forensic review

    • Capture workspace snapshots for suspicious runs.
  • Alert on abnormal behavior

    • Unexpected network calls
    • Config discovery
    • Shell execution attempts

9. Incident Readiness

  • Pre‑define a CI incident playbook

    • Credential rotation
    • Runner teardown
    • Repository lock‑down
  • Assume compromise if RCE occurs

    • Treat CI runners as fully breached.


10. Governance & Policy

  • Document agent trust policy

    • When agents may execute
    • What inputs are considered safe
  • Train developers

    • AI agents are code execution systems, not just chat assistants.

Comments

Popular posts from this blog

Entire List Leaked for Canvas Ransomware Attack

WSUS CVE-2025-59287 Mitigation

Cloud Infrastructures are Having a Bad Week

CVE-2025-58034 Fortinet Warnings and Mitigation

Broadcom is dismantling of VMware Cloud Service Providers (VCSPs)

FBI Seizes RAMP Cybercrime Forum

Instagram Data Leak Update

CodeRED emergency alert system is currently down across many regions!

SitusAMC Breached!

Notepad++ update service was compromised