@wazir-dev/cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +111 -0
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +101 -0
- package/LICENSE +21 -0
- package/README.md +314 -0
- package/assets/composition-engine.mmd +34 -0
- package/assets/demo-script.sh +17 -0
- package/assets/logo-dark.svg +14 -0
- package/assets/logo.svg +14 -0
- package/assets/pipeline.mmd +39 -0
- package/assets/record-demo.sh +51 -0
- package/docs/README.md +51 -0
- package/docs/adapters/context-mode.md +60 -0
- package/docs/concepts/architecture.md +87 -0
- package/docs/concepts/artifact-model.md +60 -0
- package/docs/concepts/composition-engine.md +36 -0
- package/docs/concepts/indexing-and-recall.md +160 -0
- package/docs/concepts/observability.md +41 -0
- package/docs/concepts/roles-and-workflows.md +59 -0
- package/docs/concepts/terminology-policy.md +27 -0
- package/docs/getting-started/01-installation.md +78 -0
- package/docs/getting-started/02-first-run.md +102 -0
- package/docs/getting-started/03-adding-to-project.md +15 -0
- package/docs/getting-started/04-host-setup.md +15 -0
- package/docs/guides/ci-integration.md +15 -0
- package/docs/guides/creating-skills.md +15 -0
- package/docs/guides/expertise-module-authoring.md +15 -0
- package/docs/guides/hook-development.md +15 -0
- package/docs/guides/memory-and-learnings.md +34 -0
- package/docs/guides/multi-host-export.md +15 -0
- package/docs/guides/troubleshooting.md +101 -0
- package/docs/guides/writing-custom-roles.md +15 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-design.md +592 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +598 -0
- package/docs/plans/2026-03-15-docs-enforcement-plan.md +238 -0
- package/docs/readmes/INDEX.md +99 -0
- package/docs/readmes/features/expertise/README.md +171 -0
- package/docs/readmes/features/exports/README.md +222 -0
- package/docs/readmes/features/hooks/README.md +103 -0
- package/docs/readmes/features/hooks/loop-cap-guard.md +133 -0
- package/docs/readmes/features/hooks/post-tool-capture.md +121 -0
- package/docs/readmes/features/hooks/post-tool-lint.md +130 -0
- package/docs/readmes/features/hooks/pre-compact-summary.md +122 -0
- package/docs/readmes/features/hooks/pre-tool-capture-route.md +100 -0
- package/docs/readmes/features/hooks/protected-path-write-guard.md +128 -0
- package/docs/readmes/features/hooks/session-start.md +119 -0
- package/docs/readmes/features/hooks/stop-handoff-harvest.md +125 -0
- package/docs/readmes/features/roles/README.md +157 -0
- package/docs/readmes/features/roles/clarifier.md +152 -0
- package/docs/readmes/features/roles/content-author.md +190 -0
- package/docs/readmes/features/roles/designer.md +193 -0
- package/docs/readmes/features/roles/executor.md +184 -0
- package/docs/readmes/features/roles/learner.md +210 -0
- package/docs/readmes/features/roles/planner.md +182 -0
- package/docs/readmes/features/roles/researcher.md +164 -0
- package/docs/readmes/features/roles/reviewer.md +184 -0
- package/docs/readmes/features/roles/specifier.md +162 -0
- package/docs/readmes/features/roles/verifier.md +215 -0
- package/docs/readmes/features/schemas/README.md +178 -0
- package/docs/readmes/features/skills/README.md +63 -0
- package/docs/readmes/features/skills/brainstorming.md +96 -0
- package/docs/readmes/features/skills/debugging.md +148 -0
- package/docs/readmes/features/skills/design.md +120 -0
- package/docs/readmes/features/skills/prepare-next.md +109 -0
- package/docs/readmes/features/skills/run-audit.md +159 -0
- package/docs/readmes/features/skills/scan-project.md +109 -0
- package/docs/readmes/features/skills/self-audit.md +176 -0
- package/docs/readmes/features/skills/tdd.md +137 -0
- package/docs/readmes/features/skills/using-skills.md +92 -0
- package/docs/readmes/features/skills/verification.md +120 -0
- package/docs/readmes/features/skills/writing-plans.md +104 -0
- package/docs/readmes/features/tooling/README.md +320 -0
- package/docs/readmes/features/workflows/README.md +186 -0
- package/docs/readmes/features/workflows/author.md +181 -0
- package/docs/readmes/features/workflows/clarify.md +154 -0
- package/docs/readmes/features/workflows/design-review.md +171 -0
- package/docs/readmes/features/workflows/design.md +169 -0
- package/docs/readmes/features/workflows/discover.md +162 -0
- package/docs/readmes/features/workflows/execute.md +173 -0
- package/docs/readmes/features/workflows/learn.md +167 -0
- package/docs/readmes/features/workflows/plan-review.md +165 -0
- package/docs/readmes/features/workflows/plan.md +170 -0
- package/docs/readmes/features/workflows/prepare-next.md +167 -0
- package/docs/readmes/features/workflows/review.md +169 -0
- package/docs/readmes/features/workflows/run-audit.md +191 -0
- package/docs/readmes/features/workflows/spec-challenge.md +159 -0
- package/docs/readmes/features/workflows/specify.md +160 -0
- package/docs/readmes/features/workflows/verify.md +177 -0
- package/docs/readmes/packages/README.md +50 -0
- package/docs/readmes/packages/ajv.md +117 -0
- package/docs/readmes/packages/context-mode.md +118 -0
- package/docs/readmes/packages/gray-matter.md +116 -0
- package/docs/readmes/packages/node-test.md +137 -0
- package/docs/readmes/packages/yaml.md +112 -0
- package/docs/reference/configuration-reference.md +159 -0
- package/docs/reference/expertise-index.md +52 -0
- package/docs/reference/git-flow.md +43 -0
- package/docs/reference/hooks.md +87 -0
- package/docs/reference/host-exports.md +50 -0
- package/docs/reference/launch-checklist.md +172 -0
- package/docs/reference/marketplace-listings.md +76 -0
- package/docs/reference/release-process.md +34 -0
- package/docs/reference/roles-reference.md +77 -0
- package/docs/reference/skills.md +33 -0
- package/docs/reference/templates.md +29 -0
- package/docs/reference/tooling-cli.md +94 -0
- package/docs/truth-claims.yaml +222 -0
- package/expertise/PROGRESS.md +63 -0
- package/expertise/README.md +18 -0
- package/expertise/antipatterns/PROGRESS.md +56 -0
- package/expertise/antipatterns/backend/api-design-antipatterns.md +1271 -0
- package/expertise/antipatterns/backend/auth-antipatterns.md +1195 -0
- package/expertise/antipatterns/backend/caching-antipatterns.md +622 -0
- package/expertise/antipatterns/backend/database-antipatterns.md +1038 -0
- package/expertise/antipatterns/backend/index.md +24 -0
- package/expertise/antipatterns/backend/microservices-antipatterns.md +850 -0
- package/expertise/antipatterns/code/architecture-antipatterns.md +919 -0
- package/expertise/antipatterns/code/async-antipatterns.md +622 -0
- package/expertise/antipatterns/code/code-smells.md +1186 -0
- package/expertise/antipatterns/code/dependency-antipatterns.md +1209 -0
- package/expertise/antipatterns/code/error-handling-antipatterns.md +1360 -0
- package/expertise/antipatterns/code/index.md +27 -0
- package/expertise/antipatterns/code/naming-and-abstraction.md +1118 -0
- package/expertise/antipatterns/code/state-management-antipatterns.md +1076 -0
- package/expertise/antipatterns/code/testing-antipatterns.md +1053 -0
- package/expertise/antipatterns/design/accessibility-antipatterns.md +1136 -0
- package/expertise/antipatterns/design/dark-patterns.md +1121 -0
- package/expertise/antipatterns/design/index.md +22 -0
- package/expertise/antipatterns/design/ui-antipatterns.md +1202 -0
- package/expertise/antipatterns/design/ux-antipatterns.md +680 -0
- package/expertise/antipatterns/frontend/css-layout-antipatterns.md +691 -0
- package/expertise/antipatterns/frontend/flutter-antipatterns.md +1827 -0
- package/expertise/antipatterns/frontend/index.md +23 -0
- package/expertise/antipatterns/frontend/mobile-antipatterns.md +573 -0
- package/expertise/antipatterns/frontend/react-antipatterns.md +1128 -0
- package/expertise/antipatterns/frontend/spa-antipatterns.md +1235 -0
- package/expertise/antipatterns/index.md +31 -0
- package/expertise/antipatterns/performance/index.md +20 -0
- package/expertise/antipatterns/performance/performance-antipatterns.md +1013 -0
- package/expertise/antipatterns/performance/premature-optimization.md +623 -0
- package/expertise/antipatterns/performance/scaling-antipatterns.md +785 -0
- package/expertise/antipatterns/process/ai-coding-antipatterns.md +853 -0
- package/expertise/antipatterns/process/code-review-antipatterns.md +656 -0
- package/expertise/antipatterns/process/deployment-antipatterns.md +920 -0
- package/expertise/antipatterns/process/index.md +23 -0
- package/expertise/antipatterns/process/technical-debt-antipatterns.md +647 -0
- package/expertise/antipatterns/security/index.md +20 -0
- package/expertise/antipatterns/security/secrets-antipatterns.md +849 -0
- package/expertise/antipatterns/security/security-theater.md +843 -0
- package/expertise/antipatterns/security/vulnerability-patterns.md +801 -0
- package/expertise/architecture/PROGRESS.md +70 -0
- package/expertise/architecture/data/caching-architecture.md +671 -0
- package/expertise/architecture/data/data-consistency.md +574 -0
- package/expertise/architecture/data/data-modeling.md +536 -0
- package/expertise/architecture/data/event-streams-and-queues.md +634 -0
- package/expertise/architecture/data/index.md +25 -0
- package/expertise/architecture/data/search-architecture.md +663 -0
- package/expertise/architecture/data/sql-vs-nosql.md +708 -0
- package/expertise/architecture/decisions/architecture-decision-records.md +640 -0
- package/expertise/architecture/decisions/build-vs-buy.md +616 -0
- package/expertise/architecture/decisions/index.md +23 -0
- package/expertise/architecture/decisions/monolith-to-microservices.md +790 -0
- package/expertise/architecture/decisions/technology-selection.md +616 -0
- package/expertise/architecture/distributed/cap-theorem-and-tradeoffs.md +800 -0
- package/expertise/architecture/distributed/circuit-breaker-bulkhead.md +741 -0
- package/expertise/architecture/distributed/consensus-and-coordination.md +796 -0
- package/expertise/architecture/distributed/distributed-systems-fundamentals.md +564 -0
- package/expertise/architecture/distributed/idempotency-and-retry.md +796 -0
- package/expertise/architecture/distributed/index.md +25 -0
- package/expertise/architecture/distributed/saga-pattern.md +797 -0
- package/expertise/architecture/foundations/architectural-thinking.md +460 -0
- package/expertise/architecture/foundations/coupling-and-cohesion.md +770 -0
- package/expertise/architecture/foundations/design-principles-solid.md +649 -0
- package/expertise/architecture/foundations/domain-driven-design.md +719 -0
- package/expertise/architecture/foundations/index.md +25 -0
- package/expertise/architecture/foundations/separation-of-concerns.md +472 -0
- package/expertise/architecture/foundations/twelve-factor-app.md +797 -0
- package/expertise/architecture/index.md +34 -0
- package/expertise/architecture/integration/api-design-graphql.md +638 -0
- package/expertise/architecture/integration/api-design-grpc.md +804 -0
- package/expertise/architecture/integration/api-design-rest.md +892 -0
- package/expertise/architecture/integration/index.md +25 -0
- package/expertise/architecture/integration/third-party-integration.md +795 -0
- package/expertise/architecture/integration/webhooks-and-callbacks.md +1152 -0
- package/expertise/architecture/integration/websockets-realtime.md +791 -0
- package/expertise/architecture/mobile-architecture/index.md +22 -0
- package/expertise/architecture/mobile-architecture/mobile-app-architecture.md +780 -0
- package/expertise/architecture/mobile-architecture/mobile-backend-for-frontend.md +670 -0
- package/expertise/architecture/mobile-architecture/offline-first.md +719 -0
- package/expertise/architecture/mobile-architecture/push-and-sync.md +782 -0
- package/expertise/architecture/patterns/cqrs-event-sourcing.md +717 -0
- package/expertise/architecture/patterns/event-driven.md +797 -0
- package/expertise/architecture/patterns/hexagonal-clean-architecture.md +870 -0
- package/expertise/architecture/patterns/index.md +27 -0
- package/expertise/architecture/patterns/layered-architecture.md +736 -0
- package/expertise/architecture/patterns/microservices.md +753 -0
- package/expertise/architecture/patterns/modular-monolith.md +692 -0
- package/expertise/architecture/patterns/monolith.md +626 -0
- package/expertise/architecture/patterns/plugin-architecture.md +735 -0
- package/expertise/architecture/patterns/serverless.md +780 -0
- package/expertise/architecture/scaling/database-scaling.md +615 -0
- package/expertise/architecture/scaling/feature-flags-and-rollouts.md +757 -0
- package/expertise/architecture/scaling/horizontal-vs-vertical.md +606 -0
- package/expertise/architecture/scaling/index.md +24 -0
- package/expertise/architecture/scaling/multi-tenancy.md +800 -0
- package/expertise/architecture/scaling/stateless-design.md +787 -0
- package/expertise/backend/embedded-firmware.md +625 -0
- package/expertise/backend/go.md +853 -0
- package/expertise/backend/index.md +24 -0
- package/expertise/backend/java-spring.md +448 -0
- package/expertise/backend/node-typescript.md +625 -0
- package/expertise/backend/python-fastapi.md +724 -0
- package/expertise/backend/rust.md +458 -0
- package/expertise/backend/solidity.md +711 -0
- package/expertise/composition-map.yaml +443 -0
- package/expertise/content/foundations/content-modeling.md +395 -0
- package/expertise/content/foundations/editorial-standards.md +449 -0
- package/expertise/content/foundations/index.md +24 -0
- package/expertise/content/foundations/microcopy.md +455 -0
- package/expertise/content/foundations/terminology-governance.md +509 -0
- package/expertise/content/index.md +34 -0
- package/expertise/content/patterns/accessibility-copy.md +518 -0
- package/expertise/content/patterns/index.md +24 -0
- package/expertise/content/patterns/notification-content.md +433 -0
- package/expertise/content/patterns/sample-content.md +486 -0
- package/expertise/content/patterns/state-copy.md +439 -0
- package/expertise/design/PROGRESS.md +58 -0
- package/expertise/design/disciplines/dark-mode-theming.md +577 -0
- package/expertise/design/disciplines/design-systems.md +595 -0
- package/expertise/design/disciplines/index.md +25 -0
- package/expertise/design/disciplines/information-architecture.md +800 -0
- package/expertise/design/disciplines/interaction-design.md +788 -0
- package/expertise/design/disciplines/responsive-design.md +552 -0
- package/expertise/design/disciplines/usability-testing.md +516 -0
- package/expertise/design/disciplines/user-research.md +792 -0
- package/expertise/design/foundations/accessibility-design.md +796 -0
- package/expertise/design/foundations/color-theory.md +797 -0
- package/expertise/design/foundations/iconography.md +795 -0
- package/expertise/design/foundations/index.md +26 -0
- package/expertise/design/foundations/motion-and-animation.md +653 -0
- package/expertise/design/foundations/rtl-design.md +585 -0
- package/expertise/design/foundations/spacing-and-layout.md +607 -0
- package/expertise/design/foundations/typography.md +800 -0
- package/expertise/design/foundations/visual-hierarchy.md +761 -0
- package/expertise/design/index.md +32 -0
- package/expertise/design/patterns/authentication-flows.md +474 -0
- package/expertise/design/patterns/content-consumption.md +789 -0
- package/expertise/design/patterns/data-display.md +618 -0
- package/expertise/design/patterns/e-commerce.md +1494 -0
- package/expertise/design/patterns/feedback-and-states.md +642 -0
- package/expertise/design/patterns/forms-and-input.md +819 -0
- package/expertise/design/patterns/gamification.md +801 -0
- package/expertise/design/patterns/index.md +31 -0
- package/expertise/design/patterns/microinteractions.md +449 -0
- package/expertise/design/patterns/navigation.md +800 -0
- package/expertise/design/patterns/notifications.md +705 -0
- package/expertise/design/patterns/onboarding.md +700 -0
- package/expertise/design/patterns/search-and-filter.md +601 -0
- package/expertise/design/patterns/settings-and-preferences.md +768 -0
- package/expertise/design/patterns/social-and-community.md +748 -0
- package/expertise/design/platforms/desktop-native.md +612 -0
- package/expertise/design/platforms/index.md +25 -0
- package/expertise/design/platforms/mobile-android.md +825 -0
- package/expertise/design/platforms/mobile-cross-platform.md +983 -0
- package/expertise/design/platforms/mobile-ios.md +699 -0
- package/expertise/design/platforms/tablet.md +794 -0
- package/expertise/design/platforms/web-dashboard.md +790 -0
- package/expertise/design/platforms/web-responsive.md +550 -0
- package/expertise/design/psychology/behavioral-nudges.md +449 -0
- package/expertise/design/psychology/cognitive-load.md +1191 -0
- package/expertise/design/psychology/error-psychology.md +778 -0
- package/expertise/design/psychology/index.md +22 -0
- package/expertise/design/psychology/persuasive-design.md +736 -0
- package/expertise/design/psychology/user-mental-models.md +623 -0
- package/expertise/design/tooling/open-pencil.md +266 -0
- package/expertise/frontend/angular.md +1073 -0
- package/expertise/frontend/desktop-electron.md +546 -0
- package/expertise/frontend/flutter.md +782 -0
- package/expertise/frontend/index.md +27 -0
- package/expertise/frontend/native-android.md +409 -0
- package/expertise/frontend/native-ios.md +490 -0
- package/expertise/frontend/react-native.md +1160 -0
- package/expertise/frontend/react.md +808 -0
- package/expertise/frontend/vue.md +1089 -0
- package/expertise/humanize/domain-rules-code.md +79 -0
- package/expertise/humanize/domain-rules-content.md +67 -0
- package/expertise/humanize/domain-rules-technical-docs.md +56 -0
- package/expertise/humanize/index.md +35 -0
- package/expertise/humanize/self-audit-checklist.md +87 -0
- package/expertise/humanize/sentence-patterns.md +218 -0
- package/expertise/humanize/vocabulary-blacklist.md +105 -0
- package/expertise/i18n/PROGRESS.md +65 -0
- package/expertise/i18n/advanced/accessibility-and-i18n.md +28 -0
- package/expertise/i18n/advanced/bidirectional-text-algorithm.md +38 -0
- package/expertise/i18n/advanced/complex-scripts.md +30 -0
- package/expertise/i18n/advanced/performance-and-i18n.md +27 -0
- package/expertise/i18n/advanced/testing-i18n.md +28 -0
- package/expertise/i18n/content/content-adaptation.md +23 -0
- package/expertise/i18n/content/locale-specific-formatting.md +23 -0
- package/expertise/i18n/content/machine-translation-integration.md +28 -0
- package/expertise/i18n/content/translation-management.md +29 -0
- package/expertise/i18n/foundations/date-time-calendars.md +67 -0
- package/expertise/i18n/foundations/i18n-architecture.md +272 -0
- package/expertise/i18n/foundations/locale-and-language-tags.md +79 -0
- package/expertise/i18n/foundations/numbers-currency-units.md +61 -0
- package/expertise/i18n/foundations/pluralization-and-gender.md +109 -0
- package/expertise/i18n/foundations/string-externalization.md +236 -0
- package/expertise/i18n/foundations/text-direction-bidi.md +241 -0
- package/expertise/i18n/foundations/unicode-and-encoding.md +86 -0
- package/expertise/i18n/index.md +38 -0
- package/expertise/i18n/platform/backend-i18n.md +31 -0
- package/expertise/i18n/platform/flutter-i18n.md +148 -0
- package/expertise/i18n/platform/native-android-i18n.md +36 -0
- package/expertise/i18n/platform/native-ios-i18n.md +36 -0
- package/expertise/i18n/platform/react-i18n.md +103 -0
- package/expertise/i18n/platform/web-css-i18n.md +81 -0
- package/expertise/i18n/rtl/arabic-specific.md +175 -0
- package/expertise/i18n/rtl/hebrew-specific.md +149 -0
- package/expertise/i18n/rtl/rtl-animations-and-transitions.md +111 -0
- package/expertise/i18n/rtl/rtl-forms-and-input.md +161 -0
- package/expertise/i18n/rtl/rtl-fundamentals.md +211 -0
- package/expertise/i18n/rtl/rtl-icons-and-images.md +181 -0
- package/expertise/i18n/rtl/rtl-layout-mirroring.md +252 -0
- package/expertise/i18n/rtl/rtl-navigation-and-gestures.md +107 -0
- package/expertise/i18n/rtl/rtl-testing-and-qa.md +147 -0
- package/expertise/i18n/rtl/rtl-typography.md +160 -0
- package/expertise/index.md +113 -0
- package/expertise/index.yaml +216 -0
- package/expertise/infrastructure/cloud-aws.md +597 -0
- package/expertise/infrastructure/cloud-gcp.md +599 -0
- package/expertise/infrastructure/cybersecurity.md +816 -0
- package/expertise/infrastructure/database-mongodb.md +447 -0
- package/expertise/infrastructure/database-postgres.md +400 -0
- package/expertise/infrastructure/devops-cicd.md +787 -0
- package/expertise/infrastructure/index.md +27 -0
- package/expertise/performance/PROGRESS.md +50 -0
- package/expertise/performance/backend/api-latency.md +1204 -0
- package/expertise/performance/backend/background-jobs.md +506 -0
- package/expertise/performance/backend/connection-pooling.md +1209 -0
- package/expertise/performance/backend/database-query-optimization.md +515 -0
- package/expertise/performance/backend/index.md +23 -0
- package/expertise/performance/backend/rate-limiting-and-throttling.md +971 -0
- package/expertise/performance/foundations/algorithmic-complexity.md +954 -0
- package/expertise/performance/foundations/caching-strategies.md +489 -0
- package/expertise/performance/foundations/concurrency-and-parallelism.md +847 -0
- package/expertise/performance/foundations/index.md +24 -0
- package/expertise/performance/foundations/measuring-and-profiling.md +440 -0
- package/expertise/performance/foundations/memory-management.md +964 -0
- package/expertise/performance/foundations/performance-budgets.md +1314 -0
- package/expertise/performance/index.md +31 -0
- package/expertise/performance/infrastructure/auto-scaling.md +1059 -0
- package/expertise/performance/infrastructure/cdn-and-edge.md +1081 -0
- package/expertise/performance/infrastructure/index.md +22 -0
- package/expertise/performance/infrastructure/load-balancing.md +1081 -0
- package/expertise/performance/infrastructure/observability.md +1079 -0
- package/expertise/performance/mobile/index.md +23 -0
- package/expertise/performance/mobile/mobile-animations.md +544 -0
- package/expertise/performance/mobile/mobile-memory-battery.md +416 -0
- package/expertise/performance/mobile/mobile-network.md +452 -0
- package/expertise/performance/mobile/mobile-rendering.md +599 -0
- package/expertise/performance/mobile/mobile-startup-time.md +505 -0
- package/expertise/performance/platform-specific/flutter-performance.md +647 -0
- package/expertise/performance/platform-specific/index.md +22 -0
- package/expertise/performance/platform-specific/node-performance.md +1307 -0
- package/expertise/performance/platform-specific/postgres-performance.md +1366 -0
- package/expertise/performance/platform-specific/react-performance.md +1403 -0
- package/expertise/performance/web/bundle-optimization.md +1239 -0
- package/expertise/performance/web/image-and-media.md +636 -0
- package/expertise/performance/web/index.md +24 -0
- package/expertise/performance/web/network-optimization.md +1133 -0
- package/expertise/performance/web/rendering-performance.md +1098 -0
- package/expertise/performance/web/ssr-and-hydration.md +918 -0
- package/expertise/performance/web/web-vitals.md +1374 -0
- package/expertise/quality/accessibility.md +985 -0
- package/expertise/quality/evidence-based-verification.md +499 -0
- package/expertise/quality/index.md +24 -0
- package/expertise/quality/ml-model-audit.md +614 -0
- package/expertise/quality/performance.md +600 -0
- package/expertise/quality/testing-api.md +891 -0
- package/expertise/quality/testing-mobile.md +496 -0
- package/expertise/quality/testing-web.md +849 -0
- package/expertise/security/PROGRESS.md +54 -0
- package/expertise/security/agentic-identity.md +540 -0
- package/expertise/security/compliance-frameworks.md +601 -0
- package/expertise/security/data/data-encryption.md +364 -0
- package/expertise/security/data/data-privacy-gdpr.md +692 -0
- package/expertise/security/data/database-security.md +1171 -0
- package/expertise/security/data/index.md +22 -0
- package/expertise/security/data/pii-handling.md +531 -0
- package/expertise/security/foundations/authentication.md +1041 -0
- package/expertise/security/foundations/authorization.md +603 -0
- package/expertise/security/foundations/cryptography.md +1001 -0
- package/expertise/security/foundations/index.md +25 -0
- package/expertise/security/foundations/owasp-top-10.md +1354 -0
- package/expertise/security/foundations/secrets-management.md +1217 -0
- package/expertise/security/foundations/secure-sdlc.md +700 -0
- package/expertise/security/foundations/supply-chain-security.md +698 -0
- package/expertise/security/index.md +31 -0
- package/expertise/security/infrastructure/cloud-security-aws.md +1296 -0
- package/expertise/security/infrastructure/cloud-security-gcp.md +1376 -0
- package/expertise/security/infrastructure/container-security.md +721 -0
- package/expertise/security/infrastructure/incident-response.md +1295 -0
- package/expertise/security/infrastructure/index.md +24 -0
- package/expertise/security/infrastructure/logging-and-monitoring.md +1618 -0
- package/expertise/security/infrastructure/network-security.md +1337 -0
- package/expertise/security/mobile/index.md +23 -0
- package/expertise/security/mobile/mobile-android-security.md +1218 -0
- package/expertise/security/mobile/mobile-binary-protection.md +1229 -0
- package/expertise/security/mobile/mobile-data-storage.md +1265 -0
- package/expertise/security/mobile/mobile-ios-security.md +1401 -0
- package/expertise/security/mobile/mobile-network-security.md +1520 -0
- package/expertise/security/smart-contract-security.md +594 -0
- package/expertise/security/testing/index.md +22 -0
- package/expertise/security/testing/penetration-testing.md +1258 -0
- package/expertise/security/testing/security-code-review.md +1765 -0
- package/expertise/security/testing/threat-modeling.md +1074 -0
- package/expertise/security/testing/vulnerability-scanning.md +1062 -0
- package/expertise/security/web/api-security.md +586 -0
- package/expertise/security/web/cors-and-headers.md +433 -0
- package/expertise/security/web/csrf.md +562 -0
- package/expertise/security/web/file-upload.md +1477 -0
- package/expertise/security/web/index.md +25 -0
- package/expertise/security/web/injection.md +1375 -0
- package/expertise/security/web/session-management.md +1101 -0
- package/expertise/security/web/xss.md +1158 -0
- package/exports/README.md +17 -0
- package/exports/hosts/claude/.claude/agents/clarifier.md +42 -0
- package/exports/hosts/claude/.claude/agents/content-author.md +63 -0
- package/exports/hosts/claude/.claude/agents/designer.md +55 -0
- package/exports/hosts/claude/.claude/agents/executor.md +55 -0
- package/exports/hosts/claude/.claude/agents/learner.md +51 -0
- package/exports/hosts/claude/.claude/agents/planner.md +53 -0
- package/exports/hosts/claude/.claude/agents/researcher.md +43 -0
- package/exports/hosts/claude/.claude/agents/reviewer.md +54 -0
- package/exports/hosts/claude/.claude/agents/specifier.md +47 -0
- package/exports/hosts/claude/.claude/agents/verifier.md +71 -0
- package/exports/hosts/claude/.claude/commands/author.md +42 -0
- package/exports/hosts/claude/.claude/commands/clarify.md +38 -0
- package/exports/hosts/claude/.claude/commands/design-review.md +46 -0
- package/exports/hosts/claude/.claude/commands/design.md +44 -0
- package/exports/hosts/claude/.claude/commands/discover.md +37 -0
- package/exports/hosts/claude/.claude/commands/execute.md +48 -0
- package/exports/hosts/claude/.claude/commands/learn.md +38 -0
- package/exports/hosts/claude/.claude/commands/plan-review.md +42 -0
- package/exports/hosts/claude/.claude/commands/plan.md +39 -0
- package/exports/hosts/claude/.claude/commands/prepare-next.md +37 -0
- package/exports/hosts/claude/.claude/commands/review.md +40 -0
- package/exports/hosts/claude/.claude/commands/run-audit.md +41 -0
- package/exports/hosts/claude/.claude/commands/spec-challenge.md +41 -0
- package/exports/hosts/claude/.claude/commands/specify.md +38 -0
- package/exports/hosts/claude/.claude/commands/verify.md +37 -0
- package/exports/hosts/claude/.claude/settings.json +34 -0
- package/exports/hosts/claude/CLAUDE.md +19 -0
- package/exports/hosts/claude/export.manifest.json +38 -0
- package/exports/hosts/claude/host-package.json +67 -0
- package/exports/hosts/codex/AGENTS.md +19 -0
- package/exports/hosts/codex/export.manifest.json +38 -0
- package/exports/hosts/codex/host-package.json +41 -0
- package/exports/hosts/cursor/.cursor/hooks.json +16 -0
- package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +19 -0
- package/exports/hosts/cursor/export.manifest.json +38 -0
- package/exports/hosts/cursor/host-package.json +42 -0
- package/exports/hosts/gemini/GEMINI.md +19 -0
- package/exports/hosts/gemini/export.manifest.json +38 -0
- package/exports/hosts/gemini/host-package.json +41 -0
- package/hooks/README.md +18 -0
- package/hooks/definitions/loop_cap_guard.yaml +21 -0
- package/hooks/definitions/post_tool_capture.yaml +24 -0
- package/hooks/definitions/pre_compact_summary.yaml +19 -0
- package/hooks/definitions/pre_tool_capture_route.yaml +19 -0
- package/hooks/definitions/protected_path_write_guard.yaml +19 -0
- package/hooks/definitions/session_start.yaml +19 -0
- package/hooks/definitions/stop_handoff_harvest.yaml +20 -0
- package/hooks/loop-cap-guard +17 -0
- package/hooks/post-tool-lint +36 -0
- package/hooks/protected-path-write-guard +17 -0
- package/hooks/session-start +41 -0
- package/llms-full.txt +2355 -0
- package/llms.txt +43 -0
- package/package.json +79 -0
- package/roles/README.md +20 -0
- package/roles/clarifier.md +42 -0
- package/roles/content-author.md +63 -0
- package/roles/designer.md +55 -0
- package/roles/executor.md +55 -0
- package/roles/learner.md +51 -0
- package/roles/planner.md +53 -0
- package/roles/researcher.md +43 -0
- package/roles/reviewer.md +54 -0
- package/roles/specifier.md +47 -0
- package/roles/verifier.md +71 -0
- package/schemas/README.md +24 -0
- package/schemas/accepted-learning.schema.json +20 -0
- package/schemas/author-artifact.schema.json +156 -0
- package/schemas/clarification.schema.json +19 -0
- package/schemas/design-artifact.schema.json +80 -0
- package/schemas/docs-claim.schema.json +18 -0
- package/schemas/export-manifest.schema.json +20 -0
- package/schemas/hook.schema.json +67 -0
- package/schemas/host-export-package.schema.json +18 -0
- package/schemas/implementation-plan.schema.json +19 -0
- package/schemas/proposed-learning.schema.json +19 -0
- package/schemas/research.schema.json +18 -0
- package/schemas/review.schema.json +29 -0
- package/schemas/run-manifest.schema.json +18 -0
- package/schemas/spec-challenge.schema.json +18 -0
- package/schemas/spec.schema.json +20 -0
- package/schemas/usage.schema.json +102 -0
- package/schemas/verification-proof.schema.json +29 -0
- package/schemas/wazir-manifest.schema.json +173 -0
- package/skills/README.md +40 -0
- package/skills/brainstorming/SKILL.md +77 -0
- package/skills/debugging/SKILL.md +50 -0
- package/skills/design/SKILL.md +61 -0
- package/skills/dispatching-parallel-agents/SKILL.md +128 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/finishing-a-development-branch/SKILL.md +169 -0
- package/skills/humanize/SKILL.md +123 -0
- package/skills/init-pipeline/SKILL.md +124 -0
- package/skills/prepare-next/SKILL.md +20 -0
- package/skills/receiving-code-review/SKILL.md +123 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +108 -0
- package/skills/run-audit/SKILL.md +197 -0
- package/skills/scan-project/SKILL.md +41 -0
- package/skills/self-audit/SKILL.md +153 -0
- package/skills/subagent-driven-development/SKILL.md +154 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +102 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/tdd/SKILL.md +23 -0
- package/skills/using-git-worktrees/SKILL.md +163 -0
- package/skills/using-skills/SKILL.md +95 -0
- package/skills/verification/SKILL.md +22 -0
- package/skills/wazir/SKILL.md +463 -0
- package/skills/writing-plans/SKILL.md +30 -0
- package/skills/writing-skills/SKILL.md +157 -0
- package/skills/writing-skills/anthropic-best-practices.md +122 -0
- package/skills/writing-skills/persuasion-principles.md +50 -0
- package/templates/README.md +20 -0
- package/templates/artifacts/README.md +10 -0
- package/templates/artifacts/accepted-learning.md +19 -0
- package/templates/artifacts/accepted-learning.template.json +12 -0
- package/templates/artifacts/author.md +74 -0
- package/templates/artifacts/author.template.json +19 -0
- package/templates/artifacts/clarification.md +21 -0
- package/templates/artifacts/clarification.template.json +12 -0
- package/templates/artifacts/execute-notes.md +19 -0
- package/templates/artifacts/implementation-plan.md +21 -0
- package/templates/artifacts/implementation-plan.template.json +11 -0
- package/templates/artifacts/learning-proposal.md +19 -0
- package/templates/artifacts/next-run-handoff.md +21 -0
- package/templates/artifacts/plan-review.md +19 -0
- package/templates/artifacts/proposed-learning.template.json +12 -0
- package/templates/artifacts/research.md +21 -0
- package/templates/artifacts/research.template.json +12 -0
- package/templates/artifacts/review-findings.md +19 -0
- package/templates/artifacts/review.template.json +11 -0
- package/templates/artifacts/run-manifest.template.json +8 -0
- package/templates/artifacts/spec-challenge.md +19 -0
- package/templates/artifacts/spec-challenge.template.json +11 -0
- package/templates/artifacts/spec.md +21 -0
- package/templates/artifacts/spec.template.json +12 -0
- package/templates/artifacts/verification-proof.md +19 -0
- package/templates/artifacts/verification-proof.template.json +11 -0
- package/templates/examples/accepted-learning.example.json +14 -0
- package/templates/examples/author.example.json +152 -0
- package/templates/examples/clarification.example.json +15 -0
- package/templates/examples/docs-claim.example.json +8 -0
- package/templates/examples/export-manifest.example.json +7 -0
- package/templates/examples/host-export-package.example.json +11 -0
- package/templates/examples/implementation-plan.example.json +17 -0
- package/templates/examples/proposed-learning.example.json +13 -0
- package/templates/examples/research.example.json +15 -0
- package/templates/examples/research.example.md +6 -0
- package/templates/examples/review.example.json +17 -0
- package/templates/examples/run-manifest.example.json +9 -0
- package/templates/examples/spec-challenge.example.json +14 -0
- package/templates/examples/spec.example.json +21 -0
- package/templates/examples/verification-proof.example.json +21 -0
- package/templates/examples/wazir-manifest.example.yaml +65 -0
- package/templates/task-definition-schema.md +99 -0
- package/tooling/README.md +20 -0
- package/tooling/src/adapters/context-mode.js +50 -0
- package/tooling/src/capture/command.js +376 -0
- package/tooling/src/capture/store.js +99 -0
- package/tooling/src/capture/usage.js +270 -0
- package/tooling/src/checks/branches.js +50 -0
- package/tooling/src/checks/brand-truth.js +110 -0
- package/tooling/src/checks/changelog.js +231 -0
- package/tooling/src/checks/command-registry.js +36 -0
- package/tooling/src/checks/commits.js +102 -0
- package/tooling/src/checks/docs-drift.js +103 -0
- package/tooling/src/checks/docs-truth.js +201 -0
- package/tooling/src/checks/runtime-surface.js +156 -0
- package/tooling/src/cli.js +116 -0
- package/tooling/src/command-options.js +56 -0
- package/tooling/src/commands/validate.js +320 -0
- package/tooling/src/doctor/command.js +91 -0
- package/tooling/src/export/command.js +77 -0
- package/tooling/src/export/compiler.js +498 -0
- package/tooling/src/guards/loop-cap-guard.js +52 -0
- package/tooling/src/guards/protected-path-write-guard.js +67 -0
- package/tooling/src/index/command.js +152 -0
- package/tooling/src/index/storage.js +1061 -0
- package/tooling/src/index/summarizers.js +261 -0
- package/tooling/src/loaders.js +18 -0
- package/tooling/src/project-root.js +22 -0
- package/tooling/src/recall/command.js +225 -0
- package/tooling/src/schema-validator.js +30 -0
- package/tooling/src/state-root.js +40 -0
- package/tooling/src/status/command.js +71 -0
- package/wazir.manifest.yaml +135 -0
- package/workflows/README.md +19 -0
- package/workflows/author.md +42 -0
- package/workflows/clarify.md +38 -0
- package/workflows/design-review.md +46 -0
- package/workflows/design.md +44 -0
- package/workflows/discover.md +37 -0
- package/workflows/execute.md +48 -0
- package/workflows/learn.md +38 -0
- package/workflows/plan-review.md +42 -0
- package/workflows/plan.md +39 -0
- package/workflows/prepare-next.md +37 -0
- package/workflows/review.md +40 -0
- package/workflows/run-audit.md +41 -0
- package/workflows/spec-challenge.md +41 -0
- package/workflows/specify.md +38 -0
- package/workflows/verify.md +37 -0
|
@@ -0,0 +1,721 @@
|
|
|
1
|
+
# Container Security Expertise Module
|
|
2
|
+
|
|
3
|
+
> Security guidance for containerized deployments across Docker, Kubernetes, and managed
|
|
4
|
+
> container platforms. Covers image hardening, runtime protection, orchestration security,
|
|
5
|
+
> and compliance. For use by AI agents securing container workloads.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Threat Landscape
|
|
10
|
+
|
|
11
|
+
### 1.1 Container Escape Vulnerabilities
|
|
12
|
+
|
|
13
|
+
Container escapes let attackers break out onto the host OS, compromising all co-located workloads.
|
|
14
|
+
|
|
15
|
+
**CVE-2024-21626 ("Leaky Vessels")** -- File descriptor leak in runc (<=1.1.11) allowed attackers
|
|
16
|
+
to manipulate WORKDIR via a leaked fd referencing the host filesystem. CVSS 8.6. Fixed in runc
|
|
17
|
+
1.1.12, containerd 1.6.28/1.7.13, Docker 25.0.2 (January 2024). Source: nvd.nist.gov.
|
|
18
|
+
|
|
19
|
+
**CVE-2025-31133/52565/52881** -- Three runc vulnerabilities (November 2025) exploiting race
|
|
20
|
+
conditions in /dev/null masking and /dev/console bind mounts. Malicious images could replace
|
|
21
|
+
/dev/null with a symlink, gaining host filesystem read-write. Fixed in runc v1.2.8/v1.3.3.
|
|
22
|
+
Source: sysdig.com.
|
|
23
|
+
|
|
24
|
+
**CVE-2025-9074** -- Docker Desktop vulnerability (CVSS 9.3) letting containers reach the Docker
|
|
25
|
+
Engine API via default subnet even with Enhanced Container Isolation enabled. On Windows,
|
|
26
|
+
attackers could mount the entire host filesystem. Fixed in Docker Desktop 4.44.3. Source: socprime.com.
|
|
27
|
+
|
|
28
|
+
### 1.2 Supply Chain and Malicious Images
|
|
29
|
+
|
|
30
|
+
87% of container images in production contain high or critical vulnerabilities (Red Hat 2024).
|
|
31
|
+
|
|
32
|
+
- **Kong Ingress Controller (2025):** Trojanized image published to Docker Hub after supply chain
|
|
33
|
+
breach, embedding a cryptominer in an image used by thousands of organizations.
|
|
34
|
+
- **SolarWinds (2020):** Trojanized updates injected into a trusted build pipeline affected 18,000
|
|
35
|
+
organizations. The same pattern applies to container image CI/CD pipelines.
|
|
36
|
+
|
|
37
|
+
### 1.3 Secrets in Images
|
|
38
|
+
|
|
39
|
+
Docker layers are permanent. Secrets in any layer (even deleted later) remain accessible via
|
|
40
|
+
`docker history` or layer extraction. Common: API keys, DB credentials, TLS keys.
|
|
41
|
+
|
|
42
|
+
### 1.4 Kubernetes RBAC Misconfiguration
|
|
43
|
+
|
|
44
|
+
89% of organizations experienced at least one K8s security incident in 2024 (Red Hat). Overly
|
|
45
|
+
permissive RBAC lets attackers escalate from a compromised pod to cluster-admin.
|
|
46
|
+
|
|
47
|
+
### 1.5 Exposed Docker Sockets
|
|
48
|
+
|
|
49
|
+
Mounting `/var/run/docker.sock` grants full daemon control -- equivalent to host root. Attackers
|
|
50
|
+
launch privileged containers, mount host filesystem, install persistent backdoors.
|
|
51
|
+
|
|
52
|
+
### 1.6 Cryptojacking
|
|
53
|
+
|
|
54
|
+
**Tesla (2018):** Attackers found an unauthenticated Kubernetes Dashboard, deployed cryptominers
|
|
55
|
+
with evasion (unlisted pool behind CloudFlare, low CPU). Also found exposed AWS S3 credentials
|
|
56
|
+
with telemetry data. Discovered by RedLock. Source: electrek.co.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 2. Core Security Principles
|
|
61
|
+
|
|
62
|
+
**Minimal base images:** Distroless or Alpine. Fewer packages = fewer CVEs, smaller attack surface.
|
|
63
|
+
|
|
64
|
+
**Non-root containers:** Root in container = UID 0 on host. Escape from root = host root access.
|
|
65
|
+
Always set USER in Dockerfile; enforce via SecurityContext.
|
|
66
|
+
|
|
67
|
+
**Immutable infrastructure:** Build once, deploy everywhere. Read-only root filesystems. State in
|
|
68
|
+
mounted volumes or external services.
|
|
69
|
+
|
|
70
|
+
**Image scanning in CI/CD:** Scan at build, before push, and continuously in production. Block
|
|
71
|
+
critical/high CVEs. Tools: Trivy, Snyk Container, Grype, Docker Scout.
|
|
72
|
+
|
|
73
|
+
**Network policies:** K8s pods communicate freely by default. Implement default-deny ingress/egress,
|
|
74
|
+
then explicitly allow required paths.
|
|
75
|
+
|
|
76
|
+
**Pod Security Standards (K8s 1.25+):**
|
|
77
|
+
- **Privileged:** No restrictions (system-level workloads only).
|
|
78
|
+
- **Baseline:** Prevents known privilege escalations. Prohibits hostNetwork/PID/IPC, privileged mode.
|
|
79
|
+
- **Restricted:** Full hardening. Non-root, drop all capabilities, seccomp, read-only rootfs.
|
|
80
|
+
|
|
81
|
+
**Secrets management:** Never in env vars, ConfigMaps, or layers. Use K8s Secrets (encrypted at
|
|
82
|
+
rest via KMS), HashiCorp Vault, CSI Secret Store Driver, or Sealed Secrets.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 3. Implementation Patterns
|
|
87
|
+
|
|
88
|
+
### 3.1 Dockerfile Hardening
|
|
89
|
+
|
|
90
|
+
```dockerfile
|
|
91
|
+
# INSECURE
|
|
92
|
+
FROM ubuntu:latest
|
|
93
|
+
COPY . /app
|
|
94
|
+
ENV DB_PASSWORD=supersecret123
|
|
95
|
+
RUN apt-get update && apt-get install -y curl wget netcat
|
|
96
|
+
CMD ["python", "app.py"]
|
|
97
|
+
|
|
98
|
+
# SECURE - hardened multi-stage build
|
|
99
|
+
FROM python:3.12-slim AS builder
|
|
100
|
+
WORKDIR /build
|
|
101
|
+
COPY requirements.txt .
|
|
102
|
+
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
|
103
|
+
|
|
104
|
+
FROM gcr.io/distroless/python3-debian12:nonroot
|
|
105
|
+
COPY --from=builder /install /usr/local
|
|
106
|
+
COPY --chown=nonroot:nonroot app/ /app/
|
|
107
|
+
WORKDIR /app
|
|
108
|
+
USER nonroot:nonroot
|
|
109
|
+
EXPOSE 8080
|
|
110
|
+
ENTRYPOINT ["python", "app.py"]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 3.2 Image Scanning with Trivy (CI)
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
# .github/workflows/container-scan.yml
|
|
117
|
+
name: Container Security Scan
|
|
118
|
+
on:
|
|
119
|
+
push:
|
|
120
|
+
paths: ['Dockerfile', 'requirements.txt']
|
|
121
|
+
jobs:
|
|
122
|
+
scan:
|
|
123
|
+
runs-on: ubuntu-latest
|
|
124
|
+
steps:
|
|
125
|
+
- uses: actions/checkout@v4
|
|
126
|
+
- name: Build image
|
|
127
|
+
run: docker build -t myapp:${{ github.sha }} .
|
|
128
|
+
- name: Trivy vulnerability scan
|
|
129
|
+
uses: aquasecurity/trivy-action@0.28.0
|
|
130
|
+
with:
|
|
131
|
+
image-ref: 'myapp:${{ github.sha }}'
|
|
132
|
+
format: 'sarif'
|
|
133
|
+
output: 'trivy-results.sarif'
|
|
134
|
+
severity: 'CRITICAL,HIGH'
|
|
135
|
+
exit-code: '1'
|
|
136
|
+
- name: Upload to GitHub Security
|
|
137
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
138
|
+
if: always()
|
|
139
|
+
with:
|
|
140
|
+
sarif_file: 'trivy-results.sarif'
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 3.3 Kubernetes RBAC (Least Privilege)
|
|
144
|
+
|
|
145
|
+
```yaml
|
|
146
|
+
# INSECURE - cluster-admin to dev team
|
|
147
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
148
|
+
kind: ClusterRoleBinding
|
|
149
|
+
metadata:
|
|
150
|
+
name: dev-team-admin
|
|
151
|
+
subjects:
|
|
152
|
+
- kind: Group
|
|
153
|
+
name: dev-team
|
|
154
|
+
apiGroup: rbac.authorization.k8s.io
|
|
155
|
+
roleRef:
|
|
156
|
+
kind: ClusterRole
|
|
157
|
+
name: cluster-admin
|
|
158
|
+
apiGroup: rbac.authorization.k8s.io
|
|
159
|
+
|
|
160
|
+
# SECURE - namespace-scoped, minimal verbs, no secret access
|
|
161
|
+
---
|
|
162
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
163
|
+
kind: Role
|
|
164
|
+
metadata:
|
|
165
|
+
namespace: app-production
|
|
166
|
+
name: app-deployer
|
|
167
|
+
rules:
|
|
168
|
+
- apiGroups: ["apps"]
|
|
169
|
+
resources: ["deployments"]
|
|
170
|
+
verbs: ["get", "list", "watch", "update", "patch"]
|
|
171
|
+
- apiGroups: [""]
|
|
172
|
+
resources: ["pods", "pods/log"]
|
|
173
|
+
verbs: ["get", "list", "watch"]
|
|
174
|
+
---
|
|
175
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
176
|
+
kind: RoleBinding
|
|
177
|
+
metadata:
|
|
178
|
+
name: app-deployer-binding
|
|
179
|
+
namespace: app-production
|
|
180
|
+
subjects:
|
|
181
|
+
- kind: Group
|
|
182
|
+
name: dev-team
|
|
183
|
+
apiGroup: rbac.authorization.k8s.io
|
|
184
|
+
roleRef:
|
|
185
|
+
kind: Role
|
|
186
|
+
name: app-deployer
|
|
187
|
+
apiGroup: rbac.authorization.k8s.io
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 3.4 Network Policies
|
|
191
|
+
|
|
192
|
+
```yaml
|
|
193
|
+
# Default deny all in namespace
|
|
194
|
+
apiVersion: networking.k8s.io/v1
|
|
195
|
+
kind: NetworkPolicy
|
|
196
|
+
metadata:
|
|
197
|
+
name: default-deny-all
|
|
198
|
+
namespace: app-production
|
|
199
|
+
spec:
|
|
200
|
+
podSelector: {}
|
|
201
|
+
policyTypes: [Ingress, Egress]
|
|
202
|
+
---
|
|
203
|
+
# Allow frontend -> backend:8080
|
|
204
|
+
apiVersion: networking.k8s.io/v1
|
|
205
|
+
kind: NetworkPolicy
|
|
206
|
+
metadata:
|
|
207
|
+
name: allow-frontend-to-backend
|
|
208
|
+
namespace: app-production
|
|
209
|
+
spec:
|
|
210
|
+
podSelector:
|
|
211
|
+
matchLabels:
|
|
212
|
+
app: backend
|
|
213
|
+
policyTypes: [Ingress]
|
|
214
|
+
ingress:
|
|
215
|
+
- from:
|
|
216
|
+
- podSelector:
|
|
217
|
+
matchLabels:
|
|
218
|
+
app: frontend
|
|
219
|
+
ports:
|
|
220
|
+
- protocol: TCP
|
|
221
|
+
port: 8080
|
|
222
|
+
---
|
|
223
|
+
# Backend egress: database:5432 + DNS
|
|
224
|
+
apiVersion: networking.k8s.io/v1
|
|
225
|
+
kind: NetworkPolicy
|
|
226
|
+
metadata:
|
|
227
|
+
name: backend-egress
|
|
228
|
+
namespace: app-production
|
|
229
|
+
spec:
|
|
230
|
+
podSelector:
|
|
231
|
+
matchLabels:
|
|
232
|
+
app: backend
|
|
233
|
+
policyTypes: [Egress]
|
|
234
|
+
egress:
|
|
235
|
+
- to:
|
|
236
|
+
- podSelector:
|
|
237
|
+
matchLabels:
|
|
238
|
+
app: database
|
|
239
|
+
ports:
|
|
240
|
+
- { protocol: TCP, port: 5432 }
|
|
241
|
+
- ports:
|
|
242
|
+
- { protocol: UDP, port: 53 }
|
|
243
|
+
- { protocol: TCP, port: 53 }
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 3.5 Pod Security Context
|
|
247
|
+
|
|
248
|
+
```yaml
|
|
249
|
+
apiVersion: apps/v1
|
|
250
|
+
kind: Deployment
|
|
251
|
+
metadata:
|
|
252
|
+
name: secure-app
|
|
253
|
+
namespace: app-production
|
|
254
|
+
spec:
|
|
255
|
+
replicas: 3
|
|
256
|
+
selector:
|
|
257
|
+
matchLabels: { app: secure-app }
|
|
258
|
+
template:
|
|
259
|
+
metadata:
|
|
260
|
+
labels: { app: secure-app }
|
|
261
|
+
spec:
|
|
262
|
+
automountServiceAccountToken: false
|
|
263
|
+
securityContext:
|
|
264
|
+
runAsNonRoot: true
|
|
265
|
+
runAsUser: 10001
|
|
266
|
+
runAsGroup: 10001
|
|
267
|
+
fsGroup: 10001
|
|
268
|
+
seccompProfile:
|
|
269
|
+
type: RuntimeDefault
|
|
270
|
+
containers:
|
|
271
|
+
- name: app
|
|
272
|
+
image: registry.example.com/app@sha256:abc123...
|
|
273
|
+
ports: [{ containerPort: 8080 }]
|
|
274
|
+
securityContext:
|
|
275
|
+
allowPrivilegeEscalation: false
|
|
276
|
+
readOnlyRootFilesystem: true
|
|
277
|
+
capabilities:
|
|
278
|
+
drop: ["ALL"]
|
|
279
|
+
resources:
|
|
280
|
+
limits: { cpu: "500m", memory: "256Mi" }
|
|
281
|
+
requests: { cpu: "100m", memory: "128Mi" }
|
|
282
|
+
volumeMounts:
|
|
283
|
+
- { name: tmp, mountPath: /tmp }
|
|
284
|
+
volumes:
|
|
285
|
+
- name: tmp
|
|
286
|
+
emptyDir: { sizeLimit: 100Mi }
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### 3.6 OPA/Gatekeeper Policy
|
|
290
|
+
|
|
291
|
+
```yaml
|
|
292
|
+
apiVersion: templates.gatekeeper.sh/v1
|
|
293
|
+
kind: ConstraintTemplate
|
|
294
|
+
metadata:
|
|
295
|
+
name: k8srequirenonroot
|
|
296
|
+
spec:
|
|
297
|
+
crd:
|
|
298
|
+
spec:
|
|
299
|
+
names:
|
|
300
|
+
kind: K8sRequireNonRoot
|
|
301
|
+
targets:
|
|
302
|
+
- target: admission.k8s.gatekeeper.sh
|
|
303
|
+
rego: |
|
|
304
|
+
package k8srequirenonroot
|
|
305
|
+
violation[{"msg": msg}] {
|
|
306
|
+
c := input.review.object.spec.containers[_]
|
|
307
|
+
not c.securityContext.runAsNonRoot
|
|
308
|
+
msg := sprintf("Container '%v' must set runAsNonRoot=true", [c.name])
|
|
309
|
+
}
|
|
310
|
+
---
|
|
311
|
+
apiVersion: constraints.gatekeeper.sh/v1beta1
|
|
312
|
+
kind: K8sRequireNonRoot
|
|
313
|
+
metadata:
|
|
314
|
+
name: require-non-root
|
|
315
|
+
spec:
|
|
316
|
+
match:
|
|
317
|
+
kinds: [{ apiGroups: [""], kinds: ["Pod"] }]
|
|
318
|
+
namespaces: ["app-production", "app-staging"]
|
|
319
|
+
enforcementAction: deny
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### 3.7 Service Mesh mTLS (Istio)
|
|
323
|
+
|
|
324
|
+
```yaml
|
|
325
|
+
apiVersion: security.istio.io/v1beta1
|
|
326
|
+
kind: PeerAuthentication
|
|
327
|
+
metadata: { name: default, namespace: istio-system }
|
|
328
|
+
spec:
|
|
329
|
+
mtls: { mode: STRICT }
|
|
330
|
+
---
|
|
331
|
+
apiVersion: security.istio.io/v1beta1
|
|
332
|
+
kind: AuthorizationPolicy
|
|
333
|
+
metadata: { name: backend-authz, namespace: app-production }
|
|
334
|
+
spec:
|
|
335
|
+
selector:
|
|
336
|
+
matchLabels: { app: backend }
|
|
337
|
+
rules:
|
|
338
|
+
- from:
|
|
339
|
+
- source:
|
|
340
|
+
principals: ["cluster.local/ns/app-production/sa/frontend"]
|
|
341
|
+
to:
|
|
342
|
+
- operation: { methods: ["GET", "POST"], paths: ["/api/*"] }
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## 4. Vulnerability Catalog
|
|
348
|
+
|
|
349
|
+
### V-01: Running as Root
|
|
350
|
+
**Risk:** Critical. UID 0 in container = UID 0 on host. Escape = full host compromise.
|
|
351
|
+
**Fix:** `USER nonroot` in Dockerfile + `runAsNonRoot: true` in SecurityContext.
|
|
352
|
+
|
|
353
|
+
### V-02: Docker Socket Mounted
|
|
354
|
+
**Risk:** Critical. Full daemon control = host root. **Fix:** Never mount socket. Use Kaniko
|
|
355
|
+
for in-cluster builds.
|
|
356
|
+
|
|
357
|
+
### V-03: Privileged Containers
|
|
358
|
+
**Risk:** Critical. Disables cgroups, seccomp, AppArmor, all capabilities.
|
|
359
|
+
**Fix:** `privileged: false`, `capabilities: { drop: ["ALL"] }`.
|
|
360
|
+
|
|
361
|
+
### V-04: Secrets in Env Vars / Layers
|
|
362
|
+
**Risk:** High. Visible in `docker inspect`, `kubectl describe`, process listings.
|
|
363
|
+
**Fix:** K8s Secrets with secretKeyRef, or CSI Secret Store Driver.
|
|
364
|
+
|
|
365
|
+
### V-05: `latest` Tag
|
|
366
|
+
**Risk:** High. Mutable, no reproducibility, no audit trail.
|
|
367
|
+
**Fix:** Pin by digest: `image: nginx@sha256:6926dd...`
|
|
368
|
+
|
|
369
|
+
### V-06: No Resource Limits
|
|
370
|
+
**Risk:** Medium. Enables DoS and unlimited cryptomining compute.
|
|
371
|
+
**Fix:** Set `resources.limits` for CPU and memory.
|
|
372
|
+
|
|
373
|
+
### V-07: Host PID/Network/IPC Sharing
|
|
374
|
+
**Risk:** High. Container can see host processes and bind host interfaces.
|
|
375
|
+
**Fix:** `hostPID/hostNetwork/hostIPC: false` (defaults).
|
|
376
|
+
|
|
377
|
+
### V-08: Writable Root Filesystem
|
|
378
|
+
**Risk:** Medium. Attackers write malware, modify binaries, plant backdoors.
|
|
379
|
+
**Fix:** `readOnlyRootFilesystem: true` + emptyDir for /tmp.
|
|
380
|
+
|
|
381
|
+
### V-09: Auto-mounted Service Account Tokens
|
|
382
|
+
**Risk:** High. Compromised pod queries K8s API with token.
|
|
383
|
+
**Fix:** `automountServiceAccountToken: false`.
|
|
384
|
+
|
|
385
|
+
### V-10: Missing Network Policies
|
|
386
|
+
**Risk:** High. Any pod can talk to any pod. Enables lateral movement.
|
|
387
|
+
**Fix:** Default-deny + explicit allow rules (Section 3.4).
|
|
388
|
+
|
|
389
|
+
### V-11: Unscanned / Outdated Base Images
|
|
390
|
+
**Risk:** High. 87% of images have high/critical CVEs.
|
|
391
|
+
**Fix:** Scan in CI, rebuild weekly, set max-age policies.
|
|
392
|
+
|
|
393
|
+
### V-12: allowPrivilegeEscalation=true
|
|
394
|
+
**Risk:** Medium. SUID binaries can gain root.
|
|
395
|
+
**Fix:** `allowPrivilegeEscalation: false`, `capabilities: { drop: ["ALL"] }`.
|
|
396
|
+
|
|
397
|
+
### V-13: No Seccomp Profile
|
|
398
|
+
**Risk:** Medium. Access to 300+ syscalls including ptrace, mount, unshare.
|
|
399
|
+
**Fix:** `seccompProfile: { type: RuntimeDefault }`.
|
|
400
|
+
|
|
401
|
+
### V-14: Exposed Kubernetes Dashboard
|
|
402
|
+
**Risk:** Critical. Unauthenticated dashboard = full cluster control (Tesla 2018 attack).
|
|
403
|
+
**Fix:** Never expose publicly. Require auth. Use `kubectl proxy` only.
|
|
404
|
+
|
|
405
|
+
### V-15: Default Namespace Usage
|
|
406
|
+
**Risk:** Medium. Lacks policies, collects misc workloads.
|
|
407
|
+
**Fix:** Dedicated namespaces with Pod Security Standards labels.
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## 5. Security Checklist
|
|
412
|
+
|
|
413
|
+
### Build Phase
|
|
414
|
+
- [ ] Minimal base images (distroless, Alpine, scratch)
|
|
415
|
+
- [ ] Pin images by digest, never `latest`
|
|
416
|
+
- [ ] Multi-stage builds (exclude build tools from runtime)
|
|
417
|
+
- [ ] Non-root USER in Dockerfile
|
|
418
|
+
- [ ] No secrets in Dockerfile or layers
|
|
419
|
+
- [ ] Scan images in CI (fail on CRITICAL/HIGH)
|
|
420
|
+
- [ ] Lint Dockerfiles (hadolint, Trivy config)
|
|
421
|
+
- [ ] Sign images (cosign/Notation), verify at deploy
|
|
422
|
+
- [ ] Use `.dockerignore` to exclude sensitive files
|
|
423
|
+
|
|
424
|
+
### Deploy Phase
|
|
425
|
+
- [ ] `runAsNonRoot: true`
|
|
426
|
+
- [ ] `readOnlyRootFilesystem: true`
|
|
427
|
+
- [ ] `allowPrivilegeEscalation: false`
|
|
428
|
+
- [ ] Drop ALL capabilities, add only needed
|
|
429
|
+
- [ ] Resource limits (CPU, memory)
|
|
430
|
+
- [ ] Seccomp profile (RuntimeDefault or custom)
|
|
431
|
+
- [ ] `automountServiceAccountToken: false`
|
|
432
|
+
- [ ] Never `privileged: true`
|
|
433
|
+
- [ ] Never share host namespaces
|
|
434
|
+
- [ ] Never mount Docker socket
|
|
435
|
+
|
|
436
|
+
### Cluster Phase
|
|
437
|
+
- [ ] Pod Security Standards (restricted for prod)
|
|
438
|
+
- [ ] Default-deny network policies
|
|
439
|
+
- [ ] Least-privilege RBAC (namespace-scoped)
|
|
440
|
+
- [ ] Audit logging on API server
|
|
441
|
+
- [ ] etcd encryption at rest
|
|
442
|
+
- [ ] OPA/Gatekeeper or Kyverno for policy enforcement
|
|
443
|
+
- [ ] kube-bench CIS compliance checks
|
|
444
|
+
|
|
445
|
+
### Runtime Phase
|
|
446
|
+
- [ ] Falco for runtime threat detection
|
|
447
|
+
- [ ] Alert on unexpected processes (shells in containers)
|
|
448
|
+
- [ ] Alert on anomalous outbound connections
|
|
449
|
+
- [ ] Continuous vulnerability scanning
|
|
450
|
+
- [ ] Centralized log aggregation
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## 6. Tools and Automation
|
|
455
|
+
|
|
456
|
+
### Image Scanning
|
|
457
|
+
| Tool | Type | Key Features |
|
|
458
|
+
|------|------|-------------|
|
|
459
|
+
| **Trivy** | OSS (Aqua) | Images, filesystems, IaC, secrets. SARIF/JSON. CI/CD native. |
|
|
460
|
+
| **Snyk Container** | Commercial+Free | Base image recommendations, IDE integration, registry monitoring. |
|
|
461
|
+
| **Grype** | OSS (Anchore) | Fast scanner. SBOM-based via Syft. |
|
|
462
|
+
| **Docker Scout** | Docker-native | Integrated into Docker Desktop/Hub. Policy-based analysis. |
|
|
463
|
+
|
|
464
|
+
### Runtime Security
|
|
465
|
+
| Tool | Type | Key Features |
|
|
466
|
+
|------|------|-------------|
|
|
467
|
+
| **Falco** | OSS (CNCF) | eBPF-based. Behavioral rules. Cryptojacking detection. |
|
|
468
|
+
| **Tetragon** | OSS (Cilium) | eBPF enforcement. Blocks threats at kernel level. |
|
|
469
|
+
|
|
470
|
+
### Configuration and Compliance
|
|
471
|
+
| Tool | Type | Key Features |
|
|
472
|
+
|------|------|-------------|
|
|
473
|
+
| **kube-bench** | OSS (Aqua) | CIS Kubernetes Benchmark checks. |
|
|
474
|
+
| **kubesec** | OSS | Security risk scoring for K8s manifests. |
|
|
475
|
+
| **Polaris** | OSS (Fairwinds) | Best practices validation. Dashboard + webhook. |
|
|
476
|
+
| **OPA/Gatekeeper** | OSS (CNCF) | Admission control. Rego-based policies. |
|
|
477
|
+
| **Kyverno** | OSS (CNCF) | K8s-native policies. YAML-based (no Rego). |
|
|
478
|
+
|
|
479
|
+
### Supply Chain
|
|
480
|
+
| Tool | Type | Key Features |
|
|
481
|
+
|------|------|-------------|
|
|
482
|
+
| **cosign** | OSS (Sigstore) | Image signing. Keyless via OIDC. |
|
|
483
|
+
| **Syft** | OSS (Anchore) | SBOM generation. CycloneDX/SPDX. |
|
|
484
|
+
|
|
485
|
+
### Trivy CLI Quick Reference
|
|
486
|
+
```bash
|
|
487
|
+
trivy image --severity CRITICAL,HIGH myapp:v1.2.3 # scan image
|
|
488
|
+
trivy image --exit-code 1 --severity CRITICAL myapp:v1 # fail CI on critical
|
|
489
|
+
trivy config --severity HIGH,CRITICAL ./k8s/ # scan K8s manifests
|
|
490
|
+
trivy k8s --report summary cluster # scan running cluster
|
|
491
|
+
trivy image --format cyclonedx --output sbom.json myapp # generate SBOM
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
## 7. Platform-Specific Guidance
|
|
497
|
+
|
|
498
|
+
### Docker
|
|
499
|
+
- Enable Docker Content Trust: `export DOCKER_CONTENT_TRUST=1`
|
|
500
|
+
- User namespace remapping to prevent UID 0 = host root
|
|
501
|
+
- `--security-opt=no-new-privileges` on all containers
|
|
502
|
+
- Use BuildKit `--secret` for build-time secrets (not cached in layers)
|
|
503
|
+
- Never use `--net=host`, `--pid=host`, `--privileged` in production
|
|
504
|
+
- Run docker-bench-security for CIS compliance
|
|
505
|
+
|
|
506
|
+
### Kubernetes (Self-Managed)
|
|
507
|
+
- Pod Security Admission with `restricted` for production namespaces
|
|
508
|
+
- Encrypt etcd at rest (KMS provider)
|
|
509
|
+
- Audit logging with policies covering auth + secret access
|
|
510
|
+
- NetworkPolicy-compatible CNI (Calico, Cilium)
|
|
511
|
+
- Disable anonymous API server authentication
|
|
512
|
+
- Admission webhooks (Gatekeeper/Kyverno)
|
|
513
|
+
|
|
514
|
+
### Amazon EKS
|
|
515
|
+
- IAM Roles for Service Accounts (IRSA) or EKS Pod Identity
|
|
516
|
+
- Fargate profiles for strong isolation (dedicated micro-VM per pod)
|
|
517
|
+
- GuardDuty for EKS runtime threat detection
|
|
518
|
+
- ECR image scanning and envelope encryption for secrets via AWS KMS
|
|
519
|
+
|
|
520
|
+
### Google GKE
|
|
521
|
+
- GKE Autopilot for hardened, managed node configuration
|
|
522
|
+
- Binary Authorization for image signing enforcement
|
|
523
|
+
- Shielded GKE Nodes for verified boot
|
|
524
|
+
- Workload Identity for secure GCP service access
|
|
525
|
+
|
|
526
|
+
### AWS ECS/Fargate
|
|
527
|
+
- Fargate for task-level isolation (dedicated micro-VM per task)
|
|
528
|
+
- Secrets in AWS Secrets Manager, referenced in task definitions
|
|
529
|
+
- Task-level IAM roles (never EC2 instance role)
|
|
530
|
+
|
|
531
|
+
### Podman
|
|
532
|
+
- Rootless by default -- no daemon, no root needed
|
|
533
|
+
- No socket by default (eliminates Docker socket attack vector)
|
|
534
|
+
- Native user namespace, seccomp, SELinux support
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
## 8. Incident Patterns
|
|
539
|
+
|
|
540
|
+
### 8.1 Container Escape Detection
|
|
541
|
+
**IOCs:** Processes outside expected cgroup, unexpected mount operations, access to host
|
|
542
|
+
/proc/1 or /etc/shadow, unusual runc/containerd behavior, fd manipulation.
|
|
543
|
+
|
|
544
|
+
```yaml
|
|
545
|
+
# Falco rule
|
|
546
|
+
- rule: Container Escape via Host Mount
|
|
547
|
+
condition: >
|
|
548
|
+
container and
|
|
549
|
+
(fd.name startswith /proc/1 or fd.name startswith /etc/shadow)
|
|
550
|
+
and not trusted_container
|
|
551
|
+
output: "Host filesystem access (container=%container.name file=%fd.name)"
|
|
552
|
+
priority: CRITICAL
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### 8.2 Cryptojacking Detection
|
|
556
|
+
**IOCs:** Sustained high CPU without load, outbound to ports 3333/4444/5555/8333, mining
|
|
557
|
+
binaries (xmrig, ccminer, minerd), stratum+tcp protocol, "hashrate"/"cryptonight" in args.
|
|
558
|
+
|
|
559
|
+
```yaml
|
|
560
|
+
# Falco rule
|
|
561
|
+
- rule: Detect Cryptomining
|
|
562
|
+
condition: >
|
|
563
|
+
spawned_process and container and
|
|
564
|
+
(proc.name in (xmrig, ccminer, minerd) or
|
|
565
|
+
proc.args contains "stratum+tcp" or
|
|
566
|
+
proc.args contains "cryptonight")
|
|
567
|
+
output: "Cryptomining detected (container=%container.name cmd=%proc.cmdline)"
|
|
568
|
+
priority: CRITICAL
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
### 8.3 Compromised Image Detection
|
|
572
|
+
**IOCs:** Digest changes without CI/CD run, unexpected layers, images from unknown registries,
|
|
573
|
+
unexpected binaries (wget, curl, nc, nmap), processes not in entrypoint.
|
|
574
|
+
|
|
575
|
+
### 8.4 RBAC Abuse Detection
|
|
576
|
+
**IOCs:** Service accounts accessing out-of-scope resources, cross-namespace secret listing,
|
|
577
|
+
new ClusterRoleBindings, unusual API requests from pod IPs. Monitor K8s audit logs for
|
|
578
|
+
`verb:create resource:clusterrolebindings` from service accounts.
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## 9. Compliance and Standards
|
|
583
|
+
|
|
584
|
+
### NIST SP 800-190: Application Container Security Guide
|
|
585
|
+
Five risk tiers: (1) Image risks -- vulnerabilities, malware, secrets; (2) Registry risks --
|
|
586
|
+
insecure connections, stale images; (3) Orchestrator risks -- unrestricted traffic, overprivileged
|
|
587
|
+
workloads; (4) Container risks -- runtime vulns, rogue processes; (5) Host OS risks -- large
|
|
588
|
+
attack surface, shared kernel. Key recommendation: use container-specific host OSs.
|
|
589
|
+
|
|
590
|
+
### CIS Docker Benchmark
|
|
591
|
+
100+ checks across: host config, daemon config, daemon files, images/build, container runtime,
|
|
592
|
+
security operations, Docker Swarm. Automate with docker-bench-security.
|
|
593
|
+
|
|
594
|
+
### CIS Kubernetes Benchmark
|
|
595
|
+
Covers: API server (auth, admission, audit), etcd (encryption, auth), kubelet (auth, kernel
|
|
596
|
+
defaults), policies (PSS, network policies, RBAC, secrets). Automate with kube-bench.
|
|
597
|
+
|
|
598
|
+
### SOC 2 Container Controls
|
|
599
|
+
| Criteria | Container Control |
|
|
600
|
+
|----------|------------------|
|
|
601
|
+
| CC6.1 (Logical Access) | RBAC, service accounts, image pull policies |
|
|
602
|
+
| CC7.1 (Config Mgmt) | IaC, GitOps, policy-as-code |
|
|
603
|
+
| CC7.2 (Change Mgmt) | Image signing, admission webhooks, audit logs |
|
|
604
|
+
| CC8.1 (Vuln Mgmt) | Image scanning in CI/CD, continuous monitoring |
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
## 10. Code Examples
|
|
609
|
+
|
|
610
|
+
### 10.1 Complete Secure Deployment
|
|
611
|
+
|
|
612
|
+
```yaml
|
|
613
|
+
apiVersion: v1
|
|
614
|
+
kind: Namespace
|
|
615
|
+
metadata:
|
|
616
|
+
name: secure-app
|
|
617
|
+
labels:
|
|
618
|
+
pod-security.kubernetes.io/enforce: restricted
|
|
619
|
+
pod-security.kubernetes.io/audit: restricted
|
|
620
|
+
pod-security.kubernetes.io/warn: restricted
|
|
621
|
+
---
|
|
622
|
+
apiVersion: v1
|
|
623
|
+
kind: ServiceAccount
|
|
624
|
+
metadata:
|
|
625
|
+
name: secure-app-sa
|
|
626
|
+
namespace: secure-app
|
|
627
|
+
automountServiceAccountToken: false
|
|
628
|
+
---
|
|
629
|
+
apiVersion: apps/v1
|
|
630
|
+
kind: Deployment
|
|
631
|
+
metadata:
|
|
632
|
+
name: secure-app
|
|
633
|
+
namespace: secure-app
|
|
634
|
+
spec:
|
|
635
|
+
replicas: 3
|
|
636
|
+
selector:
|
|
637
|
+
matchLabels: { app: secure-app }
|
|
638
|
+
template:
|
|
639
|
+
metadata:
|
|
640
|
+
labels: { app: secure-app }
|
|
641
|
+
spec:
|
|
642
|
+
serviceAccountName: secure-app-sa
|
|
643
|
+
automountServiceAccountToken: false
|
|
644
|
+
securityContext:
|
|
645
|
+
runAsNonRoot: true
|
|
646
|
+
runAsUser: 65534
|
|
647
|
+
runAsGroup: 65534
|
|
648
|
+
seccompProfile: { type: RuntimeDefault }
|
|
649
|
+
containers:
|
|
650
|
+
- name: app
|
|
651
|
+
image: registry.example.com/app@sha256:a1b2c3d4e5...
|
|
652
|
+
ports: [{ containerPort: 8080 }]
|
|
653
|
+
securityContext:
|
|
654
|
+
allowPrivilegeEscalation: false
|
|
655
|
+
readOnlyRootFilesystem: true
|
|
656
|
+
capabilities: { drop: ["ALL"] }
|
|
657
|
+
resources:
|
|
658
|
+
requests: { cpu: "100m", memory: "128Mi" }
|
|
659
|
+
limits: { cpu: "500m", memory: "256Mi" }
|
|
660
|
+
livenessProbe:
|
|
661
|
+
httpGet: { path: /healthz, port: 8080 }
|
|
662
|
+
readinessProbe:
|
|
663
|
+
httpGet: { path: /ready, port: 8080 }
|
|
664
|
+
volumeMounts: [{ name: tmp, mountPath: /tmp }]
|
|
665
|
+
volumes:
|
|
666
|
+
- name: tmp
|
|
667
|
+
emptyDir: { sizeLimit: 64Mi }
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
### 10.2 Security Gate Script
|
|
671
|
+
|
|
672
|
+
```bash
|
|
673
|
+
#!/usr/bin/env bash
|
|
674
|
+
set -euo pipefail
|
|
675
|
+
IMAGE="${1:?Usage: $0 <image:tag>}"
|
|
676
|
+
|
|
677
|
+
echo "=== Scanning: ${IMAGE} ==="
|
|
678
|
+
trivy image --exit-code 1 --severity HIGH,CRITICAL --ignore-unfixed "${IMAGE}" || {
|
|
679
|
+
echo "BLOCKED: high/critical vulnerabilities found"; exit 1; }
|
|
680
|
+
trivy image --exit-code 1 --scanners secret "${IMAGE}" || {
|
|
681
|
+
echo "BLOCKED: embedded secrets found"; exit 1; }
|
|
682
|
+
trivy image --format cyclonedx --output "sbom.json" "${IMAGE}"
|
|
683
|
+
echo "PASSED: ${IMAGE} cleared security gate"
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
### 10.3 Kyverno: Require Image Digest
|
|
687
|
+
|
|
688
|
+
```yaml
|
|
689
|
+
apiVersion: kyverno.io/v1
|
|
690
|
+
kind: ClusterPolicy
|
|
691
|
+
metadata:
|
|
692
|
+
name: require-image-digest
|
|
693
|
+
spec:
|
|
694
|
+
validationFailureAction: Enforce
|
|
695
|
+
rules:
|
|
696
|
+
- name: check-digest
|
|
697
|
+
match:
|
|
698
|
+
any: [{ resources: { kinds: ["Pod"] } }]
|
|
699
|
+
validate:
|
|
700
|
+
message: "Images must use digest (sha256), not tag."
|
|
701
|
+
pattern:
|
|
702
|
+
spec:
|
|
703
|
+
containers: [{ image: "*@sha256:*" }]
|
|
704
|
+
=(initContainers): [{ image: "*@sha256:*" }]
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
---
|
|
708
|
+
|
|
709
|
+
## References
|
|
710
|
+
|
|
711
|
+
- NIST SP 800-190 (https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-190.pdf)
|
|
712
|
+
- CIS Docker Benchmark (https://www.cisecurity.org/benchmark/docker)
|
|
713
|
+
- K8s Pod Security Standards (https://kubernetes.io/docs/concepts/security/pod-security-standards/)
|
|
714
|
+
- CVE-2024-21626 Leaky Vessels (https://nvd.nist.gov/vuln/detail/cve-2024-21626)
|
|
715
|
+
- CVE-2025-31133 runc escape (https://www.sysdig.com/blog/runc-container-escape-vulnerabilities)
|
|
716
|
+
- CVE-2025-9074 Docker Desktop (https://socprime.com/blog/cve-2025-9074-docker-desktop-vulnerability/)
|
|
717
|
+
- Tesla K8s cryptojacking (https://electrek.co/2018/02/20/tesla-cloud-hijacked-hackers-mine-cryptocurrencies/)
|
|
718
|
+
- OWASP Docker Cheat Sheet (https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html)
|
|
719
|
+
- Red Hat K8s Security Report 2024 (https://www.redhat.com/en/resources/state-kubernetes-security-report)
|
|
720
|
+
- Falco cryptomining detection (https://falco.org/blog/falco-detect-cryptomining/)
|
|
721
|
+
- OPA Gatekeeper (https://github.com/open-policy-agent/gatekeeper)
|