deepmodebot 0.0.0-stage → 0.9.1
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/.claude-plugin/marketplace.json +26 -0
- package/.omp-plugin/marketplace.json +26 -0
- package/LICENSE +24 -0
- package/README.md +377 -2
- package/bin/deepmodebot.mjs +247 -0
- package/lib/autoupdate.mjs +47 -0
- package/lib/clients.mjs +139 -0
- package/lib/run.mjs +32 -0
- package/lib/state.mjs +52 -0
- package/lib/tree.mjs +48 -0
- package/lib/version.mjs +26 -0
- package/package.json +44 -4
- package/plugins/deepmodebot/.antigravity-plugin/plugin.json +35 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/deep/SKILL.md +13 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/land-pr/SKILL.md +23 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/pr-thread/SKILL.md +17 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/review-pr/SKILL.md +16 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/tournament/SKILL.md +14 -0
- package/plugins/deepmodebot/.claude-plugin/plugin.json +27 -0
- package/plugins/deepmodebot/agents/reviewer/agent.md +33 -0
- package/plugins/deepmodebot/agents/scout/agent.md +34 -0
- package/plugins/deepmodebot/agents/security-reviewer/agent.md +30 -0
- package/plugins/deepmodebot/assets/logo.svg +8 -0
- package/plugins/deepmodebot/commands/contribute.md +8 -0
- package/plugins/deepmodebot/commands/deep.md +11 -0
- package/plugins/deepmodebot/commands/land-pr.md +12 -0
- package/plugins/deepmodebot/commands/pr-thread.md +14 -0
- package/plugins/deepmodebot/commands/project-brief.md +8 -0
- package/plugins/deepmodebot/commands/review-pr.md +10 -0
- package/plugins/deepmodebot/commands/tournament.md +12 -0
- package/plugins/deepmodebot/hooks/hooks.json +26 -0
- package/plugins/deepmodebot/hooks.json +24 -0
- package/plugins/deepmodebot/mcp_config.json +11 -0
- package/plugins/deepmodebot/scripts/antigravity-guard.mjs +413 -0
- package/plugins/deepmodebot/scripts/omp-mcp-server.mjs +1091 -0
- package/plugins/deepmodebot/skills/agent-harnesses/SKILL.md +57 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/bun.lock +391 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/check.ts +53 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/check_antigravity.py +38 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/check_claude.mjs +11 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/package.json +11 -0
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/requirements.txt +1 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/ai-native-tooling.md +190 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/ai-sdk-selection.md +50 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/antigravity.md +108 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/claude-code.md +166 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/codex.md +151 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/delegation-efficiency.md +230 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/langchain-ecosystem.md +124 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/omp.md +183 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/protocols.md +172 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/sdks.md +228 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/self-authoring.md +171 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/SKILL.md +24 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/aws.md +264 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/azure.md +261 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/containers.md +96 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/devops-tools.md +297 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/devsecops-pipeline.md +258 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/gcp.md +258 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/kubernetes.md +74 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/local-emulators.md +265 -0
- package/plugins/deepmodebot/skills/contribute/SKILL.md +134 -0
- package/plugins/deepmodebot/skills/create-verification-skill/LICENSE +21 -0
- package/plugins/deepmodebot/skills/create-verification-skill/SKILL.md +101 -0
- package/plugins/deepmodebot/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/plugins/deepmodebot/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/plugins/deepmodebot/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/plugins/deepmodebot/skills/deep-stack/SKILL.md +53 -0
- package/plugins/deepmodebot/skills/deep-stack/references/AGENTS.template.md +52 -0
- package/plugins/deepmodebot/skills/deep-stack/references/agentic-workflow.md +114 -0
- package/plugins/deepmodebot/skills/deep-stack/references/any-app-stack.md +51 -0
- package/plugins/deepmodebot/skills/deep-stack/references/design-workflow.md +101 -0
- package/plugins/deepmodebot/skills/deep-stack/references/isolate.md +23 -0
- package/plugins/deepmodebot/skills/deep-stack/references/philosophy.md +306 -0
- package/plugins/deepmodebot/skills/deep-stack/references/prove.md +31 -0
- package/plugins/deepmodebot/skills/deep-stack/references/stack.md +119 -0
- package/plugins/deepmodebot/skills/deep-stack/references/structure.md +22 -0
- package/plugins/deepmodebot/skills/deep-stack/references/unslop/LICENSE +21 -0
- package/plugins/deepmodebot/skills/deep-stack/references/unslop/unslop.md +80 -0
- package/plugins/deepmodebot/skills/deepmodebot/LICENSE +23 -0
- package/plugins/deepmodebot/skills/deepmodebot/SKILL.md +198 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/agents-md/agents_md.py +207 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/agents-md/test_agents_md.py +146 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/architecture-review/report-template.html +92 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude-guard.sh +42 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude_guard.py +135 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/omp-contain-link.ts +12 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/omp-contain.ts +115 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_antigravity_guard.py +483 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_audit_regressions.py +139 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_contain.py +301 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_omp_mcp.py +602 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/design.py +242 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/evidence.py +293 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/record.py +387 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/review.py +339 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_design.py +69 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_evidence.py +160 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_record.py +180 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_review.py +265 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard-patterns.txt +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.sh +132 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.ts +122 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/test_git_guard.py +192 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/bot.py +3037 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/brand.json +11 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/brand.py +51 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/ghapp.py +361 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/install.py +274 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/local_updates.py +576 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/review_context.py +204 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_bot.py +2182 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_brand.py +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_local_updates.py +691 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_review_context.py +127 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_workspace_cleanup.py +496 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/workspace_cleanup.py +351 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/loop.py +2394 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/plan.py +583 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_loop.py +1426 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_plan.py +320 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_windows_job.py +326 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/windows_job.py +244 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/bench_harness.py +165 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/perf_audit.py +240 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/test_bench_harness.py +55 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/test_perf_audit.py +53 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/diff_coverage.py +350 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/pr_agent_local.py +370 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/test_diff_coverage.py +94 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/arena.html +425 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/arena.py +579 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/arena_tui.py +839 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/font8x8_basic.hex +1 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/show_thread.py +329 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/test_arena.py +610 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/repo-references.json +637 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/test_yt_enrich.py +250 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_enrich.py +1820 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_meta.py +156 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_transcript_relay.js +54 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/security-audit/audit-pr.sh +122 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/security-audit/gate.cjs +155 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/security-audit/prompt.md +13 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/tournament/test_tournament.py +654 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/tournament/tournament.py +1285 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/wizard/wizard.sh +234 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/workspace-map/test_workspace_map.py +879 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/workspace-map/workspace_map.py +2436 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/README.md +61 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/catalog.md +105 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/contain.md +39 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/factory-landscape.md +147 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/flows.md +50 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/authoring-a-skill.md +37 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/babysit.md +77 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/bug-fix.md +34 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/end-to-end.md +50 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/eval.md +39 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/feature.md +60 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/handoff.md +52 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/hillclimb.md +46 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/investigation.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/opening-a-pr.md +97 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/pause-safely.md +30 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/perf-issue.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/phased-build.md +146 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/prototype.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/refactoring.md +60 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/reference-rebuild.md +45 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/run-a-goal.md +143 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/runtime-forensics.md +22 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/self-authoring.md +130 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/session-pickup.md +33 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/setup.md +105 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/shipping.md +52 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/spec.md +67 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/tickets.md +56 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/trace-forensics.md +24 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/triage.md +102 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/visual-parity.md +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/wayfinder.md +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/work-a-queue.md +189 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/worktree-cleanup.md +35 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/attack-the-premise.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/boundary-discipline.md +8 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/build-the-lever.md +8 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/encode-lessons-in-structure.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/exhaust-the-design-space.md +4 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/experience-first.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/explain-the-number.md +9 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/fix-root-causes.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/foundational-thinking.md +9 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/guard-the-context-window.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/laziness-protocol.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/make-operations-idempotent.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/migrate-callers-then-delete-legacy-apis.md +5 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/minimize-reader-load.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/model-the-domain.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/never-block-on-the-human.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/outcome-oriented-execution.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/prove-it-works.md +8 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/redesign-from-first-principles.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/separate-before-serializing-shared-state.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/sequence-verifiable-units.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/subtract-before-you-add.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/test-behavior-not-implementation.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/type-system-discipline.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/rust-migration-case-studies.md +26 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/startup-ideas.md +21 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/agent-collaboration.md +82 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/architect.md +32 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/architecture-review.md +43 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/arena.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/benchmark-checklist.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/blast-radius.md +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/correct.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/course.md +47 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/coworkers.md +70 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/domain-model.md +69 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/figure-it-out.md +25 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/git-guardrails.md +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/github-app.md +160 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/goal-review.md +156 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/grill.md +27 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/how.md +23 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/in-your-own-words.md +12 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/inner-loop.md +39 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/interrogate.md +16 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/issue-conversation.md +52 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/no-comments.md +29 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/open-design-evidence.md +65 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/panel.md +34 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pr-agent.md +39 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pr-conversation.md +135 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pr-review.md +138 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pre-commit.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/prior-art.md +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/questionnaire.md +46 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/re-explain.md +23 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/recall.md +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/reflect.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/research.md +99 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/retro.md +30 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/scrape.md +32 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/security-audit.md +40 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sharpen.md +15 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/show-me-your-work.md +19 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sme-review.md +49 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/swarm.md +14 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tdd.md +55 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/teach.md +20 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/technical-writing.md +22 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tool-routing.md +85 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tournament.md +44 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tracker.md +78 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/unslop.md +15 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/visual-e2e.md +78 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/why.md +31 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/wizard.md +25 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/workspace-map.md +35 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/writing-for-agents.md +66 -0
- package/plugins/deepmodebot/skills/deepmodebot/scripts/check_skill.py +93 -0
- package/plugins/deepmodebot/skills/deepmodebot/scripts/trending.py +598 -0
- package/plugins/deepmodebot/skills/domain-rules/SKILL.md +131 -0
- package/plugins/deepmodebot/skills/domain-rules/references/agent-engineering.md +105 -0
- package/plugins/deepmodebot/skills/domain-rules/references/ai-concepts.md +103 -0
- package/plugins/deepmodebot/skills/domain-rules/references/aws-networking.md +121 -0
- package/plugins/deepmodebot/skills/domain-rules/references/backend-system-design.md +162 -0
- package/plugins/deepmodebot/skills/domain-rules/references/data-structures-and-cache-optimization.md +48 -0
- package/plugins/deepmodebot/skills/domain-rules/references/devops-and-fundamentals.md +137 -0
- package/plugins/deepmodebot/skills/domain-rules/references/engineering-practice.md +100 -0
- package/plugins/deepmodebot/skills/domain-rules/references/high-scale-server-optimization.md +181 -0
- package/plugins/deepmodebot/skills/domain-rules/references/language-ecosystems.md +56 -0
- package/plugins/deepmodebot/skills/frontend-ui/SKILL.md +146 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/live-demos.md +38 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/mobbin-shipped-apps.md +28 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/motion-clips.md +269 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/motion-graphics.md +62 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/pinterest-animations.md +217 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/pinterest-patterns.md +101 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/01-workflow.md +25 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/02-review-rubric.md +21 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/03-ai-tells.md +46 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/04-components.md +21 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/04a-agent-ui.md +153 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/05-motion.md +106 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/05a-motion-graphics.md +121 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/06-typography-layout.md +48 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/06a-color.md +26 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/07-copy.md +11 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/08-quality-floor.md +63 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/09-steering-agents.md +13 -0
- package/plugins/deepmodebot/skills/maintain-verification-skill/LICENSE +21 -0
- package/plugins/deepmodebot/skills/maintain-verification-skill/SKILL.md +47 -0
- package/plugins/deepmodebot/skills/project-brief/SKILL.md +100 -0
- package/plugins/deepmodebot/skills/project-brief/assets/CONTRIBUTING.template.md +124 -0
- package/plugins/deepmodebot/skills/project-brief/assets/ISSUE_TEMPLATE/task.yml +61 -0
- package/plugins/deepmodebot/skills/project-brief/assets/PROJECT_BRIEF.template.md +98 -0
- package/plugins/deepmodebot/skills/project-brief/assets/PULL_REQUEST_TEMPLATE.md +35 -0
- package/plugins/deepmodebot/skills/project-brief/assets/pr-overlap.py +643 -0
- package/plugins/deepmodebot/skills/project-brief/assets/sync-roadmap.py +314 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/SKILL.md +60 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/references/agent-authentication.md +198 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/references/leak-prevention.md +206 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/references/logins-and-passwords.md +165 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/references/secrets-and-env.md +182 -0
- package/plugins/deepmodebot/skills/software-architecture/SKILL.md +47 -0
- package/plugins/deepmodebot/skills/software-architecture/references/backend-infrastructure.md +273 -0
- package/plugins/deepmodebot/skills/software-architecture/references/databases.md +277 -0
- package/plugins/deepmodebot/skills/software-architecture/references/monorepos.md +210 -0
- package/plugins/deepmodebot/skills/software-architecture/references/ontology.md +287 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# AWS security and DevSecOps
|
|
2
|
+
|
|
3
|
+
Read when designing, reviewing, debugging, or securing AWS accounts, organizations, IAM, detection, encryption, network controls, CI/CD into AWS, or IaC for AWS. Facts and prices are as of 2026-11-11 (us-east-1 list prices; treat as order of magnitude). Pipeline-generic rules live in `devsecops-pipeline.md`.
|
|
4
|
+
|
|
5
|
+
Full report: https://github.com/TimothyVang/cloud-devsecops/blob/main/research/aws-devsecops.md
|
|
6
|
+
|
|
7
|
+
## Organization structure
|
|
8
|
+
|
|
9
|
+
Use the [AWS SRA layout](https://docs.aws.amazon.com/prescriptive-guidance/latest/security-reference-architecture/architecture.html):
|
|
10
|
+
|
|
11
|
+
| OU / account | Holds | Notes |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Management | Organizations, billing, Identity Center, Control Tower | No workloads; SCPs don't apply |
|
|
14
|
+
| Security → Security Tooling | Delegated admin for GuardDuty, Security Hub, Inspector, Macie, Detective, Access Analyzer, Config aggregator | Restrict logins |
|
|
15
|
+
| Security → Log Archive | Org CloudTrail bucket, Config delivery, flow logs | Object Lock, deny deletes `[inference]` |
|
|
16
|
+
| Infrastructure → Network | TGW/Cloud WAN, central egress, Network Firewall, DNS Firewall | |
|
|
17
|
+
| Infrastructure → Shared Services | Directory, CI tooling, shared AMIs | |
|
|
18
|
+
| Workloads | One account per app per env | Account = blast-radius boundary `[inference]` |
|
|
19
|
+
|
|
20
|
+
- SRA example code (v3.1.0, Feb 2024) may be stale.
|
|
21
|
+
- [Control Tower](https://docs.aws.amazon.com/controltower/latest/userguide/how-control-tower-works.html) controls are preventive (SCP/RCP/declarative), detective (Config rules), or proactive (CFN hooks before deploy). They apply per OU; the management account is exempt but logged.
|
|
22
|
+
- Landing zone 4.0 no longer requires a Security OU. Never hand-edit Control Tower-created resources: controls can end up in an unknown state.
|
|
23
|
+
- Root: centralize [root access](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#id_root-user-access-management) and delete member-account root passwords, keys and MFA; new members get no root credentials. Root-only tasks run as "privileged tasks".
|
|
24
|
+
- Administer security services from Security Tooling, not management. Unified Security Hub is enabled via Organizations policies, not CSPM central configuration ([FAQ](https://aws.amazon.com/security-hub/faqs/)).
|
|
25
|
+
|
|
26
|
+
## Organization policies
|
|
27
|
+
|
|
28
|
+
| | SCP | RCP | Declarative |
|
|
29
|
+
|---|---|---|---|
|
|
30
|
+
| Limits | Principals in member accounts | Resources in member accounts (any caller, incl. external and root) | Service configuration |
|
|
31
|
+
| Grants? | Never | Never | n/a |
|
|
32
|
+
| Affects service-linked roles | No | No | **Yes** |
|
|
33
|
+
| Affects management account | No | No | `[unverified]` |
|
|
34
|
+
| Max size / per target | 10,240 chars / 10 | 5,120 chars / 5 (`RCPFullAWSAccess` counts) | 10,000 chars / 10 |
|
|
35
|
+
|
|
36
|
+
Sources: [limits](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html), [RCPs](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html), [declarative](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_declarative.html).
|
|
37
|
+
|
|
38
|
+
- RCPs need all features enabled and apply only to services on the supported list (S3, STS, KMS, SQS, Secrets Manager, DynamoDB, ECR, Cognito, CloudWatch Logs, more). Test on a sandbox OU before root `[inference]`.
|
|
39
|
+
- Declarative policies enforce config (IMDS defaults, allowed AMIs) and roll back when detached.
|
|
40
|
+
- Org-level S3 Block Public Access uses the Organizations **S3 policy** and overrides account settings.
|
|
41
|
+
- Region-deny SCPs must exempt global services (IAM, Organizations, Route 53, CloudFront, STS, support, billing) via `NotAction` + `aws:RequestedRegion`. Copy the maintained example from [service-control-policy-examples](https://github.com/aws-samples/service-control-policy-examples) `[inference]`.
|
|
42
|
+
|
|
43
|
+
Starter SCP (illustrative action list `[inference]`):
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{ "Version": "2012-10-17", "Statement": [
|
|
47
|
+
{ "Sid": "DenyLeaveOrg", "Effect": "Deny", "Action": "organizations:LeaveOrganization", "Resource": "*" },
|
|
48
|
+
{ "Sid": "ProtectSecurityServices", "Effect": "Deny", "Resource": "*",
|
|
49
|
+
"Action": ["cloudtrail:StopLogging","cloudtrail:DeleteTrail","cloudtrail:UpdateTrail","cloudtrail:PutEventSelectors","guardduty:DeleteDetector","guardduty:DisassociateFromAdministratorAccount","guardduty:UpdateDetector","config:StopConfigurationRecorder","config:DeleteConfigurationRecorder","config:DeleteDeliveryChannel","securityhub:DisableSecurityHub","access-analyzer:DeleteAnalyzer","ec2:DisableEbsEncryptionByDefault","s3:PutAccountPublicAccessBlock"],
|
|
50
|
+
"Condition": { "ArnNotLike": { "aws:PrincipalArn": "arn:aws:iam::*:role/SecurityBreakGlass" } } },
|
|
51
|
+
{ "Sid": "DenyRootInMembers", "Effect": "Deny", "Action": "*", "Resource": "*", "Condition": { "StringLike": { "aws:PrincipalArn": "arn:aws:iam::*:root" } } } ] }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Starter RCP (org identity perimeter + TLS-only, pattern from [data-perimeter-policy-examples](https://github.com/aws-samples/data-perimeter-policy-examples)):
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{ "Version": "2012-10-17", "Statement": [
|
|
58
|
+
{ "Sid": "EnforceOrgIdentities", "Effect": "Deny", "Principal": "*", "Action": ["s3:*","sqs:*","kms:*","secretsmanager:*","sts:AssumeRole"], "Resource": "*",
|
|
59
|
+
"Condition": { "StringNotEqualsIfExists": { "aws:PrincipalOrgID": "o-exampleorgid" }, "BoolIfExists": { "aws:PrincipalIsAWSService": "false" } } },
|
|
60
|
+
{ "Sid": "EnforceTLS", "Effect": "Deny", "Principal": "*", "Action": ["s3:*","sqs:*","kms:*","secretsmanager:*","sts:*"], "Resource": "*",
|
|
61
|
+
"Condition": { "BoolIfExists": { "aws:SecureTransport": "false" } } } ] }
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Identity perimeters break legit third-party access (vendor SaaS roles, CloudFront OAC). Add exceptions via `aws:PrincipalAccount` allow-lists or `aws:SourceArn`/`aws:SourceAccount` for service principals `[inference]`.
|
|
65
|
+
|
|
66
|
+
## IAM
|
|
67
|
+
|
|
68
|
+
- Order of [best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html): federate humans; roles for workloads (off-AWS: IAM Roles Anywhere, ECS Anywhere, EKS Hybrid Nodes, SSM hybrid); MFA; rotate only unavoidable keys; protect root; least privilege; generate policies from activity; remove unused access; use conditions; verify public/cross-account access; validate policies; SCP/RCP guardrails; permissions boundaries to delegate.
|
|
69
|
+
- Identity Center sessions default to 1 h, configurable 1–12 h. Small permission sets assigned to SCIM-synced **groups**, never individuals `[inference]`.
|
|
70
|
+
- **Permissions boundary** caps what identity policies can grant. Pattern: allow `iam:CreateRole` only when `iam:PermissionsBoundary` equals your boundary ARN; deny altering the boundary `[inference]`.
|
|
71
|
+
- **Session policies** narrow an assumed session and never grant; useful to limit a CI job to one stack `[inference]`.
|
|
72
|
+
- An explicit Deny anywhere wins; SCPs/RCPs only filter.
|
|
73
|
+
- [Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html): external analyzer (re-analysis ~30 min, up to 24 h for RCP changes), internal analyzer, unused-access analyzer (paid), free validation, paid custom checks (`check-no-new-access`, `check-access-not-granted`, `check-no-public-access`), policy generation from CloudTrail.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
aws accessanalyzer validate-policy --policy-type IDENTITY_POLICY --policy-document file://p.json
|
|
77
|
+
aws accessanalyzer check-no-public-access --resource-type AWS::S3::Bucket --policy-document file://bucket.json
|
|
78
|
+
aws accessanalyzer check-access-not-granted --policy-type IDENTITY_POLICY \
|
|
79
|
+
--policy-document file://p.json --access '[{"actions":["iam:PassRole","s3:DeleteBucket"]}]'
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For CFN templates, [`cfn-policy-validator`](https://github.com/awslabs/aws-cloudformation-iam-policy-validator) runs these checks on embedded policies.
|
|
83
|
+
|
|
84
|
+
### Condition keys
|
|
85
|
+
|
|
86
|
+
| Key | Use |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `aws:PrincipalOrgID`, `aws:PrincipalOrgPaths` | Identity perimeter |
|
|
89
|
+
| `aws:ResourceOrgID` | Resource perimeter (identity policy or SCP) |
|
|
90
|
+
| `aws:SourceVpc`, `aws:SourceVpce` | Network perimeter |
|
|
91
|
+
| `aws:SourceArn`, `aws:SourceAccount`, `aws:SourceOrgID`, `aws:SourceOrgPaths` | [Confused deputy](https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html) protection for service principals |
|
|
92
|
+
| `aws:PrincipalIsAWSService`, `aws:ViaAWSService`, `aws:CalledVia` | Exempt AWS-service calls from perimeter denies |
|
|
93
|
+
| `aws:SecureTransport` / `aws:RequestedRegion` / `aws:MultiFactorAuthPresent` | TLS-only / region limits / MFA gating |
|
|
94
|
+
| `aws:PrincipalTag/*`, `aws:ResourceTag/*`, `aws:RequestTag/*`, `aws:TagKeys` | ABAC |
|
|
95
|
+
| `iam:PassedToService`, `iam:PermissionsBoundary` | Lock down `PassRole` and role creation |
|
|
96
|
+
| `kms:ViaService`, `kms:CallerAccount`, `kms:EncryptionContext:*`, `kms:RotationPeriodInDays` | Constrain key use and rotation |
|
|
97
|
+
|
|
98
|
+
## Detection stack
|
|
99
|
+
|
|
100
|
+
| Service | Key facts |
|
|
101
|
+
|---|---|
|
|
102
|
+
| CloudTrail | Without a trail only 90 days of mgmt history. One multi-Region org trail, log file validation, KMS, bucket in Log Archive ([BP](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/best-practices-security.html)) |
|
|
103
|
+
| GuardDuty | Foundational sources need no setup; Extended Threat Detection (attack sequences, always Critical) free; all plans except Runtime Monitoring auto-on with 30-day trial ([docs](https://docs.aws.amazon.com/guardduty/latest/ug/what-is-guardduty.html)) |
|
|
104
|
+
| Security Hub (unified) | Exposure findings, attack paths, OCSF; enabling it auto-enables CSPM; no third-party partner findings (those stay in CSPM) |
|
|
105
|
+
| Security Hub CSPM | Control checks (FSBP, CIS, NIST, PCI…); requires Config recording; 100% score ≠ passing audit |
|
|
106
|
+
| Config | History + rules; conformance packs bundle rules and remediation |
|
|
107
|
+
| Inspector | CVEs for EC2/ECR/Lambda, Code Security (SAST/SCA/IaC), continuous rescans |
|
|
108
|
+
| Macie / Detective | Sensitive S3 data / investigation graph over GuardDuty findings |
|
|
109
|
+
|
|
110
|
+
- Org trails are created in members even if validation fails (bad bucket/SNS/KMS policy): check `get-trail-status`. Accounts removed from the org drop out of the trail.
|
|
111
|
+
- Run both Security Hub and CSPM; keep CSPM for partner integrations.
|
|
112
|
+
- Minimum EventBridge alerts `[inference]`: GuardDuty ≥ High and every attack sequence; Critical exposure findings; root sign-in; `StopLogging`/`DeleteTrail`; new public/external Access Analyzer finding; `ConsoleLogin` without MFA; KMS `ScheduleKeyDeletion`/`DisableKey`; `PutBucketPolicy`/`DeletePublicAccessBlock`.
|
|
113
|
+
|
|
114
|
+
## Data protection
|
|
115
|
+
|
|
116
|
+
- **KMS:** CMKs $1/month, rotation default 365 days, rotation doesn't re-encrypt data; asymmetric/HMAC/custom-store keys rotate manually ([rotation](https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html)). The key policy is the root of trust; keep the `arn:aws:iam::<acct>:root` statement ([default policy](https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html)) or the key can become unmanageable `[inference]`. Use CMKs only for cross-account sharing, separation of duties, `kms:ViaService` scoping, or crypto-shredding `[inference]`.
|
|
117
|
+
- **S3:** SSE-S3 default since 2023-01-05 (old objects not re-encrypted). **SSE-C disabled on new buckets since April 2026**; re-enable with `PutBucketEncryption` ([FAQ](https://docs.aws.amazon.com/AmazonS3/latest/userguide/default-s3-c-encryption-setting-faq.html)). ACLs disabled by default. Turning BPA off re-exposes existing public policies/ACLs; access-point BPA is immutable.
|
|
118
|
+
- S3 extras `[inference]`: `aws:SecureTransport` deny, SSE-KMS with Bucket Keys, Object Lock compliance mode for logs, CloudFront OAC instead of public buckets.
|
|
119
|
+
- **EBS encryption by default** is per Region and doesn't touch existing volumes ([EBS](https://docs.aws.amazon.com/ebs/latest/userguide/encryption-by-default.html)). RDS encryption is chosen at creation `[unverified here]`.
|
|
120
|
+
- **Secrets:** Secrets Manager ($0.40/secret/month, built-in rotation) for anything that rotates; Parameter Store (Standard free) for config. Never put secrets in Lambda env vars, CFN params without `NoEcho`, CodeBuild plaintext env, or unprotected Terraform state `[inference]`.
|
|
121
|
+
|
|
122
|
+
## Network
|
|
123
|
+
|
|
124
|
+
- Security groups: stateful, reference SGs not CIDRs, no `0.0.0.0/0` on admin ports, Session Manager over SSH `[inference]`. NACLs: stateless, mind ephemeral ports.
|
|
125
|
+
- [Endpoint policies](https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-access.html) narrow but never override identity/resource policies; gateway endpoints (S3/DynamoDB) are free.
|
|
126
|
+
- Network Firewall for egress/east-west; WAF on CloudFront/ALB/API Gateway; Shield Standard free; Shield Advanced only for real DDoS exposure.
|
|
127
|
+
- **IMDSv2** blocks SSRF credential theft ([IMDS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html)). Per Region: `aws ec2 modify-instance-metadata-defaults --http-tokens required --http-put-response-hop-limit 2` (hop limit 2 for container hosts); enforce org-wide by declarative policy.
|
|
128
|
+
|
|
129
|
+
## CI/CD: GitHub Actions → AWS via OIDC
|
|
130
|
+
|
|
131
|
+
Provider URL `https://token.actions.githubusercontent.com`, audience `sts.amazonaws.com` ([GitHub docs](https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws)).
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{ "Version": "2012-10-17", "Statement": [{
|
|
135
|
+
"Effect": "Allow",
|
|
136
|
+
"Principal": { "Federated": "arn:aws:iam::111122223333:oidc-provider/token.actions.githubusercontent.com" },
|
|
137
|
+
"Action": "sts:AssumeRoleWithWebIdentity",
|
|
138
|
+
"Condition": { "StringEquals": {
|
|
139
|
+
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
|
|
140
|
+
"token.actions.githubusercontent.com:sub": "repo:octo-org/octo-repo:environment:prod" } } }] }
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Subject gotchas:
|
|
144
|
+
- IAM **rejects** GitHub trust policies without `token.actions.githubusercontent.com:sub` or with only `*`/`?` ([IAM docs](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html#idp_oidc_Create_GitHub)). `repo:org/*` still lets any org repo deploy prod `[inference]`.
|
|
145
|
+
- **Immutable `sub` format** for repos created after 2026-07-15 (or opted in): `repo:octo-org@123456/octo-repo@456789:environment:prod`. Match whichever format the repo emits; mixed fleets need both; GHES excluded ([GitHub OIDC reference](https://docs.github.com/en/actions/reference/security/oidc)).
|
|
146
|
+
- Branch-scoped: `repo:octo-org/octo-repo:ref:refs/heads/main`. PR role: `repo:octo-org/octo-repo:pull_request`, read/plan only `[inference]`.
|
|
147
|
+
- AWS supports only default claims (`amr`, `aud`, `email`, `oaud`, `sub`); to pin reusable workflows, customize the `sub` template to include `job_workflow_ref`.
|
|
148
|
+
- Using `environment:` in `sub` requires environment protection rules (reviewers, branch rules).
|
|
149
|
+
- Dependabot tokens carry `event_name` = `dynamic`; exclude where needed.
|
|
150
|
+
- `id-token: write` only mints a JWT; set it at job level on deploy jobs only `[inference]`.
|
|
151
|
+
- HCP Terraform OIDC: IAM requires `app.terraform.io:sub` too.
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
permissions: { contents: read }
|
|
155
|
+
jobs:
|
|
156
|
+
deploy:
|
|
157
|
+
environment: prod
|
|
158
|
+
permissions: { contents: read, id-token: write }
|
|
159
|
+
steps:
|
|
160
|
+
- uses: actions/checkout@<full-40-char-sha>
|
|
161
|
+
with: { persist-credentials: false }
|
|
162
|
+
- uses: aws-actions/configure-aws-credentials@<full-40-char-sha> # v6.3.0
|
|
163
|
+
with:
|
|
164
|
+
role-to-assume: arn:aws:iam::111122223333:role/gha-prod-deploy
|
|
165
|
+
role-session-name: gha-${{ github.run_id }}
|
|
166
|
+
aws-region: eu-west-1
|
|
167
|
+
role-duration-seconds: 900 # default 3600; 900-43200
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Keep `output-credentials` false (default). Role design `[inference]`: one role per repo/env/purpose (plan vs apply), permissions boundary, deny `iam:*` except scoped `PassRole`, never chain from dev into prod.
|
|
171
|
+
|
|
172
|
+
### Supply-chain lessons
|
|
173
|
+
|
|
174
|
+
- **Trivy compromise (2026-03-19..23):** 76 of 77 `trivy-action` tags and all `setup-trivy` tags were force-pushed to credential stealers that swept AWS/GCP/Azure creds. SHA-pinned users and digest-referenced images were safe. Follow-on attack came from non-atomic rotation ([GHSA-69fq-xp46-6x23](https://github.com/aquasecurity/trivy/security/advisories/GHSA-69fq-xp46-6x23)). Verify binaries with `cosign verify-blob --certificate-oidc-issuer https://token.actions.githubusercontent.com ...`.
|
|
175
|
+
- **CodeBreach (bulletin 2026-01-15):** unanchored CodeBuild webhook `ACTOR_ID` regex. Anchor it (`^(12345|67890)$`), enable the Pull Request Comment Approval gate, or use CodeBuild-hosted Actions runners. Misconfiguration, not a CodeBuild flaw ([bulletin 2026-002](https://aws.amazon.com/security/security-bulletins/2026-002-AWS)).
|
|
176
|
+
- Untrusted PR builds never get deploy credentials or secrets; avoid `pull_request_target` checking out PR code `[inference]`.
|
|
177
|
+
- CodeBuild `[inference]`: per-project service role, no privileged mode unless building images, secrets via buildspec `secrets-manager`/`parameter-store`, CMK on cross-account artifacts, `aws:SourceArn`/`aws:SourceAccount` on service-principal trusts.
|
|
178
|
+
- **ECR:** enhanced scanning = Inspector (OS + language, continuous); switching modes drops scan configs ([scanning](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html)). [Managed signing](https://docs.aws.amazon.com/AmazonECR/latest/userguide/managed-signing.html) signs on push (pusher needs `signer:SignPayload`, ≤10 rules, same-Region profile); verification still needs Notation or an admission controller. Deploy by digest with tag immutability `[inference]`.
|
|
179
|
+
|
|
180
|
+
## IaC scanning
|
|
181
|
+
|
|
182
|
+
| Tool | Scans | Notes |
|
|
183
|
+
|---|---|---|
|
|
184
|
+
| cfn-guard 3.2.1 | CFN, K8s, Terraform plan JSON | `cfn-guard validate -d template.yaml -r rules/`; [Guard Hooks](https://docs.aws.amazon.com/cloudformation-cli/latest/hooks-userguide/guard-hooks.html) block at deploy |
|
|
185
|
+
| cdk-nag v3.0.2 | CDK apps | Needs `aws-cdk-lib` ≥ 2.257.0; `NagSuppressions` removed ([MIGRATION](https://github.com/cdklabs/cdk-nag/blob/main/MIGRATION.md)) |
|
|
186
|
+
| Checkov 3.4.3 | Terraform HCL/plan, CFN, K8s, Dockerfiles | `checkov -f tfplan.json` |
|
|
187
|
+
| Trivy v0.76.2 | `trivy config .`; tfsec is now part of Trivy | Pin and verify |
|
|
188
|
+
| Inspector Code Security / CT proactive controls / Prowler | Repo SAST-SCA-IaC / pre-provision CFN hooks / live CSPM | |
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
Validations.of(app).addPlugins(new AwsSolutionsChecks(app)); // v3, not Aspects.of(app).add(...)
|
|
192
|
+
Validations.of(myBucket).acknowledge({ id: 'AwsSolutions-S1', reason: 'Logs go to central bucket' });
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Layering `[inference]`, in order: (1) pre-commit cfn-guard / Checkov / `trivy config` + secret scanning; (2) PR: same plus scans on `terraform plan` JSON and Access Analyzer `check-no-new-access` on changed IAM, SARIF to code scanning; (3) deploy: Guard Hooks / CT proactive controls; (4) runtime: Config / CSPM for drift. Suppressions need reason + owner, reviewed in PR.
|
|
196
|
+
|
|
197
|
+
## Cost traps
|
|
198
|
+
|
|
199
|
+
| Item | Price | Trap |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| CloudTrail extra mgmt copies | $2.00/100k | Org + account + CT trails = 2–3× |
|
|
202
|
+
| CloudTrail data events | $0.10/100k | Hot S3 buckets cost thousands/month |
|
|
203
|
+
| Config items | $0.003 continuous / $0.012 periodic | Chatty ENI/EBS types; use periodic or exclude |
|
|
204
|
+
| KMS CMK | $1/key/month | Per-tenant keys; SSE-KMS without Bucket Keys |
|
|
205
|
+
| Interface endpoints | $0.01/h per ENI per AZ + $0.01/GB | Services × AZs × VPCs; centralize `[inference]` |
|
|
206
|
+
| Network Firewall | $0.395/h per endpoint + $0.065/GB | Per AZ per VPC; centralize in inspection VPC |
|
|
207
|
+
| Shield Advanced | $3,000/month, 1-yr | Needs Business/Enterprise support |
|
|
208
|
+
| GuardDuty | 30-day trial | Bill appears after trial (S3, EKS on busy accounts) |
|
|
209
|
+
|
|
210
|
+
## Debug
|
|
211
|
+
|
|
212
|
+
| Symptom | Cause | Fix |
|
|
213
|
+
|---|---|---|
|
|
214
|
+
| IAM refuses to save GitHub OIDC trust policy | Missing `sub` condition or wildcard-only `sub` | Add `StringEquals` on `aud` and a repo-specific `sub` |
|
|
215
|
+
| `AssumeRoleWithWebIdentity` denied on a new repo | Repo emits immutable `owner@id/repo@id` `sub` | Match the format the repo emits |
|
|
216
|
+
| `AccessDenied` despite allow policy | Explicit deny somewhere (SCP/RCP/boundary) | Read the error wording ("explicit deny in a service control policy") `[inference]` |
|
|
217
|
+
| Vendor or CloudFront access broke after RCP | Identity perimeter has no exception | Add `aws:PrincipalAccount` or `aws:SourceArn`/`aws:SourceAccount` exceptions |
|
|
218
|
+
| Org trail "created" but no logs | Bucket/SNS/KMS policy invalid | Run `get-trail-status`, fix policy |
|
|
219
|
+
| App writing SSE-C to a new bucket fails | SSE-C disabled since April 2026 | `PutBucketEncryption` to re-enable |
|
|
220
|
+
| CloudTrail bill doubled | Duplicate mgmt-event trails | Keep one copy |
|
|
221
|
+
| Control Tower controls in unknown state | CT-managed resource hand-edited | Don't modify CT resources |
|
|
222
|
+
| ECR scan configs vanished | Switched basic ↔ enhanced scanning | Reconfigure after switching |
|
|
223
|
+
|
|
224
|
+
## Incident response first steps
|
|
225
|
+
|
|
226
|
+
Prepare: pre-provisioned break-glass and forensics roles in every account, playbooks ([aws-customer-playbook-framework](https://github.com/aws-samples/aws-customer-playbook-framework)), game days. [AWS Security Incident Response](https://docs.aws.amazon.com/security-ir/latest/userguide/what-is.html) triages GuardDuty and integrated threat findings, not posture findings.
|
|
227
|
+
|
|
228
|
+
Leaked access key `[inference]`:
|
|
229
|
+
1. Identify the principal (CloudTrail, `aws iam get-access-key-last-used`), then **deactivate** the key (don't delete yet); for roles, "Revoke active sessions" (adds an `aws:TokenIssueTime` deny).
|
|
230
|
+
2. Search CloudTrail for new users/keys/roles, `CreateLoginProfile`, odd-Region Lambda/EC2 launches, `PutBucketPolicy`; remove persistence.
|
|
231
|
+
3. Rotate dependent secrets, check the bill for crypto-mining, open a Support case.
|
|
232
|
+
|
|
233
|
+
Compromised EC2 `[inference]`: swap in a no-ingress/no-egress SG (tracked connections may persist), detach from ASG/ELB, snapshot EBS and capture memory before stopping, tag with case ID, analyze in a forensics account.
|
|
234
|
+
|
|
235
|
+
## Hardening checklist
|
|
236
|
+
|
|
237
|
+
| Priority | Items (in order) |
|
|
238
|
+
|---|---|
|
|
239
|
+
| **P0** day 0 | Org with all features, management account holds no workloads; management root MFA + no keys, centralized root access, member root creds removed; landing zone (Log Archive, Security Tooling, Workloads, Sandbox); Identity Center + IdP (SCIM), group permission sets, 1 h admin sessions, no IAM users; one org CloudTrail (multi-Region, validation, KMS, Object Lock bucket in Log Archive); baseline SCPs (leave-org, protect security services/logs, region allow-list, deny member root); org-level S3 BPA; Budgets + cost anomaly alert `[inference]` |
|
|
240
|
+
| **P1** week 1 | Delegated admin in Security Tooling with auto-enable; GuardDuty org-wide (S3 Protection, Runtime Monitoring for EC2/EKS/ECS); Security Hub Essentials + CSPM (FSBP, CIS) with aggregator Region; Access Analyzer external/unused/internal; EBS default encryption + IMDSv2 in every Region; EventBridge alerting; GitHub OIDC roles with `aud` + `sub` and delete CI access keys |
|
|
241
|
+
| **P2** month 1 | RCPs (identity perimeter, TLS-only) tested in sandbox; permissions boundaries + Access Analyzer checks in PRs; policy-as-code in every IaC repo + Guard Hooks / proactive controls; ECR enhanced scanning, tag immutability, managed signing, deploy by digest; Secrets Manager with rotation; private subnets, gateway endpoints, SG review, WAF on public entry; Macie automated discovery |
|
|
242
|
+
| **P3** ongoing | IR playbooks, forensics roles, quarterly game day; quarterly unused-access, key-policy, SCP/RCP and security-cost reviews; Well-Architected Security pillar review per workload (pillar last revised 2024-11-06) |
|
|
243
|
+
|
|
244
|
+
## Do / Avoid
|
|
245
|
+
|
|
246
|
+
**Do**
|
|
247
|
+
- Write policies with explicit `Resource` ARNs and conditions; run `validate-policy` on each.
|
|
248
|
+
- Add `aws:SourceArn` + `aws:SourceAccount` to every grant to a service principal.
|
|
249
|
+
- Scope OIDC trust to `repo:<org>/<repo>:environment:<env>` (or immutable form) with protection rules.
|
|
250
|
+
- Pin actions to SHAs, images to digests; verify Sigstore/Notation signatures on security tools.
|
|
251
|
+
- Keep a break-glass role excluded from SCP denies via `aws:PrincipalArn`, and alarm on its use.
|
|
252
|
+
- Treat CI logs from a supply-chain exposure window as compromised; rotate all reachable secrets.
|
|
253
|
+
- Set `HttpTokens=required`, hop limit 2 on container hosts.
|
|
254
|
+
- Estimate Config, CloudTrail, Network Firewall and endpoint costs before org-wide enablement.
|
|
255
|
+
|
|
256
|
+
**Avoid**
|
|
257
|
+
- IAM users or access keys for humans or CI; `AdministratorAccess` on CI roles.
|
|
258
|
+
- `repo:org/*` or `*` subjects; `Principal: "*"` without org/VPC/source conditions.
|
|
259
|
+
- Workloads or daily Identity Center use in the management account.
|
|
260
|
+
- Duplicate management-event trails.
|
|
261
|
+
- Removing the account-root statement from KMS key policies.
|
|
262
|
+
- `pull_request_target` with PR checkout and secrets/OIDC; unanchored CodeBuild webhook regexes.
|
|
263
|
+
- CSPM scores as audit evidence; hand-editing Control Tower resources; SSE-C in new designs.
|
|
264
|
+
- cdk-nag v2 APIs (`Aspects.of(...)`, `NagSuppressions`) on `aws-cdk-lib` ≥ 2.257.0.
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Azure Security and DevSecOps
|
|
2
|
+
|
|
3
|
+
Read when designing, reviewing, debugging, or securing Azure deployments: management groups and landing zones, Entra ID identities, RBAC, Azure Policy, Defender for Cloud, Key Vault and Storage, Private Endpoints and DNS, logging and Sentinel, GitHub Actions or Azure Pipelines federation to Azure, Bicep/Terraform validation, or AKS. Facts as of 2026-11-11.
|
|
4
|
+
Full report: https://github.com/TimothyVang/cloud-devsecops/blob/main/research/azure-devsecops.md
|
|
5
|
+
|
|
6
|
+
## Recent changes that break assumptions
|
|
7
|
+
|
|
8
|
+
- **GitHub OIDC `sub` uses immutable IDs** for repos created, renamed, or transferred after 2026-07-15: `repo:ORG@OWNER_ID/REPO@REPO_ID:...`. Name-based federated credentials silently stop matching after a rename or transfer ([GitHub OIDC](https://docs.github.com/en/actions/reference/security/oidc)).
|
|
9
|
+
- **Azure DevOps WIF issuer `https://vstoken.dev.azure.com` retires 2027-07-01.** New connections use the Entra issuer and a new subject format ([WIF troubleshooting](https://learn.microsoft.com/en-us/azure/devops/pipelines/release/troubleshoot-workload-identity)).
|
|
10
|
+
- **New key vaults default to Azure RBAC** (API 2026-02-01; `az keyvault create` too) ([RBAC guide](https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-guide)).
|
|
11
|
+
- **New subnets are private** (`defaultOutboundAccess=false`) with network API versions after 2026-03-31; VMs need NAT Gateway, firewall via UDR, or a public IP ([default outbound](https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/default-outbound-access)).
|
|
12
|
+
- **Mandatory MFA phase 2** (from 2025-10-01) covers CLI, PowerShell, IaC tools, and REST for create/update/delete. Workload identities are exempt; automation signing in as a user breaks ([mandatory MFA](https://learn.microsoft.com/en-us/entra/identity/authentication/concept-mandatory-multifactor-authentication)).
|
|
13
|
+
- **Sentinel leaves the Azure portal after 2027-03-31**; Defender portal only ([Sentinel](https://learn.microsoft.com/en-us/azure/sentinel/overview)). MCSB v2 is in preview; ALZ-Bicep Classic is deprecated in favor of AVM.
|
|
14
|
+
|
|
15
|
+
## Hierarchy and landing zones
|
|
16
|
+
|
|
17
|
+
| Level | Rules |
|
|
18
|
+
|---|---|
|
|
19
|
+
| Tenant (Entra) | Identity boundary. Entra roles are separate from Azure RBAC. |
|
|
20
|
+
| Tenant root group | ID = tenant ID. Nobody has default access. New subscriptions land here by default. Never put org policy here. |
|
|
21
|
+
| Management groups | Max 6 levels deep (excluding root and subscription). One parent each. |
|
|
22
|
+
| Subscription | Billing/quota/isolation unit. Max 5,000 role assignments (sub, RG, resource scopes). |
|
|
23
|
+
| Resource group | Narrowest recommended scope for workload RBAC. |
|
|
24
|
+
|
|
25
|
+
CAF layout ([MG design](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/landing-zone/design-area/resource-org-management-groups)):
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Tenant root group
|
|
29
|
+
└── <prefix> (intermediate root: org-wide policy goes here)
|
|
30
|
+
├── Platform: Security, Management, Connectivity, Identity
|
|
31
|
+
├── Landing zones: Corp (hub-connected), Online (internet-facing)
|
|
32
|
+
├── Sandbox
|
|
33
|
+
└── Decommissioned
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- Group MGs by workload type, not org chart (newer CAF says Internal/Online/Local; keep the org's names). Grant workload teams RBAC at subscription or RG, **never at MG scope**. Platform-team MG access goes through PIM.
|
|
37
|
+
- Deploy with the ALZ IaC Accelerator (Bicep or Terraform on AVM; phases: plan, prerequisites, bootstrap, run CI/CD) ([implementation options](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/landing-zone/implementation-options)).
|
|
38
|
+
- **GA elevation gotcha**: "Access management for Azure resources" gives a Global Administrator User Access Administrator on every subscription. Alert on it; switch it off after break-glass use ([RBAC vs Entra roles](https://learn.microsoft.com/en-us/azure/role-based-access-control/rbac-and-directory-admin-roles)).
|
|
39
|
+
|
|
40
|
+
## Entra ID identities
|
|
41
|
+
|
|
42
|
+
| Type | Credential | Use when |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| System-assigned MI | Platform-managed; dies with resource | Per-resource attribution or lifecycle coupling |
|
|
45
|
+
| User-assigned MI (UAMI) | Platform-managed; can hold federated credentials; delete manually | CI/CD, AKS, identity shared by several resources |
|
|
46
|
+
| App registration + SP | Secret, cert, or federated credential | Multi-tenant apps, Graph permissions, things MI can't do |
|
|
47
|
+
| User as service account | Password + MFA | **Never**: mandatory MFA breaks it |
|
|
48
|
+
|
|
49
|
+
- Conditional Access needs Entra ID P1; roll new policies out in **report-only** first. CA for workload identities needs Workload Identities Premium, covers **single-tenant SPs only**, not managed identities; group membership does not apply CA to an SP ([CA for workload identities](https://learn.microsoft.com/en-us/entra/identity/conditional-access/workload-identity)).
|
|
50
|
+
- PIM (Entra ID Governance/P2-class) gives eligible assignments activated just in time with approval, MFA, justification, time limit. Use it for every Owner, User Access Administrator, and RBAC Administrator ([PIM](https://learn.microsoft.com/en-us/entra/id-governance/privileged-identity-management/pim-configure)).
|
|
51
|
+
- Keep at least two break-glass accounts with passkeys (FIDO2), excluded from blocking CA, sign-ins monitored ([emergency access](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/security-emergency-access)).
|
|
52
|
+
- Mandatory MFA phase 1 (Oct 2024): portal and admin centers; phase 2: CLI/PowerShell/IaC/REST writes; reads exempt. Entra sign-in/audit logs: 7 days Free, 30 days P1/P2; export via diagnostic setting.
|
|
53
|
+
|
|
54
|
+
### Workload identity federation rules
|
|
55
|
+
|
|
56
|
+
From [create trust](https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation-create-trust) and [considerations](https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation-considerations):
|
|
57
|
+
|
|
58
|
+
- Max 20 federated identity credentials (FICs) per app or UAMI; `issuer`+`subject` unique; one audience, `api://AzureADTokenExchange`.
|
|
59
|
+
- **No wildcards; exact match.** A wrong subject is accepted at creation and fails only at token exchange. `name` is immutable.
|
|
60
|
+
- New FICs take several minutes to propagate. Retry; don't "fix".
|
|
61
|
+
- Flexible FICs (preview) allow `claimsMatchingExpression` with `matches`/`eq`/`and` for GitHub, GitLab, Terraform Cloud. GitHub expressions must match `sub` plus `repository_id` and/or `repository_owner_id`. Azure CLI, PowerShell, and Terraform providers can't create them and error on reading them; use `az rest` against Graph beta or ARM `2025-01-31-preview` ([flexible FIC](https://learn.microsoft.com/en-us/entra/workload-id/workload-identities-flexible-federated-identity-credentials)).
|
|
62
|
+
|
|
63
|
+
## Authorization: RBAC vs Entra roles
|
|
64
|
+
|
|
65
|
+
| | Azure RBAC | Entra roles |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| Controls | Azure resources (control plane + data actions) | Users, groups, apps, licenses |
|
|
68
|
+
| Scopes | MG → subscription → RG → resource | Tenant or administrative unit |
|
|
69
|
+
| Key roles | Owner, Contributor, Reader, User Access Administrator, RBAC Administrator | Global Admin, User Admin, Application Admin |
|
|
70
|
+
|
|
71
|
+
Rules ([RBAC best practices](https://learn.microsoft.com/en-us/azure/role-based-access-control/best-practices)):
|
|
72
|
+
- At most **3 subscription Owners**. Assign to groups, at the narrowest scope, job-function roles over admin roles.
|
|
73
|
+
- Reference roles by **definition GUID** in automation; names change.
|
|
74
|
+
- Any role that can write role assignments gets a **condition** restricting which roles and principals ([delegate with conditions](https://learn.microsoft.com/en-us/azure/role-based-access-control/delegate-role-assignments-overview)).
|
|
75
|
+
- Custom roles: one MG max in `AssignableScopes`, no wildcards there; roles with `DataActions` can't be assigned at MG scope.
|
|
76
|
+
- You can't create deny assignments directly. Use Deployment Stacks deny settings (`DenyDelete`, `DenyWriteAndDelete`) or the `denyAction` policy effect (DELETE only) ([deployment stacks](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deployment-stacks)).
|
|
77
|
+
|
|
78
|
+
## Azure Policy
|
|
79
|
+
|
|
80
|
+
Request-time order: `disabled` → `append`/`modify` → `deny` → `audit` → `manual` → `auditIfNotExists` → `denyAction`; then `auditIfNotExists`/`deployIfNotExists` run after the provider succeeds. Multiple assignments are cumulative most-restrictive ([effect basics](https://learn.microsoft.com/en-us/azure/governance/policy/concepts/effect-basics)).
|
|
81
|
+
|
|
82
|
+
| Effect | Use | Gotcha |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `deny` | Locations, no public IP, TLS minimum | Breaks deployments; start with `enforcementMode: DoNotEnforce` |
|
|
85
|
+
| `audit` / `auditIfNotExists` | Visibility | No remediation |
|
|
86
|
+
| `modify` | Tags, toggle properties | Needs an MI with roles; existing resources need remediation |
|
|
87
|
+
| `deployIfNotExists` | Diagnostic settings, DNS zone groups | MI with `roleDefinitionIds` roles; existing resources stay non-compliant until a **remediation task** runs ([remediation](https://learn.microsoft.com/en-us/azure/governance/policy/how-to/remediate-resources)) |
|
|
88
|
+
| `denyAction` | Block deletes | DELETE only |
|
|
89
|
+
|
|
90
|
+
## Defender for Cloud
|
|
91
|
+
|
|
92
|
+
- Foundational CSPM (free): MCSB recommendations, secure score, inventory. Defender CSPM (paid): attack paths, security explorer, agentless VM vuln/secrets scanning, DevOps PR annotations and code-to-cloud mapping ([CSPM](https://learn.microsoft.com/en-us/azure/defender-for-cloud/concept-cloud-security-posture-management)).
|
|
93
|
+
- Workload plans: Servers P1/P2, Containers, Storage, Key Vault, Resource Manager, APIs, databases, AI. Classic and Defender-portal secure scores aren't comparable.
|
|
94
|
+
- `az security pricing create -n VirtualMachines --tier standard --subplan P2`; other plan names `[unverified]`, run `az security pricing list` first.
|
|
95
|
+
- DevOps security connectors: Azure DevOps, GitHub, GitLab. MSDO (`MicrosoftSecurityDevOps@1`, `microsoft/security-devops-action`) bundles Checkov, Template Analyzer/PSRule, Terrascan, Trivy and others; `categories: 'IaC'` for IaC only. Its CredScan is deprecated; use GitHub Advanced Security for secrets.
|
|
96
|
+
|
|
97
|
+
## Key Vault and Storage
|
|
98
|
+
|
|
99
|
+
| Setting | Fact |
|
|
100
|
+
|---|---|
|
|
101
|
+
| Permission model | RBAC default. Access policies let anyone with `vaults/write` (Contributor) grant themselves data access ([RBAC vs access policies](https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-access-policy)) |
|
|
102
|
+
| Roles | Key Vault Contributor = control plane only, no secrets. Apps get **Key Vault Secrets User** |
|
|
103
|
+
| Soft delete | Always on; retention 7–90 days (default 90), **set at creation only**; deleted vault name blocked until retention ends ([soft delete](https://learn.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview)) |
|
|
104
|
+
| Purge protection | **Off by default**; irreversible once on; required by most CMK integrations |
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
az keyvault create -g rg-app -n kv-app-prod-001 -l westeurope \
|
|
108
|
+
--enable-rbac-authorization true --enable-purge-protection true \
|
|
109
|
+
--retention-days 90 --public-network-access Disabled
|
|
110
|
+
az role assignment create --assignee-object-id <uami-principal-id> \
|
|
111
|
+
--assignee-principal-type ServicePrincipal \
|
|
112
|
+
--role 4633458b-17de-408a-b874-0445c86b69e6 \
|
|
113
|
+
--scope $(az keyvault show -n kv-app-prod-001 --query id -o tsv)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`4633458b-...` is Key Vault Secrets User. Passing object ID plus principal type skips a Graph lookup that can race replication `[inference]`.
|
|
117
|
+
|
|
118
|
+
Storage: Shared Key is **allowed while the property is null** (default); set `--allow-shared-key-access false` after confirming no key users. Keep `--allow-blob-public-access false`, min TLS 1.2 (1.3 minimum not enforceable), `--allow-cross-tenant-replication false`, `--public-network-access Disabled` or `SecuredByPerimeter` ([prevent Shared Key](https://learn.microsoft.com/en-us/azure/storage/common/shared-key-authorization-prevent)).
|
|
119
|
+
|
|
120
|
+
## Networking
|
|
121
|
+
|
|
122
|
+
- NSG defaults include `AllowInternetOutBound` (65001) and `AllowVNetInBound`; the `VirtualNetwork` tag spans peered VNets and on-prem, so add explicit east-west denies `[inference]` ([NSG](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview)). Existing VMs keep default outbound IPs until the subnet is private **and** the VMs are deallocated.
|
|
123
|
+
- Prefer **Private Endpoints** over Service Endpoints: PE is per resource instance, works from on-prem, and is Microsoft's recommendation; Service Endpoints hit the public endpoint and don't work from on-prem ([PE overview](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-overview)).
|
|
124
|
+
|
|
125
|
+
Private DNS gotchas ([PE DNS](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns)):
|
|
126
|
+
1. Link the `privatelink.*` zone to the VNet the client uses for DNS; one zone per service type.
|
|
127
|
+
2. Hub-spoke: zones centrally in Connectivity; DINE policy creates `privateDnsZoneGroups` ([CAF DNS at scale](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/private-link-and-dns-integration-at-scale)).
|
|
128
|
+
3. Changing a VNet's custom DNS servers requires rebooting its VMs.
|
|
129
|
+
4. NXDOMAIN trap: a linked zone breaks lookups of other tenants' PE'd accounts. Set fallback to internet (`ResolutionPolicy` NxDomainRedirect) on the link ([fallback](https://learn.microsoft.com/en-us/azure/dns/private-dns-fallback)).
|
|
130
|
+
5. On-prem forwards the **public** zone (`blob.core.windows.net`) to a DNS Private Resolver inbound endpoint.
|
|
131
|
+
6. NSG/UDR on PE subnets are ignored unless network policies are enabled.
|
|
132
|
+
7. Azure Files mounted via the public endpoint must be remounted after adding a PE.
|
|
133
|
+
|
|
134
|
+
## Logging
|
|
135
|
+
|
|
136
|
+
- Activity log: kept 90 days; add a **subscription diagnostic setting** to central Log Analytics ([activity log](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log)).
|
|
137
|
+
- Resource logs (Key Vault AuditEvent, Storage, Firewall) are **not collected by default**; deploy diagnostic settings via DINE. Max 5 settings per resource ([diagnostic settings](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings)). Plan Sentinel in the Defender portal.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
LAW=$(az monitor log-analytics workspace show -g rg-mgmt -n law-central --query id -o tsv)
|
|
141
|
+
az monitor diagnostic-settings subscription create --name activity-to-law --workspace "$LAW" \
|
|
142
|
+
--logs '[{"category":"Administrative","enabled":true},{"category":"Security","enabled":true},{"category":"Policy","enabled":true}]'
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Category list `[unverified]`; check with `az monitor diagnostic-settings subscription list`.
|
|
146
|
+
|
|
147
|
+
## CI/CD federation
|
|
148
|
+
|
|
149
|
+
GitHub `sub` formats ([GitHub OIDC](https://docs.github.com/en/actions/reference/security/oidc)):
|
|
150
|
+
|
|
151
|
+
| Trigger | `sub` |
|
|
152
|
+
|---|---|
|
|
153
|
+
| Job with `environment:` | `repo:ORG/REPO:environment:ENV` |
|
|
154
|
+
| Branch / tag | `repo:ORG/REPO:ref:refs/heads/BRANCH` / `...:ref:refs/tags/TAG` |
|
|
155
|
+
| Pull request, no environment | `repo:ORG/REPO:pull_request` |
|
|
156
|
+
| Immutable (new/renamed/transferred after 2026-07-15, or opted in) | `repo:ORG@OWNER_ID/REPO@REPO_ID:...` |
|
|
157
|
+
|
|
158
|
+
- An `environment:` overrides the ref form, so branch FICs won't match.
|
|
159
|
+
- Entra docs write `pull-request`; GitHub issues **`pull_request`**. Trust GitHub.
|
|
160
|
+
- Customized `sub` (`include_claim_keys`) must match exactly. Workflow needs `permissions: id-token: write`.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
az identity federated-credential create -g rg-cicd --identity-name id-gh-deploy \
|
|
164
|
+
--name gh-octo-repo-production \
|
|
165
|
+
--issuer https://token.actions.githubusercontent.com \
|
|
166
|
+
--subject "repo:octo-org/octo-repo:environment:Production" \
|
|
167
|
+
--audiences api://AzureADTokenExchange
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
permissions: { id-token: write, contents: read }
|
|
172
|
+
jobs:
|
|
173
|
+
deploy:
|
|
174
|
+
environment: Production # sub => repo:ORG/REPO:environment:Production
|
|
175
|
+
steps:
|
|
176
|
+
- uses: azure/login@<commit-sha> # pin full 40-char SHA (v3)
|
|
177
|
+
with:
|
|
178
|
+
client-id: ${{ vars.AZURE_CLIENT_ID }}
|
|
179
|
+
tenant-id: ${{ vars.AZURE_TENANT_ID }}
|
|
180
|
+
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
- Protect the environment: required reviewers with prevent self-review, branch restrictions. On Free/Pro/Team plans these work only on public repos ([environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments)).
|
|
184
|
+
- Terraform azurerm: `ARM_USE_OIDC=true` + client/tenant/subscription IDs. In Azure Pipelines also set `ARM_ADO_PIPELINE_SERVICE_CONNECTION_ID` and `SYSTEM_ACCESSTOKEN`, or it falls back to the GitHub flow ([azurerm OIDC](https://github.com/hashicorp/terraform-provider-azurerm/blob/main/website/docs/guides/service_principal_oidc.html.markdown)).
|
|
185
|
+
|
|
186
|
+
Azure Pipelines service connections: use app registration or managed identity **with WIF**; convert secret-based ones ([connect to Azure](https://learn.microsoft.com/en-us/azure/devops/pipelines/library/connect-to-azure)).
|
|
187
|
+
|
|
188
|
+
| | Old issuer (retires 2027-07-01) | New Entra issuer |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| Issuer | `https://vstoken.dev.azure.com/<org id>` | `https://login.microsoftonline.com/<tenant id>/v2.0` |
|
|
191
|
+
| Subject | `sc://<org>/<project>/<connection name>` | `<entra prefix>/sc/<org id>/<connection id>` |
|
|
192
|
+
|
|
193
|
+
- Copy issuer and subject from the service connection UI for manual setup. Put Branch control + Required template checks on the **prod service connection** itself `[inference]`; limit job auth scope to the current project ([approvals](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals)).
|
|
194
|
+
|
|
195
|
+
### What-if limits
|
|
196
|
+
|
|
197
|
+
`az deployment group what-if -g rg -f main.bicep` or `create ... --confirm-with-what-if`. It expands max 500 nested templates and 800 RGs within 5 minutes (rest shows `Ignore`), short-circuits modules with runtime-dependent IDs or API versions, and shows noise (defaults as deletes). Treat it as a review aid; gate on PSRule/Checkov plus policy `deny` `[inference]` ([what-if](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-what-if)).
|
|
198
|
+
|
|
199
|
+
## AKS basics
|
|
200
|
+
|
|
201
|
+
- Managed Entra: `--enable-aad --aad-admin-group-object-ids <grp> --disable-local-accounts`; can't be turned off ([Entra integration](https://learn.microsoft.com/en-us/azure/aks/enable-authentication-microsoft-entra-id)). Add `--enable-azure-rbac`.
|
|
202
|
+
- Workload identity: `--enable-oidc-issuer --enable-workload-identity`, UAMI + FIC with subject `system:serviceaccount:<ns>:<sa>` and the cluster issuer URL. Annotate the SA `azure.workload.identity/client-id`, label pods `azure.workload.identity/use: "true"`, read `AZURE_FEDERATED_TOKEN_FILE` ([WI overview](https://learn.microsoft.com/en-us/azure/aks/workload-identity-overview)).
|
|
203
|
+
- Guardrails: `az aks enable-addons --addons azure-policy` (Gatekeeper admission) and the Defender for Containers sensor for runtime detection. Pod-managed identity is deprecated; migrate.
|
|
204
|
+
|
|
205
|
+
## Debug
|
|
206
|
+
|
|
207
|
+
| Symptom | Cause | Fix |
|
|
208
|
+
|---|---|---|
|
|
209
|
+
| `AADSTS70021` no matching federated identity record | `sub`/`iss` mismatch: rename, immutable format, environment vs ref, `vstoken` vs Entra issuer | Dump real token claims or copy issuer/subject from the ADO connection; compare character by character |
|
|
210
|
+
| Login fails right after FIC creation | Propagation delay | Wait minutes, retry |
|
|
211
|
+
| `RoleAssignmentLimitExceeded` | 5,000 per subscription | Consolidate onto groups |
|
|
212
|
+
| `RequestDisallowedByPolicy` | `deny` assignment | `az policy assignment show` on the listed ID; request an exemption |
|
|
213
|
+
| DINE resources stay non-compliant | No remediation task or MI lacks role | Create remediation task; check `roleDefinitionIds` |
|
|
214
|
+
| App resolves public IP of PE'd service | Zone not linked or wrong forwarder | `nslookup` from client network |
|
|
215
|
+
| NXDOMAIN for partner storage | Linked zone lacks record | Fallback to internet (`ResolutionPolicy`) |
|
|
216
|
+
| Owner gets 403 on secrets | RBAC vault; Owner is control plane | Assign Key Vault Secrets User/Officer |
|
|
217
|
+
| Can't reuse vault name | Soft-deleted vault holds it | `az keyvault list-deleted`; recover, or purge if protection off |
|
|
218
|
+
| VM has no internet on new VNet | Private subnet default | NAT Gateway or firewall UDR |
|
|
219
|
+
| AKS pod gets no token | Missing pod label, SA annotation, or wrong FIC subject | Fix label/annotation/`system:serviceaccount:ns:sa` |
|
|
220
|
+
| CLI automation suddenly needs MFA | User account hits mandatory MFA phase 2 | Move to a workload identity |
|
|
221
|
+
|
|
222
|
+
## Hardening checklist
|
|
223
|
+
|
|
224
|
+
**P0: day 0**
|
|
225
|
+
1. Place the subscription under the right landing-zone MG (never tenant root).
|
|
226
|
+
2. ≤3 Owners, all PIM-eligible; no standing Owner/UAA; remove creator's direct Owner.
|
|
227
|
+
3. Two passkey break-glass accounts, CA baseline (MFA all users, block legacy auth), no automation as users.
|
|
228
|
+
4. Deployment UAMI with FICs for `environment:Prod` (deploy) and `pull_request` (plan); Contributor on target RGs only, Reader for plan; no secrets.
|
|
229
|
+
5. Subscription diagnostic setting: activity log to central Log Analytics.
|
|
230
|
+
|
|
231
|
+
**P1: week 1**
|
|
232
|
+
6. Verify inherited ALZ policies (locations, no public IP on NICs, storage public access, KV purge protection, DINE diagnostics and DNS zone groups) with `az policy state summarize`.
|
|
233
|
+
7. Defender CSPM plus the workload plans in use; review secure score and attack paths.
|
|
234
|
+
8. Connect the repo org to Defender DevOps security; add MSDO or PSRule + Checkov to PRs.
|
|
235
|
+
9. Network: hub peering, private subnets, firewall egress via UDR, NSGs with east-west denies, PEs for PaaS with central DNS.
|
|
236
|
+
10. Key Vault: RBAC, purge protection, PE, `AuditEvent` diagnostics; apps use Secrets User via MI.
|
|
237
|
+
11. Storage: Shared Key off, anonymous off, TLS 1.2, PE or perimeter, cross-tenant replication off.
|
|
238
|
+
|
|
239
|
+
**P2: month 1**
|
|
240
|
+
12. Resource-log diagnostics via policy; Entra logs and Defender alerts to Sentinel.
|
|
241
|
+
13. AKS: managed Entra, local accounts off, Azure RBAC, workload identity, policy add-on, Defender sensor.
|
|
242
|
+
14. Prod RGs as deployment stacks with `DenyDelete`, or `denyAction` policy.
|
|
243
|
+
15. ADO: Branch control + Required template on prod connection, project-scoped job auth. GitHub: reviewers with self-review blocked, `sub` customized with `repository_id`.
|
|
244
|
+
16. Quarterly access reviews of privileged roles and workload identities (CA doesn't cover MIs).
|
|
245
|
+
|
|
246
|
+
## Do / Avoid
|
|
247
|
+
|
|
248
|
+
**Do**
|
|
249
|
+
- UAMI + FICs for CI/CD and AKS; environment-scoped GitHub FICs; separate Reader identity for PR/plan.
|
|
250
|
+
- Roles by GUID, to groups, narrowest scope; PIM for privileged roles; conditions on role-assigning roles.
|
|
251
|
+
- Org policy on an intermediate root MG; `deny` as `DoNotEnforce` first; remediation tasks for DINE/Modify.
|
|
252
|
+
- New vaults: RBAC, purge protection, public access off, PE; choose retention deliberately.
|
|
253
|
+
- Central `privatelink.*` zones with DINE zone groups and internet fallback where needed.
|
|
254
|
+
- Pin `azure/login`, `microsoft/ps-rule` (v2.9.0), Checkov, and third-party actions by full 40-char commit SHA (`@<sha> # vX`, per `devsecops-pipeline.md`) `[inference]`.
|
|
255
|
+
|
|
256
|
+
**Avoid**
|
|
257
|
+
- Client secrets, `--sdk-auth` JSON, publish profiles, user accounts as service accounts.
|
|
258
|
+
- Wildcards in classic FICs; flexible GitHub FICs without an immutable ID claim.
|
|
259
|
+
- Key Vault access policies; standing Owner/UAA; MG-scope RBAC for workload teams.
|
|
260
|
+
- What-if as the only gate; Service Endpoints as the isolation story; assuming PE-subnet NSGs apply.
|
|
261
|
+
- Leaving GA elevation on; new work on ALZ-Bicep Classic or pod-managed identity; new manual FICs on `vstoken.dev.azure.com`.
|