blockmine 1.20.0 → 1.22.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/.claude/agents/README.md +469 -0
- package/.claude/agents/auth-route-debugger.md +118 -0
- package/.claude/agents/auth-route-tester.md +93 -0
- package/.claude/agents/auto-error-resolver.md +97 -0
- package/.claude/agents/build-optimizer.md +236 -0
- package/.claude/agents/code-architecture-reviewer.md +83 -0
- package/.claude/agents/code-refactor-master.md +94 -0
- package/.claude/agents/cost-optimizer.md +134 -0
- package/.claude/agents/deployment-orchestrator.md +113 -0
- package/.claude/agents/documentation-architect.md +82 -0
- package/.claude/agents/frontend-error-fixer.md +77 -0
- package/.claude/agents/iac-code-generator.md +71 -0
- package/.claude/agents/incident-responder.md +346 -0
- package/.claude/agents/infrastructure-architect.md +31 -0
- package/.claude/agents/kubernetes-specialist.md +56 -0
- package/.claude/agents/migration-planner.md +181 -0
- package/.claude/agents/network-architect.md +196 -0
- package/.claude/agents/plan-reviewer.md +52 -0
- package/.claude/agents/refactor-planner.md +63 -0
- package/.claude/agents/security-scanner.md +102 -0
- package/.claude/agents/web-research-specialist.md +78 -0
- package/.claude/commands/cost-analysis.md +315 -0
- package/.claude/commands/dev-docs-update.md +55 -0
- package/.claude/commands/dev-docs.md +51 -0
- package/.claude/commands/incident-debug.md +247 -0
- package/.claude/commands/infra-plan.md +81 -0
- package/.claude/commands/migration-plan.md +478 -0
- package/.claude/commands/route-research-for-testing.md +37 -0
- package/.claude/commands/security-review.md +66 -0
- package/.claude/hooks/CONFIG.md +448 -0
- package/.claude/hooks/README.md +163 -0
- package/.claude/hooks/SKILL_ACTIVATION_COMPLETE.md +226 -0
- package/.claude/hooks/WINDOWS_HOOKS_README.md +151 -0
- package/.claude/hooks/add-skill-activation-banners.ts +132 -0
- package/.claude/hooks/comprehensive-skill-test.ts +1315 -0
- package/.claude/hooks/error-handling-reminder.sh +12 -0
- package/.claude/hooks/error-handling-reminder.ts +222 -0
- package/.claude/hooks/k8s-manifest-validator.sh +56 -0
- package/.claude/hooks/package-lock.json +556 -0
- package/.claude/hooks/package.json +16 -0
- package/.claude/hooks/post-tool-use-tracker.ps1 +174 -0
- package/.claude/hooks/post-tool-use-tracker.sh +183 -0
- package/.claude/hooks/security-policy-check.sh +247 -0
- package/.claude/hooks/skill-activation-prompt.ps1 +10 -0
- package/.claude/hooks/skill-activation-prompt.sh +10 -0
- package/.claude/hooks/skill-activation-prompt.ts +141 -0
- package/.claude/hooks/stop-build-check-enhanced.sh +130 -0
- package/.claude/hooks/terraform-validator.sh +53 -0
- package/.claude/hooks/test-input.json +7 -0
- package/.claude/hooks/test-skill-activation.ts +427 -0
- package/.claude/hooks/trigger-build-resolver.sh +79 -0
- package/.claude/hooks/tsc-check.sh +173 -0
- package/.claude/hooks/tsconfig.json +19 -0
- package/.claude/settings.json +55 -0
- package/.claude/settings.local.json +28 -3
- package/.claude/skills/README.md +507 -0
- package/.claude/skills/api-engineering/SKILL.md +63 -0
- package/.claude/skills/api-engineering/resources/api-versioning.md +88 -0
- package/.claude/skills/api-engineering/resources/graphql-patterns.md +106 -0
- package/.claude/skills/api-engineering/resources/rate-limiting.md +118 -0
- package/.claude/skills/api-engineering/resources/rest-api-design.md +105 -0
- package/.claude/skills/backend-dev-guidelines/SKILL.md +306 -0
- package/.claude/skills/backend-dev-guidelines/resources/architecture-overview.md +451 -0
- package/.claude/skills/backend-dev-guidelines/resources/async-and-errors.md +307 -0
- package/.claude/skills/backend-dev-guidelines/resources/complete-examples.md +638 -0
- package/.claude/skills/backend-dev-guidelines/resources/configuration.md +275 -0
- package/.claude/skills/backend-dev-guidelines/resources/database-patterns.md +224 -0
- package/.claude/skills/backend-dev-guidelines/resources/middleware-guide.md +213 -0
- package/.claude/skills/backend-dev-guidelines/resources/routing-and-controllers.md +756 -0
- package/.claude/skills/backend-dev-guidelines/resources/sentry-and-monitoring.md +336 -0
- package/.claude/skills/backend-dev-guidelines/resources/services-and-repositories.md +789 -0
- package/.claude/skills/backend-dev-guidelines/resources/testing-guide.md +235 -0
- package/.claude/skills/backend-dev-guidelines/resources/validation-patterns.md +754 -0
- package/.claude/skills/budget-and-cost-management/SKILL.md +850 -0
- package/.claude/skills/build-engineering/SKILL.md +431 -0
- package/.claude/skills/build-engineering/resources/artifact-repositories.md +72 -0
- package/.claude/skills/build-engineering/resources/build-caching.md +96 -0
- package/.claude/skills/build-engineering/resources/build-pipelines.md +105 -0
- package/.claude/skills/build-engineering/resources/build-security.md +95 -0
- package/.claude/skills/build-engineering/resources/build-systems.md +389 -0
- package/.claude/skills/build-engineering/resources/compilation-optimization.md +201 -0
- package/.claude/skills/build-engineering/resources/dependency-management.md +73 -0
- package/.claude/skills/build-engineering/resources/monorepo-builds.md +110 -0
- package/.claude/skills/build-engineering/resources/performance-optimization.md +113 -0
- package/.claude/skills/build-engineering/resources/reproducible-builds.md +82 -0
- package/.claude/skills/cloud-engineering/SKILL.md +675 -0
- package/.claude/skills/cloud-engineering/resources/aws-patterns.md +742 -0
- package/.claude/skills/cloud-engineering/resources/azure-patterns.md +714 -0
- package/.claude/skills/cloud-engineering/resources/cleared-cloud-environments.md +987 -0
- package/.claude/skills/cloud-engineering/resources/cloud-cost-optimization.md +757 -0
- package/.claude/skills/cloud-engineering/resources/cloud-networking.md +1058 -0
- package/.claude/skills/cloud-engineering/resources/cloud-security-tools.md +1530 -0
- package/.claude/skills/cloud-engineering/resources/cloud-security.md +990 -0
- package/.claude/skills/cloud-engineering/resources/gcp-patterns.md +758 -0
- package/.claude/skills/cloud-engineering/resources/migration-strategies.md +820 -0
- package/.claude/skills/cloud-engineering/resources/multi-cloud-strategies.md +670 -0
- package/.claude/skills/cloud-engineering/resources/oci-patterns.md +1198 -0
- package/.claude/skills/cloud-engineering/resources/serverless-patterns.md +795 -0
- package/.claude/skills/cloud-engineering/resources/well-architected-frameworks.md +966 -0
- package/.claude/skills/cybersecurity/SKILL.md +409 -0
- package/.claude/skills/cybersecurity/resources/security-architecture.md +266 -0
- package/.claude/skills/database-engineering/SKILL.md +61 -0
- package/.claude/skills/database-engineering/resources/backup-and-recovery.md +72 -0
- package/.claude/skills/database-engineering/resources/database-replication.md +63 -0
- package/.claude/skills/database-engineering/resources/postgresql-fundamentals.md +70 -0
- package/.claude/skills/database-engineering/resources/query-optimization.md +68 -0
- package/.claude/skills/devsecops/SKILL.md +374 -0
- package/.claude/skills/devsecops/resources/ci-cd-security.md +204 -0
- package/.claude/skills/devsecops/resources/compliance-automation.md +530 -0
- package/.claude/skills/devsecops/resources/compliance-frameworks.md +2322 -0
- package/.claude/skills/devsecops/resources/container-security.md +915 -0
- package/.claude/skills/devsecops/resources/cspm-integration.md +1440 -0
- package/.claude/skills/devsecops/resources/policy-enforcement.md +619 -0
- package/.claude/skills/devsecops/resources/secrets-management.md +755 -0
- package/.claude/skills/devsecops/resources/security-monitoring.md +146 -0
- package/.claude/skills/devsecops/resources/security-scanning.md +887 -0
- package/.claude/skills/devsecops/resources/security-testing.md +203 -0
- package/.claude/skills/devsecops/resources/supply-chain-security.md +518 -0
- package/.claude/skills/devsecops/resources/vulnerability-management.md +481 -0
- package/.claude/skills/devsecops/resources/zero-trust-architecture.md +177 -0
- package/.claude/skills/documentation-as-code/SKILL.md +323 -0
- package/.claude/skills/documentation-as-code/resources/api-documentation.md +90 -0
- package/.claude/skills/documentation-as-code/resources/changelog-management.md +79 -0
- package/.claude/skills/documentation-as-code/resources/diagram-generation.md +44 -0
- package/.claude/skills/documentation-as-code/resources/docs-as-code-workflow.md +99 -0
- package/.claude/skills/documentation-as-code/resources/documentation-automation.md +68 -0
- package/.claude/skills/documentation-as-code/resources/documentation-sites.md +79 -0
- package/.claude/skills/documentation-as-code/resources/markdown-best-practices.md +162 -0
- package/.claude/skills/documentation-as-code/resources/openapi-specification.md +77 -0
- package/.claude/skills/documentation-as-code/resources/readme-engineering.md +60 -0
- package/.claude/skills/documentation-as-code/resources/technical-writing-guide.md +202 -0
- package/.claude/skills/engineering-management/SKILL.md +356 -0
- package/.claude/skills/engineering-management/resources/career-ladders.md +609 -0
- package/.claude/skills/engineering-management/resources/hiring-and-assessment.md +555 -0
- package/.claude/skills/engineering-management/resources/one-on-one-guides.md +609 -0
- package/.claude/skills/engineering-management/resources/resource-planning.md +557 -0
- package/.claude/skills/engineering-management/resources/team-organization-patterns.md +491 -0
- package/.claude/skills/engineering-management/resources/technical-interviews.md +474 -0
- package/.claude/skills/engineering-operations-management/SKILL.md +817 -0
- package/.claude/skills/error-tracking/SKILL.md +379 -0
- package/.claude/skills/frontend-dev-guidelines/SKILL.md +403 -0
- package/.claude/skills/frontend-dev-guidelines/resources/common-patterns.md +331 -0
- package/.claude/skills/frontend-dev-guidelines/resources/complete-examples.md +872 -0
- package/.claude/skills/frontend-dev-guidelines/resources/component-patterns.md +502 -0
- package/.claude/skills/frontend-dev-guidelines/resources/data-fetching.md +767 -0
- package/.claude/skills/frontend-dev-guidelines/resources/file-organization.md +502 -0
- package/.claude/skills/frontend-dev-guidelines/resources/loading-and-error-states.md +501 -0
- package/.claude/skills/frontend-dev-guidelines/resources/performance.md +406 -0
- package/.claude/skills/frontend-dev-guidelines/resources/routing-guide.md +364 -0
- package/.claude/skills/frontend-dev-guidelines/resources/styling-guide.md +428 -0
- package/.claude/skills/frontend-dev-guidelines/resources/typescript-standards.md +418 -0
- package/.claude/skills/general-it-engineering/SKILL.md +393 -0
- package/.claude/skills/general-it-engineering/resources/asset-management.md +712 -0
- package/.claude/skills/general-it-engineering/resources/automation-orchestration.md +817 -0
- package/.claude/skills/general-it-engineering/resources/business-continuity.md +786 -0
- package/.claude/skills/general-it-engineering/resources/change-management.md +715 -0
- package/.claude/skills/general-it-engineering/resources/enterprise-monitoring.md +729 -0
- package/.claude/skills/general-it-engineering/resources/help-desk-operations.md +738 -0
- package/.claude/skills/general-it-engineering/resources/incident-service-management.md +834 -0
- package/.claude/skills/general-it-engineering/resources/it-governance.md +753 -0
- package/.claude/skills/general-it-engineering/resources/itil-framework.md +503 -0
- package/.claude/skills/general-it-engineering/resources/service-management.md +669 -0
- package/.claude/skills/infrastructure-architecture/SKILL.md +328 -0
- package/.claude/skills/infrastructure-architecture/resources/architecture-decision-records.md +505 -0
- package/.claude/skills/infrastructure-architecture/resources/architecture-patterns.md +528 -0
- package/.claude/skills/infrastructure-architecture/resources/capacity-planning.md +453 -0
- package/.claude/skills/infrastructure-architecture/resources/cleared-environment-architecture.md +773 -0
- package/.claude/skills/infrastructure-architecture/resources/cost-architecture.md +499 -0
- package/.claude/skills/infrastructure-architecture/resources/data-architecture.md +501 -0
- package/.claude/skills/infrastructure-architecture/resources/disaster-recovery.md +535 -0
- package/.claude/skills/infrastructure-architecture/resources/migration-architecture.md +512 -0
- package/.claude/skills/infrastructure-architecture/resources/multi-region-design.md +608 -0
- package/.claude/skills/infrastructure-architecture/resources/reference-architectures.md +562 -0
- package/.claude/skills/infrastructure-architecture/resources/security-architecture.md +538 -0
- package/.claude/skills/infrastructure-architecture/resources/system-design-principles.md +489 -0
- package/.claude/skills/infrastructure-architecture/resources/workload-classification.md +1000 -0
- package/.claude/skills/infrastructure-strategy/SKILL.md +924 -0
- package/.claude/skills/network-engineering/SKILL.md +385 -0
- package/.claude/skills/network-engineering/resources/dns-management.md +738 -0
- package/.claude/skills/network-engineering/resources/load-balancing.md +820 -0
- package/.claude/skills/network-engineering/resources/network-architecture.md +546 -0
- package/.claude/skills/network-engineering/resources/network-security.md +921 -0
- package/.claude/skills/network-engineering/resources/network-troubleshooting.md +749 -0
- package/.claude/skills/network-engineering/resources/routing-switching.md +373 -0
- package/.claude/skills/network-engineering/resources/sdn-networking.md +695 -0
- package/.claude/skills/network-engineering/resources/service-mesh-networking.md +777 -0
- package/.claude/skills/network-engineering/resources/tcp-ip-protocols.md +444 -0
- package/.claude/skills/network-engineering/resources/vpn-connectivity.md +672 -0
- package/.claude/skills/observability-engineering/SKILL.md +101 -0
- package/.claude/skills/observability-engineering/resources/apm-tools.md +97 -0
- package/.claude/skills/observability-engineering/resources/correlation-strategies.md +87 -0
- package/.claude/skills/observability-engineering/resources/distributed-tracing.md +98 -0
- package/.claude/skills/observability-engineering/resources/logs-aggregation.md +118 -0
- package/.claude/skills/observability-engineering/resources/observability-cost-optimization.md +141 -0
- package/.claude/skills/observability-engineering/resources/opentelemetry.md +110 -0
- package/.claude/skills/platform-engineering/SKILL.md +555 -0
- package/.claude/skills/platform-engineering/resources/architecture-overview.md +600 -0
- package/.claude/skills/platform-engineering/resources/container-orchestration.md +916 -0
- package/.claude/skills/platform-engineering/resources/cost-optimization.md +634 -0
- package/.claude/skills/platform-engineering/resources/developer-platforms.md +670 -0
- package/.claude/skills/platform-engineering/resources/gitops-automation.md +650 -0
- package/.claude/skills/platform-engineering/resources/infrastructure-as-code.md +778 -0
- package/.claude/skills/platform-engineering/resources/infrastructure-standards.md +708 -0
- package/.claude/skills/platform-engineering/resources/multi-tenancy.md +602 -0
- package/.claude/skills/platform-engineering/resources/platform-security.md +711 -0
- package/.claude/skills/platform-engineering/resources/resource-management.md +592 -0
- package/.claude/skills/platform-engineering/resources/service-mesh.md +628 -0
- package/.claude/skills/release-engineering/SKILL.md +393 -0
- package/.claude/skills/release-engineering/resources/artifact-management.md +108 -0
- package/.claude/skills/release-engineering/resources/build-optimization.md +84 -0
- package/.claude/skills/release-engineering/resources/ci-cd-pipelines.md +411 -0
- package/.claude/skills/release-engineering/resources/deployment-strategies.md +197 -0
- package/.claude/skills/release-engineering/resources/pipeline-security.md +62 -0
- package/.claude/skills/release-engineering/resources/progressive-delivery.md +83 -0
- package/.claude/skills/release-engineering/resources/release-automation.md +68 -0
- package/.claude/skills/release-engineering/resources/release-orchestration.md +77 -0
- package/.claude/skills/release-engineering/resources/rollback-strategies.md +66 -0
- package/.claude/skills/release-engineering/resources/versioning-strategies.md +59 -0
- package/.claude/skills/route-tester/SKILL.md +392 -0
- package/.claude/skills/skill-developer/ADVANCED.md +197 -0
- package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +306 -0
- package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +152 -0
- package/.claude/skills/skill-developer/SKILL.md +430 -0
- package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +315 -0
- package/.claude/skills/skill-developer/TRIGGER_TYPES.md +305 -0
- package/.claude/skills/skill-developer/TROUBLESHOOTING.md +514 -0
- package/.claude/skills/skill-rules.json +2940 -0
- package/.claude/skills/sre/SKILL.md +464 -0
- package/.claude/skills/sre/resources/alerting-best-practices.md +282 -0
- package/.claude/skills/sre/resources/capacity-planning.md +226 -0
- package/.claude/skills/sre/resources/chaos-engineering.md +193 -0
- package/.claude/skills/sre/resources/disaster-recovery.md +232 -0
- package/.claude/skills/sre/resources/incident-management.md +436 -0
- package/.claude/skills/sre/resources/observability-stack.md +240 -0
- package/.claude/skills/sre/resources/on-call-runbooks.md +167 -0
- package/.claude/skills/sre/resources/performance-optimization.md +108 -0
- package/.claude/skills/sre/resources/reliability-patterns.md +183 -0
- package/.claude/skills/sre/resources/slo-sli-sla.md +464 -0
- package/.claude/skills/sre/resources/toil-reduction.md +145 -0
- package/.claude/skills/systems-engineering/SKILL.md +648 -0
- package/.claude/skills/systems-engineering/resources/automation-patterns.md +771 -0
- package/.claude/skills/systems-engineering/resources/configuration-management.md +998 -0
- package/.claude/skills/systems-engineering/resources/linux-administration.md +672 -0
- package/.claude/skills/systems-engineering/resources/networking-fundamentals.md +982 -0
- package/.claude/skills/systems-engineering/resources/performance-tuning.md +871 -0
- package/.claude/skills/systems-engineering/resources/powershell-scripting.md +482 -0
- package/.claude/skills/systems-engineering/resources/security-hardening.md +739 -0
- package/.claude/skills/systems-engineering/resources/shell-scripting.md +915 -0
- package/.claude/skills/systems-engineering/resources/storage-management.md +628 -0
- package/.claude/skills/systems-engineering/resources/system-monitoring.md +787 -0
- package/.claude/skills/systems-engineering/resources/troubleshooting-guide.md +753 -0
- package/.claude/skills/systems-engineering/resources/windows-administration.md +738 -0
- package/.claude/skills/technical-leadership/SKILL.md +728 -0
- package/CHANGELOG.md +90 -39
- package/README.md +94 -0
- package/backend/docs/SECRETS_DOCUMENTATION.md +327 -0
- package/backend/jest.config.js +59 -0
- package/backend/package-lock.json +6129 -0
- package/backend/package.json +16 -4
- package/backend/prisma/migrations/20251026104609_add_websocket_api/migration.sql +33 -0
- package/backend/prisma/schema.prisma +33 -0
- package/backend/src/__tests__/core/DependencyService.test.js +336 -0
- package/backend/src/__tests__/core/UserService.test.js +875 -0
- package/backend/src/__tests__/repositories/BaseRepository.test.js +146 -0
- package/backend/src/__tests__/repositories/BotRepository.test.js +118 -0
- package/backend/src/__tests__/repositories/CommandRepository.test.js +132 -0
- package/backend/src/__tests__/repositories/EventGraphRepository.test.js +93 -0
- package/backend/src/__tests__/repositories/GroupRepository.test.js +155 -0
- package/backend/src/__tests__/repositories/PermissionRepository.test.js +130 -0
- package/backend/src/__tests__/repositories/PluginRepository.test.js +107 -0
- package/backend/src/__tests__/repositories/ServerRepository.test.js +80 -0
- package/backend/src/__tests__/repositories/UserRepository.test.js +128 -0
- package/backend/src/__tests__/secretsFilter.test.js +425 -0
- package/backend/src/__tests__/services/BotLifecycleService.test.js +411 -0
- package/backend/src/__tests__/services/BotProcessManager.test.js +285 -0
- package/backend/src/__tests__/services/CacheManager.test.js +125 -0
- package/backend/src/__tests__/services/CommandExecutionService.test.js +460 -0
- package/backend/src/__tests__/services/ResourceMonitorService.test.js +207 -0
- package/backend/src/__tests__/services/TelemetryService.test.js +291 -0
- package/backend/src/__tests__/setup.js +25 -0
- package/backend/src/api/routes/apiKeys.js +181 -0
- package/backend/src/api/routes/bots.js +49 -7
- package/backend/src/api/routes/plugins.js +2 -1
- package/backend/src/api/routes/system.js +174 -0
- package/backend/src/container.js +82 -0
- package/backend/src/core/BotManager.js +142 -871
- package/backend/src/core/BotManager.old.js +1093 -0
- package/backend/src/core/BotProcess.js +1092 -850
- package/backend/src/core/BreakLoopSignal.js +8 -0
- package/backend/src/core/EventGraphManager.js +280 -193
- package/backend/src/core/GraphExecutionEngine.js +321 -928
- package/backend/src/core/MessageQueue.js +27 -6
- package/backend/src/core/NodeRegistry.js +37 -991
- package/backend/src/core/PluginManager.js +62 -12
- package/backend/src/core/PrismaService.js +32 -0
- package/backend/src/core/UserService.js +3 -3
- package/backend/src/core/__tests__/PrismaService.test.js +24 -0
- package/backend/src/core/commands/README.md +305 -0
- package/backend/src/core/commands/dev.js +13 -7
- package/backend/src/core/commands/ping.js +10 -4
- package/backend/src/core/commands/whois.js +63 -0
- package/backend/src/core/config/validation.js +27 -0
- package/backend/src/core/constants/graphTypes.js +21 -0
- package/backend/src/core/node-registries/actions.js +132 -0
- package/backend/src/core/node-registries/arrays.js +137 -0
- package/backend/src/core/node-registries/bot.js +23 -0
- package/backend/src/core/node-registries/data.js +290 -0
- package/backend/src/core/node-registries/debug.js +26 -0
- package/backend/src/core/node-registries/events.js +187 -0
- package/backend/src/core/node-registries/flow.js +139 -0
- package/backend/src/core/node-registries/logic.js +45 -0
- package/backend/src/core/node-registries/math.js +42 -0
- package/backend/src/core/node-registries/objects.js +98 -0
- package/backend/src/core/node-registries/strings.js +153 -0
- package/backend/src/core/node-registries/time.js +113 -0
- package/backend/src/core/node-registries/users.js +79 -0
- package/backend/src/core/nodes/actions/bot_look_at.js +36 -0
- package/backend/src/core/nodes/actions/bot_set_variable.js +32 -0
- package/backend/src/core/nodes/actions/http_request.js +98 -0
- package/backend/src/core/nodes/actions/send_log.js +28 -0
- package/backend/src/core/nodes/actions/send_message.js +32 -0
- package/backend/src/core/nodes/actions/send_websocket_response.js +33 -0
- package/backend/src/core/nodes/arrays/add_element.js +23 -0
- package/backend/src/core/nodes/arrays/contains.js +40 -0
- package/backend/src/core/nodes/arrays/find_index.js +23 -0
- package/backend/src/core/nodes/arrays/get_by_index.js +23 -0
- package/backend/src/core/nodes/arrays/get_next.js +35 -0
- package/backend/src/core/nodes/arrays/get_random_element.js +32 -0
- package/backend/src/core/nodes/arrays/remove_by_index.js +30 -0
- package/backend/src/core/nodes/bot/get_position.js +20 -0
- package/backend/src/core/nodes/data/array_literal.js +31 -0
- package/backend/src/core/nodes/data/boolean_literal.js +21 -0
- package/backend/src/core/nodes/data/cast.js +42 -0
- package/backend/src/core/nodes/data/datetime_literal.js +27 -0
- package/backend/src/core/nodes/data/entity_info.js +69 -0
- package/backend/src/core/nodes/data/get_argument.js +23 -0
- package/backend/src/core/nodes/data/get_bot_look.js +14 -0
- package/backend/src/core/nodes/data/get_entity_field.js +18 -0
- package/backend/src/core/nodes/data/get_nearby_entities.js +32 -0
- package/backend/src/core/nodes/data/get_nearby_players.js +64 -0
- package/backend/src/core/nodes/data/get_server_players.js +18 -0
- package/backend/src/core/nodes/data/get_user_field.js +40 -0
- package/backend/src/core/nodes/data/get_variable.js +23 -0
- package/backend/src/core/nodes/data/length.js +25 -0
- package/backend/src/core/nodes/data/make_object.js +31 -0
- package/backend/src/core/nodes/data/number_literal.js +21 -0
- package/backend/src/core/nodes/data/string_literal.js +34 -0
- package/backend/src/core/nodes/data/type_check.js +53 -0
- package/backend/src/core/nodes/debug/log.js +16 -0
- package/backend/src/core/nodes/flow/branch.js +15 -0
- package/backend/src/core/nodes/flow/break.js +14 -0
- package/backend/src/core/nodes/flow/delay.js +43 -0
- package/backend/src/core/nodes/flow/for_each.js +39 -0
- package/backend/src/core/nodes/flow/sequence.js +16 -0
- package/backend/src/core/nodes/flow/switch.js +47 -0
- package/backend/src/core/nodes/flow/while.js +64 -0
- package/backend/src/core/nodes/logic/__tests__/compare.test.js +83 -0
- package/backend/src/core/nodes/logic/compare.js +33 -0
- package/backend/src/core/nodes/logic/operation.js +35 -0
- package/backend/src/core/nodes/math/__tests__/operation.test.js +65 -0
- package/backend/src/core/nodes/math/operation.js +31 -0
- package/backend/src/core/nodes/math/random_number.js +43 -0
- package/backend/src/core/nodes/objects/create.js +40 -0
- package/backend/src/core/nodes/objects/delete.js +26 -0
- package/backend/src/core/nodes/objects/get.js +23 -0
- package/backend/src/core/nodes/objects/has_key.js +30 -0
- package/backend/src/core/nodes/objects/set.js +27 -0
- package/backend/src/core/nodes/strings/__tests__/concat.test.js +89 -0
- package/backend/src/core/nodes/strings/concat.js +27 -0
- package/backend/src/core/nodes/strings/contains.js +41 -0
- package/backend/src/core/nodes/strings/ends_with.js +43 -0
- package/backend/src/core/nodes/strings/equals.js +36 -0
- package/backend/src/core/nodes/strings/length.js +36 -0
- package/backend/src/core/nodes/strings/matches.js +39 -0
- package/backend/src/core/nodes/strings/split.js +37 -0
- package/backend/src/core/nodes/strings/starts_with.js +43 -0
- package/backend/src/core/nodes/time/__tests__/now.test.js +24 -0
- package/backend/src/core/nodes/time/add.js +33 -0
- package/backend/src/core/nodes/time/compare.js +35 -0
- package/backend/src/core/nodes/time/diff.js +29 -0
- package/backend/src/core/nodes/time/format.js +32 -0
- package/backend/src/core/nodes/time/now.js +18 -0
- package/backend/src/core/nodes/users/check_blacklist.js +37 -0
- package/backend/src/core/nodes/users/get_groups.js +36 -0
- package/backend/src/core/nodes/users/get_permissions.js +36 -0
- package/backend/src/core/nodes/users/set_blacklist.js +37 -0
- package/backend/src/core/services/BotLifecycleService.js +596 -0
- package/backend/src/core/services/BotProcessManager.js +163 -0
- package/backend/src/core/services/CacheManager.js +111 -0
- package/backend/src/core/services/CommandExecutionService.js +351 -0
- package/backend/src/core/services/ResourceMonitorService.js +90 -0
- package/backend/src/core/services/TelemetryService.js +124 -0
- package/backend/src/core/services/ValidationService.js +132 -0
- package/backend/src/core/services/__tests__/ValidationService.test.js +148 -0
- package/backend/src/core/services.js +20 -5
- package/backend/src/core/system/CommandContext.js +84 -0
- package/backend/src/core/system/Transport.js +78 -0
- package/backend/src/core/utils/__tests__/jsonParser.test.js +44 -0
- package/backend/src/core/utils/jsonParser.js +18 -0
- package/backend/src/core/utils/secretsFilter.js +262 -0
- package/backend/src/core/utils/variableParser.js +89 -0
- package/backend/src/core/validation/__tests__/nodeSchemas.test.js +175 -0
- package/backend/src/core/validation/nodeSchemas.js +112 -0
- package/backend/src/lib/prisma.js +2 -4
- package/backend/src/real-time/botApi/handlers/commandHandlers.js +28 -0
- package/backend/src/real-time/botApi/handlers/graphHandlers.js +99 -0
- package/backend/src/real-time/botApi/handlers/graphWebSocketHandlers.js +147 -0
- package/backend/src/real-time/botApi/handlers/index.js +43 -0
- package/backend/src/real-time/botApi/handlers/messageHandlers.js +66 -0
- package/backend/src/real-time/botApi/handlers/statusHandlers.js +17 -0
- package/backend/src/real-time/botApi/handlers/userHandlers.js +141 -0
- package/backend/src/real-time/botApi/index.js +40 -0
- package/backend/src/real-time/botApi/middleware.js +79 -0
- package/backend/src/real-time/botApi/utils.js +54 -0
- package/backend/src/real-time/socketHandler.js +6 -2
- package/backend/src/repositories/BaseRepository.js +43 -0
- package/backend/src/repositories/BotRepository.js +42 -0
- package/backend/src/repositories/CommandRepository.js +53 -0
- package/backend/src/repositories/EventGraphRepository.js +40 -0
- package/backend/src/repositories/GroupRepository.js +69 -0
- package/backend/src/repositories/PermissionRepository.js +48 -0
- package/backend/src/repositories/PluginRepository.js +42 -0
- package/backend/src/repositories/ServerRepository.js +27 -0
- package/backend/src/repositories/UserRepository.js +48 -0
- package/backend/src/server.js +3 -0
- package/backend/src/test-refactor.js +85 -0
- package/frontend/dist/assets/index-CfTo92bP.css +1 -0
- package/frontend/dist/assets/index-CiFD5X9Z.js +8344 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/package.json +1 -5
- package/package.json +2 -1
- package/frontend/dist/assets/index-BFd7YoAj.css +0 -1
- package/frontend/dist/assets/index-CMMutadc.js +0 -8352
- package/nul +0 -0
|
@@ -0,0 +1,1530 @@
|
|
|
1
|
+
# Cloud Security Tools
|
|
2
|
+
|
|
3
|
+
Cloud Security Posture Management (CSPM), Cloud Workload Protection Platforms (CWPP), container security, and native cloud security services.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [Trend Micro Cloud One](#trend-micro-cloud-one)
|
|
9
|
+
- [Prisma Cloud (Palo Alto)](#prisma-cloud-palo-alto)
|
|
10
|
+
- [Wiz](#wiz)
|
|
11
|
+
- [Aqua Security](#aqua-security)
|
|
12
|
+
- [AWS Security Hub](#aws-security-hub)
|
|
13
|
+
- [Microsoft Defender for Cloud](#microsoft-defender-for-cloud)
|
|
14
|
+
- [Google Cloud Security Command Center](#google-cloud-security-command-center)
|
|
15
|
+
- [Tool Comparison](#tool-comparison)
|
|
16
|
+
- [Integration Patterns](#integration-patterns)
|
|
17
|
+
- [Best Practices](#best-practices)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Overview
|
|
22
|
+
|
|
23
|
+
**Cloud Security Tools** provide comprehensive security across cloud environments, including posture management, threat detection, compliance monitoring, and workload protection.
|
|
24
|
+
|
|
25
|
+
**Tool Categories:**
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Security Tool Landscape:
|
|
29
|
+
┌─────────────────────────────────────────────────────┐
|
|
30
|
+
│ CSPM (Cloud Security Posture Management) │
|
|
31
|
+
│ - Configuration scanning │
|
|
32
|
+
│ - Compliance monitoring (FedRAMP, CMMC, PCI-DSS) │
|
|
33
|
+
│ - Misconfiguration detection │
|
|
34
|
+
│ - Policy enforcement │
|
|
35
|
+
├─────────────────────────────────────────────────────┤
|
|
36
|
+
│ CWPP (Cloud Workload Protection Platform) │
|
|
37
|
+
│ - Runtime protection │
|
|
38
|
+
│ - Vulnerability scanning │
|
|
39
|
+
│ - Malware detection │
|
|
40
|
+
│ - File integrity monitoring │
|
|
41
|
+
├─────────────────────────────────────────────────────┤
|
|
42
|
+
│ Container Security │
|
|
43
|
+
│ - Image scanning │
|
|
44
|
+
│ - Runtime security │
|
|
45
|
+
│ - Kubernetes security │
|
|
46
|
+
│ - Registry scanning │
|
|
47
|
+
├─────────────────────────────────────────────────────┤
|
|
48
|
+
│ Code Security (SAST/SCA) │
|
|
49
|
+
│ - Static analysis │
|
|
50
|
+
│ - Dependency scanning │
|
|
51
|
+
│ - IaC security scanning │
|
|
52
|
+
│ - Secret detection │
|
|
53
|
+
└─────────────────────────────────────────────────────┘
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Trend Micro Cloud One
|
|
59
|
+
|
|
60
|
+
**Trend Micro Cloud One** is a comprehensive cloud security platform with modular services for workload, container, network, file storage, and conformity (CSPM).
|
|
61
|
+
|
|
62
|
+
### Components
|
|
63
|
+
|
|
64
|
+
| Component | Purpose | Use Case |
|
|
65
|
+
|-----------|---------|----------|
|
|
66
|
+
| Workload Security | Server/VM protection | Runtime protection, anti-malware |
|
|
67
|
+
| Container Security | Container image scanning | CI/CD integration, registry scanning |
|
|
68
|
+
| Network Security | Virtual patching | IPS/IDS for cloud workloads |
|
|
69
|
+
| File Storage Security | Object storage scanning | S3/Blob malware scanning |
|
|
70
|
+
| Conformity | CSPM, compliance | FedRAMP, CMMC, CIS benchmarks |
|
|
71
|
+
| Application Security | Runtime RASP | Application-level protection |
|
|
72
|
+
|
|
73
|
+
### Conformity (CSPM) Setup
|
|
74
|
+
|
|
75
|
+
**1. AWS Integration:**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Install Conformity CloudFormation template
|
|
79
|
+
aws cloudformation create-stack \
|
|
80
|
+
--stack-name TrendMicroConformity \
|
|
81
|
+
--template-url https://conformity-templates.s3.amazonaws.com/cloudformation/conformity-role.template \
|
|
82
|
+
--parameters \
|
|
83
|
+
ParameterKey=ExternalId,ParameterValue=YOUR_EXTERNAL_ID \
|
|
84
|
+
--capabilities CAPABILITY_NAMED_IAM \
|
|
85
|
+
--region us-east-1
|
|
86
|
+
|
|
87
|
+
# Get Role ARN for Conformity console
|
|
88
|
+
aws cloudformation describe-stacks \
|
|
89
|
+
--stack-name TrendMicroConformity \
|
|
90
|
+
--query 'Stacks[0].Outputs[?OutputKey==`ConformityRoleArn`].OutputValue' \
|
|
91
|
+
--output text
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**2. Terraform Integration:**
|
|
95
|
+
|
|
96
|
+
```hcl
|
|
97
|
+
# Conformity IAM role
|
|
98
|
+
resource "aws_iam_role" "conformity_role" {
|
|
99
|
+
name = "TrendMicroConformityRole"
|
|
100
|
+
|
|
101
|
+
assume_role_policy = jsonencode({
|
|
102
|
+
Version = "2012-10-17"
|
|
103
|
+
Statement = [
|
|
104
|
+
{
|
|
105
|
+
Effect = "Allow"
|
|
106
|
+
Principal = {
|
|
107
|
+
AWS = "arn:aws:iam::717210094962:root"
|
|
108
|
+
}
|
|
109
|
+
Action = "sts:AssumeRole"
|
|
110
|
+
Condition = {
|
|
111
|
+
StringEquals = {
|
|
112
|
+
"sts:ExternalId" = var.conformity_external_id
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
resource "aws_iam_role_policy_attachment" "conformity_readonly" {
|
|
121
|
+
role = aws_iam_role.conformity_role.name
|
|
122
|
+
policy_arn = "arn:aws:iam::aws:policy/ReadOnlyAccess"
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
# Additional permissions for deeper scanning
|
|
126
|
+
resource "aws_iam_role_policy" "conformity_additional" {
|
|
127
|
+
name = "ConformityAdditionalPermissions"
|
|
128
|
+
role = aws_iam_role.conformity_role.id
|
|
129
|
+
|
|
130
|
+
policy = jsonencode({
|
|
131
|
+
Version = "2012-10-17"
|
|
132
|
+
Statement = [
|
|
133
|
+
{
|
|
134
|
+
Effect = "Allow"
|
|
135
|
+
Action = [
|
|
136
|
+
"sns:Publish",
|
|
137
|
+
"s3:GetBucketPublicAccessBlock",
|
|
138
|
+
"s3:GetAccountPublicAccessBlock"
|
|
139
|
+
]
|
|
140
|
+
Resource = "*"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**3. Conformity Rule Configuration:**
|
|
148
|
+
|
|
149
|
+
```yaml
|
|
150
|
+
# conformity-rules.yaml
|
|
151
|
+
# Custom rule profiles for compliance
|
|
152
|
+
---
|
|
153
|
+
rules:
|
|
154
|
+
- id: S3-001
|
|
155
|
+
name: "S3 bucket encryption enabled"
|
|
156
|
+
severity: VERY_HIGH
|
|
157
|
+
enabled: true
|
|
158
|
+
compliance:
|
|
159
|
+
- FedRAMP
|
|
160
|
+
- CMMC-L2
|
|
161
|
+
- NIST-800-171
|
|
162
|
+
|
|
163
|
+
- id: IAM-045
|
|
164
|
+
name: "IAM password policy meets requirements"
|
|
165
|
+
severity: HIGH
|
|
166
|
+
enabled: true
|
|
167
|
+
settings:
|
|
168
|
+
minimumPasswordLength: 14
|
|
169
|
+
requireUppercase: true
|
|
170
|
+
requireLowercase: true
|
|
171
|
+
requireNumbers: true
|
|
172
|
+
requireSymbols: true
|
|
173
|
+
maxPasswordAge: 90
|
|
174
|
+
|
|
175
|
+
- id: VPC-007
|
|
176
|
+
name: "VPC flow logs enabled"
|
|
177
|
+
severity: MEDIUM
|
|
178
|
+
enabled: true
|
|
179
|
+
compliance:
|
|
180
|
+
- FedRAMP
|
|
181
|
+
- PCI-DSS
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**4. Container Security Integration:**
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
# .gitlab-ci.yml integration
|
|
188
|
+
stages:
|
|
189
|
+
- build
|
|
190
|
+
- scan
|
|
191
|
+
- deploy
|
|
192
|
+
|
|
193
|
+
container_scan:
|
|
194
|
+
stage: scan
|
|
195
|
+
image: trendmicro/smartcheck-scan-action:latest
|
|
196
|
+
script:
|
|
197
|
+
- |
|
|
198
|
+
docker run --rm \
|
|
199
|
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
200
|
+
trendmicro/tmas-scan:latest \
|
|
201
|
+
--image-name ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} \
|
|
202
|
+
--smartcheck-host ${SMARTCHECK_HOST} \
|
|
203
|
+
--smartcheck-user ${SMARTCHECK_USER} \
|
|
204
|
+
--smartcheck-password ${SMARTCHECK_PASSWORD} \
|
|
205
|
+
--severity-threshold medium
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Prisma Cloud (Palo Alto)
|
|
211
|
+
|
|
212
|
+
**Prisma Cloud** is a comprehensive Cloud Native Application Protection Platform (CNAPP) providing CSPM, CWPP, and code security.
|
|
213
|
+
|
|
214
|
+
### Capabilities
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
Prisma Cloud Platform:
|
|
218
|
+
┌─────────────────────────────────────────────────────┐
|
|
219
|
+
│ Code Security (Bridgecrew) │
|
|
220
|
+
│ - IaC scanning (Terraform, CloudFormation, K8s) │
|
|
221
|
+
│ - Secret detection in repos │
|
|
222
|
+
│ - VCS integration (GitHub, GitLab, Bitbucket) │
|
|
223
|
+
├─────────────────────────────────────────────────────┤
|
|
224
|
+
│ CSPM (Posture Management) │
|
|
225
|
+
│ - Multi-cloud visibility (AWS, Azure, GCP, OCI) │
|
|
226
|
+
│ - Compliance frameworks (40+) │
|
|
227
|
+
│ - Asset inventory │
|
|
228
|
+
├─────────────────────────────────────────────────────┤
|
|
229
|
+
│ CWPP (Workload Protection) │
|
|
230
|
+
│ - Runtime defense │
|
|
231
|
+
│ - Vulnerability management │
|
|
232
|
+
│ - Compliance scanning │
|
|
233
|
+
├─────────────────────────────────────────────────────┤
|
|
234
|
+
│ Container Security (Twistlock) │
|
|
235
|
+
│ - Image scanning │
|
|
236
|
+
│ - Registry scanning │
|
|
237
|
+
│ - Runtime protection │
|
|
238
|
+
│ - Kubernetes security │
|
|
239
|
+
└─────────────────────────────────────────────────────┘
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### AWS Integration
|
|
243
|
+
|
|
244
|
+
**1. Onboarding AWS Account:**
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Create IAM role for Prisma Cloud
|
|
248
|
+
# Download CloudFormation template from Prisma Cloud console
|
|
249
|
+
aws cloudformation create-stack \
|
|
250
|
+
--stack-name PrismaCloudRole \
|
|
251
|
+
--template-url https://prisma-cloud-templates.s3.amazonaws.com/prisma-cloud-aws-iam-role.template \
|
|
252
|
+
--parameters \
|
|
253
|
+
ParameterKey=PrismaCloudRoleArn,ParameterValue=arn:aws:iam::188619942792:root \
|
|
254
|
+
ParameterKey=ExternalId,ParameterValue=YOUR_EXTERNAL_ID \
|
|
255
|
+
--capabilities CAPABILITY_NAMED_IAM
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**2. Terraform for Prisma Cloud Integration:**
|
|
259
|
+
|
|
260
|
+
```hcl
|
|
261
|
+
# Prisma Cloud provider configuration
|
|
262
|
+
terraform {
|
|
263
|
+
required_providers {
|
|
264
|
+
prismacloud = {
|
|
265
|
+
source = "PaloAltoNetworks/prismacloud"
|
|
266
|
+
version = "~> 1.4"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
provider "prismacloud" {
|
|
272
|
+
url = var.prisma_api_url
|
|
273
|
+
username = var.prisma_access_key
|
|
274
|
+
password = var.prisma_secret_key
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
# Add cloud account to Prisma Cloud
|
|
278
|
+
resource "prismacloud_cloud_account" "aws_account" {
|
|
279
|
+
aws {
|
|
280
|
+
account_id = "123456789012"
|
|
281
|
+
enabled = true
|
|
282
|
+
group_ids = [prismacloud_account_group.production.group_id]
|
|
283
|
+
name = "Production AWS Account"
|
|
284
|
+
role_arn = "arn:aws:iam::123456789012:role/PrismaCloudRole"
|
|
285
|
+
account_type = "account"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
# Create account group
|
|
290
|
+
resource "prismacloud_account_group" "production" {
|
|
291
|
+
name = "Production Accounts"
|
|
292
|
+
description = "All production cloud accounts"
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
# Create alert rule
|
|
296
|
+
resource "prismacloud_alert_rule" "high_severity" {
|
|
297
|
+
name = "High Severity Violations"
|
|
298
|
+
description = "Alert on high severity policy violations"
|
|
299
|
+
enabled = true
|
|
300
|
+
|
|
301
|
+
policies = [
|
|
302
|
+
prismacloud_policy.s3_encryption.policy_id,
|
|
303
|
+
prismacloud_policy.public_s3.policy_id
|
|
304
|
+
]
|
|
305
|
+
|
|
306
|
+
target {
|
|
307
|
+
account_groups = [prismacloud_account_group.production.group_id]
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
notification_config {
|
|
311
|
+
config_type = "email"
|
|
312
|
+
recipients = ["security@company.com"]
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
# Custom policy
|
|
317
|
+
resource "prismacloud_policy" "s3_encryption" {
|
|
318
|
+
name = "S3 Bucket Encryption Mandatory"
|
|
319
|
+
policy_type = "config"
|
|
320
|
+
cloud_type = "aws"
|
|
321
|
+
severity = "high"
|
|
322
|
+
enabled = true
|
|
323
|
+
|
|
324
|
+
rule {
|
|
325
|
+
name = "S3 encryption check"
|
|
326
|
+
rule_type = "Config"
|
|
327
|
+
|
|
328
|
+
criteria = "$.resource.aws_s3_bucket[*].server_side_encryption_configuration does not exist"
|
|
329
|
+
|
|
330
|
+
parameters = {
|
|
331
|
+
savedSearch = "false"
|
|
332
|
+
withIac = "true"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
compliance_metadata {
|
|
337
|
+
compliance_id = "fedramp-high"
|
|
338
|
+
requirement_id = "SC-28"
|
|
339
|
+
requirement_name = "Protection of Information at Rest"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**3. Kubernetes Runtime Protection:**
|
|
345
|
+
|
|
346
|
+
```yaml
|
|
347
|
+
# Deploy Prisma Cloud Defender as DaemonSet
|
|
348
|
+
apiVersion: apps/v1
|
|
349
|
+
kind: DaemonSet
|
|
350
|
+
metadata:
|
|
351
|
+
name: twistlock-defender-ds
|
|
352
|
+
namespace: twistlock
|
|
353
|
+
spec:
|
|
354
|
+
selector:
|
|
355
|
+
matchLabels:
|
|
356
|
+
app: twistlock-defender
|
|
357
|
+
template:
|
|
358
|
+
metadata:
|
|
359
|
+
labels:
|
|
360
|
+
app: twistlock-defender
|
|
361
|
+
spec:
|
|
362
|
+
serviceAccountName: twistlock-service
|
|
363
|
+
hostPID: true
|
|
364
|
+
hostNetwork: true
|
|
365
|
+
containers:
|
|
366
|
+
- name: twistlock-defender
|
|
367
|
+
image: registry.twistlock.com/twistlock/defender:defender_22_12_694
|
|
368
|
+
env:
|
|
369
|
+
- name: DEFENDER_TYPE
|
|
370
|
+
value: "daemonset"
|
|
371
|
+
- name: DEFENDER_LISTENER_TYPE
|
|
372
|
+
value: "none"
|
|
373
|
+
- name: CONSOLE_ADDR
|
|
374
|
+
value: "https://console.prismacloud.io"
|
|
375
|
+
- name: DEFENDER_CLUSTER_ID
|
|
376
|
+
value: "production-cluster"
|
|
377
|
+
securityContext:
|
|
378
|
+
privileged: true
|
|
379
|
+
volumeMounts:
|
|
380
|
+
- name: docker-sock
|
|
381
|
+
mountPath: /var/run/docker.sock
|
|
382
|
+
- name: host-root
|
|
383
|
+
mountPath: /host
|
|
384
|
+
volumes:
|
|
385
|
+
- name: docker-sock
|
|
386
|
+
hostPath:
|
|
387
|
+
path: /var/run/docker.sock
|
|
388
|
+
- name: host-root
|
|
389
|
+
hostPath:
|
|
390
|
+
path: /
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**4. CI/CD Integration:**
|
|
394
|
+
|
|
395
|
+
```yaml
|
|
396
|
+
# GitHub Actions integration
|
|
397
|
+
name: Prisma Cloud IaC Scan
|
|
398
|
+
|
|
399
|
+
on:
|
|
400
|
+
pull_request:
|
|
401
|
+
branches: [main]
|
|
402
|
+
|
|
403
|
+
jobs:
|
|
404
|
+
prisma_cloud_iac_scan:
|
|
405
|
+
runs-on: ubuntu-latest
|
|
406
|
+
steps:
|
|
407
|
+
- uses: actions/checkout@v3
|
|
408
|
+
|
|
409
|
+
- name: Run Prisma Cloud IaC Scan
|
|
410
|
+
uses: bridgecrewio/checkov-action@master
|
|
411
|
+
with:
|
|
412
|
+
api-key: ${{ secrets.PRISMA_ACCESS_KEY }}::${{ secrets.PRISMA_SECRET_KEY }}
|
|
413
|
+
directory: terraform/
|
|
414
|
+
framework: terraform
|
|
415
|
+
soft_fail: false
|
|
416
|
+
output_format: cli,sarif
|
|
417
|
+
output_file_path: console,results.sarif
|
|
418
|
+
|
|
419
|
+
- name: Upload SARIF file
|
|
420
|
+
uses: github/codeql-action/upload-sarif@v2
|
|
421
|
+
with:
|
|
422
|
+
sarif_file: results.sarif
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## Wiz
|
|
428
|
+
|
|
429
|
+
**Wiz** is a cloud security platform providing comprehensive visibility, risk prioritization, and threat detection across multi-cloud environments.
|
|
430
|
+
|
|
431
|
+
### Core Capabilities
|
|
432
|
+
|
|
433
|
+
```
|
|
434
|
+
Wiz Security Platform:
|
|
435
|
+
┌─────────────────────────────────────────────────────┐
|
|
436
|
+
│ Security Graph │
|
|
437
|
+
│ - Full cloud environment mapping │
|
|
438
|
+
│ - Relationship visualization │
|
|
439
|
+
│ - Attack path analysis │
|
|
440
|
+
├─────────────────────────────────────────────────────┤
|
|
441
|
+
│ Risk Prioritization │
|
|
442
|
+
│ - Critical path detection │
|
|
443
|
+
│ - Toxic combinations │
|
|
444
|
+
│ - Exploitability scoring │
|
|
445
|
+
├─────────────────────────────────────────────────────┤
|
|
446
|
+
│ Vulnerability Management │
|
|
447
|
+
│ - VM/container scanning │
|
|
448
|
+
│ - Serverless scanning │
|
|
449
|
+
│ - Prioritized remediation │
|
|
450
|
+
├─────────────────────────────────────────────────────┤
|
|
451
|
+
│ Data Security │
|
|
452
|
+
│ - Sensitive data discovery │
|
|
453
|
+
│ - Data classification │
|
|
454
|
+
│ - Exposure analysis │
|
|
455
|
+
└─────────────────────────────────────────────────────┘
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### AWS Integration
|
|
459
|
+
|
|
460
|
+
**1. Connector Setup:**
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
# Deploy Wiz CloudFormation stack
|
|
464
|
+
# This creates a read-only role for Wiz scanner
|
|
465
|
+
aws cloudformation create-stack \
|
|
466
|
+
--stack-name WizConnector \
|
|
467
|
+
--template-url https://wiz-security-templates.s3.amazonaws.com/connector.yaml \
|
|
468
|
+
--parameters \
|
|
469
|
+
ParameterKey=WizExternalId,ParameterValue=YOUR_EXTERNAL_ID \
|
|
470
|
+
ParameterKey=EnableCloudTrail,ParameterValue=true \
|
|
471
|
+
ParameterKey=EnableVulnerabilityScanning,ParameterValue=true \
|
|
472
|
+
--capabilities CAPABILITY_NAMED_IAM
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
**2. Terraform Wiz Connector:**
|
|
476
|
+
|
|
477
|
+
```hcl
|
|
478
|
+
# Wiz connector IAM role
|
|
479
|
+
resource "aws_iam_role" "wiz_connector" {
|
|
480
|
+
name = "WizSecurityConnector"
|
|
481
|
+
|
|
482
|
+
assume_role_policy = jsonencode({
|
|
483
|
+
Version = "2012-10-17"
|
|
484
|
+
Statement = [
|
|
485
|
+
{
|
|
486
|
+
Effect = "Allow"
|
|
487
|
+
Principal = {
|
|
488
|
+
AWS = "arn:aws:iam::197171649850:root"
|
|
489
|
+
}
|
|
490
|
+
Action = "sts:AssumeRole"
|
|
491
|
+
Condition = {
|
|
492
|
+
StringEquals = {
|
|
493
|
+
"sts:ExternalId" = var.wiz_external_id
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
})
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
# Wiz requires SecurityAudit + additional permissions
|
|
502
|
+
resource "aws_iam_role_policy_attachment" "wiz_security_audit" {
|
|
503
|
+
role = aws_iam_role.wiz_connector.name
|
|
504
|
+
policy_arn = "arn:aws:iam::aws:policy/SecurityAudit"
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
resource "aws_iam_role_policy" "wiz_additional" {
|
|
508
|
+
name = "WizAdditionalPermissions"
|
|
509
|
+
role = aws_iam_role.wiz_connector.id
|
|
510
|
+
|
|
511
|
+
policy = jsonencode({
|
|
512
|
+
Version = "2012-10-17"
|
|
513
|
+
Statement = [
|
|
514
|
+
{
|
|
515
|
+
Sid = "WizVulnerabilityScanning"
|
|
516
|
+
Effect = "Allow"
|
|
517
|
+
Action = [
|
|
518
|
+
"ec2:DescribeImages",
|
|
519
|
+
"ec2:DescribeSnapshots",
|
|
520
|
+
"ec2:CreateSnapshots",
|
|
521
|
+
"ec2:DeleteSnapshot",
|
|
522
|
+
"ecr:GetAuthorizationToken",
|
|
523
|
+
"ecr:BatchCheckLayerAvailability",
|
|
524
|
+
"ecr:GetDownloadUrlForLayer",
|
|
525
|
+
"ecr:BatchGetImage"
|
|
526
|
+
]
|
|
527
|
+
Resource = "*"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
Sid = "WizDataScanning"
|
|
531
|
+
Effect = "Allow"
|
|
532
|
+
Action = [
|
|
533
|
+
"s3:GetObject",
|
|
534
|
+
"s3:ListBucket"
|
|
535
|
+
]
|
|
536
|
+
Resource = [
|
|
537
|
+
"arn:aws:s3:::*/*",
|
|
538
|
+
"arn:aws:s3:::*"
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
]
|
|
542
|
+
})
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
**3. Wiz CLI Integration:**
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
# Install Wiz CLI
|
|
550
|
+
curl -o wizcli https://wizcli.app.wiz.io/wizcli
|
|
551
|
+
chmod +x wizcli
|
|
552
|
+
|
|
553
|
+
# Authenticate
|
|
554
|
+
export WIZ_CLIENT_ID="your-client-id"
|
|
555
|
+
export WIZ_CLIENT_SECRET="your-client-secret"
|
|
556
|
+
|
|
557
|
+
# Scan Docker image
|
|
558
|
+
./wizcli docker scan \
|
|
559
|
+
--image myapp:latest \
|
|
560
|
+
--policy "Production Policy" \
|
|
561
|
+
--output-format json
|
|
562
|
+
|
|
563
|
+
# Scan IaC directory
|
|
564
|
+
./wizcli iac scan \
|
|
565
|
+
--path ./terraform \
|
|
566
|
+
--policy-id abcd1234 \
|
|
567
|
+
--fail-on high
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
**4. API Integration for Automation:**
|
|
571
|
+
|
|
572
|
+
```python
|
|
573
|
+
# wiz_integration.py
|
|
574
|
+
import requests
|
|
575
|
+
import json
|
|
576
|
+
|
|
577
|
+
class WizAPI:
|
|
578
|
+
def __init__(self, client_id, client_secret):
|
|
579
|
+
self.api_url = "https://api.us1.app.wiz.io/graphql"
|
|
580
|
+
self.token = self._authenticate(client_id, client_secret)
|
|
581
|
+
|
|
582
|
+
def _authenticate(self, client_id, client_secret):
|
|
583
|
+
auth_url = "https://auth.app.wiz.io/oauth/token"
|
|
584
|
+
payload = {
|
|
585
|
+
"grant_type": "client_credentials",
|
|
586
|
+
"client_id": client_id,
|
|
587
|
+
"client_secret": client_secret,
|
|
588
|
+
"audience": "wiz-api"
|
|
589
|
+
}
|
|
590
|
+
response = requests.post(auth_url, json=payload)
|
|
591
|
+
return response.json()["access_token"]
|
|
592
|
+
|
|
593
|
+
def query_issues(self, severity="CRITICAL"):
|
|
594
|
+
query = """
|
|
595
|
+
query IssuesTable($filterBy: IssueFilters) {
|
|
596
|
+
issues(filterBy: $filterBy, first: 100) {
|
|
597
|
+
nodes {
|
|
598
|
+
id
|
|
599
|
+
type
|
|
600
|
+
severity
|
|
601
|
+
status
|
|
602
|
+
entitySnapshot {
|
|
603
|
+
name
|
|
604
|
+
type
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
"""
|
|
610
|
+
variables = {
|
|
611
|
+
"filterBy": {
|
|
612
|
+
"severity": [severity],
|
|
613
|
+
"status": ["OPEN"]
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
headers = {"Authorization": f"Bearer {self.token}"}
|
|
618
|
+
response = requests.post(
|
|
619
|
+
self.api_url,
|
|
620
|
+
json={"query": query, "variables": variables},
|
|
621
|
+
headers=headers
|
|
622
|
+
)
|
|
623
|
+
return response.json()
|
|
624
|
+
|
|
625
|
+
# Usage
|
|
626
|
+
wiz = WizAPI(
|
|
627
|
+
client_id="your-client-id",
|
|
628
|
+
client_secret="your-client-secret"
|
|
629
|
+
)
|
|
630
|
+
critical_issues = wiz.query_issues(severity="CRITICAL")
|
|
631
|
+
print(json.dumps(critical_issues, indent=2))
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
## Aqua Security
|
|
637
|
+
|
|
638
|
+
**Aqua Security** provides comprehensive container and cloud-native security from development to runtime.
|
|
639
|
+
|
|
640
|
+
### Platform Components
|
|
641
|
+
|
|
642
|
+
| Component | Purpose |
|
|
643
|
+
|-----------|---------|
|
|
644
|
+
| Aqua Console | Central management, policy engine |
|
|
645
|
+
| Aqua Scanner | Image and registry scanning |
|
|
646
|
+
| Aqua Enforcer | Runtime protection for containers |
|
|
647
|
+
| Aqua Gateway | Communication hub |
|
|
648
|
+
| MicroEnforcer | Lightweight runtime protection |
|
|
649
|
+
| KubeEnforcer | Kubernetes admission controller |
|
|
650
|
+
|
|
651
|
+
### Kubernetes Deployment
|
|
652
|
+
|
|
653
|
+
**1. Deploy Aqua Platform:**
|
|
654
|
+
|
|
655
|
+
```yaml
|
|
656
|
+
# aqua-namespace.yaml
|
|
657
|
+
apiVersion: v1
|
|
658
|
+
kind: Namespace
|
|
659
|
+
metadata:
|
|
660
|
+
name: aqua
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
# aqua-db.yaml (PostgreSQL for Aqua)
|
|
664
|
+
apiVersion: apps/v1
|
|
665
|
+
kind: StatefulSet
|
|
666
|
+
metadata:
|
|
667
|
+
name: aqua-db
|
|
668
|
+
namespace: aqua
|
|
669
|
+
spec:
|
|
670
|
+
serviceName: aqua-db
|
|
671
|
+
replicas: 1
|
|
672
|
+
selector:
|
|
673
|
+
matchLabels:
|
|
674
|
+
app: aqua-db
|
|
675
|
+
template:
|
|
676
|
+
metadata:
|
|
677
|
+
labels:
|
|
678
|
+
app: aqua-db
|
|
679
|
+
spec:
|
|
680
|
+
containers:
|
|
681
|
+
- name: postgres
|
|
682
|
+
image: postgres:13
|
|
683
|
+
env:
|
|
684
|
+
- name: POSTGRES_PASSWORD
|
|
685
|
+
valueFrom:
|
|
686
|
+
secretKeyRef:
|
|
687
|
+
name: aqua-db
|
|
688
|
+
key: password
|
|
689
|
+
volumeMounts:
|
|
690
|
+
- name: postgres-data
|
|
691
|
+
mountPath: /var/lib/postgresql/data
|
|
692
|
+
volumeClaimTemplates:
|
|
693
|
+
- metadata:
|
|
694
|
+
name: postgres-data
|
|
695
|
+
spec:
|
|
696
|
+
accessModes: ["ReadWriteOnce"]
|
|
697
|
+
resources:
|
|
698
|
+
requests:
|
|
699
|
+
storage: 50Gi
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
# aqua-console.yaml
|
|
703
|
+
apiVersion: apps/v1
|
|
704
|
+
kind: Deployment
|
|
705
|
+
metadata:
|
|
706
|
+
name: aqua-console
|
|
707
|
+
namespace: aqua
|
|
708
|
+
spec:
|
|
709
|
+
replicas: 1
|
|
710
|
+
selector:
|
|
711
|
+
matchLabels:
|
|
712
|
+
app: aqua-console
|
|
713
|
+
template:
|
|
714
|
+
metadata:
|
|
715
|
+
labels:
|
|
716
|
+
app: aqua-console
|
|
717
|
+
spec:
|
|
718
|
+
containers:
|
|
719
|
+
- name: aqua-console
|
|
720
|
+
image: registry.aquasec.com/console:2022.4
|
|
721
|
+
env:
|
|
722
|
+
- name: SCALOCK_DBUSER
|
|
723
|
+
value: "postgres"
|
|
724
|
+
- name: SCALOCK_DBPASSWORD
|
|
725
|
+
valueFrom:
|
|
726
|
+
secretKeyRef:
|
|
727
|
+
name: aqua-db
|
|
728
|
+
key: password
|
|
729
|
+
- name: SCALOCK_DBNAME
|
|
730
|
+
value: "scalock"
|
|
731
|
+
- name: SCALOCK_DBHOST
|
|
732
|
+
value: "aqua-db"
|
|
733
|
+
- name: SCALOCK_AUDIT_DBUSER
|
|
734
|
+
value: "postgres"
|
|
735
|
+
- name: SCALOCK_AUDIT_DBPASSWORD
|
|
736
|
+
valueFrom:
|
|
737
|
+
secretKeyRef:
|
|
738
|
+
name: aqua-db
|
|
739
|
+
key: password
|
|
740
|
+
- name: SCALOCK_AUDIT_DBNAME
|
|
741
|
+
value: "slk_audit"
|
|
742
|
+
- name: SCALOCK_AUDIT_DBHOST
|
|
743
|
+
value: "aqua-db"
|
|
744
|
+
ports:
|
|
745
|
+
- containerPort: 8080
|
|
746
|
+
- containerPort: 8443
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
**2. Aqua Enforcer DaemonSet:**
|
|
750
|
+
|
|
751
|
+
```yaml
|
|
752
|
+
# aqua-enforcer.yaml
|
|
753
|
+
apiVersion: apps/v1
|
|
754
|
+
kind: DaemonSet
|
|
755
|
+
metadata:
|
|
756
|
+
name: aqua-enforcer
|
|
757
|
+
namespace: aqua
|
|
758
|
+
spec:
|
|
759
|
+
selector:
|
|
760
|
+
matchLabels:
|
|
761
|
+
app: aqua-enforcer
|
|
762
|
+
template:
|
|
763
|
+
metadata:
|
|
764
|
+
labels:
|
|
765
|
+
app: aqua-enforcer
|
|
766
|
+
spec:
|
|
767
|
+
serviceAccountName: aqua-sa
|
|
768
|
+
hostPID: true
|
|
769
|
+
containers:
|
|
770
|
+
- name: enforcer
|
|
771
|
+
image: registry.aquasec.com/enforcer:2022.4
|
|
772
|
+
env:
|
|
773
|
+
- name: AQUA_TOKEN
|
|
774
|
+
valueFrom:
|
|
775
|
+
secretKeyRef:
|
|
776
|
+
name: aqua-enforcer-token
|
|
777
|
+
key: token
|
|
778
|
+
- name: AQUA_SERVER
|
|
779
|
+
value: "aqua-gateway:8443"
|
|
780
|
+
- name: AQUA_LOGICAL_NAME
|
|
781
|
+
value: "production-cluster"
|
|
782
|
+
securityContext:
|
|
783
|
+
privileged: true
|
|
784
|
+
volumeMounts:
|
|
785
|
+
- name: docker-sock
|
|
786
|
+
mountPath: /var/run/docker.sock
|
|
787
|
+
- name: containerd-sock
|
|
788
|
+
mountPath: /run/containerd/containerd.sock
|
|
789
|
+
volumes:
|
|
790
|
+
- name: docker-sock
|
|
791
|
+
hostPath:
|
|
792
|
+
path: /var/run/docker.sock
|
|
793
|
+
- name: containerd-sock
|
|
794
|
+
hostPath:
|
|
795
|
+
path: /run/containerd/containerd.sock
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
**3. KubeEnforcer (Admission Controller):**
|
|
799
|
+
|
|
800
|
+
```yaml
|
|
801
|
+
# aqua-kube-enforcer.yaml
|
|
802
|
+
apiVersion: admissionregistration.k8s.io/v1
|
|
803
|
+
kind: ValidatingWebhookConfiguration
|
|
804
|
+
metadata:
|
|
805
|
+
name: kube-enforcer-admission-hook
|
|
806
|
+
webhooks:
|
|
807
|
+
- name: imageassurance.aquasec.com
|
|
808
|
+
clientConfig:
|
|
809
|
+
service:
|
|
810
|
+
namespace: aqua
|
|
811
|
+
name: aqua-kube-enforcer
|
|
812
|
+
path: /v1/imagechecks
|
|
813
|
+
caBundle: LS0tLS1CRUdJTi... # Base64 encoded CA cert
|
|
814
|
+
rules:
|
|
815
|
+
- operations: ["CREATE", "UPDATE"]
|
|
816
|
+
apiGroups: ["*"]
|
|
817
|
+
apiVersions: ["*"]
|
|
818
|
+
resources: ["pods"]
|
|
819
|
+
failurePolicy: Fail
|
|
820
|
+
sideEffects: None
|
|
821
|
+
admissionReviewVersions: ["v1", "v1beta1"]
|
|
822
|
+
|
|
823
|
+
---
|
|
824
|
+
apiVersion: apps/v1
|
|
825
|
+
kind: Deployment
|
|
826
|
+
metadata:
|
|
827
|
+
name: aqua-kube-enforcer
|
|
828
|
+
namespace: aqua
|
|
829
|
+
spec:
|
|
830
|
+
replicas: 1
|
|
831
|
+
selector:
|
|
832
|
+
matchLabels:
|
|
833
|
+
app: aqua-kube-enforcer
|
|
834
|
+
template:
|
|
835
|
+
metadata:
|
|
836
|
+
labels:
|
|
837
|
+
app: aqua-kube-enforcer
|
|
838
|
+
spec:
|
|
839
|
+
serviceAccountName: aqua-kube-enforcer-sa
|
|
840
|
+
containers:
|
|
841
|
+
- name: kube-enforcer
|
|
842
|
+
image: registry.aquasec.com/kube-enforcer:2022.4
|
|
843
|
+
env:
|
|
844
|
+
- name: AQUA_TOKEN
|
|
845
|
+
valueFrom:
|
|
846
|
+
secretKeyRef:
|
|
847
|
+
name: aqua-kube-enforcer-token
|
|
848
|
+
key: token
|
|
849
|
+
- name: AQUA_GATEWAY_URL
|
|
850
|
+
value: "aqua-gateway:8443"
|
|
851
|
+
ports:
|
|
852
|
+
- containerPort: 8443
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
**4. CI/CD Scanner Integration:**
|
|
856
|
+
|
|
857
|
+
```yaml
|
|
858
|
+
# .gitlab-ci.yml
|
|
859
|
+
stages:
|
|
860
|
+
- build
|
|
861
|
+
- scan
|
|
862
|
+
- deploy
|
|
863
|
+
|
|
864
|
+
aqua_scan:
|
|
865
|
+
stage: scan
|
|
866
|
+
image: registry.aquasec.com/scanner:2022.4
|
|
867
|
+
script:
|
|
868
|
+
- |
|
|
869
|
+
docker run --rm \
|
|
870
|
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
871
|
+
registry.aquasec.com/scanner:2022.4 \
|
|
872
|
+
scan \
|
|
873
|
+
--host $AQUA_SERVER \
|
|
874
|
+
--user $AQUA_USERNAME \
|
|
875
|
+
--password $AQUA_PASSWORD \
|
|
876
|
+
--register \
|
|
877
|
+
--local ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}
|
|
878
|
+
only:
|
|
879
|
+
- branches
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
---
|
|
883
|
+
|
|
884
|
+
## AWS Security Hub
|
|
885
|
+
|
|
886
|
+
**AWS Security Hub** provides a comprehensive view of security alerts and compliance status across AWS accounts.
|
|
887
|
+
|
|
888
|
+
### Setup and Configuration
|
|
889
|
+
|
|
890
|
+
**1. Enable Security Hub:**
|
|
891
|
+
|
|
892
|
+
```bash
|
|
893
|
+
# Enable Security Hub in all regions
|
|
894
|
+
for region in us-east-1 us-west-2 eu-west-1; do
|
|
895
|
+
aws securityhub enable-security-hub \
|
|
896
|
+
--region $region \
|
|
897
|
+
--enable-default-standards
|
|
898
|
+
done
|
|
899
|
+
|
|
900
|
+
# Enable specific standards
|
|
901
|
+
aws securityhub batch-enable-standards \
|
|
902
|
+
--standards-subscription-requests \
|
|
903
|
+
'[{"StandardsArn":"arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0"}]' \
|
|
904
|
+
--region us-east-1
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
**2. Terraform Configuration:**
|
|
908
|
+
|
|
909
|
+
```hcl
|
|
910
|
+
# Enable Security Hub
|
|
911
|
+
resource "aws_securityhub_account" "main" {}
|
|
912
|
+
|
|
913
|
+
# Enable CIS AWS Foundations Benchmark
|
|
914
|
+
resource "aws_securityhub_standards_subscription" "cis" {
|
|
915
|
+
depends_on = [aws_securityhub_account.main]
|
|
916
|
+
standards_arn = "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0"
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
# Enable AWS Foundational Security Best Practices
|
|
920
|
+
resource "aws_securityhub_standards_subscription" "aws_foundational" {
|
|
921
|
+
depends_on = [aws_securityhub_account.main]
|
|
922
|
+
standards_arn = "arn:aws:securityhub:${data.aws_region.current.name}::standards/aws-foundational-security-best-practices/v/1.0.0"
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
# Enable PCI DSS
|
|
926
|
+
resource "aws_securityhub_standards_subscription" "pci_dss" {
|
|
927
|
+
depends_on = [aws_securityhub_account.main]
|
|
928
|
+
standards_arn = "arn:aws:securityhub:${data.aws_region.current.name}::standards/pci-dss/v/3.2.1"
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
# Custom insights
|
|
932
|
+
resource "aws_securityhub_insight" "critical_findings" {
|
|
933
|
+
filters {
|
|
934
|
+
severity_label {
|
|
935
|
+
comparison = "EQUALS"
|
|
936
|
+
value = "CRITICAL"
|
|
937
|
+
}
|
|
938
|
+
workflow_status {
|
|
939
|
+
comparison = "EQUALS"
|
|
940
|
+
value = "NEW"
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
group_by_attribute = "ResourceType"
|
|
945
|
+
name = "Critical Unresolved Findings by Resource Type"
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
# EventBridge rule for critical findings
|
|
949
|
+
resource "aws_cloudwatch_event_rule" "security_hub_findings" {
|
|
950
|
+
name = "security-hub-critical-findings"
|
|
951
|
+
description = "Capture critical Security Hub findings"
|
|
952
|
+
|
|
953
|
+
event_pattern = jsonencode({
|
|
954
|
+
source = ["aws.securityhub"]
|
|
955
|
+
detail-type = ["Security Hub Findings - Imported"]
|
|
956
|
+
detail = {
|
|
957
|
+
findings = {
|
|
958
|
+
Severity = {
|
|
959
|
+
Label = ["CRITICAL", "HIGH"]
|
|
960
|
+
}
|
|
961
|
+
Workflow = {
|
|
962
|
+
Status = ["NEW"]
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
})
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
resource "aws_cloudwatch_event_target" "sns" {
|
|
970
|
+
rule = aws_cloudwatch_event_rule.security_hub_findings.name
|
|
971
|
+
target_id = "SendToSNS"
|
|
972
|
+
arn = aws_sns_topic.security_alerts.arn
|
|
973
|
+
}
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
**3. Custom Actions:**
|
|
977
|
+
|
|
978
|
+
```python
|
|
979
|
+
# security_hub_automation.py
|
|
980
|
+
import boto3
|
|
981
|
+
import json
|
|
982
|
+
|
|
983
|
+
securityhub = boto3.client('securityhub')
|
|
984
|
+
|
|
985
|
+
def remediate_public_s3_bucket(finding):
|
|
986
|
+
"""Auto-remediate public S3 buckets"""
|
|
987
|
+
s3 = boto3.client('s3')
|
|
988
|
+
bucket_name = finding['Resources'][0]['Id'].split(':')[-1]
|
|
989
|
+
|
|
990
|
+
# Block public access
|
|
991
|
+
s3.put_public_access_block(
|
|
992
|
+
Bucket=bucket_name,
|
|
993
|
+
PublicAccessBlockConfiguration={
|
|
994
|
+
'BlockPublicAcls': True,
|
|
995
|
+
'IgnorePublicAcls': True,
|
|
996
|
+
'BlockPublicPolicy': True,
|
|
997
|
+
'RestrictPublicBuckets': True
|
|
998
|
+
}
|
|
999
|
+
)
|
|
1000
|
+
|
|
1001
|
+
# Update finding status
|
|
1002
|
+
securityhub.batch_update_findings(
|
|
1003
|
+
FindingIdentifiers=[{
|
|
1004
|
+
'Id': finding['Id'],
|
|
1005
|
+
'ProductArn': finding['ProductArn']
|
|
1006
|
+
}],
|
|
1007
|
+
Workflow={'Status': 'RESOLVED'},
|
|
1008
|
+
Note={
|
|
1009
|
+
'Text': 'Auto-remediated: Blocked public access',
|
|
1010
|
+
'UpdatedBy': 'AutoRemediation'
|
|
1011
|
+
}
|
|
1012
|
+
)
|
|
1013
|
+
|
|
1014
|
+
# Lambda handler
|
|
1015
|
+
def lambda_handler(event, context):
|
|
1016
|
+
finding = event['detail']['findings'][0]
|
|
1017
|
+
|
|
1018
|
+
if 'S3.1' in finding['Title']: # S3 bucket public read
|
|
1019
|
+
remediate_public_s3_bucket(finding)
|
|
1020
|
+
|
|
1021
|
+
return {'statusCode': 200}
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
---
|
|
1025
|
+
|
|
1026
|
+
## Microsoft Defender for Cloud
|
|
1027
|
+
|
|
1028
|
+
**Microsoft Defender for Cloud** (formerly Azure Security Center + Azure Defender) provides unified security management and threat protection.
|
|
1029
|
+
|
|
1030
|
+
### Components
|
|
1031
|
+
|
|
1032
|
+
| Component | Purpose |
|
|
1033
|
+
|-----------|---------|
|
|
1034
|
+
| Defender for Servers | VM protection, JIT access |
|
|
1035
|
+
| Defender for Containers | AKS, ACR security |
|
|
1036
|
+
| Defender for Storage | Blob/File protection |
|
|
1037
|
+
| Defender for SQL | Database security |
|
|
1038
|
+
| Defender for Key Vault | Secret protection |
|
|
1039
|
+
| Defender CSPM | Posture management |
|
|
1040
|
+
|
|
1041
|
+
### Setup
|
|
1042
|
+
|
|
1043
|
+
**1. Enable Defender for Cloud:**
|
|
1044
|
+
|
|
1045
|
+
```bash
|
|
1046
|
+
# Enable Defender for Cloud (Standard tier)
|
|
1047
|
+
az security pricing create \
|
|
1048
|
+
--name VirtualMachines \
|
|
1049
|
+
--tier Standard
|
|
1050
|
+
|
|
1051
|
+
az security pricing create \
|
|
1052
|
+
--name Containers \
|
|
1053
|
+
--tier Standard
|
|
1054
|
+
|
|
1055
|
+
az security pricing create \
|
|
1056
|
+
--name StorageAccounts \
|
|
1057
|
+
--tier Standard
|
|
1058
|
+
|
|
1059
|
+
# Enable auto-provisioning
|
|
1060
|
+
az security auto-provisioning-setting update \
|
|
1061
|
+
--auto-provision On \
|
|
1062
|
+
--name default
|
|
1063
|
+
```
|
|
1064
|
+
|
|
1065
|
+
**2. Terraform Configuration:**
|
|
1066
|
+
|
|
1067
|
+
```hcl
|
|
1068
|
+
# Enable Defender for Cloud plans
|
|
1069
|
+
resource "azurerm_security_center_subscription_pricing" "vm" {
|
|
1070
|
+
tier = "Standard"
|
|
1071
|
+
resource_type = "VirtualMachines"
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
resource "azurerm_security_center_subscription_pricing" "containers" {
|
|
1075
|
+
tier = "Standard"
|
|
1076
|
+
resource_type = "Containers"
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
resource "azurerm_security_center_subscription_pricing" "storage" {
|
|
1080
|
+
tier = "Standard"
|
|
1081
|
+
resource_type = "StorageAccounts"
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
# Enable auto-provisioning of Log Analytics agent
|
|
1085
|
+
resource "azurerm_security_center_auto_provisioning" "auto_provisioning" {
|
|
1086
|
+
auto_provision = "On"
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
# Configure Log Analytics workspace
|
|
1090
|
+
resource "azurerm_security_center_workspace" "workspace" {
|
|
1091
|
+
scope = "/subscriptions/${data.azurerm_subscription.current.subscription_id}"
|
|
1092
|
+
workspace_id = azurerm_log_analytics_workspace.security.id
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
# Security contacts
|
|
1096
|
+
resource "azurerm_security_center_contact" "contact" {
|
|
1097
|
+
email = "security@company.com"
|
|
1098
|
+
phone = "+1-555-0100"
|
|
1099
|
+
alert_notifications = true
|
|
1100
|
+
alerts_to_admins = true
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
# Regulatory compliance assessments
|
|
1104
|
+
resource "azurerm_security_center_assessment" "fedramp_high" {
|
|
1105
|
+
assessment_policy_id = "/providers/Microsoft.Authorization/policyDefinitions/fedramp-high"
|
|
1106
|
+
target_resource_id = data.azurerm_subscription.current.id
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
# Just-In-Time VM Access
|
|
1110
|
+
resource "azurerm_security_center_jit_network_access_policy" "jit_policy" {
|
|
1111
|
+
name = "jit-policy-vm"
|
|
1112
|
+
kind = "Basic"
|
|
1113
|
+
location = azurerm_resource_group.rg.location
|
|
1114
|
+
resource_group_name = azurerm_resource_group.rg.name
|
|
1115
|
+
|
|
1116
|
+
virtual_machine {
|
|
1117
|
+
virtual_machine_id = azurerm_linux_virtual_machine.vm.id
|
|
1118
|
+
|
|
1119
|
+
port {
|
|
1120
|
+
number = 22
|
|
1121
|
+
protocol = "TCP"
|
|
1122
|
+
allowed_source_address_prefix = ["10.0.0.0/8"]
|
|
1123
|
+
max_request_access_duration = "PT3H"
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
port {
|
|
1127
|
+
number = 3389
|
|
1128
|
+
protocol = "TCP"
|
|
1129
|
+
allowed_source_address_prefix = ["10.0.0.0/8"]
|
|
1130
|
+
max_request_access_duration = "PT3H"
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
**3. Azure Policy Integration:**
|
|
1137
|
+
|
|
1138
|
+
```bash
|
|
1139
|
+
# Assign built-in initiatives for compliance
|
|
1140
|
+
az policy assignment create \
|
|
1141
|
+
--name 'fedramp-high' \
|
|
1142
|
+
--display-name 'FedRAMP High Compliance' \
|
|
1143
|
+
--policy-set-definition '/providers/Microsoft.Authorization/policySetDefinitions/fedramp-high' \
|
|
1144
|
+
--scope "/subscriptions/${SUBSCRIPTION_ID}"
|
|
1145
|
+
|
|
1146
|
+
# Custom policy for tagging enforcement
|
|
1147
|
+
az policy definition create \
|
|
1148
|
+
--name 'require-classification-tag' \
|
|
1149
|
+
--display-name 'Require Classification Tag' \
|
|
1150
|
+
--mode Indexed \
|
|
1151
|
+
--rules '{
|
|
1152
|
+
"if": {
|
|
1153
|
+
"field": "tags[Classification]",
|
|
1154
|
+
"exists": "false"
|
|
1155
|
+
},
|
|
1156
|
+
"then": {
|
|
1157
|
+
"effect": "deny"
|
|
1158
|
+
}
|
|
1159
|
+
}'
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
---
|
|
1163
|
+
|
|
1164
|
+
## Google Cloud Security Command Center
|
|
1165
|
+
|
|
1166
|
+
**Google Cloud Security Command Center (SCC)** provides centralized visibility and control over GCP security.
|
|
1167
|
+
|
|
1168
|
+
### Tiers
|
|
1169
|
+
|
|
1170
|
+
| Tier | Features |
|
|
1171
|
+
|------|----------|
|
|
1172
|
+
| Standard (Free) | Asset discovery, vulnerability scanning, basic findings |
|
|
1173
|
+
| Premium | Advanced threat detection, compliance monitoring, Event Threat Detection, Container Threat Detection |
|
|
1174
|
+
|
|
1175
|
+
### Setup
|
|
1176
|
+
|
|
1177
|
+
**1. Enable SCC:**
|
|
1178
|
+
|
|
1179
|
+
```bash
|
|
1180
|
+
# Enable SCC API
|
|
1181
|
+
gcloud services enable securitycenter.googleapis.com
|
|
1182
|
+
|
|
1183
|
+
# Enable SCC Premium
|
|
1184
|
+
gcloud scc settings update \
|
|
1185
|
+
--organization=123456789 \
|
|
1186
|
+
--tier=PREMIUM
|
|
1187
|
+
|
|
1188
|
+
# Enable built-in services
|
|
1189
|
+
gcloud scc settings services enable \
|
|
1190
|
+
--organization=123456789 \
|
|
1191
|
+
--service=CONTAINER_THREAT_DETECTION
|
|
1192
|
+
|
|
1193
|
+
gcloud scc settings services enable \
|
|
1194
|
+
--organization=123456789 \
|
|
1195
|
+
--service=EVENT_THREAT_DETECTION
|
|
1196
|
+
|
|
1197
|
+
gcloud scc settings services enable \
|
|
1198
|
+
--organization=123456789 \
|
|
1199
|
+
--service=SECURITY_HEALTH_ANALYTICS
|
|
1200
|
+
```
|
|
1201
|
+
|
|
1202
|
+
**2. Terraform Configuration:**
|
|
1203
|
+
|
|
1204
|
+
```hcl
|
|
1205
|
+
# Enable SCC
|
|
1206
|
+
resource "google_scc_organization_settings" "scc_settings" {
|
|
1207
|
+
organization = "123456789"
|
|
1208
|
+
|
|
1209
|
+
asset_discovery_config {
|
|
1210
|
+
project_ids = ["project-1", "project-2"]
|
|
1211
|
+
inclusion_mode = "INCLUDE_ONLY"
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
# Create notification config
|
|
1216
|
+
resource "google_scc_notification_config" "scc_notification" {
|
|
1217
|
+
config_id = "critical-findings"
|
|
1218
|
+
organization = "123456789"
|
|
1219
|
+
description = "Notify on critical findings"
|
|
1220
|
+
pubsub_topic = google_pubsub_topic.scc_notifications.id
|
|
1221
|
+
|
|
1222
|
+
streaming_config {
|
|
1223
|
+
filter = "severity=\"CRITICAL\" AND state=\"ACTIVE\""
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
resource "google_pubsub_topic" "scc_notifications" {
|
|
1228
|
+
name = "scc-critical-findings"
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
# Custom security marks
|
|
1232
|
+
resource "google_scc_source" "custom_source" {
|
|
1233
|
+
display_name = "Custom Security Scanner"
|
|
1234
|
+
organization = "123456789"
|
|
1235
|
+
description = "Custom vulnerability scanner"
|
|
1236
|
+
}
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
**3. Findings API Integration:**
|
|
1240
|
+
|
|
1241
|
+
```python
|
|
1242
|
+
# scc_findings.py
|
|
1243
|
+
from google.cloud import securitycenter
|
|
1244
|
+
|
|
1245
|
+
def list_all_findings(organization_id):
|
|
1246
|
+
"""List all active findings"""
|
|
1247
|
+
client = securitycenter.SecurityCenterClient()
|
|
1248
|
+
org_name = f"organizations/{organization_id}/sources/-"
|
|
1249
|
+
|
|
1250
|
+
# List findings
|
|
1251
|
+
findings = client.list_findings(
|
|
1252
|
+
request={
|
|
1253
|
+
"parent": org_name,
|
|
1254
|
+
"filter": 'state="ACTIVE" AND severity="CRITICAL"'
|
|
1255
|
+
}
|
|
1256
|
+
)
|
|
1257
|
+
|
|
1258
|
+
for finding in findings:
|
|
1259
|
+
print(f"Finding: {finding.finding.name}")
|
|
1260
|
+
print(f" Category: {finding.finding.category}")
|
|
1261
|
+
print(f" Resource: {finding.finding.resource_name}")
|
|
1262
|
+
print(f" Severity: {finding.finding.severity}")
|
|
1263
|
+
print(f" State: {finding.finding.state}")
|
|
1264
|
+
|
|
1265
|
+
def create_finding(organization_id, source_id, finding_id):
|
|
1266
|
+
"""Create a custom finding"""
|
|
1267
|
+
client = securitycenter.SecurityCenterClient()
|
|
1268
|
+
source_name = f"organizations/{organization_id}/sources/{source_id}"
|
|
1269
|
+
|
|
1270
|
+
finding = {
|
|
1271
|
+
"state": securitycenter.Finding.State.ACTIVE,
|
|
1272
|
+
"resource_name": f"//cloudresourcemanager.googleapis.com/organizations/{organization_id}",
|
|
1273
|
+
"category": "CUSTOM_VULNERABILITY",
|
|
1274
|
+
"severity": securitycenter.Finding.Severity.HIGH,
|
|
1275
|
+
"event_time": {"seconds": int(time.time())},
|
|
1276
|
+
"finding_class": securitycenter.Finding.FindingClass.VULNERABILITY,
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
created_finding = client.create_finding(
|
|
1280
|
+
request={
|
|
1281
|
+
"parent": source_name,
|
|
1282
|
+
"finding_id": finding_id,
|
|
1283
|
+
"finding": finding
|
|
1284
|
+
}
|
|
1285
|
+
)
|
|
1286
|
+
|
|
1287
|
+
return created_finding
|
|
1288
|
+
|
|
1289
|
+
# Usage
|
|
1290
|
+
list_all_findings("123456789")
|
|
1291
|
+
```
|
|
1292
|
+
|
|
1293
|
+
---
|
|
1294
|
+
|
|
1295
|
+
## Tool Comparison
|
|
1296
|
+
|
|
1297
|
+
### Feature Matrix
|
|
1298
|
+
|
|
1299
|
+
| Feature | Trend Micro | Prisma Cloud | Wiz | Aqua | AWS Hub | Azure Defender | GCP SCC |
|
|
1300
|
+
|---------|-------------|--------------|-----|------|---------|----------------|---------|
|
|
1301
|
+
| **Multi-Cloud** | ✅ | ✅ | ✅ | ✅ | AWS only | Azure only | GCP only |
|
|
1302
|
+
| **CSPM** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
1303
|
+
| **Container Security** | ✅ | ✅ | ✅ | ✅ | Limited | ✅ | ✅ |
|
|
1304
|
+
| **Runtime Protection** | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | Limited |
|
|
1305
|
+
| **IaC Scanning** | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
|
|
1306
|
+
| **Kubernetes** | ✅ | ✅ | ✅ | ✅ | Limited | ✅ | ✅ |
|
|
1307
|
+
| **Compliance** | 40+ | 40+ | 35+ | 30+ | 3 | 25+ | 15+ |
|
|
1308
|
+
| **Agentless** | ❌ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
|
|
1309
|
+
| **On-Prem** | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ |
|
|
1310
|
+
|
|
1311
|
+
### Cost Comparison (Approximate)
|
|
1312
|
+
|
|
1313
|
+
| Tool | Pricing Model | Est. Cost (100 workloads) |
|
|
1314
|
+
|------|--------------|---------------------------|
|
|
1315
|
+
| Trend Micro Cloud One | Per workload | $5-10/workload/month |
|
|
1316
|
+
| Prisma Cloud | Per credit/resource | $15K-30K/year |
|
|
1317
|
+
| Wiz | Per workload | $8-15/workload/month |
|
|
1318
|
+
| Aqua Security | Per node | $10-20/node/month |
|
|
1319
|
+
| AWS Security Hub | Per check | $0.0010/check (~$100-500/month) |
|
|
1320
|
+
| Microsoft Defender | Per resource | $15/server/month, $7/storage/month |
|
|
1321
|
+
| GCP SCC Premium | Flat + usage | $2,500/month + usage |
|
|
1322
|
+
|
|
1323
|
+
---
|
|
1324
|
+
|
|
1325
|
+
## Integration Patterns
|
|
1326
|
+
|
|
1327
|
+
### 1. Multi-Tool Strategy
|
|
1328
|
+
|
|
1329
|
+
```
|
|
1330
|
+
Layered Security Approach:
|
|
1331
|
+
┌─────────────────────────────────────────────────────┐
|
|
1332
|
+
│ Development Phase │
|
|
1333
|
+
│ - Prisma Cloud (IaC scanning) │
|
|
1334
|
+
│ - Aqua (Container scanning in CI/CD) │
|
|
1335
|
+
└───────────────┬─────────────────────────────────────┘
|
|
1336
|
+
↓
|
|
1337
|
+
┌───────────────┴─────────────────────────────────────┐
|
|
1338
|
+
│ Deployment Phase │
|
|
1339
|
+
│ - Wiz (Pre-deployment validation) │
|
|
1340
|
+
│ - Native cloud tools (Security Hub/Defender/SCC) │
|
|
1341
|
+
└───────────────┬─────────────────────────────────────┘
|
|
1342
|
+
↓
|
|
1343
|
+
┌───────────────┴─────────────────────────────────────┐
|
|
1344
|
+
│ Runtime Phase │
|
|
1345
|
+
│ - Trend Micro (Workload protection) │
|
|
1346
|
+
│ - Aqua (Container runtime security) │
|
|
1347
|
+
│ - Wiz (Continuous threat detection) │
|
|
1348
|
+
└─────────────────────────────────────────────────────┘
|
|
1349
|
+
```
|
|
1350
|
+
|
|
1351
|
+
### 2. Centralized Findings Aggregation
|
|
1352
|
+
|
|
1353
|
+
```python
|
|
1354
|
+
# aggregate_findings.py
|
|
1355
|
+
"""Aggregate findings from multiple security tools"""
|
|
1356
|
+
import boto3
|
|
1357
|
+
import requests
|
|
1358
|
+
from google.cloud import securitycenter
|
|
1359
|
+
|
|
1360
|
+
class SecurityAggregator:
|
|
1361
|
+
def __init__(self):
|
|
1362
|
+
self.findings = []
|
|
1363
|
+
|
|
1364
|
+
def get_aws_findings(self):
|
|
1365
|
+
"""Get findings from AWS Security Hub"""
|
|
1366
|
+
securityhub = boto3.client('securityhub')
|
|
1367
|
+
response = securityhub.get_findings(
|
|
1368
|
+
Filters={
|
|
1369
|
+
'SeverityLabel': [{'Value': 'CRITICAL', 'Comparison': 'EQUALS'}],
|
|
1370
|
+
'WorkflowStatus': [{'Value': 'NEW', 'Comparison': 'EQUALS'}]
|
|
1371
|
+
}
|
|
1372
|
+
)
|
|
1373
|
+
return response['Findings']
|
|
1374
|
+
|
|
1375
|
+
def get_prisma_findings(self, api_url, token):
|
|
1376
|
+
"""Get findings from Prisma Cloud"""
|
|
1377
|
+
headers = {'Authorization': f'Bearer {token}'}
|
|
1378
|
+
response = requests.get(
|
|
1379
|
+
f"{api_url}/api/v1/alerts",
|
|
1380
|
+
headers=headers,
|
|
1381
|
+
params={'severity': 'high', 'status': 'open'}
|
|
1382
|
+
)
|
|
1383
|
+
return response.json()
|
|
1384
|
+
|
|
1385
|
+
def get_wiz_findings(self, client_id, secret):
|
|
1386
|
+
"""Get findings from Wiz"""
|
|
1387
|
+
# Implementation similar to earlier Wiz API example
|
|
1388
|
+
pass
|
|
1389
|
+
|
|
1390
|
+
def normalize_findings(self, findings, source):
|
|
1391
|
+
"""Normalize findings to common format"""
|
|
1392
|
+
normalized = []
|
|
1393
|
+
for finding in findings:
|
|
1394
|
+
normalized.append({
|
|
1395
|
+
'source': source,
|
|
1396
|
+
'severity': self._normalize_severity(finding, source),
|
|
1397
|
+
'resource': self._extract_resource(finding, source),
|
|
1398
|
+
'description': self._extract_description(finding, source),
|
|
1399
|
+
'compliance': self._extract_compliance(finding, source)
|
|
1400
|
+
})
|
|
1401
|
+
return normalized
|
|
1402
|
+
|
|
1403
|
+
def aggregate_all(self):
|
|
1404
|
+
"""Aggregate from all sources"""
|
|
1405
|
+
self.findings.extend(
|
|
1406
|
+
self.normalize_findings(self.get_aws_findings(), 'AWS Security Hub')
|
|
1407
|
+
)
|
|
1408
|
+
# Add other sources...
|
|
1409
|
+
return self.findings
|
|
1410
|
+
|
|
1411
|
+
# Usage
|
|
1412
|
+
aggregator = SecurityAggregator()
|
|
1413
|
+
all_findings = aggregator.aggregate_all()
|
|
1414
|
+
```
|
|
1415
|
+
|
|
1416
|
+
---
|
|
1417
|
+
|
|
1418
|
+
## Best Practices
|
|
1419
|
+
|
|
1420
|
+
### 1. Tool Selection
|
|
1421
|
+
|
|
1422
|
+
**Decision Matrix:**
|
|
1423
|
+
|
|
1424
|
+
| Requirement | Recommended Tool(s) |
|
|
1425
|
+
|-------------|---------------------|
|
|
1426
|
+
| AWS-only environment | AWS Security Hub + Prisma Cloud |
|
|
1427
|
+
| Azure-only | Microsoft Defender for Cloud |
|
|
1428
|
+
| GCP-only | GCP SCC Premium + Wiz |
|
|
1429
|
+
| Multi-cloud | Prisma Cloud or Wiz |
|
|
1430
|
+
| Container-heavy | Aqua Security or Prisma Cloud |
|
|
1431
|
+
| Air-gapped | Trend Micro (on-prem) or Aqua |
|
|
1432
|
+
| Budget-conscious | Native tools (Security Hub, Defender, SCC) |
|
|
1433
|
+
| Comprehensive | Prisma Cloud or Wiz |
|
|
1434
|
+
|
|
1435
|
+
### 2. Alert Fatigue Reduction
|
|
1436
|
+
|
|
1437
|
+
```yaml
|
|
1438
|
+
# Prioritization strategy
|
|
1439
|
+
alert_tiers:
|
|
1440
|
+
tier_1_critical:
|
|
1441
|
+
- Public exposure of sensitive data
|
|
1442
|
+
- Active exploitation detected
|
|
1443
|
+
- Privilege escalation
|
|
1444
|
+
- Crypto mining
|
|
1445
|
+
action: Immediate notification + auto-remediation
|
|
1446
|
+
|
|
1447
|
+
tier_2_high:
|
|
1448
|
+
- Critical vulnerabilities
|
|
1449
|
+
- Compliance violations
|
|
1450
|
+
- Misconfigured security groups
|
|
1451
|
+
action: Next-business-day review
|
|
1452
|
+
|
|
1453
|
+
tier_3_medium:
|
|
1454
|
+
- Best practice violations
|
|
1455
|
+
- Outdated software
|
|
1456
|
+
action: Weekly review
|
|
1457
|
+
|
|
1458
|
+
tier_4_low:
|
|
1459
|
+
- Informational findings
|
|
1460
|
+
action: Monthly review + reports
|
|
1461
|
+
```
|
|
1462
|
+
|
|
1463
|
+
### 3. Compliance Mapping
|
|
1464
|
+
|
|
1465
|
+
```bash
|
|
1466
|
+
# Tag resources for compliance tracking
|
|
1467
|
+
# All CSPM tools can filter by tags
|
|
1468
|
+
|
|
1469
|
+
# Terraform example
|
|
1470
|
+
resource "aws_instance" "web" {
|
|
1471
|
+
ami = "ami-12345"
|
|
1472
|
+
instance_type = "t3.medium"
|
|
1473
|
+
|
|
1474
|
+
tags = {
|
|
1475
|
+
Classification = "CUI"
|
|
1476
|
+
Compliance = "FedRAMP-High,CMMC-L2,NIST-800-171"
|
|
1477
|
+
DataOwner = "security@agency.gov"
|
|
1478
|
+
Environment = "Production"
|
|
1479
|
+
CostCenter = "12345"
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
```
|
|
1483
|
+
|
|
1484
|
+
### 4. Continuous Monitoring
|
|
1485
|
+
|
|
1486
|
+
```python
|
|
1487
|
+
# monitoring_automation.py
|
|
1488
|
+
"""Continuous compliance monitoring"""
|
|
1489
|
+
import schedule
|
|
1490
|
+
import time
|
|
1491
|
+
|
|
1492
|
+
def daily_compliance_check():
|
|
1493
|
+
"""Run daily compliance scans"""
|
|
1494
|
+
# Check all tools
|
|
1495
|
+
check_prisma_compliance()
|
|
1496
|
+
check_wiz_compliance()
|
|
1497
|
+
check_native_tools()
|
|
1498
|
+
|
|
1499
|
+
# Generate report
|
|
1500
|
+
generate_compliance_report()
|
|
1501
|
+
|
|
1502
|
+
def weekly_vulnerability_scan():
|
|
1503
|
+
"""Weekly vulnerability assessment"""
|
|
1504
|
+
scan_with_aqua()
|
|
1505
|
+
scan_with_trend_micro()
|
|
1506
|
+
correlate_findings()
|
|
1507
|
+
|
|
1508
|
+
def monthly_compliance_report():
|
|
1509
|
+
"""Monthly executive report"""
|
|
1510
|
+
aggregate_findings()
|
|
1511
|
+
calculate_risk_score()
|
|
1512
|
+
send_executive_summary()
|
|
1513
|
+
|
|
1514
|
+
# Schedule jobs
|
|
1515
|
+
schedule.every().day.at("02:00").do(daily_compliance_check)
|
|
1516
|
+
schedule.every().monday.at("03:00").do(weekly_vulnerability_scan)
|
|
1517
|
+
schedule.every().month.at("05:00").do(monthly_compliance_report)
|
|
1518
|
+
|
|
1519
|
+
while True:
|
|
1520
|
+
schedule.run_pending()
|
|
1521
|
+
time.sleep(3600) # Check every hour
|
|
1522
|
+
```
|
|
1523
|
+
|
|
1524
|
+
---
|
|
1525
|
+
|
|
1526
|
+
**Related Resources:**
|
|
1527
|
+
- [cloud-security.md](cloud-security.md) - IAM, encryption, compliance
|
|
1528
|
+
- [cleared-cloud-environments.md](cleared-cloud-environments.md) - Government cloud security
|
|
1529
|
+
- [devsecops/cspm-integration.md](../devsecops/resources/cspm-integration.md) - CI/CD integration
|
|
1530
|
+
- [devsecops/compliance-frameworks.md](../devsecops/resources/compliance-frameworks.md) - Compliance requirements
|