heimdall-agent 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -26
- package/README.pt-BR.md +443 -0
- package/agents/cloud-engineer.md +77 -0
- package/agents/code-sentinel.md +71 -34
- package/agents/database-architect.md +31 -25
- package/agents/frontend-designer.md +30 -28
- package/agents/mobile-designer.md +25 -24
- package/agents/modernizer.md +68 -0
- package/agents/orchestrator.md +107 -93
- package/agents/reviewer.md +102 -71
- package/agents/security-auditor.md +27 -27
- package/agents/tester.md +97 -90
- package/commands/grill-me.md +20 -4
- package/commands/orchestrate.md +16 -0
- package/commands/orchestrator.md +16 -0
- package/commands/plan.md +17 -1
- package/config/agents.json +31 -3
- package/config/mcp.json +72 -0
- package/config/models.json +26 -16
- package/config/profiles.json +2 -4
- package/config/skills.json +762 -573
- package/docs/SKILLS.md +393 -275
- package/docs/designs/old/2026-10-31 plan-lifecycle-backlog-and-clean-code-skill.md +87 -0
- package/docs/designs/old/2026-11-02 skill-upstream-audit-and-update.md +105 -0
- package/docs/designs/old/2026-11-05 communication-doctrine-bluf-ste.md +94 -0
- package/docs/designs/old/2026-11-06-cloud-engineer-and-resilience-synthesis.md +67 -0
- package/docs/designs/old/2026-11-06-herdr-native-agent-orchestration.md +45 -0
- package/docs/runs/skill-audit/2026-11-12-compare-report.json +1028 -0
- package/docs/runs/skill-audit/2026-11-12-upstream-audit.json +275 -0
- package/docs/runs/skill-audit/add_progressive_disclosure.cjs +30 -0
- package/docs/runs/skill-audit/check_heimdall_skills.ps1 +9 -0
- package/docs/runs/skill-audit/compare_classics.ps1 +26 -0
- package/docs/runs/skill-audit/compare_taste.ps1 +12 -0
- package/docs/runs/skill-audit/customization-report.json +380 -0
- package/docs/runs/skill-audit/diff_pending_skills.cjs +94 -0
- package/docs/runs/skill-audit/fetch_and_apply_skill.cjs +58 -0
- package/docs/runs/skill-audit/fetch_and_apply_taste_v2.cjs +65 -0
- package/docs/runs/skill-audit/inspect_pending_skills.cjs +71 -0
- package/docs/runs/skill-audit/inventory.json +308 -0
- package/docs/runs/skill-audit/list_local_taste.ps1 +1 -0
- package/docs/runs/skill-audit/phase5-update-plan.json +595 -0
- package/docs/runs/skill-audit/phase5-update-plan.md +138 -0
- package/docs/runs/skill-audit/probe.ps1 +16 -0
- package/docs/runs/skill-audit/probe_classics_branches.ps1 +3 -0
- package/docs/runs/skill-audit/probe_commits.ps1 +15 -0
- package/docs/runs/skill-audit/probe_repos.ps1 +17 -0
- package/docs/runs/skill-audit/probe_sentry_sec.ps1 +3 -0
- package/docs/runs/skill-audit/probe_sentry_sweep.ps1 +5 -0
- package/docs/runs/skill-audit/probe_snyk.ps1 +3 -0
- package/docs/runs/skill-audit/probe_snyk_recipes.ps1 +5 -0
- package/docs/runs/skill-audit/probe_taste_branches.ps1 +8 -0
- package/docs/runs/skill-audit/probe_taste_v19.ps1 +3 -0
- package/docs/runs/skill-audit/probe_user_repos.ps1 +19 -0
- package/docs/runs/skill-audit/prune_taste_skills.cjs +22 -0
- package/docs/runs/skill-audit/run_phase1_2.cjs +142 -0
- package/docs/runs/skill-audit/run_phase6_verification.cjs +107 -0
- package/docs/runs/skill-audit/show_16_details.ps1 +25 -0
- package/docs/runs/skill-audit/show_20_skills.ps1 +28 -0
- package/docs/runs/skill-audit/show_classics_diff.cjs +37 -0
- package/docs/runs/skill-audit/sync_agent_markdowns.cjs +30 -0
- package/docs/runs/skill-audit/taste-skill-upstream.md +542 -0
- package/docs/runs/skill-audit/update-manifest.md +88 -0
- package/docs/runs/skill-audit/update_config_skills.cjs +52 -0
- package/docs/runs/skill-audit/update_registry_phase7.cjs +83 -0
- package/docs/runs/skill-audit/upstream-status.json +563 -0
- package/docs/runs/skill-audit/verification-results.json +252 -0
- package/doctrine/AGENTS.md +42 -77
- package/hooks/git/pre-commit +11 -0
- package/hooks/heimdall-hook.cjs +81 -2
- package/hooks/herdr-agent-state.ps1 +55 -0
- package/hooks/hooks.json +0 -11
- package/lib/catalog-sync.cjs +167 -0
- package/lib/hermes-context.cjs +57 -0
- package/lib/model-context.cjs +123 -0
- package/lib/path-discovery.cjs +94 -0
- package/package.json +7 -3
- package/playbooks/01-interactive-grilling-gate.md +23 -6
- package/playbooks/02-fast-code-deep-verification.md +3 -2
- package/playbooks/03-adversarial-code-review.md +15 -7
- package/playbooks/05-canonical-plan-template.md +35 -19
- package/playbooks/06-model-registry-matrix.md +24 -13
- package/playbooks/07-legacy-code-modernization.md +74 -0
- package/playbooks/08-backlog-and-change-request-flow.md +122 -0
- package/setup.mjs +592 -172
- package/skills/antislop/SKILL.md +76 -56
- package/skills/antislop/VERSION +1 -0
- package/skills/antislop-copywriting/SKILL.md +407 -372
- package/skills/antislop-human/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-human/SKILL.md +204 -147
- package/skills/antislop-human/contrast-check.py +168 -165
- package/skills/antislop-human/contrast-mcp.py +6 -3
- package/skills/antislop-human/references/A11Y-PATTERNS.md +249 -0
- package/skills/antislop-human/references/WCAG.md +127 -0
- package/skills/antislop-ui/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-ui/SKILL.md +344 -304
- package/skills/antislop-ui/references/CORE-WEB-VITALS.md +181 -0
- package/skills/antislop-ui/references/WEB-BASELINE.md +28 -0
- package/skills/brainstorming/SKILL.md +296 -265
- package/skills/brainstorming/builder-check-prompt.md +23 -0
- package/skills/brainstorming/scripts/frame-template.html +213 -213
- package/skills/brainstorming/scripts/server.cjs +723 -723
- package/skills/brandkit/SKILL.md +798 -798
- package/skills/brutalist-skill/SKILL.md +93 -92
- package/skills/caveman/README.md +68 -0
- package/skills/caveman/SKILL.md +73 -38
- package/skills/claude-collaborator/SKILL.md +24 -44
- package/skills/clean-code/SKILL.md +152 -0
- package/skills/cloudflare-security-audit/AI-AND-LLM.md +83 -83
- package/skills/cloudflare-security-audit/ATTACK-CLASSES.md +130 -130
- package/skills/cloudflare-security-audit/CLIENT-SIDE.md +83 -83
- package/skills/cloudflare-security-audit/CLOUD-AND-DEPLOYMENT.md +86 -86
- package/skills/cloudflare-security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -84
- package/skills/cloudflare-security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -89
- package/skills/cloudflare-security-audit/HUNTING.md +251 -251
- package/skills/cloudflare-security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -101
- package/skills/cloudflare-security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -81
- package/skills/cloudflare-security-audit/RECONNAISSANCE.md +156 -156
- package/skills/cloudflare-security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -78
- package/skills/cloudflare-security-audit/SKILL.md +192 -192
- package/skills/cloudflare-security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -73
- package/skills/cloudflare-security-audit/VALIDATION-AND-REPORTING.md +186 -186
- package/skills/cloudflare-security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -105
- package/skills/cloudflare-security-audit/report-schema.json +461 -461
- package/skills/cloudflare-security-audit/validate-coverage-ledger.cjs +872 -872
- package/skills/cloudflare-security-audit/validate-coverage-ledger.test.cjs +740 -740
- package/skills/cloudflare-security-audit/validate-findings.cjs +773 -773
- package/skills/cloudflare-security-audit/validate-findings.test.cjs +652 -652
- package/skills/codebase-design/DEEPENING.md +37 -0
- package/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/skills/codebase-design/SKILL.md +114 -0
- package/skills/codex-collaborator/SKILL.md +24 -45
- package/skills/communication-doctrine/SKILL.md +89 -0
- package/skills/diagnosing-superpowers/SKILL.md +1 -1
- package/skills/diagnosing-superpowers/references/github-issues.md +3 -3
- package/skills/diagnosing-superpowers/templates/issue.md +23 -4
- package/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +60 -0
- package/skills/domain-modeling/SKILL.md +74 -0
- package/skills/executing-plans/SKILL.md +6 -56
- package/skills/executing-plans/scripts/task-done +52 -52
- package/skills/executing-plans/scripts/task-start +28 -28
- package/skills/gemini-collaborator/SKILL.md +24 -56
- package/skills/grill-me/SKILL.md +65 -0
- package/skills/handoff/SKILL.md +64 -0
- package/skills/herdr/SKILL.md +243 -0
- package/skills/image-to-code-skill/SKILL.md +1228 -1228
- package/skills/imagegen-frontend-mobile/SKILL.md +1465 -1465
- package/skills/imagegen-frontend-web/SKILL.md +987 -987
- package/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/skills/improve-codebase-architecture/SKILL.md +71 -0
- package/skills/karpathy-guidelines/SKILL.md +67 -67
- package/skills/mcp-engineering/SKILL.md +74 -0
- package/skills/minimalist-skill/SKILL.md +87 -85
- package/skills/output-skill/SKILL.md +49 -49
- package/skills/owasp-security/reference/config-and-supply-chain.md +346 -344
- package/skills/owasp-security/reference/languages.md +378 -372
- package/skills/owasp-security/reference/owasp-report.md +1144 -1140
- package/skills/owasp-security/reference/review-checklist.md +134 -132
- package/skills/ponytail/SKILL.md +36 -52
- package/skills/postgres-best-practices/SKILL.md +30 -52
- package/skills/postgres-best-practices/references/backup-restore.md +372 -0
- package/skills/postgres-best-practices/references/bulk-loading.md +315 -0
- package/skills/postgres-best-practices/references/connection-pooling.md +310 -0
- package/skills/postgres-best-practices/references/hot-standby.md +221 -0
- package/skills/postgres-best-practices/references/indexing.md +318 -0
- package/skills/postgres-best-practices/references/logical-replication.md +610 -0
- package/skills/postgres-best-practices/references/major-version-upgrades.md +334 -0
- package/skills/postgres-best-practices/references/performance-diagnostics.md +553 -0
- package/skills/postgres-best-practices/references/query-optimization.md +294 -0
- package/skills/postgres-best-practices/references/query-patterns.md +566 -0
- package/skills/postgres-best-practices/references/schema-design.md +362 -0
- package/skills/postgres-best-practices/references/security-roles.md +489 -0
- package/skills/postgres-best-practices/references/transaction-isolation.md +344 -0
- package/skills/progressive-disclosure/SKILL.md +68 -0
- package/skills/pstack-discipline/SKILL.md +40 -0
- package/skills/receiving-code-review/SKILL.md +2 -23
- package/skills/requesting-code-review/SKILL.md +7 -36
- package/skills/soft-skill/SKILL.md +99 -98
- package/skills/stitch-skill/DESIGN.md +121 -121
- package/skills/stitch-skill/SKILL.md +185 -184
- package/skills/strix-security/SKILL.md +54 -53
- package/skills/subagent-driven-development/SKILL.md +35 -264
- package/skills/subagent-driven-development/references/batching.md +11 -0
- package/skills/subagent-driven-development/references/cannot-verify.md +10 -0
- package/skills/subagent-driven-development/references/final-review.md +47 -0
- package/skills/subagent-driven-development/references/fix-loop.md +77 -0
- package/skills/subagent-driven-development/references/handling-reports.md +15 -0
- package/skills/subagent-driven-development/references/preflight.md +26 -0
- package/skills/subagent-driven-development/references/resuming.md +12 -0
- package/skills/subagent-driven-development/scripts/review-package +53 -53
- package/skills/subagent-driven-development/scripts/sdd-workspace +87 -82
- package/skills/subagent-driven-development/scripts/task-brief +43 -43
- package/skills/systematic-debugging/SKILL.md +283 -306
- package/skills/taste-skill/SKILL.md +542 -1206
- package/skills/taste-skill/references/app-screens.md +1199 -0
- package/skills/taste-skill/references/colour.md +141 -0
- package/skills/taste-skill/references/copy.md +177 -0
- package/skills/taste-skill/references/critique.md +182 -0
- package/skills/taste-skill/references/imagery.md +791 -0
- package/skills/taste-skill/references/layout.md +292 -0
- package/skills/taste-skill/references/motion.md +980 -0
- package/skills/taste-skill/references/research.md +356 -0
- package/skills/taste-skill/references/scenes.md +174 -0
- package/skills/taste-skill/references/tells.md +115 -0
- package/skills/taste-skill/references/type.md +170 -0
- package/skills/test-driven-development/SKILL.md +330 -337
- package/skills/thermo/SKILL.md +67 -0
- package/skills/threat-modeling/SKILL.md +55 -0
- package/skills/to-spec/SKILL.md +75 -0
- package/skills/to-tickets/SKILL.md +105 -0
- package/skills/trailofbits-audit-context/SKILL.md +72 -72
- package/skills/trailofbits-insecure-defaults/commands/audit.md +35 -0
- package/skills/trailofbits-insecure-defaults/references/debug-features.json +13 -13
- package/skills/trailofbits-insecure-defaults/references/debug-features.md +75 -75
- package/skills/trailofbits-insecure-defaults/references/default-credentials.json +12 -12
- package/skills/trailofbits-insecure-defaults/references/default-credentials.md +76 -76
- package/skills/trailofbits-insecure-defaults/references/fail-open-security.json +11 -11
- package/skills/trailofbits-insecure-defaults/references/fail-open-security.md +70 -70
- package/skills/trailofbits-insecure-defaults/references/fallback-secrets.json +11 -11
- package/skills/trailofbits-insecure-defaults/references/fallback-secrets.md +70 -70
- package/skills/trailofbits-insecure-defaults/references/permissive-access.json +13 -13
- package/skills/trailofbits-insecure-defaults/references/permissive-access.md +62 -62
- package/skills/trailofbits-insecure-defaults/references/weak-crypto.json +13 -13
- package/skills/trailofbits-insecure-defaults/references/weak-crypto.md +71 -71
- package/skills/trailofbits-triage-brocards/SKILL.md +208 -208
- package/skills/verification-before-completion/SKILL.md +0 -14
- package/skills/wayfinder/SKILL.md +128 -0
- package/skills/writing-plans/SKILL.md +11 -15
- package/skills/writing-skills/SKILL.md +21 -303
- package/skills/writing-skills/references/CLAUDE_MD_TESTING.md +189 -0
- package/skills/writing-skills/references/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/references/bulletproofing.md +80 -0
- package/skills/writing-skills/references/discovery.md +201 -0
- package/skills/writing-skills/references/flowcharts.md +37 -0
- package/skills/writing-skills/references/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/references/persuasion-principles.md +187 -0
- package/skills/writing-skills/references/testing-skills-with-subagents.md +384 -0
- package/tools/{claude-bridge.ps1 → archive/claude-bridge.ps1} +10 -7
- package/tools/{codex-bridge.ps1 → archive/codex-bridge.ps1} +1 -1
- package/tools/{gemini-bridge.ps1 → archive/gemini-bridge.ps1} +12 -19
- package/skills/gpt-tasteskill/SKILL.md +0 -74
- package/skills/taste-skill-v1/SKILL.md +0 -226
- /package/tools/{claude-bridge.cmd → archive/claude-bridge.cmd} +0 -0
- /package/tools/{claude-bridge.sh → archive/claude-bridge.sh} +0 -0
- /package/tools/{codex-bridge.cmd → archive/codex-bridge.cmd} +0 -0
- /package/tools/{codex-bridge.sh → archive/codex-bridge.sh} +0 -0
- /package/tools/{codexcli-bridge.cmd → archive/codexcli-bridge.cmd} +0 -0
- /package/tools/{codexcli-bridge.ps1 → archive/codexcli-bridge.ps1} +0 -0
- /package/tools/{gemini-bridge.cmd → archive/gemini-bridge.cmd} +0 -0
- /package/tools/{gemini-bridge.sh → archive/gemini-bridge.sh} +0 -0
|
@@ -1,344 +1,346 @@
|
|
|
1
|
-
# A02 Security Misconfiguration & A03 Software Supply Chain Failures
|
|
2
|
-
|
|
3
|
-
The #2 and #3 categories of the OWASP Top 10:2025 are rarely found in application code. They
|
|
4
|
-
live in Dockerfiles, Kubernetes manifests, Terraform, framework settings, lockfiles, and CI
|
|
5
|
-
workflow definitions. This file covers those surfaces concretely.
|
|
6
|
-
|
|
7
|
-
> **Same reporting bar applies.** A hardening gap in a file that never reaches production, or a
|
|
8
|
-
> permissive setting already constrained by a layer above it (a security group behind a private
|
|
9
|
-
> subnet, a `latest` tag pinned by digest at deploy), is defense-in-depth - report it as such.
|
|
10
|
-
> See "Before Reporting a Finding" in [`../SKILL.md`](../SKILL.md).
|
|
11
|
-
|
|
12
|
-
## Contents
|
|
13
|
-
- [Where to Look First](#where-to-look-first)
|
|
14
|
-
- [A02 - Containers](#a02-containers)
|
|
15
|
-
- [A02 - Kubernetes](#a02-kubernetes)
|
|
16
|
-
- [A02 - Cloud & Terraform](#a02-cloud--terraform)
|
|
17
|
-
- [A02 - Application & Web Server Config](#a02-application--web-server-config)
|
|
18
|
-
- [A02 - Security Headers](#a02-security-headers)
|
|
19
|
-
- [A03 - Dependency Manifests and Lockfiles](#a03-dependency-manifests-and-lockfiles)
|
|
20
|
-
- [A03 - Dependency Confusion and Typosquatting](#a03-dependency-confusion-and-typosquatting)
|
|
21
|
-
- [A03 - Install Scripts](#a03-install-scripts)
|
|
22
|
-
- [A03 - CI/CD Pipelines](#a03-cicd-pipelines)
|
|
23
|
-
- [A03 - Provenance, Signing, and SBOM](#a03-provenance-signing-and-sbom)
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Where to Look First
|
|
28
|
-
|
|
29
|
-
Before reading any application code, list these files if they exist. They are small, high-signal,
|
|
30
|
-
and frequently unreviewed:
|
|
31
|
-
|
|
32
|
-
| Surface | Files |
|
|
33
|
-
|---|---|
|
|
34
|
-
| Containers | `Dockerfile*`, `docker-compose*.yml`, `.dockerignore` |
|
|
35
|
-
| Orchestration | `k8s/**/*.yaml`, `helm/**/values.yaml`, `*.deployment.yaml` |
|
|
36
|
-
| Infrastructure | `*.tf`, `*.tfvars`, `cdk/**`, `template.yaml` (SAM), `serverless.yml` |
|
|
37
|
-
| App config | `settings.py`, `application*.yml`, `appsettings*.json`, `next.config.js`, `.env*` |
|
|
38
|
-
| Web server | `nginx.conf`, `httpd.conf`, ingress annotations |
|
|
39
|
-
| Dependencies | `package.json` + lockfile, `requirements.txt`, `pyproject.toml`, `go.mod`, `pom.xml`, `Gemfile`, `Cargo.toml` |
|
|
40
|
-
| Registry config | `.npmrc`, `pip.conf`, `settings.xml`, `.yarnrc.yml` |
|
|
41
|
-
| Pipelines | `.github/workflows/*.yml`, `.gitlab-ci.yml`, `Jenkinsfile`, `azure-pipelines.yml` |
|
|
42
|
-
|
|
43
|
-
Two questions cut through most of it: **what runs as root or with wildcard permissions**, and
|
|
44
|
-
**what executes code that someone outside the repo controls**.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## A02: Containers
|
|
49
|
-
|
|
50
|
-
```dockerfile
|
|
51
|
-
# UNSAFE
|
|
52
|
-
FROM node:latest # unpinned - the image changes under you
|
|
53
|
-
COPY . . # no .dockerignore: .env, .git, keys land in the layer
|
|
54
|
-
RUN npm install
|
|
55
|
-
ARG NPM_TOKEN # build args are visible in image history
|
|
56
|
-
ENV API_KEY="sk-live-..." # baked into the image, readable by anyone who pulls it
|
|
57
|
-
USER root # default; the process runs as uid 0
|
|
58
|
-
CMD ["npm", "start"]
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
```dockerfile
|
|
62
|
-
# SAFE
|
|
63
|
-
FROM node:22.11.0-alpine@sha256:... # pinned by digest
|
|
64
|
-
WORKDIR /app
|
|
65
|
-
COPY package*.json ./
|
|
66
|
-
RUN npm ci --omit=dev # ci, not install: honors the lockfile exactly
|
|
67
|
-
COPY --chown=node:node . . # with a .dockerignore covering .git, .env, secrets
|
|
68
|
-
USER node # non-root
|
|
69
|
-
CMD ["node", "server.js"]
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Check for:**
|
|
73
|
-
- Running as root - `USER` absent entirely is the common case, not an explicit `USER root`
|
|
74
|
-
- Secrets in `ENV`, `ARG`, or any `RUN` command -
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
- `
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
-
|
|
193
|
-
|
|
194
|
-
-
|
|
195
|
-
|
|
196
|
-
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
|
207
|
-
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
|
|
|
212
|
-
|
|
213
|
-
`
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
|
227
|
-
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
|
233
|
-
|
|
|
234
|
-
|
|
|
235
|
-
|
|
|
236
|
-
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
-
|
|
265
|
-
|
|
266
|
-
-
|
|
267
|
-
|
|
268
|
-
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
-
|
|
324
|
-
|
|
325
|
-
-
|
|
326
|
-
|
|
327
|
-
-
|
|
328
|
-
-
|
|
329
|
-
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
-
|
|
338
|
-
|
|
339
|
-
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
1
|
+
# A02 Security Misconfiguration & A03 Software Supply Chain Failures
|
|
2
|
+
|
|
3
|
+
The #2 and #3 categories of the OWASP Top 10:2025 are rarely found in application code. They
|
|
4
|
+
live in Dockerfiles, Kubernetes manifests, Terraform, framework settings, lockfiles, and CI
|
|
5
|
+
workflow definitions. This file covers those surfaces concretely.
|
|
6
|
+
|
|
7
|
+
> **Same reporting bar applies.** A hardening gap in a file that never reaches production, or a
|
|
8
|
+
> permissive setting already constrained by a layer above it (a security group behind a private
|
|
9
|
+
> subnet, a `latest` tag pinned by digest at deploy), is defense-in-depth - report it as such.
|
|
10
|
+
> See "Before Reporting a Finding" in [`../SKILL.md`](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Contents
|
|
13
|
+
- [Where to Look First](#where-to-look-first)
|
|
14
|
+
- [A02 - Containers](#a02-containers)
|
|
15
|
+
- [A02 - Kubernetes](#a02-kubernetes)
|
|
16
|
+
- [A02 - Cloud & Terraform](#a02-cloud--terraform)
|
|
17
|
+
- [A02 - Application & Web Server Config](#a02-application--web-server-config)
|
|
18
|
+
- [A02 - Security Headers](#a02-security-headers)
|
|
19
|
+
- [A03 - Dependency Manifests and Lockfiles](#a03-dependency-manifests-and-lockfiles)
|
|
20
|
+
- [A03 - Dependency Confusion and Typosquatting](#a03-dependency-confusion-and-typosquatting)
|
|
21
|
+
- [A03 - Install Scripts](#a03-install-scripts)
|
|
22
|
+
- [A03 - CI/CD Pipelines](#a03-cicd-pipelines)
|
|
23
|
+
- [A03 - Provenance, Signing, and SBOM](#a03-provenance-signing-and-sbom)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Where to Look First
|
|
28
|
+
|
|
29
|
+
Before reading any application code, list these files if they exist. They are small, high-signal,
|
|
30
|
+
and frequently unreviewed:
|
|
31
|
+
|
|
32
|
+
| Surface | Files |
|
|
33
|
+
|---|---|
|
|
34
|
+
| Containers | `Dockerfile*`, `docker-compose*.yml`, `.dockerignore` |
|
|
35
|
+
| Orchestration | `k8s/**/*.yaml`, `helm/**/values.yaml`, `*.deployment.yaml` |
|
|
36
|
+
| Infrastructure | `*.tf`, `*.tfvars`, `cdk/**`, `template.yaml` (SAM), `serverless.yml` |
|
|
37
|
+
| App config | `settings.py`, `application*.yml`, `appsettings*.json`, `next.config.js`, `.env*` |
|
|
38
|
+
| Web server | `nginx.conf`, `httpd.conf`, ingress annotations |
|
|
39
|
+
| Dependencies | `package.json` + lockfile, `requirements.txt`, `pyproject.toml`, `go.mod`, `pom.xml`, `Gemfile`, `Cargo.toml` |
|
|
40
|
+
| Registry config | `.npmrc`, `pip.conf`, `settings.xml`, `.yarnrc.yml` |
|
|
41
|
+
| Pipelines | `.github/workflows/*.yml`, `.gitlab-ci.yml`, `Jenkinsfile`, `azure-pipelines.yml` |
|
|
42
|
+
|
|
43
|
+
Two questions cut through most of it: **what runs as root or with wildcard permissions**, and
|
|
44
|
+
**what executes code that someone outside the repo controls**.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## A02: Containers
|
|
49
|
+
|
|
50
|
+
```dockerfile
|
|
51
|
+
# UNSAFE
|
|
52
|
+
FROM node:latest # unpinned - the image changes under you
|
|
53
|
+
COPY . . # no .dockerignore: .env, .git, keys land in the layer
|
|
54
|
+
RUN npm install
|
|
55
|
+
ARG NPM_TOKEN # build args are visible in image history
|
|
56
|
+
ENV API_KEY="sk-live-..." # baked into the image, readable by anyone who pulls it
|
|
57
|
+
USER root # default; the process runs as uid 0
|
|
58
|
+
CMD ["npm", "start"]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```dockerfile
|
|
62
|
+
# SAFE
|
|
63
|
+
FROM node:22.11.0-alpine@sha256:... # pinned by digest
|
|
64
|
+
WORKDIR /app
|
|
65
|
+
COPY package*.json ./
|
|
66
|
+
RUN npm ci --omit=dev # ci, not install: honors the lockfile exactly
|
|
67
|
+
COPY --chown=node:node . . # with a .dockerignore covering .git, .env, secrets
|
|
68
|
+
USER node # non-root
|
|
69
|
+
CMD ["node", "server.js"]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Check for:**
|
|
73
|
+
- Running as root - `USER` absent entirely is the common case, not an explicit `USER root`
|
|
74
|
+
- Secrets in `ENV`, `ARG`, or any `RUN` command - the values are in the layer metadata, visible
|
|
75
|
+
with `docker history`. Use build secrets (`RUN --mount=type=secret`) or inject at runtime.
|
|
76
|
+
- Secret files copied in and deleted in a later layer - `docker history` does not show these,
|
|
77
|
+
but the earlier layer still contains the file; `docker save` or `dive` recovers it. Check both
|
|
78
|
+
vectors: history for values, layer contents for files.
|
|
79
|
+
- Missing `.dockerignore` while the Dockerfile does `COPY . .` - this is how `.git` and `.env`
|
|
80
|
+
reach production images
|
|
81
|
+
- `npm install` / `pip install -r` without a lockfile step (see A03 below)
|
|
82
|
+
- `latest` or floating tags; unpinned base image digests
|
|
83
|
+
- `curl ... | sh` in a build step - unverified remote code at build time
|
|
84
|
+
- `--privileged`, `network_mode: host`, or docker socket mounts (`/var/run/docker.sock`) in
|
|
85
|
+
compose files - a socket mount is host root, effectively
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## A02: Kubernetes
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
# UNSAFE
|
|
93
|
+
spec:
|
|
94
|
+
containers:
|
|
95
|
+
- name: api
|
|
96
|
+
image: myapp:latest
|
|
97
|
+
securityContext:
|
|
98
|
+
privileged: true # full host access
|
|
99
|
+
runAsUser: 0
|
|
100
|
+
env:
|
|
101
|
+
- name: DB_PASSWORD
|
|
102
|
+
value: "hunter2" # plaintext in the manifest, and in git
|
|
103
|
+
volumeMounts:
|
|
104
|
+
- mountPath: /host
|
|
105
|
+
name: hostvol
|
|
106
|
+
volumes:
|
|
107
|
+
- name: hostvol
|
|
108
|
+
hostPath: { path: / } # the entire node filesystem
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
# SAFE
|
|
113
|
+
spec:
|
|
114
|
+
automountServiceAccountToken: false # unless the pod actually calls the API server
|
|
115
|
+
securityContext:
|
|
116
|
+
runAsNonRoot: true
|
|
117
|
+
runAsUser: 10001
|
|
118
|
+
seccompProfile: { type: RuntimeDefault }
|
|
119
|
+
containers:
|
|
120
|
+
- name: api
|
|
121
|
+
image: myapp@sha256:...
|
|
122
|
+
securityContext:
|
|
123
|
+
allowPrivilegeEscalation: false
|
|
124
|
+
readOnlyRootFilesystem: true
|
|
125
|
+
capabilities: { drop: ["ALL"] }
|
|
126
|
+
envFrom:
|
|
127
|
+
- secretRef: { name: api-secrets } # from a secret store, not the manifest
|
|
128
|
+
resources:
|
|
129
|
+
limits: { cpu: "1", memory: "512Mi" } # absent limits = node-wide DoS
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Check for:** `privileged: true`, `hostNetwork`/`hostPID`/`hostPath`, missing
|
|
133
|
+
`allowPrivilegeEscalation: false`, capabilities not dropped, secrets as literal `value:` (and
|
|
134
|
+
remember base64 in a `Secret` object is encoding, not encryption), `automountServiceAccountToken`
|
|
135
|
+
left on by default, absent resource limits, no NetworkPolicy (default is all pods can reach all
|
|
136
|
+
pods), and RBAC bindings granting `cluster-admin` or `*` verbs.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## A02: Cloud & Terraform
|
|
141
|
+
|
|
142
|
+
```hcl
|
|
143
|
+
# UNSAFE
|
|
144
|
+
resource "aws_s3_bucket_public_access_block" "b" {
|
|
145
|
+
block_public_acls = false # public-ACL guard off
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
resource "aws_security_group_rule" "ssh" {
|
|
149
|
+
type = "ingress"
|
|
150
|
+
from_port = 22
|
|
151
|
+
to_port = 22
|
|
152
|
+
cidr_blocks = ["0.0.0.0/0"] # SSH open to the internet
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
resource "aws_db_instance" "db" {
|
|
156
|
+
publicly_accessible = true
|
|
157
|
+
storage_encrypted = false
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
data "aws_iam_policy_document" "p" {
|
|
161
|
+
statement {
|
|
162
|
+
actions = ["*"] # wildcard action on wildcard resource
|
|
163
|
+
resources = ["*"]
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Check for:**
|
|
169
|
+
- Storage exposed publicly (S3 ACLs/policies, GCS `allUsers`, Azure blob public access)
|
|
170
|
+
- `0.0.0.0/0` on anything that is not 80/443 - SSH, RDP, database ports, admin panels
|
|
171
|
+
- Encryption at rest disabled; TLS not enforced in transit
|
|
172
|
+
- IAM policies with `"*"` actions or resources; roles assumable by `"*"` principals
|
|
173
|
+
- Managed databases and caches marked publicly accessible
|
|
174
|
+
- Audit logging (CloudTrail, flow logs, GCP audit logs) disabled or not retained
|
|
175
|
+
- Secrets in `.tfvars` or committed state files - Terraform state stores values in cleartext
|
|
176
|
+
- IMDSv1 permitted on EC2 (`http_tokens = "optional"`) - this is the SSRF-to-credentials path
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## A02: Application & Web Server Config
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
# UNSAFE (Django)
|
|
184
|
+
DEBUG = True # tracebacks with settings and local variables
|
|
185
|
+
ALLOWED_HOSTS = ["*"] # host header injection, cache poisoning
|
|
186
|
+
SECRET_KEY = "dev-key-do-not-use" # committed and predictable → forgeable sessions
|
|
187
|
+
CORS_ALLOW_ALL_ORIGINS = True # with credentials, any site reads authenticated responses
|
|
188
|
+
SESSION_COOKIE_SECURE = False
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Check for:**
|
|
192
|
+
- Debug/verbose error modes reachable in production; stack-trace pages, `/debug` or profiler routes
|
|
193
|
+
- Development secrets committed, or the same key across environments
|
|
194
|
+
- CORS: `*` combined with credentials, origin reflected from the request, or a regex matching
|
|
195
|
+
`evil-myapp.com` because the dot was not escaped
|
|
196
|
+
- Directory listing enabled; `.git/`, `.env`, backups, or `/actuator`, `/metrics`, `/graphql`
|
|
197
|
+
introspection served publicly
|
|
198
|
+
- Default admin consoles left mounted (`/admin`, phpMyAdmin, Kibana, Grafana) without auth
|
|
199
|
+
- TLS: versions below 1.2 enabled, weak ciphers, certificate verification disabled in clients
|
|
200
|
+
(`verify=False`, `rejectUnauthorized: false`, `InsecureSkipVerify: true`)
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## A02: Security Headers
|
|
205
|
+
|
|
206
|
+
| Header | Value | Why |
|
|
207
|
+
|---|---|---|
|
|
208
|
+
| `Content-Security-Policy` | `default-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'` | Last line of defense for XSS. `unsafe-inline`/`unsafe-eval` mostly negates it; prefer nonces or hashes. |
|
|
209
|
+
| `Strict-Transport-Security` | `max-age=31536000; includeSubDomains` | Prevents downgrade/stripping. |
|
|
210
|
+
| `X-Content-Type-Options` | `nosniff` | Stops MIME sniffing turning an upload into script. |
|
|
211
|
+
| `Referrer-Policy` | `strict-origin-when-cross-origin` | Keeps paths and tokens out of `Referer`. |
|
|
212
|
+
| `Cache-Control` | `no-store` on authenticated responses | Prevents shared-cache leakage. |
|
|
213
|
+
| Cookies | `HttpOnly; Secure; SameSite=Lax` | XSS theft and cross-site request defense. |
|
|
214
|
+
|
|
215
|
+
`frame-ancestors` supersedes `X-Frame-Options`; setting both is harmless and helps old clients.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## A03: Dependency Manifests and Lockfiles
|
|
220
|
+
|
|
221
|
+
The recurring finding is a lockfile that is missing, or one the build is allowed to rewrite,
|
|
222
|
+
so what ships can differ from what was reviewed. Most JS package managers read the lockfile on a
|
|
223
|
+
plain install; the question is whether a mismatch with the manifest fails the build or silently
|
|
224
|
+
updates the lock.
|
|
225
|
+
|
|
226
|
+
| Ecosystem | Does not enforce the lock (may rewrite it or skip checks) | Fails the build if the lock is missing or out of sync |
|
|
227
|
+
|---|---|---|
|
|
228
|
+
| npm | `npm install` (updates the lock when `package.json` disagrees) | `npm ci` |
|
|
229
|
+
| Yarn 2+ | `yarn install` outside CI | `yarn install --immutable`, the default when Yarn detects CI (`enableImmutableInstalls`) |
|
|
230
|
+
| Yarn 1 | `yarn install`; `--frozen-lockfile` still succeeds when `yarn.lock` is missing | `yarn install --frozen-lockfile` plus an explicit check that `yarn.lock` exists |
|
|
231
|
+
| pnpm | `pnpm install` outside CI | `pnpm install --frozen-lockfile`, the default in CI when a lockfile exists |
|
|
232
|
+
| pip | `pip install -r requirements.txt` without hashes | `pip install --require-hashes -r requirements.txt` (every entry pinned `==` with `--hash`) |
|
|
233
|
+
| uv | `uv sync`, or `uv sync --frozen` (uses the lock without checking it is current) | `uv sync --locked` |
|
|
234
|
+
| Poetry | `poetry install` | `poetry check --lock` before install |
|
|
235
|
+
| Go | `-mod=mod` (updates `go.mod`) | the default `-mod=readonly` since Go 1.16, with `go.sum` committed. `go mod verify` is separate: it checks the module cache for local tampering against hashes recorded at download |
|
|
236
|
+
| Rust | `cargo build` (may update `Cargo.lock`) | `cargo build --locked` |
|
|
237
|
+
| Gradle | dynamic versions with no lock; any CI build run with `--write-locks` (overwrites lock state) or `--update-locks` (rewrites the named entries) | committed `gradle.lockfile` with `lockMode = LockMode.STRICT` (also fails when a locked configuration has no lock state) |
|
|
238
|
+
| Maven | version ranges in `pom.xml` | no native lockfile: pin exact versions and forbid ranges |
|
|
239
|
+
|
|
240
|
+
**Check for:** a lockfile missing or gitignored; a production build step that can rewrite it
|
|
241
|
+
(`npm install` in CI, `uv sync --frozen` where `--locked` was meant, Gradle `--write-locks` in CI, or
|
|
242
|
+
`enableImmutableInstalls: false` / `--no-frozen-lockfile` overriding the CI default); floating ranges (`^`, `~`, `*`, `latest`) with no enforced lockfile behind them; `requirements.txt` without `==`; a lockfile whose `resolved` URLs point at
|
|
243
|
+
a registry other than the expected one; and vulnerable-but-unused dependencies (they still count
|
|
244
|
+
if the code path is reachable - check before rating severity).
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## A03: Dependency Confusion and Typosquatting
|
|
249
|
+
|
|
250
|
+
Dependency confusion: an internal package name that is not registered publicly can be claimed by
|
|
251
|
+
an attacker, whose higher version number wins resolution when a build falls back to the public
|
|
252
|
+
registry.
|
|
253
|
+
|
|
254
|
+
```ini
|
|
255
|
+
# UNSAFE .npmrc - private scope resolvable from the public registry
|
|
256
|
+
registry=https://registry.npmjs.org/
|
|
257
|
+
|
|
258
|
+
# SAFE - bind the scope to the internal registry explicitly
|
|
259
|
+
@mycompany:registry=https://npm.internal.example.com/
|
|
260
|
+
//npm.internal.example.com/:_authToken=${NPM_TOKEN}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Check for:**
|
|
264
|
+
- Internal package names used unscoped, or scopes not pinned to an internal registry
|
|
265
|
+
- A proxy/mirror configured to fall through to the public registry for internal names
|
|
266
|
+
- `pip install --extra-index-url` - pip picks the highest version across **all** indexes; use
|
|
267
|
+
`--index-url` with a single trusted mirror
|
|
268
|
+
- Names one edit away from a popular package (`crossenv`, `python3-dateutil`, `reqeusts`),
|
|
269
|
+
packages with very recent first-publish dates, or a maintainer change on a critical dependency
|
|
270
|
+
- Git/URL dependencies pointing at a branch rather than a commit SHA
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## A03: Install Scripts
|
|
275
|
+
|
|
276
|
+
Package installation executes code. `npm install` runs `preinstall`/`postinstall` from every
|
|
277
|
+
package in the tree, with the developer's or CI runner's privileges.
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
// Review any package that ships this - it is the standard malware entry point
|
|
281
|
+
{ "scripts": { "postinstall": "node ./scripts/collect.js" } }
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Mitigations: `npm ci --ignore-scripts` (then run the builds you actually need explicitly),
|
|
285
|
+
`pip install --only-binary :all:` to avoid arbitrary `setup.py` execution, and running installs
|
|
286
|
+
in a container without credentials or network access beyond the registry.
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## A03: CI/CD Pipelines
|
|
291
|
+
|
|
292
|
+
The pipeline has repository write access and production credentials. It is a higher-value target
|
|
293
|
+
than the application.
|
|
294
|
+
|
|
295
|
+
```yaml
|
|
296
|
+
# UNSAFE - GitHub Actions
|
|
297
|
+
on: pull_request_target # runs with a writable token AND secrets...
|
|
298
|
+
jobs:
|
|
299
|
+
build:
|
|
300
|
+
steps:
|
|
301
|
+
- uses: actions/checkout@v4
|
|
302
|
+
with:
|
|
303
|
+
ref: ${{ github.event.pull_request.head.sha }} # ...on the fork's code. RCE.
|
|
304
|
+
- uses: some-org/some-action@main # mutable ref
|
|
305
|
+
- run: echo "Title: ${{ github.event.pull_request.title }}" # script injection
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
```yaml
|
|
309
|
+
# SAFE
|
|
310
|
+
on: pull_request # read-only token, no secrets for forks
|
|
311
|
+
permissions:
|
|
312
|
+
contents: read # least privilege, declared explicitly
|
|
313
|
+
jobs:
|
|
314
|
+
build:
|
|
315
|
+
steps:
|
|
316
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pinned SHA
|
|
317
|
+
- env:
|
|
318
|
+
TITLE: ${{ github.event.pull_request.title }} # via env, not interpolated into the shell
|
|
319
|
+
run: echo "Title: $TITLE"
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Check for:**
|
|
323
|
+
- `pull_request_target` or `workflow_run` that checks out untrusted code - the combination of
|
|
324
|
+
fork code plus secrets is the critical one
|
|
325
|
+
- `${{ }}` interpolation of attacker-controllable fields (PR title, branch name, issue body,
|
|
326
|
+
commit message) directly into `run:` - the expression is substituted before the shell sees it
|
|
327
|
+
- Third-party actions referenced by tag or branch instead of a commit SHA; tags are mutable
|
|
328
|
+
- `permissions:` not restricted (default may be write-all)
|
|
329
|
+
- Secrets echoed, passed to untrusted steps, or exposed to fork-triggered runs
|
|
330
|
+
- Self-hosted runners on public repositories - fork PRs get code execution on your infrastructure
|
|
331
|
+
- No required review or branch protection on the branch that deploys
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## A03: Provenance, Signing, and SBOM
|
|
336
|
+
|
|
337
|
+
- Generate an SBOM (CycloneDX or SPDX) as a build artifact, not as a one-off report
|
|
338
|
+
- Verify signatures before deploy: `cosign verify`, `npm audit signatures`, sigstore attestations
|
|
339
|
+
- Publish with provenance (`npm publish --provenance`, SLSA attestations) so consumers can verify
|
|
340
|
+
which workflow and commit produced an artifact
|
|
341
|
+
- Pin container images by digest, not tag - a tag can be repointed after your review
|
|
342
|
+
- Keep a rollback path: an artifact whose signature fails verification should block the deploy,
|
|
343
|
+
which only works if failing closed does not leave you unable to ship the previous version
|
|
344
|
+
|
|
345
|
+
Continuous monitoring (Dependabot, Renovate, Snyk, `osv-scanner`, `pip-audit`, `cargo audit`)
|
|
346
|
+
matters more than a point-in-time audit - the dependency was clean on the day you reviewed it.
|