@jetrabbits/agentic 0.0.2 → 0.0.4

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.
Files changed (27) hide show
  1. package/AGENTS.md +6 -0
  2. package/README.md +10 -8
  3. package/areas/devops/ci-cd/prompts/release-pipeline.md +69 -79
  4. package/areas/devops/ci-cd/rules/supply-chain-security.md +39 -19
  5. package/areas/devops/ci-cd/skills/github-actions-patterns/SKILL.md +6 -1
  6. package/areas/devops/ci-cd/skills/pipeline-security/SKILL.md +54 -119
  7. package/areas/devops/ci-cd/workflows/release-pipeline.md +72 -62
  8. package/areas/devops/kubernetes/skills/pod-troubleshooting/SKILL.md +1 -1
  9. package/areas/devops/observability/rules/alerting-standards.md +37 -31
  10. package/areas/devops/observability/rules/golden-signals.md +29 -20
  11. package/areas/devops/observability/skills/distributed-tracing/SKILL.md +10 -1
  12. package/areas/software/backend/rules/security.md +32 -12
  13. package/areas/software/frontend/skills/component-design/SKILL.md +13 -1
  14. package/areas/software/full-stack/rules/security-guide.md +48 -12
  15. package/areas/software/security/prompts/security-scan.md +47 -55
  16. package/areas/software/security/rules/dependency-policy.md +43 -8
  17. package/areas/software/security/skills/dependency-audit/SKILL.md +46 -25
  18. package/areas/software/security/skills/threat-modeling/SKILL.md +26 -0
  19. package/extensions/gemini/GEMINI.md +9 -1
  20. package/extensions/gemini/agents/designer.md +60 -0
  21. package/extensions/gemini/agents/developer.md +62 -0
  22. package/extensions/gemini/agents/devops-engineer.md +68 -0
  23. package/extensions/gemini/agents/pm.md +54 -0
  24. package/extensions/gemini/agents/product-owner.md +75 -0
  25. package/extensions/gemini/agents/qa.md +65 -0
  26. package/extensions/gemini/agents/team-lead.md +66 -0
  27. package/package.json +1 -1
package/AGENTS.md CHANGED
@@ -61,6 +61,12 @@ Cross-cutting practices that apply to every project regardless of area.
61
61
  - Document requirements before implementation — "we'll figure it out" is not a requirement.
62
62
  - Conduct design reviews for any change with architectural, security, or data model impact.
63
63
 
64
+ ### Documentation of Behavior Changes
65
+
66
+ - Any behavior change captured in Markdown artifacts must be documented under the project `docs/` directory.
67
+ - Use documentation paths that match the change type, for example `docs/<feature>/README.md` for feature behavior and `docs/incidents/<date>-<workload>-root-cause.md` for incident root cause reports.
68
+ - Create or update the relevant `docs/` artifact in the same change set; do not leave behavior changes documented only in workflow outputs, tickets, or PR comments.
69
+
64
70
  ### Code Style
65
71
 
66
72
  - Write self-documenting code with meaningful names — comments explain why, not what.
package/README.md CHANGED
@@ -8,6 +8,7 @@ and prompts into any project — and run a full SDLC agent team out of the box.
8
8
  - [Website](https://sawrus.github.io/agent-guides/)
9
9
  - [Coverage scorecard](https://claude.ai/public/artifacts/8177bc3d-3b2f-48a6-8232-47c5b02b20f3)
10
10
  - [CLI usage guide](docs/agentic-usage.md)
11
+ - [NPM package](https://www.npmjs.com/package/@jetrabbits/agentic)
11
12
 
12
13
  ## Coverage snapshot
13
14
 
@@ -83,6 +84,7 @@ agent-guides/
83
84
  │ ├── codex/ # Codex custom agents and override configs
84
85
  │ │ └── agents/ # 7 SDLC agents for .codex/agents/
85
86
  │ └── gemini/ # Gemini-specific configs
87
+ │ │ └── agents/ # 7 SDLC agents for .gemini/agents/
86
88
  ├── areas/template/ # Authoring templates — start here for new content
87
89
  ├── docs/ # Setup and usage guides
88
90
  ├── AGENTS.md # Root agent guidance (loaded into every project)
@@ -133,7 +135,8 @@ guidance bundle.
133
135
 
134
136
  ## SDLC Agent team
135
137
 
136
- The same 7-agent team works across **Claude Code**, **OpenCode**, **Codex**, and any tool that supports agent or subagent files.
138
+ The same 7-agent team works across **Claude Code**, **OpenCode**, **Codex**, and any tool that supports agent or
139
+ subagent files.
137
140
 
138
141
  | Agent | Role | Invoke when |
139
142
  |:------------------|:-----------------------------------------------|:----------------------------------------------|
@@ -148,13 +151,12 @@ The same 7-agent team works across **Claude Code**, **OpenCode**, **Codex**, and
148
151
  Each agent has a `vibe` (one-line personality), `Identity`, `Communication Style`, `Success Metrics`, and explicit
149
152
  `Boundaries` — so roles never overlap and handoffs are always documented.
150
153
 
151
- | Platform | Agent path | Format | Guide |
152
- |:---------|:-----------|:-------|:------|
153
- | Claude Code | `project/.claude/agents/*.md` | Markdown with YAML frontmatter | [Claude Code subagents](https://docs.claude.com/en/api/agent-sdk/subagents) |
154
- | OpenCode | `project/.opencode/agents/*.md` | Markdown with frontmatter | [OpenCode agents](https://opencode.ai/docs/agents/) · [repo setup note](docs/opencode_setup.md) |
155
- | Codex | `project/.codex/agents/*.toml` | TOML custom agents | [Codex subagents](https://developers.openai.com/codex/subagents) |
156
-
157
- Codex installs both `.codex/agents/*.toml` custom agents and `.codex/AGENTS.override.md`.
154
+ | Platform | Agent path | Format | Guide |
155
+ |:------------|:--------------------------------|:-------------------------------|:------------------------------------------------------------------------------------------------|
156
+ | Claude Code | `project/.claude/agents/*.md` | Markdown with YAML frontmatter | [Claude Code subagents](https://docs.claude.com/en/api/agent-sdk/subagents) |
157
+ | OpenCode | `project/.opencode/agents/*.md` | Markdown with frontmatter | [OpenCode agents](https://opencode.ai/docs/agents/) · [repo setup note](docs/opencode_setup.md) |
158
+ | Codex | `project/.codex/agents/*.toml` | TOML custom agents | [Codex subagents](https://developers.openai.com/codex/subagents) |
159
+ | Gemini | `project/.gemini/agents/*.toml` | Markdown with YAML frontmatter | [Gemini subagents](https://geminicli.com/docs/core/subagents) |
158
160
 
159
161
  ---
160
162
 
@@ -4,112 +4,102 @@ workflow: release-pipeline
4
4
 
5
5
  # Prompt: `/release-pipeline`
6
6
 
7
- Use when: designing or running a production release pipeline with versioning, supply-chain controls, and deployment gates.
7
+ Use when: designing or executing a production release pipeline with strong supply-chain guarantees, safe database rollout, and progressive delivery controls.
8
8
 
9
9
  ---
10
10
 
11
- ## Example 1 — Semantic versioning + automated changelog
11
+ ## Example 1 — High-risk release with schema change + feature flags
12
12
 
13
13
  **EN:**
14
14
  ```
15
15
  /release-pipeline
16
16
 
17
- Repo: github.com/myorg/api-service
18
- Release strategy: semantic versioning (semver) via git tags
19
- Changelog: auto-generated from conventional commits (feat/fix/breaking)
20
- Trigger: manual tag push (v1.2.3) → full release pipeline
21
- Pipeline steps:
22
- 1. Validate: all CI gates pass on tagged commit
23
- 2. Build: image with tag=v1.2.3 AND digest; push to ghcr.io
24
- 3. Sign: cosign sign + SBOM attach
25
- 4. Release: GitHub Release with changelog + image digest in description
26
- 5. Deploy staging: Helm upgrade --set image.tag=v1.2.3 --atomic
27
- 6. Smoke test staging: automated; gate before production
28
- 7. Deploy production: manual approval; canary 10% 100%
17
+ Service: payments-api
18
+ Version: v3.8.0
19
+ Risk level: high
20
+ Change type:
21
+ - New payment routing engine behind feature flag `routing_v2`
22
+ - Database migration (expand phase only) adding nullable columns + backfill job
23
+ Requirements:
24
+ 1. Build immutable image digest and sign keylessly with cosign
25
+ 2. Generate SLSA provenance + CycloneDX SBOM
26
+ 3. Verify identity-constrained signature and attestation before deploy
27
+ 4. Staging gate: 15 min soak + critical path integration tests
28
+ 5. Production canary: 5% (10m) -> 25% (15m) -> 50% (15m) -> 100%
29
+ 6. Rollback criteria:
30
+ - 5xx > 1% for 5 min
31
+ - p99 latency > 20% regression for 10 min
32
+ - fast burn-rate alert fires
33
+ 7. Feature flag rollout by cohorts after service-level stability
34
+ Output:
35
+ - Full CI/CD workflow YAML
36
+ - Migration safety checklist
37
+ - Rollback runbook
29
38
  ```
30
39
 
31
40
  **RU:**
32
41
  ```
33
42
  /release-pipeline
34
43
 
35
- Репо: github.com/myorg/api-service
36
- Стратегия релизов: semantic versioning (semver) через git теги
37
- Changelog: авто-генерация из conventional commits (feat/fix/breaking)
38
- Триггер: ручной push тега (v1.2.3) → полный pipeline релиза
39
- Шаги pipeline:
40
- 1. Validate: все CI gates проходят на тегированном коммите
41
- 2. Build: образ с tag=v1.2.3 И digest; push в ghcr.io
42
- 3. Sign: cosign sign + SBOM attach
43
- 4. Release: GitHub Release с changelog + image digest в описании
44
- 5. Deploy staging: Helm upgrade --set image.tag=v1.2.3 --atomic
45
- 6. Smoke test staging: автоматический; gate перед production
46
- 7. Deploy production: ручное подтверждение; canary 10% 100%
44
+ Сервис: payments-api
45
+ Версия: v3.8.0
46
+ Уровень риска: high
47
+ Тип изменений:
48
+ - Новый роутинг платежей под feature flag `routing_v2`
49
+ - Миграция БД (только expand-фаза): новые nullable-колонки + backfill job
50
+ Требования:
51
+ 1. Собрать immutable digest и подписать keyless через cosign
52
+ 2. Сгенерировать SLSA provenance + CycloneDX SBOM
53
+ 3. Выполнить verify подписи/attestation с identity constraints перед деплоем
54
+ 4. Staging gate: 15 минут наблюдения + интеграционные критичные тесты
55
+ 5. Canary в production: 5% (10м) -> 25% (15м) -> 50% (15м) -> 100%
56
+ 6. Критерии отката:
57
+ - 5xx > 1% в течение 5 минут
58
+ - p99 latency хуже baseline на >20% в течение 10 минут
59
+ - сработал fast burn-rate alert
60
+ 7. Раскатка feature flag по когортам после стабилизации сервиса
61
+ Результат:
62
+ - Полный CI/CD workflow YAML
63
+ - Чеклист безопасности миграции
64
+ - Runbook отката
47
65
  ```
48
66
 
49
67
  ---
50
68
 
51
- ## Example 2 — Emergency hotfix release
69
+ ## Example 2 — Compliance-grade supply chain hardening
52
70
 
53
71
  **EN:**
54
72
  ```
55
73
  /release-pipeline
56
74
 
57
- Context: critical bug in v2.1.0 (CVE exploited in production); hotfix needed in < 2 hours
58
- Branch: hotfix/cve-2024-payment from tag v2.1.0 (NOT from main — main has unreleased features)
59
- Version: v2.1.1
60
- Speed optimizations allowed:
61
- - Skip: integration tests (replace with targeted regression test for the fix)
62
- - Skip: changelog automation (write manually)
63
- - Keep: security scan (mandatory), smoke test (mandatory), canary deploy (mandatory)
64
- Rollback plan: v2.1.0 image already in registry Helm rollback in < 2 min if needed
75
+ Context: move existing GitHub Actions pipeline to compliance-grade release controls
76
+ Current state: tests + image build only
77
+ Target:
78
+ - OIDC federation for cloud auth (remove static secrets)
79
+ - Keyless cosign signing of container digest
80
+ - SLSA provenance attestation generation and verification
81
+ - SBOM attach and retention policy >= 1 year
82
+ - Admission policy in production namespace: signed + attested + digest-only images
83
+ Provide:
84
+ - Updated release workflow
85
+ - Example Kyverno/Gatekeeper policies
86
+ - Failure-mode behavior (fail closed)
65
87
  ```
66
88
 
67
89
  **RU:**
68
90
  ```
69
91
  /release-pipeline
70
92
 
71
- Контекст: критический баг в v2.1.0 (CVE эксплуатируется в production); hotfix нужен за < 2 часа
72
- Ветка: hotfix/cve-2024-payment от тега v2.1.0 (НЕ от main — там незарелиженные фичи)
73
- Версия: v2.1.1
74
- Допустимые оптимизации скорости:
75
- - Пропустить: интеграционные тесты (заменить целевым регрессионным тестом для исправления)
76
- - Пропустить: автоматизацию changelog (написать вручную)
77
- - Оставить: security scan (обязательно), smoke test (обязательно), canary deploy (обязательно)
78
- План отката: образ v2.1.0 уже в реестре Helm rollback за < 2 мин при необходимости
79
- ```
80
-
81
- ---
82
-
83
- ## Example 3 — Add full supply chain to existing pipeline
84
-
85
- **EN:**
86
- ```
87
- /release-pipeline
88
-
89
- Service: checkout-service / CI: GitHub Actions
90
- Current state: images built and pushed, no signing, no SBOM
91
- Required:
92
- 1. SBOM: generate CycloneDX SBOM with Syft during build; attach to image with cosign
93
- 2. Signing: sign image with cosign using GitHub OIDC (keyless) after push
94
- 3. Provenance: enable SLSA level 2 via docker/build-push-action (provenance: true)
95
- 4. Verification: add cosign verify step in CD pipeline before every deploy
96
- 5. Policy: Kyverno ClusterPolicy — block unsigned images in production namespace
97
- 6. Dependency pinning: base image must reference @sha256 digest, not tag
98
- Show full updated GitHub Actions workflow + Kyverno policy
99
- ```
100
-
101
- **RU:**
102
- ```
103
- /release-pipeline
104
-
105
- Сервис: checkout-service / CI: GitHub Actions
106
- Текущее состояние: образы собираются и пушатся, без подписи, без SBOM
107
- Требуется:
108
- 1. SBOM: генерация CycloneDX SBOM через Syft при сборке; прикрепление к образу через cosign
109
- 2. Подпись: подпись образа через cosign с GitHub OIDC (keyless) после push
110
- 3. Provenance: SLSA level 2 через docker/build-push-action (provenance: true)
111
- 4. Верификация: добавить шаг cosign verify в CD pipeline перед каждым деплоем
112
- 5. Политика: Kyverno ClusterPolicy — блокировка неподписанных образов в production namespace
113
- 6. Pinning зависимостей: base image должен ссылаться на @sha256 digest, не тег
114
- Показать полный обновлённый workflow GitHub Actions + Kyverno политику
93
+ Контекст: перевести существующий GitHub Actions pipeline на compliance-grade контроль релизов
94
+ Текущее состояние: только тесты + сборка образа
95
+ Цель:
96
+ - OIDC federation для cloud auth (убрать static secrets)
97
+ - Keyless cosign-подпись digest контейнера
98
+ - Генерация и проверка SLSA provenance attestation
99
+ - Прикрепление SBOM и политика хранения >= 1 года
100
+ - Admission policy в production: только signed + attested + digest-only образы
101
+ Нужно выдать:
102
+ - Обновлённый workflow релиза
103
+ - Примеры политик Kyverno/Gatekeeper
104
+ - Поведение при сбоях (fail closed)
115
105
  ```
@@ -1,34 +1,54 @@
1
1
  # Rule: Supply Chain Security
2
2
 
3
- **Priority**: P0 — Unsigned or unverified artifacts are blocked from production.
3
+ **Priority**: P0 — Artifacts without verified identity, provenance, and policy compliance are blocked from production.
4
4
 
5
- ## SBOM (Software Bill of Materials)
5
+ ## Baseline (mandatory)
6
6
 
7
- 1. Every container image build generates an SBOM (Syft / Trivy).
8
- 2. SBOM attached to image in OCI registry (cosign attach sbom).
9
- 3. SBOM stored for minimum 1 year per compliance requirements.
7
+ 1. **Keyless signing by default**: use Sigstore keyless (`cosign` + OIDC/Fulcio/Rekor) for CI-produced artifacts.
8
+ 2. **Immutable references only**: deploy by digest (`@sha256:...`), never mutable tags (`latest`, `stable`).
9
+ 3. **Provenance required**: generate SLSA-compatible provenance attestations for every production build.
10
+ 4. **SBOM required**: generate CycloneDX or SPDX SBOM and attach/store with the exact artifact digest.
11
+ 5. **Admission policy enforcement**: clusters must verify signature + provenance + digest pinning before workload admission.
10
12
 
11
- ## Image Signing (Sigstore/cosign)
13
+ ## Signing and Verification
12
14
 
13
15
  ```bash
14
- # Sign image after build
15
- cosign sign --key env://COSIGN_PRIVATE_KEY \
16
- registry.example.com/my-service@sha256:<digest>
16
+ # Keyless signing (preferred)
17
+ cosign sign --yes registry.example.com/my-service@sha256:<digest>
17
18
 
18
- # Verify before deploy (in CD pipeline)
19
- cosign verify --key env://COSIGN_PUBLIC_KEY \
19
+ # Verification with issuer/identity constraints (required in CD)
20
+ cosign verify \
21
+ --certificate-oidc-issuer https://token.actions.githubusercontent.com \
22
+ --certificate-identity-regexp 'https://github.com/myorg/myrepo/\.github/workflows/.+@refs/tags/v.+' \
20
23
  registry.example.com/my-service@sha256:<digest>
21
24
  ```
22
25
 
23
- 4. Unsigned images are blocked from production namespaces via OPA/Kyverno policy.
26
+ 6. **Key-pair signing is fallback only**: if keyless is unavailable, keys must be in KMS/HSM and rotated at least quarterly.
27
+ 7. **Transparency log evidence**: verification must include Rekor entry checks when supported.
28
+
29
+ ## Provenance and Build Integrity
30
+
31
+ 8. Production builds run only on trusted CI and produce attestations bound to exact commit SHA.
32
+ 9. Build provenance must include: repository, workflow identity, source revision, build parameters, and builder identity.
33
+ 10. Reproducibility target: deterministic builds for critical services; if not feasible, document non-deterministic inputs.
34
+
35
+ ## Dependency and Base Image Controls
36
+
37
+ 11. Pin direct dependencies and commit lockfiles (`package-lock.json`, `poetry.lock`, `go.sum`, etc.).
38
+ 12. Base images pinned by digest in Dockerfile; floating tags are forbidden.
39
+ 13. Package managers must verify checksums/hashes where available.
40
+ 14. External CI actions/plugins must be pinned to immutable commit SHA.
24
41
 
25
- ## Dependency Pinning
42
+ ## Policy Enforcement (Kubernetes / CD)
26
43
 
27
- 5. All `package.json`, `requirements.txt`, `go.sum` must pin exact versions.
28
- 6. `pip install requests` (unpinned) is forbidden in CI — use `requirements.txt` with hashes.
29
- 7. Base images pinned to digest in Dockerfile: `FROM python:3.12-slim@sha256:...`
44
+ 15. Admission controllers (Kyverno/Gatekeeper) must enforce:
45
+ - signed image verification;
46
+ - digest-only image references;
47
+ - required provenance attestation for production namespaces.
48
+ 16. Deploy pipeline fails closed if verification services are unavailable (no silent bypass).
49
+ 17. Exceptions require documented risk acceptance with owner + expiry date (max 14 days).
30
50
 
31
- ## Audit Trail
51
+ ## Audit Trail and Retention
32
52
 
33
- 8. Every build records: git commit, build timestamp, base image digest, all dependency versions.
34
- 9. Provenance attestation (SLSA level 2+) generated for production releases.
53
+ 18. Keep artifact metadata for at least 1 year: commit SHA, SBOM digest, provenance digest, signer identity, scan results.
54
+ 19. Every release record must be traceable from ticket/PR → commit → artifact digest → deployment event.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: github-actions-patterns
3
3
  type: skill
4
- description: Production-grade GitHub Actions workflows — reusable workflows, OIDC auth, caching, matrix builds, environment protection.
4
+ description: "Production-grade GitHub Actions workflows — reusable workflows, OIDC cloud auth, caching, matrix builds, and environment protection rules. Use when the user creates, reviews, or debugs CI/CD pipelines in .github/workflows, or asks about GitHub Actions deployment, OIDC authentication, or workflow optimization."
5
5
  related-rules:
6
6
  - pipeline-standards.md
7
7
  - quality-gates.md
@@ -152,6 +152,11 @@ jobs:
152
152
  --set image.digest=${{ inputs.image-digest }} \
153
153
  --namespace ${{ inputs.environment }} \
154
154
  --atomic --timeout 5m
155
+
156
+ - name: Verify deployment health
157
+ run: |
158
+ kubectl rollout status deployment/my-service -n ${{ inputs.environment }} --timeout=120s
159
+ curl -sf http://my-service.${{ inputs.environment }}.svc.cluster.local/health || exit 1
155
160
  ```
156
161
 
157
162
  ## OIDC Cloud Authentication (no long-lived keys)
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: pipeline-security
3
3
  type: skill
4
- description: Secure CI/CD pipelines OIDC auth, secret scanning, dependency review, SLSA provenance, and runner hardening.
4
+ description: Secure CI/CD pipelines with keyless signing, OIDC federation, provenance attestations, policy enforcement, and hardened runners.
5
5
  related-rules:
6
6
  - supply-chain-security.md
7
7
  - pipeline-standards.md
@@ -10,152 +10,87 @@ allowed-tools: Read, Write, Edit
10
10
 
11
11
  # Skill: Pipeline Security
12
12
 
13
- > **Expertise:** OIDC cloud auth, GitHub Actions security hardening, secret scanning (trufflehog/gitleaks), SLSA provenance, dependency review.
13
+ > **Expertise:** OIDC cloud auth, least-privilege workflow permissions, secret scanning, keyless artifact signing, SLSA provenance, and admission policy checks.
14
14
 
15
15
  ## When to load
16
16
 
17
- When setting up secure CI credentials, adding secret scanning, implementing SLSA provenance, or hardening runner permissions.
17
+ When designing or hardening CI/CD pipelines for production deployments, especially where compliance or high-risk workloads are involved.
18
18
 
19
- ## OIDC Authentication (no long-lived secrets)
19
+ ## Security Outcomes (definition of done)
20
+
21
+ - Pipeline uses **OIDC federation** (no long-lived cloud keys in CI secrets).
22
+ - Artifacts are **signed keylessly** and verified with identity constraints.
23
+ - **Provenance + SBOM** are generated and validated before deploy.
24
+ - Workflows use **minimal GitHub/GitLab permissions**.
25
+ - Runtime admission policies block unsigned/unattested artifacts.
26
+
27
+ ## OIDC Authentication (no long-lived credentials)
20
28
 
21
29
  ```yaml
22
- # GitHub Actions → AWS (no AWS_ACCESS_KEY_ID needed)
23
30
  jobs:
24
31
  deploy:
25
32
  permissions:
26
- id-token: write # required for OIDC
33
+ id-token: write
27
34
  contents: read
28
35
  steps:
29
- - uses: aws-actions/configure-aws-credentials@v4
36
+ - uses: aws-actions/configure-aws-credentials@<pinned-sha>
30
37
  with:
31
38
  role-to-assume: arn:aws:iam::123456789012:role/github-actions-deploy
32
- aws-region: eu-west-1
33
- role-session-name: github-${{ github.run_id }}
34
-
35
- # AWS IAM trust policy (configure once)
36
- # {
37
- # "Principal": {"Federated": "arn:aws:iam::123456789012:oidc-provider/token.actions.githubusercontent.com"},
38
- # "Condition": {
39
- # "StringEquals": {"token.actions.githubusercontent.com:sub": "repo:myorg/myrepo:ref:refs/heads/main"}
40
- # }
41
- # }
39
+ aws-region: us-east-1
42
40
  ```
43
41
 
44
- ```yaml
45
- # GitHub Actions GCP
46
- - uses: google-github-actions/auth@v2
47
- with:
48
- workload_identity_provider: projects/123456789/locations/global/workloadIdentityPools/github/providers/github
49
- service_account: github-actions@my-project.iam.gserviceaccount.com
50
-
51
- # GitHub Actions → K8s (via kubeconfig secret — use when OIDC not available)
52
- - name: Set up kubeconfig
53
- run: |
54
- echo "${{ secrets.KUBECONFIG_B64 }}" | base64 -d > /tmp/kubeconfig
55
- chmod 600 /tmp/kubeconfig
56
- env:
57
- KUBECONFIG: /tmp/kubeconfig
58
- ```
42
+ - Constrain trust policy by repo, ref, and workflow identity.
43
+ - Prefer short session duration and environment-scoped roles.
59
44
 
60
- ## Minimal Permissions (principle of least privilege)
45
+ ## Minimal Permissions Model
61
46
 
62
47
  ```yaml
63
- # Always declare permissions explicitly; defaults are too broad
64
- jobs:
65
- build:
66
- permissions:
67
- contents: read # checkout only
68
- packages: write # push to ghcr.io
69
- id-token: write # OIDC for cloud/registry auth
70
- security-events: write # upload SARIF to Security tab
71
-
72
- deploy:
73
- permissions:
74
- contents: read
75
- id-token: write # OIDC for cloud auth
76
- # NOT: actions:write, administration:write, etc.
48
+ permissions:
49
+ contents: read
50
+ id-token: write
51
+ packages: write
77
52
  ```
78
53
 
79
- ## Secret Scanning
54
+ - Deny by default; explicitly request only required scopes.
55
+ - Split build and deploy into separate jobs with separate permissions.
80
56
 
81
- ```yaml
82
- # trufflehog — detect secrets in git history and current diff
83
- - name: Scan for secrets (trufflehog)
84
- uses: trufflesecurity/trufflehog@main
85
- with:
86
- path: ./
87
- base: ${{ github.event.repository.default_branch }}
88
- head: HEAD
89
- extra_args: --only-verified # reduce noise — only verified secrets
90
-
91
- # gitleaks — alternative (faster, configurable)
92
- - name: Scan for secrets (gitleaks)
93
- uses: gitleaks/gitleaks-action@v2
94
- env:
95
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57
+ ## Keyless Signing + Verification
58
+
59
+ ```bash
60
+ # Sign immutable artifact digest
61
+ cosign sign --yes registry.example.com/team/service@sha256:<digest>
62
+
63
+ # Verify identity and issuer in deploy gate
64
+ cosign verify \
65
+ --certificate-oidc-issuer https://token.actions.githubusercontent.com \
66
+ --certificate-identity-regexp 'https://github.com/myorg/myrepo/\.github/workflows/.+@refs/tags/v.+' \
67
+ registry.example.com/team/service@sha256:<digest>
96
68
  ```
97
69
 
98
- ## Dependency Review (GitHub)
70
+ ## Provenance + SBOM Requirements
99
71
 
100
- ```yaml
101
- # Block PRs that introduce vulnerable dependencies
102
- - name: Dependency Review
103
- uses: actions/dependency-review-action@v4
104
- with:
105
- fail-on-severity: high # block on High and Critical
106
- allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC
107
- deny-licenses: GPL-3.0, AGPL-3.0 # copyleft licenses blocked
108
- ```
72
+ - Generate SLSA provenance attestation for each release artifact.
73
+ - Generate CycloneDX/SPDX SBOM for exact artifact digest.
74
+ - Store attestation/SBOM references in release metadata.
75
+ - Block deploy if attestation/SBOM is missing or invalid.
109
76
 
110
- ## SLSA Provenance (Supply chain Level 2)
77
+ ## Secret and Dependency Controls
111
78
 
112
- ```yaml
113
- # Generate SLSA L2 provenance attestation with sigstore
114
- - name: Generate SLSA provenance
115
- uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2
116
- with:
117
- image: registry.example.com/myorg/order-service
118
- digest: ${{ steps.build.outputs.digest }}
119
- registry-username: ${{ github.actor }}
120
- registry-password: ${{ secrets.GITHUB_TOKEN }}
121
- ```
79
+ - Run secret scanning (trufflehog/gitleaks) on PR and main.
80
+ - Run dependency review with severity threshold and license policy.
81
+ - Fail pipeline on critical policy violations; do not “warn-only” for production paths.
122
82
 
123
83
  ## Runner Hardening
124
84
 
125
- ```yaml
126
- # Pin action versions to SHA (not tag — tags are mutable)
127
- # Safe
128
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
129
- # ❌ Unsafe (tag can be moved by attacker)
130
- - uses: actions/checkout@v4
131
-
132
- # Restrict third-party actions to verified/trusted
133
- # In GitHub org settings: only allow selected actions + GitHub Actions
134
- ```
135
-
136
- ```bash
137
- # Self-hosted runner hardening
138
- # - Run as non-root dedicated user (no sudo)
139
- # - Ephemeral runners (fresh VM per job) — preferred
140
- # - Network: egress to required registries only; no inbound
141
- # - No persistent credentials on runner filesystem
142
- # - Use actions/runner-container-hooks for K8s ephemeral runners
143
- ```
85
+ - Ephemeral runners preferred (one job per VM/pod).
86
+ - No privileged mode unless explicitly justified.
87
+ - Restrict network egress to required registries/APIs.
88
+ - Never persist cloud credentials or kubeconfig on runner disk.
144
89
 
145
- ## Audit: What Your Pipeline Can Access
90
+ ## Policy-as-Code Integration
146
91
 
147
- ```bash
148
- # Check what secrets are available to a workflow
149
- # In GitHub: Settings → Secrets → Actions
150
- # Rule: each secret should only be available to the environment that needs it
151
-
152
- # Prevent secret leakage in logs
153
- - name: No secret echo
154
- run: |
155
- # ❌ BAD: leaks secret to logs
156
- echo "DB_PASS=$DB_PASS"
157
- env # dumps all env vars including secrets
158
-
159
- # ✅ Use secret only where needed; never echo
160
- helm upgrade ... --set db.password="$DB_PASS" > /dev/null
161
- ```
92
+ - Enforce cluster admission checks for:
93
+ - signed image;
94
+ - digest-only reference;
95
+ - valid provenance for production namespaces.
96
+ - Keep exception path explicit: owner + expiry + compensating controls.