@kevinrabun/judges-cli 3.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/agents/accessibility.judge.md +44 -0
- package/agents/agent-instructions.judge.md +44 -0
- package/agents/ai-code-safety.judge.md +55 -0
- package/agents/api-contract.judge.md +37 -0
- package/agents/api-design.judge.md +55 -0
- package/agents/authentication.judge.md +61 -0
- package/agents/backwards-compatibility.judge.md +44 -0
- package/agents/caching.judge.md +44 -0
- package/agents/ci-cd.judge.md +44 -0
- package/agents/cloud-readiness.judge.md +51 -0
- package/agents/code-structure.judge.md +48 -0
- package/agents/compliance.judge.md +47 -0
- package/agents/concurrency.judge.md +46 -0
- package/agents/configuration-management.judge.md +44 -0
- package/agents/cost-effectiveness.judge.md +40 -0
- package/agents/cybersecurity.judge.md +61 -0
- package/agents/data-security.judge.md +48 -0
- package/agents/data-sovereignty.judge.md +58 -0
- package/agents/database.judge.md +49 -0
- package/agents/dependency-health.judge.md +46 -0
- package/agents/documentation.judge.md +53 -0
- package/agents/error-handling.judge.md +53 -0
- package/agents/ethics-bias.judge.md +46 -0
- package/agents/false-positive-review.judge.md +85 -0
- package/agents/framework-safety.judge.md +47 -0
- package/agents/hallucination-detection.judge.md +46 -0
- package/agents/iac-security.judge.md +45 -0
- package/agents/intent-alignment.judge.md +44 -0
- package/agents/internationalization.judge.md +42 -0
- package/agents/logging-privacy.judge.md +44 -0
- package/agents/logic-review.judge.md +34 -0
- package/agents/maintainability.judge.md +44 -0
- package/agents/model-fingerprint.judge.md +31 -0
- package/agents/multi-turn-coherence.judge.md +36 -0
- package/agents/observability.judge.md +52 -0
- package/agents/over-engineering.judge.md +48 -0
- package/agents/performance.judge.md +44 -0
- package/agents/portability.judge.md +44 -0
- package/agents/rate-limiting.judge.md +53 -0
- package/agents/reliability.judge.md +55 -0
- package/agents/scalability.judge.md +50 -0
- package/agents/security.judge.md +62 -0
- package/agents/software-practices.judge.md +54 -0
- package/agents/testing.judge.md +52 -0
- package/agents/ux.judge.md +44 -0
- package/bin/judges.js +8 -0
- package/dist/a2a-protocol.d.ts +136 -0
- package/dist/a2a-protocol.js +218 -0
- package/dist/agent-loader.d.ts +107 -0
- package/dist/agent-loader.js +260 -0
- package/dist/api.d.ts +169 -0
- package/dist/api.js +195 -0
- package/dist/ast/cross-file-taint.d.ts +42 -0
- package/dist/ast/cross-file-taint.js +679 -0
- package/dist/ast/index.d.ts +25 -0
- package/dist/ast/index.js +148 -0
- package/dist/ast/structural-parser.d.ts +2 -0
- package/dist/ast/structural-parser.js +756 -0
- package/dist/ast/taint-tracker.d.ts +48 -0
- package/dist/ast/taint-tracker.js +1033 -0
- package/dist/ast/tree-sitter-ast.d.ts +33 -0
- package/dist/ast/tree-sitter-ast.js +1164 -0
- package/dist/ast/types.d.ts +50 -0
- package/dist/ast/types.js +7 -0
- package/dist/audit-trail.d.ts +245 -0
- package/dist/audit-trail.js +257 -0
- package/dist/auto-tune.d.ts +146 -0
- package/dist/auto-tune.js +373 -0
- package/dist/cache.d.ts +53 -0
- package/dist/cache.js +86 -0
- package/dist/calibration.d.ts +108 -0
- package/dist/calibration.js +219 -0
- package/dist/cli-dispatch.d.ts +7 -0
- package/dist/cli-dispatch.js +654 -0
- package/dist/cli-formatters.d.ts +6 -0
- package/dist/cli-formatters.js +186 -0
- package/dist/cli-helpers.d.ts +29 -0
- package/dist/cli-helpers.js +129 -0
- package/dist/cli.d.ts +30 -0
- package/dist/cli.js +1487 -0
- package/dist/commands/adoption-report.d.ts +7 -0
- package/dist/commands/adoption-report.js +218 -0
- package/dist/commands/adoption-track.d.ts +4 -0
- package/dist/commands/adoption-track.js +246 -0
- package/dist/commands/ai-gate.d.ts +7 -0
- package/dist/commands/ai-gate.js +212 -0
- package/dist/commands/ai-model-trust.d.ts +16 -0
- package/dist/commands/ai-model-trust.js +234 -0
- package/dist/commands/ai-output-compare.d.ts +8 -0
- package/dist/commands/ai-output-compare.js +202 -0
- package/dist/commands/ai-pattern-trend.d.ts +8 -0
- package/dist/commands/ai-pattern-trend.js +223 -0
- package/dist/commands/ai-prompt-audit.d.ts +22 -0
- package/dist/commands/ai-prompt-audit.js +254 -0
- package/dist/commands/ai-provenance.d.ts +4 -0
- package/dist/commands/ai-provenance.js +247 -0
- package/dist/commands/api-audit.d.ts +8 -0
- package/dist/commands/api-audit.js +359 -0
- package/dist/commands/api-misuse.d.ts +4 -0
- package/dist/commands/api-misuse.js +260 -0
- package/dist/commands/api-versioning-audit.d.ts +5 -0
- package/dist/commands/api-versioning-audit.js +233 -0
- package/dist/commands/approve-chain.d.ts +7 -0
- package/dist/commands/approve-chain.js +234 -0
- package/dist/commands/arch-audit.d.ts +8 -0
- package/dist/commands/arch-audit.js +283 -0
- package/dist/commands/assertion-density.d.ts +4 -0
- package/dist/commands/assertion-density.js +263 -0
- package/dist/commands/assign-findings.d.ts +36 -0
- package/dist/commands/assign-findings.js +177 -0
- package/dist/commands/async-safety.d.ts +4 -0
- package/dist/commands/async-safety.js +266 -0
- package/dist/commands/audit-bundle.d.ts +28 -0
- package/dist/commands/audit-bundle.js +234 -0
- package/dist/commands/audit-trail.d.ts +17 -0
- package/dist/commands/audit-trail.js +154 -0
- package/dist/commands/auto-approve.d.ts +4 -0
- package/dist/commands/auto-approve.js +188 -0
- package/dist/commands/auto-calibrate.d.ts +14 -0
- package/dist/commands/auto-calibrate.js +106 -0
- package/dist/commands/auto-detect.d.ts +61 -0
- package/dist/commands/auto-detect.js +328 -0
- package/dist/commands/auto-fix.d.ts +17 -0
- package/dist/commands/auto-fix.js +240 -0
- package/dist/commands/auto-triage.d.ts +31 -0
- package/dist/commands/auto-triage.js +125 -0
- package/dist/commands/baseline.d.ts +47 -0
- package/dist/commands/baseline.js +353 -0
- package/dist/commands/batch-review.d.ts +4 -0
- package/dist/commands/batch-review.js +180 -0
- package/dist/commands/benchmark-advanced.d.ts +14 -0
- package/dist/commands/benchmark-advanced.js +5057 -0
- package/dist/commands/benchmark-ai-agents.d.ts +8 -0
- package/dist/commands/benchmark-ai-agents.js +4123 -0
- package/dist/commands/benchmark-ai-output.d.ts +9 -0
- package/dist/commands/benchmark-ai-output.js +365 -0
- package/dist/commands/benchmark-compliance-ethics.d.ts +8 -0
- package/dist/commands/benchmark-compliance-ethics.js +3060 -0
- package/dist/commands/benchmark-expanded-2.d.ts +12 -0
- package/dist/commands/benchmark-expanded-2.js +5530 -0
- package/dist/commands/benchmark-expanded.d.ts +12 -0
- package/dist/commands/benchmark-expanded.js +2599 -0
- package/dist/commands/benchmark-infrastructure.d.ts +8 -0
- package/dist/commands/benchmark-infrastructure.js +2882 -0
- package/dist/commands/benchmark-languages.d.ts +8 -0
- package/dist/commands/benchmark-languages.js +1963 -0
- package/dist/commands/benchmark-quality-ops.d.ts +8 -0
- package/dist/commands/benchmark-quality-ops.js +3415 -0
- package/dist/commands/benchmark-security-deep.d.ts +9 -0
- package/dist/commands/benchmark-security-deep.js +2335 -0
- package/dist/commands/benchmark.d.ts +233 -0
- package/dist/commands/benchmark.js +3214 -0
- package/dist/commands/blame-review.d.ts +4 -0
- package/dist/commands/blame-review.js +266 -0
- package/dist/commands/boundary-enforce.d.ts +5 -0
- package/dist/commands/boundary-enforce.js +255 -0
- package/dist/commands/build-optimize.d.ts +6 -0
- package/dist/commands/build-optimize.js +256 -0
- package/dist/commands/burndown.d.ts +26 -0
- package/dist/commands/burndown.js +179 -0
- package/dist/commands/cache-audit.d.ts +4 -0
- package/dist/commands/cache-audit.js +219 -0
- package/dist/commands/calibration-dashboard.d.ts +1 -0
- package/dist/commands/calibration-dashboard.js +294 -0
- package/dist/commands/calibration-share.d.ts +30 -0
- package/dist/commands/calibration-share.js +182 -0
- package/dist/commands/chat-notify.d.ts +8 -0
- package/dist/commands/chat-notify.js +258 -0
- package/dist/commands/ci-template.d.ts +14 -0
- package/dist/commands/ci-template.js +211 -0
- package/dist/commands/ci-templates.d.ts +9 -0
- package/dist/commands/ci-templates.js +89 -0
- package/dist/commands/clarity-score.d.ts +8 -0
- package/dist/commands/clarity-score.js +260 -0
- package/dist/commands/clone-detect.d.ts +4 -0
- package/dist/commands/clone-detect.js +232 -0
- package/dist/commands/coach-mode.d.ts +7 -0
- package/dist/commands/coach-mode.js +229 -0
- package/dist/commands/code-health.d.ts +4 -0
- package/dist/commands/code-health.js +195 -0
- package/dist/commands/code-owner-suggest.d.ts +16 -0
- package/dist/commands/code-owner-suggest.js +214 -0
- package/dist/commands/code-similarity.d.ts +8 -0
- package/dist/commands/code-similarity.js +231 -0
- package/dist/commands/comment-drift.d.ts +4 -0
- package/dist/commands/comment-drift.js +228 -0
- package/dist/commands/commit-hygiene.d.ts +5 -0
- package/dist/commands/commit-hygiene.js +175 -0
- package/dist/commands/community-patterns.d.ts +1 -0
- package/dist/commands/community-patterns.js +131 -0
- package/dist/commands/compare-runs.d.ts +37 -0
- package/dist/commands/compare-runs.js +228 -0
- package/dist/commands/completion-audit.d.ts +4 -0
- package/dist/commands/completion-audit.js +296 -0
- package/dist/commands/completions.d.ts +1 -0
- package/dist/commands/completions.js +257 -0
- package/dist/commands/compliance-map.d.ts +8 -0
- package/dist/commands/compliance-map.js +374 -0
- package/dist/commands/compliance-report.d.ts +34 -0
- package/dist/commands/compliance-report.js +161 -0
- package/dist/commands/compliance-weight.d.ts +8 -0
- package/dist/commands/compliance-weight.js +272 -0
- package/dist/commands/config-drift.d.ts +24 -0
- package/dist/commands/config-drift.js +213 -0
- package/dist/commands/config-lint.d.ts +4 -0
- package/dist/commands/config-lint.js +187 -0
- package/dist/commands/config-migrate.d.ts +43 -0
- package/dist/commands/config-migrate.js +240 -0
- package/dist/commands/config-share.d.ts +95 -0
- package/dist/commands/config-share.js +406 -0
- package/dist/commands/context-blind.d.ts +4 -0
- package/dist/commands/context-blind.js +272 -0
- package/dist/commands/context-inject.d.ts +8 -0
- package/dist/commands/context-inject.js +211 -0
- package/dist/commands/contract-verify.d.ts +4 -0
- package/dist/commands/contract-verify.js +316 -0
- package/dist/commands/correlate.d.ts +27 -0
- package/dist/commands/correlate.js +241 -0
- package/dist/commands/cost-forecast.d.ts +18 -0
- package/dist/commands/cost-forecast.js +193 -0
- package/dist/commands/coverage-map.d.ts +22 -0
- package/dist/commands/coverage-map.js +222 -0
- package/dist/commands/coverage.d.ts +40 -0
- package/dist/commands/coverage.js +147 -0
- package/dist/commands/cross-file-consistency.d.ts +4 -0
- package/dist/commands/cross-file-consistency.js +254 -0
- package/dist/commands/cross-pr-regression.d.ts +8 -0
- package/dist/commands/cross-pr-regression.js +297 -0
- package/dist/commands/custom-rule.d.ts +4 -0
- package/dist/commands/custom-rule.js +210 -0
- package/dist/commands/dead-code-detect.d.ts +4 -0
- package/dist/commands/dead-code-detect.js +255 -0
- package/dist/commands/dedup-report.d.ts +12 -0
- package/dist/commands/dedup-report.js +137 -0
- package/dist/commands/dep-audit.d.ts +52 -0
- package/dist/commands/dep-audit.js +277 -0
- package/dist/commands/dep-correlate.d.ts +8 -0
- package/dist/commands/dep-correlate.js +207 -0
- package/dist/commands/deploy-readiness.d.ts +5 -0
- package/dist/commands/deploy-readiness.js +211 -0
- package/dist/commands/deprecated.d.ts +47 -0
- package/dist/commands/deprecated.js +201 -0
- package/dist/commands/deps.d.ts +5 -0
- package/dist/commands/deps.js +122 -0
- package/dist/commands/design-audit.d.ts +8 -0
- package/dist/commands/design-audit.js +301 -0
- package/dist/commands/dev-score.d.ts +36 -0
- package/dist/commands/dev-score.js +203 -0
- package/dist/commands/diff-explain.d.ts +4 -0
- package/dist/commands/diff-explain.js +142 -0
- package/dist/commands/diff-only.d.ts +33 -0
- package/dist/commands/diff-only.js +151 -0
- package/dist/commands/diff-review.d.ts +4 -0
- package/dist/commands/diff-review.js +190 -0
- package/dist/commands/diff.d.ts +6 -0
- package/dist/commands/diff.js +449 -0
- package/dist/commands/digest.d.ts +19 -0
- package/dist/commands/digest.js +221 -0
- package/dist/commands/doc-drift.d.ts +8 -0
- package/dist/commands/doc-drift.js +258 -0
- package/dist/commands/doc-gen.d.ts +7 -0
- package/dist/commands/doc-gen.js +208 -0
- package/dist/commands/docs.d.ts +1 -0
- package/dist/commands/docs.js +156 -0
- package/dist/commands/doctor.d.ts +55 -0
- package/dist/commands/doctor.js +362 -0
- package/dist/commands/encoding-safety.d.ts +4 -0
- package/dist/commands/encoding-safety.js +275 -0
- package/dist/commands/error-taxonomy.d.ts +5 -0
- package/dist/commands/error-taxonomy.js +226 -0
- package/dist/commands/error-ux.d.ts +4 -0
- package/dist/commands/error-ux.js +252 -0
- package/dist/commands/event-leak.d.ts +4 -0
- package/dist/commands/event-leak.js +262 -0
- package/dist/commands/evidence-chain.d.ts +4 -0
- package/dist/commands/evidence-chain.js +309 -0
- package/dist/commands/example-leak.d.ts +4 -0
- package/dist/commands/example-leak.js +232 -0
- package/dist/commands/exception-consistency.d.ts +6 -0
- package/dist/commands/exception-consistency.js +192 -0
- package/dist/commands/exec-report.d.ts +8 -0
- package/dist/commands/exec-report.js +271 -0
- package/dist/commands/explain-finding.d.ts +7 -0
- package/dist/commands/explain-finding.js +278 -0
- package/dist/commands/false-negatives.d.ts +34 -0
- package/dist/commands/false-negatives.js +165 -0
- package/dist/commands/feedback-rules.d.ts +28 -0
- package/dist/commands/feedback-rules.js +173 -0
- package/dist/commands/feedback.d.ts +182 -0
- package/dist/commands/feedback.js +550 -0
- package/dist/commands/finding-age-analysis.d.ts +4 -0
- package/dist/commands/finding-age-analysis.js +144 -0
- package/dist/commands/finding-age-report.d.ts +4 -0
- package/dist/commands/finding-age-report.js +154 -0
- package/dist/commands/finding-age-tracker.d.ts +7 -0
- package/dist/commands/finding-age-tracker.js +152 -0
- package/dist/commands/finding-age.d.ts +4 -0
- package/dist/commands/finding-age.js +145 -0
- package/dist/commands/finding-ancestry-trace.d.ts +1 -0
- package/dist/commands/finding-ancestry-trace.js +69 -0
- package/dist/commands/finding-annotation-export.d.ts +1 -0
- package/dist/commands/finding-annotation-export.js +97 -0
- package/dist/commands/finding-annotation-layer.d.ts +4 -0
- package/dist/commands/finding-annotation-layer.js +128 -0
- package/dist/commands/finding-auto-categorize.d.ts +1 -0
- package/dist/commands/finding-auto-categorize.js +109 -0
- package/dist/commands/finding-auto-fix-suggest.d.ts +1 -0
- package/dist/commands/finding-auto-fix-suggest.js +76 -0
- package/dist/commands/finding-auto-fix.d.ts +4 -0
- package/dist/commands/finding-auto-fix.js +188 -0
- package/dist/commands/finding-auto-group.d.ts +4 -0
- package/dist/commands/finding-auto-group.js +108 -0
- package/dist/commands/finding-auto-label.d.ts +4 -0
- package/dist/commands/finding-auto-label.js +220 -0
- package/dist/commands/finding-auto-priority.d.ts +1 -0
- package/dist/commands/finding-auto-priority.js +100 -0
- package/dist/commands/finding-auto-suppress.d.ts +4 -0
- package/dist/commands/finding-auto-suppress.js +126 -0
- package/dist/commands/finding-auto-tag.d.ts +4 -0
- package/dist/commands/finding-auto-tag.js +113 -0
- package/dist/commands/finding-auto-triage.d.ts +4 -0
- package/dist/commands/finding-auto-triage.js +108 -0
- package/dist/commands/finding-autofix-preview.d.ts +4 -0
- package/dist/commands/finding-autofix-preview.js +86 -0
- package/dist/commands/finding-batch-resolve.d.ts +4 -0
- package/dist/commands/finding-batch-resolve.js +165 -0
- package/dist/commands/finding-batch-suppress.d.ts +4 -0
- package/dist/commands/finding-batch-suppress.js +85 -0
- package/dist/commands/finding-batch-triage.d.ts +1 -0
- package/dist/commands/finding-batch-triage.js +90 -0
- package/dist/commands/finding-blast-radius.d.ts +4 -0
- package/dist/commands/finding-blast-radius.js +91 -0
- package/dist/commands/finding-budget.d.ts +4 -0
- package/dist/commands/finding-budget.js +232 -0
- package/dist/commands/finding-category-map.d.ts +4 -0
- package/dist/commands/finding-category-map.js +103 -0
- package/dist/commands/finding-category-stats.d.ts +4 -0
- package/dist/commands/finding-category-stats.js +104 -0
- package/dist/commands/finding-category.d.ts +4 -0
- package/dist/commands/finding-category.js +109 -0
- package/dist/commands/finding-change-impact.d.ts +4 -0
- package/dist/commands/finding-change-impact.js +107 -0
- package/dist/commands/finding-cluster-analysis.d.ts +4 -0
- package/dist/commands/finding-cluster-analysis.js +133 -0
- package/dist/commands/finding-cluster-group.d.ts +4 -0
- package/dist/commands/finding-cluster-group.js +105 -0
- package/dist/commands/finding-cluster-summary.d.ts +1 -0
- package/dist/commands/finding-cluster-summary.js +85 -0
- package/dist/commands/finding-cluster.d.ts +4 -0
- package/dist/commands/finding-cluster.js +157 -0
- package/dist/commands/finding-code-context.d.ts +4 -0
- package/dist/commands/finding-code-context.js +96 -0
- package/dist/commands/finding-code-smell.d.ts +4 -0
- package/dist/commands/finding-code-smell.js +113 -0
- package/dist/commands/finding-compare-runs.d.ts +4 -0
- package/dist/commands/finding-compare-runs.js +105 -0
- package/dist/commands/finding-compliance-tag.d.ts +1 -0
- package/dist/commands/finding-compliance-tag.js +106 -0
- package/dist/commands/finding-confidence-boost.d.ts +1 -0
- package/dist/commands/finding-confidence-boost.js +88 -0
- package/dist/commands/finding-confidence-calibrate.d.ts +4 -0
- package/dist/commands/finding-confidence-calibrate.js +111 -0
- package/dist/commands/finding-confidence-filter.d.ts +4 -0
- package/dist/commands/finding-confidence-filter.js +77 -0
- package/dist/commands/finding-contest.d.ts +7 -0
- package/dist/commands/finding-contest.js +192 -0
- package/dist/commands/finding-context-enrich.d.ts +4 -0
- package/dist/commands/finding-context-enrich.js +89 -0
- package/dist/commands/finding-context-expand.d.ts +4 -0
- package/dist/commands/finding-context-expand.js +102 -0
- package/dist/commands/finding-context-link.d.ts +1 -0
- package/dist/commands/finding-context-link.js +94 -0
- package/dist/commands/finding-context-summary.d.ts +1 -0
- package/dist/commands/finding-context-summary.js +85 -0
- package/dist/commands/finding-context-window.d.ts +4 -0
- package/dist/commands/finding-context-window.js +126 -0
- package/dist/commands/finding-context.d.ts +4 -0
- package/dist/commands/finding-context.js +140 -0
- package/dist/commands/finding-correlate.d.ts +4 -0
- package/dist/commands/finding-correlate.js +88 -0
- package/dist/commands/finding-correlation-map.d.ts +4 -0
- package/dist/commands/finding-correlation-map.js +101 -0
- package/dist/commands/finding-correlation.d.ts +4 -0
- package/dist/commands/finding-correlation.js +103 -0
- package/dist/commands/finding-cross-file-link.d.ts +1 -0
- package/dist/commands/finding-cross-file-link.js +101 -0
- package/dist/commands/finding-cross-ref.d.ts +4 -0
- package/dist/commands/finding-cross-ref.js +98 -0
- package/dist/commands/finding-cve-lookup.d.ts +4 -0
- package/dist/commands/finding-cve-lookup.js +97 -0
- package/dist/commands/finding-cwe-lookup.d.ts +4 -0
- package/dist/commands/finding-cwe-lookup.js +148 -0
- package/dist/commands/finding-cwe-map.d.ts +4 -0
- package/dist/commands/finding-cwe-map.js +133 -0
- package/dist/commands/finding-dedup-cross-file.d.ts +4 -0
- package/dist/commands/finding-dedup-cross-file.js +95 -0
- package/dist/commands/finding-dedup-cross.d.ts +4 -0
- package/dist/commands/finding-dedup-cross.js +90 -0
- package/dist/commands/finding-dedup-merge.d.ts +1 -0
- package/dist/commands/finding-dedup-merge.js +107 -0
- package/dist/commands/finding-dedup-report.d.ts +4 -0
- package/dist/commands/finding-dedup-report.js +101 -0
- package/dist/commands/finding-dedup-smart.d.ts +1 -0
- package/dist/commands/finding-dedup-smart.js +109 -0
- package/dist/commands/finding-deduplicate.d.ts +4 -0
- package/dist/commands/finding-deduplicate.js +141 -0
- package/dist/commands/finding-dependency-check.d.ts +4 -0
- package/dist/commands/finding-dependency-check.js +119 -0
- package/dist/commands/finding-dependency-impact.d.ts +1 -0
- package/dist/commands/finding-dependency-impact.js +97 -0
- package/dist/commands/finding-dependency-link.d.ts +4 -0
- package/dist/commands/finding-dependency-link.js +73 -0
- package/dist/commands/finding-dependency-risk.d.ts +4 -0
- package/dist/commands/finding-dependency-risk.js +117 -0
- package/dist/commands/finding-dependency-tree.d.ts +4 -0
- package/dist/commands/finding-dependency-tree.js +116 -0
- package/dist/commands/finding-diff-highlight.d.ts +4 -0
- package/dist/commands/finding-diff-highlight.js +107 -0
- package/dist/commands/finding-dismiss-workflow.d.ts +4 -0
- package/dist/commands/finding-dismiss-workflow.js +119 -0
- package/dist/commands/finding-duplicate-detect.d.ts +4 -0
- package/dist/commands/finding-duplicate-detect.js +113 -0
- package/dist/commands/finding-duplicate-rule.d.ts +4 -0
- package/dist/commands/finding-duplicate-rule.js +103 -0
- package/dist/commands/finding-effort-rank.d.ts +1 -0
- package/dist/commands/finding-effort-rank.js +93 -0
- package/dist/commands/finding-evidence-chain.d.ts +4 -0
- package/dist/commands/finding-evidence-chain.js +147 -0
- package/dist/commands/finding-evidence-collect.d.ts +4 -0
- package/dist/commands/finding-evidence-collect.js +114 -0
- package/dist/commands/finding-explain.d.ts +4 -0
- package/dist/commands/finding-explain.js +93 -0
- package/dist/commands/finding-export-csv.d.ts +4 -0
- package/dist/commands/finding-export-csv.js +78 -0
- package/dist/commands/finding-false-neg-check.d.ts +8 -0
- package/dist/commands/finding-false-neg-check.js +139 -0
- package/dist/commands/finding-false-positive-learn.d.ts +4 -0
- package/dist/commands/finding-false-positive-learn.js +85 -0
- package/dist/commands/finding-false-positive-log.d.ts +4 -0
- package/dist/commands/finding-false-positive-log.js +150 -0
- package/dist/commands/finding-false-positive.d.ts +4 -0
- package/dist/commands/finding-false-positive.js +134 -0
- package/dist/commands/finding-filter-view.d.ts +4 -0
- package/dist/commands/finding-filter-view.js +107 -0
- package/dist/commands/finding-fix-chain.d.ts +1 -0
- package/dist/commands/finding-fix-chain.js +78 -0
- package/dist/commands/finding-fix-estimate.d.ts +1 -0
- package/dist/commands/finding-fix-estimate.js +95 -0
- package/dist/commands/finding-fix-playbook.d.ts +1 -0
- package/dist/commands/finding-fix-playbook.js +110 -0
- package/dist/commands/finding-fix-priority.d.ts +4 -0
- package/dist/commands/finding-fix-priority.js +98 -0
- package/dist/commands/finding-fix-rate.d.ts +4 -0
- package/dist/commands/finding-fix-rate.js +141 -0
- package/dist/commands/finding-fix-suggest.d.ts +4 -0
- package/dist/commands/finding-fix-suggest.js +88 -0
- package/dist/commands/finding-fix-validation.d.ts +4 -0
- package/dist/commands/finding-fix-validation.js +115 -0
- package/dist/commands/finding-fix-verify.d.ts +4 -0
- package/dist/commands/finding-fix-verify.js +198 -0
- package/dist/commands/finding-group-by.d.ts +4 -0
- package/dist/commands/finding-group-by.js +86 -0
- package/dist/commands/finding-group.d.ts +15 -0
- package/dist/commands/finding-group.js +164 -0
- package/dist/commands/finding-groupby-file.d.ts +4 -0
- package/dist/commands/finding-groupby-file.js +94 -0
- package/dist/commands/finding-hotfix-suggest.d.ts +7 -0
- package/dist/commands/finding-hotfix-suggest.js +170 -0
- package/dist/commands/finding-hotspot-detect.d.ts +1 -0
- package/dist/commands/finding-hotspot-detect.js +120 -0
- package/dist/commands/finding-hotspot-map.d.ts +4 -0
- package/dist/commands/finding-hotspot-map.js +106 -0
- package/dist/commands/finding-hotspot.d.ts +4 -0
- package/dist/commands/finding-hotspot.js +115 -0
- package/dist/commands/finding-impact-radius.d.ts +1 -0
- package/dist/commands/finding-impact-radius.js +94 -0
- package/dist/commands/finding-impact-rank.d.ts +4 -0
- package/dist/commands/finding-impact-rank.js +85 -0
- package/dist/commands/finding-impact-score.d.ts +4 -0
- package/dist/commands/finding-impact-score.js +123 -0
- package/dist/commands/finding-impact.d.ts +4 -0
- package/dist/commands/finding-impact.js +135 -0
- package/dist/commands/finding-line-blame.d.ts +7 -0
- package/dist/commands/finding-line-blame.js +129 -0
- package/dist/commands/finding-link-graph.d.ts +4 -0
- package/dist/commands/finding-link-graph.js +144 -0
- package/dist/commands/finding-link.d.ts +4 -0
- package/dist/commands/finding-link.js +128 -0
- package/dist/commands/finding-merge-results.d.ts +4 -0
- package/dist/commands/finding-merge-results.js +110 -0
- package/dist/commands/finding-merge-strategy.d.ts +1 -0
- package/dist/commands/finding-merge-strategy.js +84 -0
- package/dist/commands/finding-metadata-enrich.d.ts +4 -0
- package/dist/commands/finding-metadata-enrich.js +92 -0
- package/dist/commands/finding-noise-filter.d.ts +7 -0
- package/dist/commands/finding-noise-filter.js +140 -0
- package/dist/commands/finding-noise-reduce.d.ts +1 -0
- package/dist/commands/finding-noise-reduce.js +81 -0
- package/dist/commands/finding-noise-score.d.ts +1 -0
- package/dist/commands/finding-noise-score.js +93 -0
- package/dist/commands/finding-owner-assign.d.ts +4 -0
- package/dist/commands/finding-owner-assign.js +133 -0
- package/dist/commands/finding-owner-notify.d.ts +1 -0
- package/dist/commands/finding-owner-notify.js +121 -0
- package/dist/commands/finding-ownership-assign.d.ts +4 -0
- package/dist/commands/finding-ownership-assign.js +101 -0
- package/dist/commands/finding-ownership-map.d.ts +4 -0
- package/dist/commands/finding-ownership-map.js +118 -0
- package/dist/commands/finding-patch-chain.d.ts +1 -0
- package/dist/commands/finding-patch-chain.js +90 -0
- package/dist/commands/finding-patch-preview.d.ts +4 -0
- package/dist/commands/finding-patch-preview.js +103 -0
- package/dist/commands/finding-pattern-detect.d.ts +4 -0
- package/dist/commands/finding-pattern-detect.js +127 -0
- package/dist/commands/finding-pattern-library.d.ts +4 -0
- package/dist/commands/finding-pattern-library.js +145 -0
- package/dist/commands/finding-pattern-match.d.ts +4 -0
- package/dist/commands/finding-pattern-match.js +165 -0
- package/dist/commands/finding-prioritize.d.ts +4 -0
- package/dist/commands/finding-prioritize.js +119 -0
- package/dist/commands/finding-priority-matrix.d.ts +4 -0
- package/dist/commands/finding-priority-matrix.js +102 -0
- package/dist/commands/finding-priority-queue.d.ts +4 -0
- package/dist/commands/finding-priority-queue.js +131 -0
- package/dist/commands/finding-priority-rank.d.ts +1 -0
- package/dist/commands/finding-priority-rank.js +82 -0
- package/dist/commands/finding-quality-gate.d.ts +4 -0
- package/dist/commands/finding-quality-gate.js +107 -0
- package/dist/commands/finding-rank.d.ts +4 -0
- package/dist/commands/finding-rank.js +138 -0
- package/dist/commands/finding-reachability-check.d.ts +4 -0
- package/dist/commands/finding-reachability-check.js +102 -0
- package/dist/commands/finding-reachability.d.ts +4 -0
- package/dist/commands/finding-reachability.js +131 -0
- package/dist/commands/finding-recurrence-check.d.ts +1 -0
- package/dist/commands/finding-recurrence-check.js +103 -0
- package/dist/commands/finding-recurrence-detect.d.ts +4 -0
- package/dist/commands/finding-recurrence-detect.js +77 -0
- package/dist/commands/finding-recurrence.d.ts +4 -0
- package/dist/commands/finding-recurrence.js +135 -0
- package/dist/commands/finding-regression-check.d.ts +4 -0
- package/dist/commands/finding-regression-check.js +112 -0
- package/dist/commands/finding-regression-detect.d.ts +1 -0
- package/dist/commands/finding-regression-detect.js +86 -0
- package/dist/commands/finding-related-rules.d.ts +4 -0
- package/dist/commands/finding-related-rules.js +151 -0
- package/dist/commands/finding-remediation-cost.d.ts +1 -0
- package/dist/commands/finding-remediation-cost.js +79 -0
- package/dist/commands/finding-remediation-plan.d.ts +4 -0
- package/dist/commands/finding-remediation-plan.js +107 -0
- package/dist/commands/finding-reopen-detect.d.ts +1 -0
- package/dist/commands/finding-reopen-detect.js +77 -0
- package/dist/commands/finding-repeat-detect.d.ts +1 -0
- package/dist/commands/finding-repeat-detect.js +92 -0
- package/dist/commands/finding-resolution-track.d.ts +4 -0
- package/dist/commands/finding-resolution-track.js +150 -0
- package/dist/commands/finding-resolution-tracker.d.ts +4 -0
- package/dist/commands/finding-resolution-tracker.js +163 -0
- package/dist/commands/finding-resolution-workflow.d.ts +1 -0
- package/dist/commands/finding-resolution-workflow.js +91 -0
- package/dist/commands/finding-resolution.d.ts +4 -0
- package/dist/commands/finding-resolution.js +142 -0
- package/dist/commands/finding-risk-label.d.ts +1 -0
- package/dist/commands/finding-risk-label.js +72 -0
- package/dist/commands/finding-risk-matrix.d.ts +4 -0
- package/dist/commands/finding-risk-matrix.js +126 -0
- package/dist/commands/finding-risk-score.d.ts +4 -0
- package/dist/commands/finding-risk-score.js +95 -0
- package/dist/commands/finding-root-cause.d.ts +4 -0
- package/dist/commands/finding-root-cause.js +184 -0
- package/dist/commands/finding-rule-explain.d.ts +4 -0
- package/dist/commands/finding-rule-explain.js +140 -0
- package/dist/commands/finding-scope-filter.d.ts +1 -0
- package/dist/commands/finding-scope-filter.js +77 -0
- package/dist/commands/finding-scope-impact.d.ts +1 -0
- package/dist/commands/finding-scope-impact.js +83 -0
- package/dist/commands/finding-search-index.d.ts +4 -0
- package/dist/commands/finding-search-index.js +99 -0
- package/dist/commands/finding-security-hotspot.d.ts +4 -0
- package/dist/commands/finding-security-hotspot.js +175 -0
- package/dist/commands/finding-severity-dist.d.ts +4 -0
- package/dist/commands/finding-severity-dist.js +105 -0
- package/dist/commands/finding-severity-drift.d.ts +4 -0
- package/dist/commands/finding-severity-drift.js +92 -0
- package/dist/commands/finding-severity-heatmap.d.ts +4 -0
- package/dist/commands/finding-severity-heatmap.js +108 -0
- package/dist/commands/finding-severity-histogram.d.ts +4 -0
- package/dist/commands/finding-severity-histogram.js +66 -0
- package/dist/commands/finding-severity-override.d.ts +4 -0
- package/dist/commands/finding-severity-override.js +131 -0
- package/dist/commands/finding-severity-rebalance.d.ts +1 -0
- package/dist/commands/finding-severity-rebalance.js +108 -0
- package/dist/commands/finding-severity-trend.d.ts +4 -0
- package/dist/commands/finding-severity-trend.js +127 -0
- package/dist/commands/finding-similar-match.d.ts +1 -0
- package/dist/commands/finding-similar-match.js +112 -0
- package/dist/commands/finding-snippet.d.ts +4 -0
- package/dist/commands/finding-snippet.js +102 -0
- package/dist/commands/finding-summary-digest.d.ts +7 -0
- package/dist/commands/finding-summary-digest.js +145 -0
- package/dist/commands/finding-suppress-pattern.d.ts +4 -0
- package/dist/commands/finding-suppress-pattern.js +148 -0
- package/dist/commands/finding-suppress.d.ts +4 -0
- package/dist/commands/finding-suppress.js +164 -0
- package/dist/commands/finding-suppression-audit.d.ts +4 -0
- package/dist/commands/finding-suppression-audit.js +137 -0
- package/dist/commands/finding-suppression-list.d.ts +4 -0
- package/dist/commands/finding-suppression-list.js +119 -0
- package/dist/commands/finding-suppression-log.d.ts +4 -0
- package/dist/commands/finding-suppression-log.js +174 -0
- package/dist/commands/finding-time-to-fix.d.ts +1 -0
- package/dist/commands/finding-time-to-fix.js +98 -0
- package/dist/commands/finding-timeline-view.d.ts +4 -0
- package/dist/commands/finding-timeline-view.js +98 -0
- package/dist/commands/finding-timeline.d.ts +4 -0
- package/dist/commands/finding-timeline.js +143 -0
- package/dist/commands/finding-top-offender.d.ts +1 -0
- package/dist/commands/finding-top-offender.js +75 -0
- package/dist/commands/finding-trace.d.ts +4 -0
- package/dist/commands/finding-trace.js +118 -0
- package/dist/commands/finding-trend-alert.d.ts +1 -0
- package/dist/commands/finding-trend-alert.js +126 -0
- package/dist/commands/finding-trend-analysis.d.ts +4 -0
- package/dist/commands/finding-trend-analysis.js +95 -0
- package/dist/commands/finding-trend-forecast.d.ts +4 -0
- package/dist/commands/finding-trend-forecast.js +106 -0
- package/dist/commands/finding-trend-report.d.ts +4 -0
- package/dist/commands/finding-trend-report.js +107 -0
- package/dist/commands/finding-trend.d.ts +4 -0
- package/dist/commands/finding-trend.js +118 -0
- package/dist/commands/fix-pr.d.ts +22 -0
- package/dist/commands/fix-pr.js +286 -0
- package/dist/commands/fix-suggest.d.ts +4 -0
- package/dist/commands/fix-suggest.js +171 -0
- package/dist/commands/fix-verify.d.ts +4 -0
- package/dist/commands/fix-verify.js +123 -0
- package/dist/commands/fix.d.ts +117 -0
- package/dist/commands/fix.js +445 -0
- package/dist/commands/focus-area.d.ts +5 -0
- package/dist/commands/focus-area.js +192 -0
- package/dist/commands/generate.d.ts +7 -0
- package/dist/commands/generate.js +403 -0
- package/dist/commands/governance.d.ts +31 -0
- package/dist/commands/governance.js +202 -0
- package/dist/commands/group-findings.d.ts +22 -0
- package/dist/commands/group-findings.js +154 -0
- package/dist/commands/guided-tour.d.ts +8 -0
- package/dist/commands/guided-tour.js +287 -0
- package/dist/commands/habit-tracker.d.ts +7 -0
- package/dist/commands/habit-tracker.js +194 -0
- package/dist/commands/hallucination-detect.d.ts +4 -0
- package/dist/commands/hallucination-detect.js +350 -0
- package/dist/commands/hallucination-score.d.ts +8 -0
- package/dist/commands/hallucination-score.js +316 -0
- package/dist/commands/help.d.ts +7 -0
- package/dist/commands/help.js +302 -0
- package/dist/commands/hook-install.d.ts +21 -0
- package/dist/commands/hook-install.js +142 -0
- package/dist/commands/hook.d.ts +8 -0
- package/dist/commands/hook.js +145 -0
- package/dist/commands/iac-lint.d.ts +7 -0
- package/dist/commands/iac-lint.js +312 -0
- package/dist/commands/idempotency-audit.d.ts +4 -0
- package/dist/commands/idempotency-audit.js +222 -0
- package/dist/commands/ignore-list.d.ts +18 -0
- package/dist/commands/ignore-list.js +152 -0
- package/dist/commands/impact-scan.d.ts +8 -0
- package/dist/commands/impact-scan.js +281 -0
- package/dist/commands/incident-response.d.ts +7 -0
- package/dist/commands/incident-response.js +254 -0
- package/dist/commands/incremental-review.d.ts +4 -0
- package/dist/commands/incremental-review.js +236 -0
- package/dist/commands/init.d.ts +10 -0
- package/dist/commands/init.js +265 -0
- package/dist/commands/input-guard.d.ts +4 -0
- package/dist/commands/input-guard.js +255 -0
- package/dist/commands/interactive-fix.d.ts +22 -0
- package/dist/commands/interactive-fix.js +139 -0
- package/dist/commands/judge-author.d.ts +7 -0
- package/dist/commands/judge-author.js +260 -0
- package/dist/commands/judge-config.d.ts +4 -0
- package/dist/commands/judge-config.js +151 -0
- package/dist/commands/judge-learn.d.ts +8 -0
- package/dist/commands/judge-learn.js +217 -0
- package/dist/commands/judge-reputation.d.ts +28 -0
- package/dist/commands/judge-reputation.js +198 -0
- package/dist/commands/kb.d.ts +40 -0
- package/dist/commands/kb.js +228 -0
- package/dist/commands/language-packs.d.ts +42 -0
- package/dist/commands/language-packs.js +150 -0
- package/dist/commands/learn.d.ts +26 -0
- package/dist/commands/learn.js +288 -0
- package/dist/commands/learning-path.d.ts +8 -0
- package/dist/commands/learning-path.js +325 -0
- package/dist/commands/license-scan.d.ts +8 -0
- package/dist/commands/license-scan.js +183 -0
- package/dist/commands/llm-benchmark-optimizer.d.ts +78 -0
- package/dist/commands/llm-benchmark-optimizer.js +241 -0
- package/dist/commands/llm-benchmark.d.ts +156 -0
- package/dist/commands/llm-benchmark.js +670 -0
- package/dist/commands/log-quality.d.ts +5 -0
- package/dist/commands/log-quality.js +211 -0
- package/dist/commands/logic-lint.d.ts +4 -0
- package/dist/commands/logic-lint.js +255 -0
- package/dist/commands/lsp.d.ts +23 -0
- package/dist/commands/lsp.js +285 -0
- package/dist/commands/merge-verdict.d.ts +4 -0
- package/dist/commands/merge-verdict.js +287 -0
- package/dist/commands/metrics-dashboard.d.ts +21 -0
- package/dist/commands/metrics-dashboard.js +334 -0
- package/dist/commands/metrics.d.ts +57 -0
- package/dist/commands/metrics.js +241 -0
- package/dist/commands/migration-safety.d.ts +5 -0
- package/dist/commands/migration-safety.js +256 -0
- package/dist/commands/model-report.d.ts +8 -0
- package/dist/commands/model-report.js +194 -0
- package/dist/commands/model-risk.d.ts +27 -0
- package/dist/commands/model-risk.js +220 -0
- package/dist/commands/monorepo.d.ts +37 -0
- package/dist/commands/monorepo.js +232 -0
- package/dist/commands/multi-lang-review.d.ts +4 -0
- package/dist/commands/multi-lang-review.js +230 -0
- package/dist/commands/noise-advisor.d.ts +29 -0
- package/dist/commands/noise-advisor.js +170 -0
- package/dist/commands/notify.d.ts +78 -0
- package/dist/commands/notify.js +324 -0
- package/dist/commands/null-safety-audit.d.ts +5 -0
- package/dist/commands/null-safety-audit.js +221 -0
- package/dist/commands/observability-gap.d.ts +5 -0
- package/dist/commands/observability-gap.js +211 -0
- package/dist/commands/onboard.d.ts +12 -0
- package/dist/commands/onboard.js +178 -0
- package/dist/commands/org-metrics.d.ts +23 -0
- package/dist/commands/org-metrics.js +237 -0
- package/dist/commands/org-policy.d.ts +7 -0
- package/dist/commands/org-policy.js +207 -0
- package/dist/commands/over-abstraction.d.ts +4 -0
- package/dist/commands/over-abstraction.js +307 -0
- package/dist/commands/override.d.ts +61 -0
- package/dist/commands/override.js +268 -0
- package/dist/commands/ownership-map.d.ts +5 -0
- package/dist/commands/ownership-map.js +217 -0
- package/dist/commands/parity.d.ts +30 -0
- package/dist/commands/parity.js +212 -0
- package/dist/commands/pattern-registry.d.ts +22 -0
- package/dist/commands/pattern-registry.js +226 -0
- package/dist/commands/perf-compare.d.ts +8 -0
- package/dist/commands/perf-compare.js +245 -0
- package/dist/commands/perf-hotspot.d.ts +7 -0
- package/dist/commands/perf-hotspot.js +273 -0
- package/dist/commands/phantom-import.d.ts +4 -0
- package/dist/commands/phantom-import.js +260 -0
- package/dist/commands/pii-scan.d.ts +7 -0
- package/dist/commands/pii-scan.js +299 -0
- package/dist/commands/plugin-search.d.ts +39 -0
- package/dist/commands/plugin-search.js +327 -0
- package/dist/commands/plugins.d.ts +12 -0
- package/dist/commands/plugins.js +104 -0
- package/dist/commands/policy-audit.d.ts +52 -0
- package/dist/commands/policy-audit.js +160 -0
- package/dist/commands/pr-quality-gate.d.ts +28 -0
- package/dist/commands/pr-quality-gate.js +207 -0
- package/dist/commands/pr-summary.d.ts +25 -0
- package/dist/commands/pr-summary.js +187 -0
- package/dist/commands/predict.d.ts +7 -0
- package/dist/commands/predict.js +218 -0
- package/dist/commands/privilege-path.d.ts +4 -0
- package/dist/commands/privilege-path.js +233 -0
- package/dist/commands/profile.d.ts +37 -0
- package/dist/commands/profile.js +101 -0
- package/dist/commands/prompt-replay.d.ts +7 -0
- package/dist/commands/prompt-replay.js +176 -0
- package/dist/commands/quality-gate.d.ts +69 -0
- package/dist/commands/quality-gate.js +252 -0
- package/dist/commands/query.d.ts +19 -0
- package/dist/commands/query.js +229 -0
- package/dist/commands/quick-check.d.ts +4 -0
- package/dist/commands/quick-check.js +173 -0
- package/dist/commands/recommend.d.ts +20 -0
- package/dist/commands/recommend.js +282 -0
- package/dist/commands/refactor-safety.d.ts +8 -0
- package/dist/commands/refactor-safety.js +273 -0
- package/dist/commands/reg-watch.d.ts +20 -0
- package/dist/commands/reg-watch.js +219 -0
- package/dist/commands/regression-alert.d.ts +31 -0
- package/dist/commands/regression-alert.js +215 -0
- package/dist/commands/remediation-lib.d.ts +8 -0
- package/dist/commands/remediation-lib.js +265 -0
- package/dist/commands/remediation.d.ts +20 -0
- package/dist/commands/remediation.js +256 -0
- package/dist/commands/report-template.d.ts +16 -0
- package/dist/commands/report-template.js +290 -0
- package/dist/commands/report.d.ts +12 -0
- package/dist/commands/report.js +139 -0
- package/dist/commands/resource-cleanup.d.ts +6 -0
- package/dist/commands/resource-cleanup.js +235 -0
- package/dist/commands/retro.d.ts +22 -0
- package/dist/commands/retro.js +211 -0
- package/dist/commands/retry-pattern-audit.d.ts +5 -0
- package/dist/commands/retry-pattern-audit.js +215 -0
- package/dist/commands/review-ab-test.d.ts +4 -0
- package/dist/commands/review-ab-test.js +224 -0
- package/dist/commands/review-access-log.d.ts +4 -0
- package/dist/commands/review-access-log.js +65 -0
- package/dist/commands/review-action-item-gen.d.ts +1 -0
- package/dist/commands/review-action-item-gen.js +72 -0
- package/dist/commands/review-adoption-metrics.d.ts +4 -0
- package/dist/commands/review-adoption-metrics.js +95 -0
- package/dist/commands/review-adoption-score.d.ts +1 -0
- package/dist/commands/review-adoption-score.js +181 -0
- package/dist/commands/review-ai-feedback-loop.d.ts +1 -0
- package/dist/commands/review-ai-feedback-loop.js +116 -0
- package/dist/commands/review-annotate.d.ts +4 -0
- package/dist/commands/review-annotate.js +122 -0
- package/dist/commands/review-annotation-export.d.ts +4 -0
- package/dist/commands/review-annotation-export.js +105 -0
- package/dist/commands/review-annotation.d.ts +4 -0
- package/dist/commands/review-annotation.js +133 -0
- package/dist/commands/review-api-export.d.ts +4 -0
- package/dist/commands/review-api-export.js +98 -0
- package/dist/commands/review-approval-criteria.d.ts +1 -0
- package/dist/commands/review-approval-criteria.js +99 -0
- package/dist/commands/review-approval-gate.d.ts +7 -0
- package/dist/commands/review-approval-gate.js +190 -0
- package/dist/commands/review-approval.d.ts +4 -0
- package/dist/commands/review-approval.js +133 -0
- package/dist/commands/review-archive-search.d.ts +4 -0
- package/dist/commands/review-archive-search.js +70 -0
- package/dist/commands/review-archive.d.ts +4 -0
- package/dist/commands/review-archive.js +135 -0
- package/dist/commands/review-audit-export.d.ts +4 -0
- package/dist/commands/review-audit-export.js +93 -0
- package/dist/commands/review-audit-log.d.ts +4 -0
- package/dist/commands/review-audit-log.js +140 -0
- package/dist/commands/review-audit-trail.d.ts +4 -0
- package/dist/commands/review-audit-trail.js +96 -0
- package/dist/commands/review-auto-merge.d.ts +4 -0
- package/dist/commands/review-auto-merge.js +175 -0
- package/dist/commands/review-badge.d.ts +4 -0
- package/dist/commands/review-badge.js +152 -0
- package/dist/commands/review-batch-files.d.ts +4 -0
- package/dist/commands/review-batch-files.js +82 -0
- package/dist/commands/review-batch-mode.d.ts +4 -0
- package/dist/commands/review-batch-mode.js +97 -0
- package/dist/commands/review-batch-run.d.ts +4 -0
- package/dist/commands/review-batch-run.js +149 -0
- package/dist/commands/review-benchmark-self.d.ts +4 -0
- package/dist/commands/review-benchmark-self.js +140 -0
- package/dist/commands/review-blame-map.d.ts +4 -0
- package/dist/commands/review-blame-map.js +100 -0
- package/dist/commands/review-branch-compare.d.ts +4 -0
- package/dist/commands/review-branch-compare.js +108 -0
- package/dist/commands/review-branch-policy.d.ts +4 -0
- package/dist/commands/review-branch-policy.js +102 -0
- package/dist/commands/review-bulk-action.d.ts +4 -0
- package/dist/commands/review-bulk-action.js +109 -0
- package/dist/commands/review-bulk-apply.d.ts +4 -0
- package/dist/commands/review-bulk-apply.js +102 -0
- package/dist/commands/review-cache-clear.d.ts +4 -0
- package/dist/commands/review-cache-clear.js +160 -0
- package/dist/commands/review-cache-warm.d.ts +4 -0
- package/dist/commands/review-cache-warm.js +70 -0
- package/dist/commands/review-cache.d.ts +22 -0
- package/dist/commands/review-cache.js +134 -0
- package/dist/commands/review-changelog-entry.d.ts +7 -0
- package/dist/commands/review-changelog-entry.js +109 -0
- package/dist/commands/review-changelog-gen.d.ts +4 -0
- package/dist/commands/review-changelog-gen.js +117 -0
- package/dist/commands/review-changelog-impact.d.ts +1 -0
- package/dist/commands/review-changelog-impact.js +89 -0
- package/dist/commands/review-checklist.d.ts +4 -0
- package/dist/commands/review-checklist.js +144 -0
- package/dist/commands/review-checkpoint.d.ts +4 -0
- package/dist/commands/review-checkpoint.js +163 -0
- package/dist/commands/review-ci-gate.d.ts +4 -0
- package/dist/commands/review-ci-gate.js +114 -0
- package/dist/commands/review-ci-insight.d.ts +1 -0
- package/dist/commands/review-ci-insight.js +100 -0
- package/dist/commands/review-ci-integration.d.ts +4 -0
- package/dist/commands/review-ci-integration.js +125 -0
- package/dist/commands/review-ci-status.d.ts +4 -0
- package/dist/commands/review-ci-status.js +200 -0
- package/dist/commands/review-cicd-integrate.d.ts +4 -0
- package/dist/commands/review-cicd-integrate.js +122 -0
- package/dist/commands/review-code-health-score.d.ts +1 -0
- package/dist/commands/review-code-health-score.js +100 -0
- package/dist/commands/review-code-owner.d.ts +7 -0
- package/dist/commands/review-code-owner.js +164 -0
- package/dist/commands/review-code-ownership.d.ts +1 -0
- package/dist/commands/review-code-ownership.js +88 -0
- package/dist/commands/review-comment.d.ts +4 -0
- package/dist/commands/review-comment.js +165 -0
- package/dist/commands/review-commit-hook.d.ts +7 -0
- package/dist/commands/review-commit-hook.js +134 -0
- package/dist/commands/review-commit-quality.d.ts +1 -0
- package/dist/commands/review-commit-quality.js +94 -0
- package/dist/commands/review-comparative.d.ts +4 -0
- package/dist/commands/review-comparative.js +149 -0
- package/dist/commands/review-compare-version.d.ts +4 -0
- package/dist/commands/review-compare-version.js +108 -0
- package/dist/commands/review-compare.d.ts +4 -0
- package/dist/commands/review-compare.js +200 -0
- package/dist/commands/review-compliance-check.d.ts +4 -0
- package/dist/commands/review-compliance-check.js +202 -0
- package/dist/commands/review-compliance-gate.d.ts +4 -0
- package/dist/commands/review-compliance-gate.js +151 -0
- package/dist/commands/review-compliance-map.d.ts +4 -0
- package/dist/commands/review-compliance-map.js +110 -0
- package/dist/commands/review-compliance-report.d.ts +4 -0
- package/dist/commands/review-compliance-report.js +127 -0
- package/dist/commands/review-confidence-explain.d.ts +1 -0
- package/dist/commands/review-confidence-explain.js +99 -0
- package/dist/commands/review-config-diff.d.ts +4 -0
- package/dist/commands/review-config-diff.js +108 -0
- package/dist/commands/review-config-export.d.ts +4 -0
- package/dist/commands/review-config-export.js +124 -0
- package/dist/commands/review-config-health.d.ts +1 -0
- package/dist/commands/review-config-health.js +172 -0
- package/dist/commands/review-config-migrate.d.ts +4 -0
- package/dist/commands/review-config-migrate.js +123 -0
- package/dist/commands/review-config-template.d.ts +4 -0
- package/dist/commands/review-config-template.js +112 -0
- package/dist/commands/review-config-validate.d.ts +4 -0
- package/dist/commands/review-config-validate.js +110 -0
- package/dist/commands/review-contract.d.ts +4 -0
- package/dist/commands/review-contract.js +199 -0
- package/dist/commands/review-coverage-gap.d.ts +4 -0
- package/dist/commands/review-coverage-gap.js +120 -0
- package/dist/commands/review-coverage-map.d.ts +4 -0
- package/dist/commands/review-coverage-map.js +194 -0
- package/dist/commands/review-custom-judge-config.d.ts +4 -0
- package/dist/commands/review-custom-judge-config.js +103 -0
- package/dist/commands/review-custom-judge.d.ts +4 -0
- package/dist/commands/review-custom-judge.js +182 -0
- package/dist/commands/review-custom-prompt.d.ts +4 -0
- package/dist/commands/review-custom-prompt.js +170 -0
- package/dist/commands/review-custom-rule.d.ts +4 -0
- package/dist/commands/review-custom-rule.js +169 -0
- package/dist/commands/review-dashboard-data.d.ts +4 -0
- package/dist/commands/review-dashboard-data.js +142 -0
- package/dist/commands/review-dashboard.d.ts +4 -0
- package/dist/commands/review-dashboard.js +140 -0
- package/dist/commands/review-data-retention.d.ts +4 -0
- package/dist/commands/review-data-retention.js +119 -0
- package/dist/commands/review-dependency-graph.d.ts +4 -0
- package/dist/commands/review-dependency-graph.js +94 -0
- package/dist/commands/review-dependency-review.d.ts +1 -0
- package/dist/commands/review-dependency-review.js +104 -0
- package/dist/commands/review-deployment-gate.d.ts +4 -0
- package/dist/commands/review-deployment-gate.js +94 -0
- package/dist/commands/review-depth.d.ts +4 -0
- package/dist/commands/review-depth.js +142 -0
- package/dist/commands/review-diff-annotate.d.ts +4 -0
- package/dist/commands/review-diff-annotate.js +104 -0
- package/dist/commands/review-diff-context.d.ts +4 -0
- package/dist/commands/review-diff-context.js +158 -0
- package/dist/commands/review-diff-highlight.d.ts +4 -0
- package/dist/commands/review-diff-highlight.js +179 -0
- package/dist/commands/review-diff-stats.d.ts +4 -0
- package/dist/commands/review-diff-stats.js +90 -0
- package/dist/commands/review-diff-summary.d.ts +4 -0
- package/dist/commands/review-diff-summary.js +154 -0
- package/dist/commands/review-digest-gen.d.ts +1 -0
- package/dist/commands/review-digest-gen.js +100 -0
- package/dist/commands/review-digest.d.ts +4 -0
- package/dist/commands/review-digest.js +265 -0
- package/dist/commands/review-dry-run.d.ts +4 -0
- package/dist/commands/review-dry-run.js +120 -0
- package/dist/commands/review-engagement-score.d.ts +1 -0
- package/dist/commands/review-engagement-score.js +111 -0
- package/dist/commands/review-env-check.d.ts +4 -0
- package/dist/commands/review-env-check.js +115 -0
- package/dist/commands/review-environment-config.d.ts +4 -0
- package/dist/commands/review-environment-config.js +102 -0
- package/dist/commands/review-escalation-path.d.ts +1 -0
- package/dist/commands/review-escalation-path.js +86 -0
- package/dist/commands/review-exclude-vendor.d.ts +4 -0
- package/dist/commands/review-exclude-vendor.js +158 -0
- package/dist/commands/review-explain.d.ts +5 -0
- package/dist/commands/review-explain.js +194 -0
- package/dist/commands/review-export-pdf.d.ts +7 -0
- package/dist/commands/review-export-pdf.js +131 -0
- package/dist/commands/review-export.d.ts +4 -0
- package/dist/commands/review-export.js +179 -0
- package/dist/commands/review-feedback-loop.d.ts +4 -0
- package/dist/commands/review-feedback-loop.js +113 -0
- package/dist/commands/review-feedback-summary.d.ts +1 -0
- package/dist/commands/review-feedback-summary.js +130 -0
- package/dist/commands/review-feedback.d.ts +4 -0
- package/dist/commands/review-feedback.js +145 -0
- package/dist/commands/review-file-complexity.d.ts +4 -0
- package/dist/commands/review-file-complexity.js +137 -0
- package/dist/commands/review-file-filter.d.ts +4 -0
- package/dist/commands/review-file-filter.js +121 -0
- package/dist/commands/review-file-stats.d.ts +4 -0
- package/dist/commands/review-file-stats.js +130 -0
- package/dist/commands/review-filter.d.ts +4 -0
- package/dist/commands/review-filter.js +161 -0
- package/dist/commands/review-finding-link.d.ts +7 -0
- package/dist/commands/review-finding-link.js +115 -0
- package/dist/commands/review-focus-area.d.ts +1 -0
- package/dist/commands/review-focus-area.js +96 -0
- package/dist/commands/review-focus.d.ts +4 -0
- package/dist/commands/review-focus.js +196 -0
- package/dist/commands/review-gate-config.d.ts +4 -0
- package/dist/commands/review-gate-config.js +153 -0
- package/dist/commands/review-gate.d.ts +4 -0
- package/dist/commands/review-gate.js +212 -0
- package/dist/commands/review-goal-track.d.ts +1 -0
- package/dist/commands/review-goal-track.js +123 -0
- package/dist/commands/review-guardrail.d.ts +4 -0
- package/dist/commands/review-guardrail.js +155 -0
- package/dist/commands/review-handoff.d.ts +4 -0
- package/dist/commands/review-handoff.js +208 -0
- package/dist/commands/review-health-check.d.ts +4 -0
- package/dist/commands/review-health-check.js +148 -0
- package/dist/commands/review-health-trend.d.ts +1 -0
- package/dist/commands/review-health-trend.js +107 -0
- package/dist/commands/review-history-compare.d.ts +4 -0
- package/dist/commands/review-history-compare.js +93 -0
- package/dist/commands/review-history-search.d.ts +4 -0
- package/dist/commands/review-history-search.js +214 -0
- package/dist/commands/review-ide-sync.d.ts +4 -0
- package/dist/commands/review-ide-sync.js +91 -0
- package/dist/commands/review-ignore-path.d.ts +4 -0
- package/dist/commands/review-ignore-path.js +147 -0
- package/dist/commands/review-ignore-pattern.d.ts +5 -0
- package/dist/commands/review-ignore-pattern.js +138 -0
- package/dist/commands/review-incident-link.d.ts +4 -0
- package/dist/commands/review-incident-link.js +93 -0
- package/dist/commands/review-incremental.d.ts +4 -0
- package/dist/commands/review-incremental.js +128 -0
- package/dist/commands/review-integration-health.d.ts +4 -0
- package/dist/commands/review-integration-health.js +84 -0
- package/dist/commands/review-integration-test.d.ts +4 -0
- package/dist/commands/review-integration-test.js +145 -0
- package/dist/commands/review-integration.d.ts +4 -0
- package/dist/commands/review-integration.js +236 -0
- package/dist/commands/review-interactive.d.ts +4 -0
- package/dist/commands/review-interactive.js +85 -0
- package/dist/commands/review-knowledge-capture.d.ts +1 -0
- package/dist/commands/review-knowledge-capture.js +94 -0
- package/dist/commands/review-language-profile.d.ts +4 -0
- package/dist/commands/review-language-profile.js +72 -0
- package/dist/commands/review-language-stats.d.ts +4 -0
- package/dist/commands/review-language-stats.js +152 -0
- package/dist/commands/review-lock-file.d.ts +4 -0
- package/dist/commands/review-lock-file.js +153 -0
- package/dist/commands/review-lock.d.ts +4 -0
- package/dist/commands/review-lock.js +107 -0
- package/dist/commands/review-log.d.ts +22 -0
- package/dist/commands/review-log.js +164 -0
- package/dist/commands/review-mentor-suggest.d.ts +1 -0
- package/dist/commands/review-mentor-suggest.js +112 -0
- package/dist/commands/review-merge-check.d.ts +4 -0
- package/dist/commands/review-merge-check.js +101 -0
- package/dist/commands/review-merge-config.d.ts +4 -0
- package/dist/commands/review-merge-config.js +119 -0
- package/dist/commands/review-merge-readiness.d.ts +1 -0
- package/dist/commands/review-merge-readiness.js +90 -0
- package/dist/commands/review-merge-request.d.ts +4 -0
- package/dist/commands/review-merge-request.js +95 -0
- package/dist/commands/review-merge.d.ts +4 -0
- package/dist/commands/review-merge.js +145 -0
- package/dist/commands/review-metric-export.d.ts +4 -0
- package/dist/commands/review-metric-export.js +62 -0
- package/dist/commands/review-milestone.d.ts +4 -0
- package/dist/commands/review-milestone.js +136 -0
- package/dist/commands/review-multi-repo-sync.d.ts +4 -0
- package/dist/commands/review-multi-repo-sync.js +115 -0
- package/dist/commands/review-multi-repo.d.ts +4 -0
- package/dist/commands/review-multi-repo.js +145 -0
- package/dist/commands/review-note.d.ts +4 -0
- package/dist/commands/review-note.js +104 -0
- package/dist/commands/review-notification-config.d.ts +4 -0
- package/dist/commands/review-notification-config.js +122 -0
- package/dist/commands/review-notification-digest.d.ts +4 -0
- package/dist/commands/review-notification-digest.js +64 -0
- package/dist/commands/review-notification.d.ts +4 -0
- package/dist/commands/review-notification.js +126 -0
- package/dist/commands/review-notify.d.ts +4 -0
- package/dist/commands/review-notify.js +143 -0
- package/dist/commands/review-offline.d.ts +4 -0
- package/dist/commands/review-offline.js +125 -0
- package/dist/commands/review-onboard-checklist.d.ts +4 -0
- package/dist/commands/review-onboard-checklist.js +119 -0
- package/dist/commands/review-onboard-wizard.d.ts +4 -0
- package/dist/commands/review-onboard-wizard.js +92 -0
- package/dist/commands/review-onboard.d.ts +4 -0
- package/dist/commands/review-onboard.js +154 -0
- package/dist/commands/review-onboarding-check.d.ts +1 -0
- package/dist/commands/review-onboarding-check.js +93 -0
- package/dist/commands/review-org-dashboard.d.ts +4 -0
- package/dist/commands/review-org-dashboard.js +68 -0
- package/dist/commands/review-output-filter.d.ts +4 -0
- package/dist/commands/review-output-filter.js +112 -0
- package/dist/commands/review-output-format.d.ts +4 -0
- package/dist/commands/review-output-format.js +144 -0
- package/dist/commands/review-output-transform.d.ts +4 -0
- package/dist/commands/review-output-transform.js +119 -0
- package/dist/commands/review-owner.d.ts +4 -0
- package/dist/commands/review-owner.js +129 -0
- package/dist/commands/review-parallel-diff.d.ts +4 -0
- package/dist/commands/review-parallel-diff.js +146 -0
- package/dist/commands/review-parallel-files.d.ts +7 -0
- package/dist/commands/review-parallel-files.js +134 -0
- package/dist/commands/review-parallel-run.d.ts +4 -0
- package/dist/commands/review-parallel-run.js +116 -0
- package/dist/commands/review-parallel.d.ts +4 -0
- package/dist/commands/review-parallel.js +164 -0
- package/dist/commands/review-perf-profile.d.ts +4 -0
- package/dist/commands/review-perf-profile.js +98 -0
- package/dist/commands/review-permission-model.d.ts +4 -0
- package/dist/commands/review-permission-model.js +149 -0
- package/dist/commands/review-pipeline-status.d.ts +4 -0
- package/dist/commands/review-pipeline-status.js +54 -0
- package/dist/commands/review-plugin-config.d.ts +4 -0
- package/dist/commands/review-plugin-config.js +167 -0
- package/dist/commands/review-plugin-list.d.ts +4 -0
- package/dist/commands/review-plugin-list.js +99 -0
- package/dist/commands/review-plugin-manage.d.ts +4 -0
- package/dist/commands/review-plugin-manage.js +137 -0
- package/dist/commands/review-plugin-status.d.ts +4 -0
- package/dist/commands/review-plugin-status.js +53 -0
- package/dist/commands/review-policy-enforce.d.ts +1 -0
- package/dist/commands/review-policy-enforce.js +92 -0
- package/dist/commands/review-policy-engine.d.ts +4 -0
- package/dist/commands/review-policy-engine.js +135 -0
- package/dist/commands/review-pr-comment-gen.d.ts +4 -0
- package/dist/commands/review-pr-comment-gen.js +62 -0
- package/dist/commands/review-pr-comment.d.ts +4 -0
- package/dist/commands/review-pr-comment.js +106 -0
- package/dist/commands/review-pr-label-suggest.d.ts +1 -0
- package/dist/commands/review-pr-label-suggest.js +77 -0
- package/dist/commands/review-pr-size-check.d.ts +1 -0
- package/dist/commands/review-pr-size-check.js +98 -0
- package/dist/commands/review-pr-template.d.ts +4 -0
- package/dist/commands/review-pr-template.js +104 -0
- package/dist/commands/review-preset-save.d.ts +4 -0
- package/dist/commands/review-preset-save.js +159 -0
- package/dist/commands/review-priority.d.ts +4 -0
- package/dist/commands/review-priority.js +157 -0
- package/dist/commands/review-profile.d.ts +4 -0
- package/dist/commands/review-profile.js +168 -0
- package/dist/commands/review-progress-bar.d.ts +4 -0
- package/dist/commands/review-progress-bar.js +157 -0
- package/dist/commands/review-progress-report.d.ts +1 -0
- package/dist/commands/review-progress-report.js +95 -0
- package/dist/commands/review-progress-track.d.ts +4 -0
- package/dist/commands/review-progress-track.js +94 -0
- package/dist/commands/review-quality-baseline.d.ts +1 -0
- package/dist/commands/review-quality-baseline.js +134 -0
- package/dist/commands/review-quality-gate.d.ts +1 -0
- package/dist/commands/review-quality-gate.js +86 -0
- package/dist/commands/review-quality-score.d.ts +4 -0
- package/dist/commands/review-quality-score.js +127 -0
- package/dist/commands/review-quality-trend.d.ts +4 -0
- package/dist/commands/review-quality-trend.js +57 -0
- package/dist/commands/review-queue.d.ts +33 -0
- package/dist/commands/review-queue.js +225 -0
- package/dist/commands/review-quickstart.d.ts +4 -0
- package/dist/commands/review-quickstart.js +107 -0
- package/dist/commands/review-quota-check.d.ts +4 -0
- package/dist/commands/review-quota-check.js +97 -0
- package/dist/commands/review-quota.d.ts +4 -0
- package/dist/commands/review-quota.js +126 -0
- package/dist/commands/review-rate-limit.d.ts +4 -0
- package/dist/commands/review-rate-limit.js +130 -0
- package/dist/commands/review-readiness-check.d.ts +1 -0
- package/dist/commands/review-readiness-check.js +98 -0
- package/dist/commands/review-receipt.d.ts +4 -0
- package/dist/commands/review-receipt.js +220 -0
- package/dist/commands/review-release-gate.d.ts +1 -0
- package/dist/commands/review-release-gate.js +81 -0
- package/dist/commands/review-replay.d.ts +8 -0
- package/dist/commands/review-replay.js +264 -0
- package/dist/commands/review-repo-onboard.d.ts +4 -0
- package/dist/commands/review-repo-onboard.js +114 -0
- package/dist/commands/review-report-archive.d.ts +4 -0
- package/dist/commands/review-report-archive.js +100 -0
- package/dist/commands/review-report-merge.d.ts +4 -0
- package/dist/commands/review-report-merge.js +90 -0
- package/dist/commands/review-report-pdf.d.ts +4 -0
- package/dist/commands/review-report-pdf.js +163 -0
- package/dist/commands/review-report-schedule.d.ts +4 -0
- package/dist/commands/review-report-schedule.js +96 -0
- package/dist/commands/review-retrospective.d.ts +1 -0
- package/dist/commands/review-retrospective.js +118 -0
- package/dist/commands/review-retry.d.ts +4 -0
- package/dist/commands/review-retry.js +91 -0
- package/dist/commands/review-review-cadence.d.ts +1 -0
- package/dist/commands/review-review-cadence.js +85 -0
- package/dist/commands/review-review-comments.d.ts +4 -0
- package/dist/commands/review-review-comments.js +84 -0
- package/dist/commands/review-reviewer-match.d.ts +1 -0
- package/dist/commands/review-reviewer-match.js +108 -0
- package/dist/commands/review-risk-matrix.d.ts +1 -0
- package/dist/commands/review-risk-matrix.js +96 -0
- package/dist/commands/review-risk-score.d.ts +4 -0
- package/dist/commands/review-risk-score.js +156 -0
- package/dist/commands/review-role-assignment.d.ts +4 -0
- package/dist/commands/review-role-assignment.js +98 -0
- package/dist/commands/review-rollback.d.ts +4 -0
- package/dist/commands/review-rollback.js +171 -0
- package/dist/commands/review-rollout-plan.d.ts +4 -0
- package/dist/commands/review-rollout-plan.js +123 -0
- package/dist/commands/review-rule-filter.d.ts +4 -0
- package/dist/commands/review-rule-filter.js +116 -0
- package/dist/commands/review-rule-stats.d.ts +4 -0
- package/dist/commands/review-rule-stats.js +161 -0
- package/dist/commands/review-sandbox.d.ts +4 -0
- package/dist/commands/review-sandbox.js +191 -0
- package/dist/commands/review-schedule.d.ts +4 -0
- package/dist/commands/review-schedule.js +169 -0
- package/dist/commands/review-scope-limit.d.ts +4 -0
- package/dist/commands/review-scope-limit.js +100 -0
- package/dist/commands/review-scope-lock.d.ts +7 -0
- package/dist/commands/review-scope-lock.js +138 -0
- package/dist/commands/review-scope-select.d.ts +4 -0
- package/dist/commands/review-scope-select.js +98 -0
- package/dist/commands/review-scope-suggest.d.ts +1 -0
- package/dist/commands/review-scope-suggest.js +112 -0
- package/dist/commands/review-scope.d.ts +4 -0
- package/dist/commands/review-scope.js +197 -0
- package/dist/commands/review-score-history.d.ts +4 -0
- package/dist/commands/review-score-history.js +137 -0
- package/dist/commands/review-security-posture.d.ts +1 -0
- package/dist/commands/review-security-posture.js +105 -0
- package/dist/commands/review-session-replay.d.ts +4 -0
- package/dist/commands/review-session-replay.js +81 -0
- package/dist/commands/review-session-save.d.ts +4 -0
- package/dist/commands/review-session-save.js +173 -0
- package/dist/commands/review-session.d.ts +4 -0
- package/dist/commands/review-session.js +150 -0
- package/dist/commands/review-skip-list.d.ts +4 -0
- package/dist/commands/review-skip-list.js +135 -0
- package/dist/commands/review-skip-rule.d.ts +4 -0
- package/dist/commands/review-skip-rule.js +105 -0
- package/dist/commands/review-sla-config.d.ts +4 -0
- package/dist/commands/review-sla-config.js +88 -0
- package/dist/commands/review-slack-format.d.ts +4 -0
- package/dist/commands/review-slack-format.js +113 -0
- package/dist/commands/review-snapshot-diff.d.ts +4 -0
- package/dist/commands/review-snapshot-diff.js +100 -0
- package/dist/commands/review-sprint-plan.d.ts +1 -0
- package/dist/commands/review-sprint-plan.js +79 -0
- package/dist/commands/review-stakeholder-notify.d.ts +1 -0
- package/dist/commands/review-stakeholder-notify.js +134 -0
- package/dist/commands/review-stakeholder-report.d.ts +4 -0
- package/dist/commands/review-stakeholder-report.js +75 -0
- package/dist/commands/review-stale-finding-clean.d.ts +1 -0
- package/dist/commands/review-stale-finding-clean.js +81 -0
- package/dist/commands/review-standup.d.ts +4 -0
- package/dist/commands/review-standup.js +95 -0
- package/dist/commands/review-stats.d.ts +4 -0
- package/dist/commands/review-stats.js +175 -0
- package/dist/commands/review-status-badge.d.ts +4 -0
- package/dist/commands/review-status-badge.js +120 -0
- package/dist/commands/review-streak.d.ts +4 -0
- package/dist/commands/review-streak.js +150 -0
- package/dist/commands/review-summary-dashboard.d.ts +4 -0
- package/dist/commands/review-summary-dashboard.js +96 -0
- package/dist/commands/review-summary-email.d.ts +4 -0
- package/dist/commands/review-summary-email.js +102 -0
- package/dist/commands/review-summary.d.ts +4 -0
- package/dist/commands/review-summary.js +174 -0
- package/dist/commands/review-tag-manager.d.ts +4 -0
- package/dist/commands/review-tag-manager.js +128 -0
- package/dist/commands/review-tag.d.ts +4 -0
- package/dist/commands/review-tag.js +136 -0
- package/dist/commands/review-team-analytics.d.ts +1 -0
- package/dist/commands/review-team-analytics.js +94 -0
- package/dist/commands/review-team-assign.d.ts +7 -0
- package/dist/commands/review-team-assign.js +211 -0
- package/dist/commands/review-team-coverage.d.ts +1 -0
- package/dist/commands/review-team-coverage.js +95 -0
- package/dist/commands/review-team-dashboard.d.ts +4 -0
- package/dist/commands/review-team-dashboard.js +98 -0
- package/dist/commands/review-team-rotation.d.ts +1 -0
- package/dist/commands/review-team-rotation.js +99 -0
- package/dist/commands/review-team-skill-map.d.ts +1 -0
- package/dist/commands/review-team-skill-map.js +102 -0
- package/dist/commands/review-team-stats.d.ts +4 -0
- package/dist/commands/review-team-stats.js +97 -0
- package/dist/commands/review-team-summary.d.ts +4 -0
- package/dist/commands/review-team-summary.js +155 -0
- package/dist/commands/review-team-velocity.d.ts +1 -0
- package/dist/commands/review-team-velocity.js +103 -0
- package/dist/commands/review-template-export.d.ts +4 -0
- package/dist/commands/review-template-export.js +146 -0
- package/dist/commands/review-template-library.d.ts +4 -0
- package/dist/commands/review-template-library.js +155 -0
- package/dist/commands/review-template-suggest.d.ts +1 -0
- package/dist/commands/review-template-suggest.js +119 -0
- package/dist/commands/review-template.d.ts +4 -0
- package/dist/commands/review-template.js +212 -0
- package/dist/commands/review-tenant-config.d.ts +4 -0
- package/dist/commands/review-tenant-config.js +116 -0
- package/dist/commands/review-threshold-tune.d.ts +4 -0
- package/dist/commands/review-threshold-tune.js +135 -0
- package/dist/commands/review-timeline.d.ts +4 -0
- package/dist/commands/review-timeline.js +76 -0
- package/dist/commands/review-token-budget.d.ts +4 -0
- package/dist/commands/review-token-budget.js +117 -0
- package/dist/commands/review-velocity-track.d.ts +1 -0
- package/dist/commands/review-velocity-track.js +94 -0
- package/dist/commands/review-watch-mode.d.ts +7 -0
- package/dist/commands/review-watch-mode.js +132 -0
- package/dist/commands/review-webhook-dispatch.d.ts +4 -0
- package/dist/commands/review-webhook-dispatch.js +99 -0
- package/dist/commands/review-webhook-notify.d.ts +4 -0
- package/dist/commands/review-webhook-notify.js +145 -0
- package/dist/commands/review-webhook.d.ts +4 -0
- package/dist/commands/review-webhook.js +140 -0
- package/dist/commands/review-whitelist.d.ts +4 -0
- package/dist/commands/review-whitelist.js +150 -0
- package/dist/commands/review-workflow-suggest.d.ts +1 -0
- package/dist/commands/review-workflow-suggest.js +129 -0
- package/dist/commands/review-workload-balance.d.ts +1 -0
- package/dist/commands/review-workload-balance.js +86 -0
- package/dist/commands/review-workspace-init.d.ts +4 -0
- package/dist/commands/review-workspace-init.js +104 -0
- package/dist/commands/review-workspace-scan.d.ts +4 -0
- package/dist/commands/review-workspace-scan.js +144 -0
- package/dist/commands/review.d.ts +155 -0
- package/dist/commands/review.js +1114 -0
- package/dist/commands/risk-heatmap.d.ts +7 -0
- package/dist/commands/risk-heatmap.js +223 -0
- package/dist/commands/rollback-safety.d.ts +4 -0
- package/dist/commands/rollback-safety.js +191 -0
- package/dist/commands/rule-catalog.d.ts +4 -0
- package/dist/commands/rule-catalog.js +128 -0
- package/dist/commands/rule-metrics.d.ts +43 -0
- package/dist/commands/rule-metrics.js +113 -0
- package/dist/commands/rule-owner.d.ts +30 -0
- package/dist/commands/rule-owner.js +181 -0
- package/dist/commands/rule-share.d.ts +34 -0
- package/dist/commands/rule-share.js +202 -0
- package/dist/commands/rule-test.d.ts +4 -0
- package/dist/commands/rule-test.js +201 -0
- package/dist/commands/rule.d.ts +114 -0
- package/dist/commands/rule.js +295 -0
- package/dist/commands/sbom-export.d.ts +7 -0
- package/dist/commands/sbom-export.js +161 -0
- package/dist/commands/scaffold-plugin.d.ts +15 -0
- package/dist/commands/scaffold-plugin.js +270 -0
- package/dist/commands/secret-age.d.ts +5 -0
- package/dist/commands/secret-age.js +214 -0
- package/dist/commands/secret-scan.d.ts +7 -0
- package/dist/commands/secret-scan.js +244 -0
- package/dist/commands/security-maturity.d.ts +7 -0
- package/dist/commands/security-maturity.js +312 -0
- package/dist/commands/security-theater.d.ts +4 -0
- package/dist/commands/security-theater.js +278 -0
- package/dist/commands/setup-wizard.d.ts +4 -0
- package/dist/commands/setup-wizard.js +174 -0
- package/dist/commands/severity-tune.d.ts +4 -0
- package/dist/commands/severity-tune.js +208 -0
- package/dist/commands/sla-track.d.ts +56 -0
- package/dist/commands/sla-track.js +268 -0
- package/dist/commands/smart-output.d.ts +38 -0
- package/dist/commands/smart-output.js +175 -0
- package/dist/commands/smart-select.d.ts +26 -0
- package/dist/commands/smart-select.js +345 -0
- package/dist/commands/snapshot.d.ts +139 -0
- package/dist/commands/snapshot.js +478 -0
- package/dist/commands/snippet-eval.d.ts +7 -0
- package/dist/commands/snippet-eval.js +223 -0
- package/dist/commands/spec-conform.d.ts +4 -0
- package/dist/commands/spec-conform.js +304 -0
- package/dist/commands/stale-pattern.d.ts +4 -0
- package/dist/commands/stale-pattern.js +293 -0
- package/dist/commands/state-integrity.d.ts +4 -0
- package/dist/commands/state-integrity.js +283 -0
- package/dist/commands/suppress.d.ts +39 -0
- package/dist/commands/suppress.js +203 -0
- package/dist/commands/team-config.d.ts +4 -0
- package/dist/commands/team-config.js +234 -0
- package/dist/commands/team-leaderboard.d.ts +24 -0
- package/dist/commands/team-leaderboard.js +227 -0
- package/dist/commands/team-rules-sync.d.ts +7 -0
- package/dist/commands/team-rules-sync.js +250 -0
- package/dist/commands/team-trust.d.ts +7 -0
- package/dist/commands/team-trust.js +174 -0
- package/dist/commands/test-correlate.d.ts +7 -0
- package/dist/commands/test-correlate.js +221 -0
- package/dist/commands/test-isolation.d.ts +5 -0
- package/dist/commands/test-isolation.js +234 -0
- package/dist/commands/test-quality.d.ts +5 -0
- package/dist/commands/test-quality.js +160 -0
- package/dist/commands/test-suggest.d.ts +8 -0
- package/dist/commands/test-suggest.js +247 -0
- package/dist/commands/ticket-sync.d.ts +25 -0
- package/dist/commands/ticket-sync.js +235 -0
- package/dist/commands/timeout-audit.d.ts +4 -0
- package/dist/commands/timeout-audit.js +210 -0
- package/dist/commands/trace.d.ts +64 -0
- package/dist/commands/trace.js +245 -0
- package/dist/commands/trend-report.d.ts +4 -0
- package/dist/commands/trend-report.js +148 -0
- package/dist/commands/triage.d.ts +15 -0
- package/dist/commands/triage.js +171 -0
- package/dist/commands/trust-adaptive.d.ts +8 -0
- package/dist/commands/trust-adaptive.js +193 -0
- package/dist/commands/trust-ramp.d.ts +29 -0
- package/dist/commands/trust-ramp.js +189 -0
- package/dist/commands/tune.d.ts +24 -0
- package/dist/commands/tune.js +380 -0
- package/dist/commands/type-boundary.d.ts +4 -0
- package/dist/commands/type-boundary.js +235 -0
- package/dist/commands/upload.d.ts +13 -0
- package/dist/commands/upload.js +172 -0
- package/dist/commands/validate-config.d.ts +16 -0
- package/dist/commands/validate-config.js +267 -0
- package/dist/commands/vendor-lock-detect.d.ts +7 -0
- package/dist/commands/vendor-lock-detect.js +288 -0
- package/dist/commands/vote.d.ts +31 -0
- package/dist/commands/vote.js +200 -0
- package/dist/commands/warm-cache.d.ts +30 -0
- package/dist/commands/warm-cache.js +165 -0
- package/dist/commands/watch-judge.d.ts +7 -0
- package/dist/commands/watch-judge.js +179 -0
- package/dist/commands/watch.d.ts +22 -0
- package/dist/commands/watch.js +147 -0
- package/dist/comparison.d.ts +67 -0
- package/dist/comparison.js +253 -0
- package/dist/config.d.ts +108 -0
- package/dist/config.js +694 -0
- package/dist/context/context-snippets.d.ts +15 -0
- package/dist/context/context-snippets.js +36 -0
- package/dist/context/embedding-cache.d.ts +30 -0
- package/dist/context/embedding-cache.js +48 -0
- package/dist/data-adapter.d.ts +123 -0
- package/dist/data-adapter.js +212 -0
- package/dist/dedup.d.ts +105 -0
- package/dist/dedup.js +606 -0
- package/dist/disk-cache.d.ts +59 -0
- package/dist/disk-cache.js +236 -0
- package/dist/errors.d.ts +43 -0
- package/dist/errors.js +63 -0
- package/dist/escalation.d.ts +100 -0
- package/dist/escalation.js +292 -0
- package/dist/evaluation-session.d.ts +74 -0
- package/dist/evaluation-session.js +152 -0
- package/dist/evaluators/accessibility.d.ts +2 -0
- package/dist/evaluators/accessibility.js +559 -0
- package/dist/evaluators/agent-instructions.d.ts +2 -0
- package/dist/evaluators/agent-instructions.js +214 -0
- package/dist/evaluators/ai-code-safety.d.ts +8 -0
- package/dist/evaluators/ai-code-safety.js +410 -0
- package/dist/evaluators/api-contract.d.ts +9 -0
- package/dist/evaluators/api-contract.js +203 -0
- package/dist/evaluators/api-design.d.ts +2 -0
- package/dist/evaluators/api-design.js +260 -0
- package/dist/evaluators/app-builder.d.ts +33 -0
- package/dist/evaluators/app-builder.js +155 -0
- package/dist/evaluators/authentication.d.ts +2 -0
- package/dist/evaluators/authentication.js +455 -0
- package/dist/evaluators/backwards-compatibility.d.ts +2 -0
- package/dist/evaluators/backwards-compatibility.js +168 -0
- package/dist/evaluators/caching.d.ts +2 -0
- package/dist/evaluators/caching.js +171 -0
- package/dist/evaluators/ci-cd.d.ts +2 -0
- package/dist/evaluators/ci-cd.js +218 -0
- package/dist/evaluators/cloud-readiness.d.ts +2 -0
- package/dist/evaluators/cloud-readiness.js +231 -0
- package/dist/evaluators/code-structure.d.ts +21 -0
- package/dist/evaluators/code-structure.js +195 -0
- package/dist/evaluators/compliance.d.ts +2 -0
- package/dist/evaluators/compliance.js +329 -0
- package/dist/evaluators/concurrency.d.ts +2 -0
- package/dist/evaluators/concurrency.js +307 -0
- package/dist/evaluators/configuration-management.d.ts +2 -0
- package/dist/evaluators/configuration-management.js +232 -0
- package/dist/evaluators/cost-effectiveness.d.ts +2 -0
- package/dist/evaluators/cost-effectiveness.js +418 -0
- package/dist/evaluators/cybersecurity.d.ts +2 -0
- package/dist/evaluators/cybersecurity.js +1197 -0
- package/dist/evaluators/data-security.d.ts +2 -0
- package/dist/evaluators/data-security.js +467 -0
- package/dist/evaluators/data-sovereignty.d.ts +2 -0
- package/dist/evaluators/data-sovereignty.js +495 -0
- package/dist/evaluators/database.d.ts +2 -0
- package/dist/evaluators/database.js +240 -0
- package/dist/evaluators/dependencies.d.ts +5 -0
- package/dist/evaluators/dependencies.js +228 -0
- package/dist/evaluators/dependency-health.d.ts +2 -0
- package/dist/evaluators/dependency-health.js +477 -0
- package/dist/evaluators/documentation.d.ts +2 -0
- package/dist/evaluators/documentation.js +432 -0
- package/dist/evaluators/error-handling.d.ts +2 -0
- package/dist/evaluators/error-handling.js +426 -0
- package/dist/evaluators/ethics-bias.d.ts +2 -0
- package/dist/evaluators/ethics-bias.js +263 -0
- package/dist/evaluators/false-positive-review.d.ts +21 -0
- package/dist/evaluators/false-positive-review.js +1246 -0
- package/dist/evaluators/framework-rules.d.ts +58 -0
- package/dist/evaluators/framework-rules.js +291 -0
- package/dist/evaluators/framework-safety.d.ts +12 -0
- package/dist/evaluators/framework-safety.js +1205 -0
- package/dist/evaluators/hallucination-detection.d.ts +2 -0
- package/dist/evaluators/hallucination-detection.js +1250 -0
- package/dist/evaluators/iac-security.d.ts +8 -0
- package/dist/evaluators/iac-security.js +701 -0
- package/dist/evaluators/index.d.ts +167 -0
- package/dist/evaluators/index.js +994 -0
- package/dist/evaluators/intent-alignment.d.ts +18 -0
- package/dist/evaluators/intent-alignment.js +405 -0
- package/dist/evaluators/internationalization.d.ts +2 -0
- package/dist/evaluators/internationalization.js +287 -0
- package/dist/evaluators/judge-selector.d.ts +19 -0
- package/dist/evaluators/judge-selector.js +141 -0
- package/dist/evaluators/logging-privacy.d.ts +2 -0
- package/dist/evaluators/logging-privacy.js +190 -0
- package/dist/evaluators/logic-review.d.ts +2 -0
- package/dist/evaluators/logic-review.js +289 -0
- package/dist/evaluators/maintainability.d.ts +2 -0
- package/dist/evaluators/maintainability.js +430 -0
- package/dist/evaluators/model-fingerprint.d.ts +2 -0
- package/dist/evaluators/model-fingerprint.js +151 -0
- package/dist/evaluators/multi-turn-coherence.d.ts +13 -0
- package/dist/evaluators/multi-turn-coherence.js +149 -0
- package/dist/evaluators/observability.d.ts +2 -0
- package/dist/evaluators/observability.js +238 -0
- package/dist/evaluators/over-engineering.d.ts +2 -0
- package/dist/evaluators/over-engineering.js +160 -0
- package/dist/evaluators/performance.d.ts +2 -0
- package/dist/evaluators/performance.js +649 -0
- package/dist/evaluators/portability.d.ts +2 -0
- package/dist/evaluators/portability.js +254 -0
- package/dist/evaluators/project.d.ts +48 -0
- package/dist/evaluators/project.js +817 -0
- package/dist/evaluators/rate-limiting.d.ts +2 -0
- package/dist/evaluators/rate-limiting.js +193 -0
- package/dist/evaluators/recall-boost.d.ts +27 -0
- package/dist/evaluators/recall-boost.js +409 -0
- package/dist/evaluators/reliability.d.ts +2 -0
- package/dist/evaluators/reliability.js +245 -0
- package/dist/evaluators/scalability.d.ts +2 -0
- package/dist/evaluators/scalability.js +230 -0
- package/dist/evaluators/security.d.ts +12 -0
- package/dist/evaluators/security.js +1013 -0
- package/dist/evaluators/shared.d.ts +219 -0
- package/dist/evaluators/shared.js +1169 -0
- package/dist/evaluators/software-practices.d.ts +2 -0
- package/dist/evaluators/software-practices.js +395 -0
- package/dist/evaluators/suppressions.d.ts +49 -0
- package/dist/evaluators/suppressions.js +185 -0
- package/dist/evaluators/testing.d.ts +2 -0
- package/dist/evaluators/testing.js +348 -0
- package/dist/evaluators/ux.d.ts +2 -0
- package/dist/evaluators/ux.js +309 -0
- package/dist/evaluators/v2.d.ts +26 -0
- package/dist/evaluators/v2.js +354 -0
- package/dist/ext-to-lang.d.ts +16 -0
- package/dist/ext-to-lang.js +60 -0
- package/dist/feedback-loop.d.ts +62 -0
- package/dist/feedback-loop.js +179 -0
- package/dist/finding-lifecycle.d.ts +215 -0
- package/dist/finding-lifecycle.js +547 -0
- package/dist/fingerprint.d.ts +39 -0
- package/dist/fingerprint.js +179 -0
- package/dist/fix-history.d.ts +103 -0
- package/dist/fix-history.js +164 -0
- package/dist/formatters/badge.d.ts +16 -0
- package/dist/formatters/badge.js +78 -0
- package/dist/formatters/codeclimate.d.ts +24 -0
- package/dist/formatters/codeclimate.js +80 -0
- package/dist/formatters/csv.d.ts +16 -0
- package/dist/formatters/csv.js +53 -0
- package/dist/formatters/diagnostics.d.ts +81 -0
- package/dist/formatters/diagnostics.js +152 -0
- package/dist/formatters/github-actions.d.ts +6 -0
- package/dist/formatters/github-actions.js +68 -0
- package/dist/formatters/html.d.ts +12 -0
- package/dist/formatters/html.js +194 -0
- package/dist/formatters/junit.d.ts +6 -0
- package/dist/formatters/junit.js +68 -0
- package/dist/formatters/pdf.d.ts +12 -0
- package/dist/formatters/pdf.js +114 -0
- package/dist/formatters/sarif.d.ts +92 -0
- package/dist/formatters/sarif.js +256 -0
- package/dist/formatters/shared.d.ts +4 -0
- package/dist/formatters/shared.js +29 -0
- package/dist/git-diff.d.ts +62 -0
- package/dist/git-diff.js +282 -0
- package/dist/github-app.d.ts +152 -0
- package/dist/github-app.js +716 -0
- package/dist/import-resolver.d.ts +51 -0
- package/dist/import-resolver.js +213 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +38 -0
- package/dist/judge-registry.d.ts +156 -0
- package/dist/judge-registry.js +272 -0
- package/dist/judges/accessibility.d.ts +2 -0
- package/dist/judges/accessibility.js +46 -0
- package/dist/judges/agent-instructions.d.ts +2 -0
- package/dist/judges/agent-instructions.js +46 -0
- package/dist/judges/ai-code-safety.d.ts +2 -0
- package/dist/judges/ai-code-safety.js +57 -0
- package/dist/judges/api-contract.d.ts +2 -0
- package/dist/judges/api-contract.js +40 -0
- package/dist/judges/api-design.d.ts +2 -0
- package/dist/judges/api-design.js +57 -0
- package/dist/judges/authentication.d.ts +2 -0
- package/dist/judges/authentication.js +63 -0
- package/dist/judges/backwards-compatibility.d.ts +2 -0
- package/dist/judges/backwards-compatibility.js +46 -0
- package/dist/judges/caching.d.ts +2 -0
- package/dist/judges/caching.js +46 -0
- package/dist/judges/ci-cd.d.ts +2 -0
- package/dist/judges/ci-cd.js +46 -0
- package/dist/judges/cloud-readiness.d.ts +2 -0
- package/dist/judges/cloud-readiness.js +53 -0
- package/dist/judges/code-structure.d.ts +2 -0
- package/dist/judges/code-structure.js +50 -0
- package/dist/judges/compliance.d.ts +2 -0
- package/dist/judges/compliance.js +49 -0
- package/dist/judges/concurrency.d.ts +2 -0
- package/dist/judges/concurrency.js +48 -0
- package/dist/judges/configuration-management.d.ts +2 -0
- package/dist/judges/configuration-management.js +46 -0
- package/dist/judges/cost-effectiveness.d.ts +2 -0
- package/dist/judges/cost-effectiveness.js +42 -0
- package/dist/judges/cybersecurity.d.ts +2 -0
- package/dist/judges/cybersecurity.js +63 -0
- package/dist/judges/data-security.d.ts +2 -0
- package/dist/judges/data-security.js +50 -0
- package/dist/judges/data-sovereignty.d.ts +2 -0
- package/dist/judges/data-sovereignty.js +60 -0
- package/dist/judges/database.d.ts +2 -0
- package/dist/judges/database.js +51 -0
- package/dist/judges/dependency-health.d.ts +2 -0
- package/dist/judges/dependency-health.js +48 -0
- package/dist/judges/documentation.d.ts +2 -0
- package/dist/judges/documentation.js +55 -0
- package/dist/judges/error-handling.d.ts +2 -0
- package/dist/judges/error-handling.js +55 -0
- package/dist/judges/ethics-bias.d.ts +2 -0
- package/dist/judges/ethics-bias.js +48 -0
- package/dist/judges/false-positive-review.d.ts +2 -0
- package/dist/judges/false-positive-review.js +85 -0
- package/dist/judges/framework-safety.d.ts +2 -0
- package/dist/judges/framework-safety.js +49 -0
- package/dist/judges/hallucination-detection.d.ts +2 -0
- package/dist/judges/hallucination-detection.js +48 -0
- package/dist/judges/iac-security.d.ts +2 -0
- package/dist/judges/iac-security.js +47 -0
- package/dist/judges/index.d.ts +88 -0
- package/dist/judges/index.js +128 -0
- package/dist/judges/intent-alignment.d.ts +2 -0
- package/dist/judges/intent-alignment.js +46 -0
- package/dist/judges/internationalization.d.ts +2 -0
- package/dist/judges/internationalization.js +44 -0
- package/dist/judges/logging-privacy.d.ts +2 -0
- package/dist/judges/logging-privacy.js +46 -0
- package/dist/judges/logic-review.d.ts +2 -0
- package/dist/judges/logic-review.js +36 -0
- package/dist/judges/maintainability.d.ts +2 -0
- package/dist/judges/maintainability.js +46 -0
- package/dist/judges/model-fingerprint.d.ts +2 -0
- package/dist/judges/model-fingerprint.js +35 -0
- package/dist/judges/multi-turn-coherence.d.ts +2 -0
- package/dist/judges/multi-turn-coherence.js +39 -0
- package/dist/judges/observability.d.ts +2 -0
- package/dist/judges/observability.js +54 -0
- package/dist/judges/over-engineering.d.ts +2 -0
- package/dist/judges/over-engineering.js +50 -0
- package/dist/judges/performance.d.ts +2 -0
- package/dist/judges/performance.js +46 -0
- package/dist/judges/portability.d.ts +2 -0
- package/dist/judges/portability.js +46 -0
- package/dist/judges/rate-limiting.d.ts +2 -0
- package/dist/judges/rate-limiting.js +55 -0
- package/dist/judges/reliability.d.ts +2 -0
- package/dist/judges/reliability.js +57 -0
- package/dist/judges/scalability.d.ts +2 -0
- package/dist/judges/scalability.js +52 -0
- package/dist/judges/security.d.ts +2 -0
- package/dist/judges/security.js +64 -0
- package/dist/judges/software-practices.d.ts +2 -0
- package/dist/judges/software-practices.js +56 -0
- package/dist/judges/testing.d.ts +2 -0
- package/dist/judges/testing.js +54 -0
- package/dist/judges/ux.d.ts +2 -0
- package/dist/judges/ux.js +46 -0
- package/dist/language-patterns.d.ts +653 -0
- package/dist/language-patterns.js +851 -0
- package/dist/parallel.d.ts +52 -0
- package/dist/parallel.js +157 -0
- package/dist/patches/apply.d.ts +15 -0
- package/dist/patches/apply.js +37 -0
- package/dist/patches/index.d.ts +9 -0
- package/dist/patches/index.js +2544 -0
- package/dist/plugins.d.ts +59 -0
- package/dist/plugins.js +76 -0
- package/dist/presets.d.ts +35 -0
- package/dist/presets.js +406 -0
- package/dist/probabilistic/llm-response-validator.d.ts +26 -0
- package/dist/probabilistic/llm-response-validator.js +122 -0
- package/dist/reports/public-repo-report.d.ts +42 -0
- package/dist/reports/public-repo-report.js +579 -0
- package/dist/review-conversation.d.ts +87 -0
- package/dist/review-conversation.js +307 -0
- package/dist/sast-integration.d.ts +112 -0
- package/dist/sast-integration.js +215 -0
- package/dist/scoring.d.ts +36 -0
- package/dist/scoring.js +437 -0
- package/dist/security-ids.d.ts +23 -0
- package/dist/security-ids.js +239 -0
- package/dist/skill-loader.d.ts +33 -0
- package/dist/skill-loader.js +167 -0
- package/dist/tools/command-safety.d.ts +13 -0
- package/dist/tools/command-safety.js +95 -0
- package/dist/tools/deep-review.d.ts +38 -0
- package/dist/tools/deep-review.js +302 -0
- package/dist/tools/prompts.d.ts +27 -0
- package/dist/tools/prompts.js +122 -0
- package/dist/tools/register-evaluation.d.ts +6 -0
- package/dist/tools/register-evaluation.js +587 -0
- package/dist/tools/register-fix.d.ts +5 -0
- package/dist/tools/register-fix.js +175 -0
- package/dist/tools/register-resources.d.ts +6 -0
- package/dist/tools/register-resources.js +177 -0
- package/dist/tools/register-review.d.ts +6 -0
- package/dist/tools/register-review.js +564 -0
- package/dist/tools/register-scaffold.d.ts +2 -0
- package/dist/tools/register-scaffold.js +398 -0
- package/dist/tools/register-workflow.d.ts +6 -0
- package/dist/tools/register-workflow.js +1037 -0
- package/dist/tools/register-workspace.d.ts +2 -0
- package/dist/tools/register-workspace.js +214 -0
- package/dist/tools/register.d.ts +6 -0
- package/dist/tools/register.js +21 -0
- package/dist/tools/schemas.d.ts +25 -0
- package/dist/tools/schemas.js +41 -0
- package/dist/tools/validation.d.ts +13 -0
- package/dist/tools/validation.js +77 -0
- package/dist/types.d.ts +898 -0
- package/dist/types.js +1 -0
- package/package.json +54 -0
- package/skills/ai-code-review.skill.md +57 -0
- package/skills/release-gate.skill.md +27 -0
- package/skills/security-review.skill.md +32 -0
|
@@ -0,0 +1,2882 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure-as-Code, cloud, configuration, CI/CD, cost, scaling,
|
|
3
|
+
* caching, reliability, and rate limiting benchmark cases.
|
|
4
|
+
*
|
|
5
|
+
* Covers IAC, CLOUD, CFG, CICD, COST, SCALE, CACHE, REL, RATE prefixes.
|
|
6
|
+
*/
|
|
7
|
+
export const BENCHMARK_INFRASTRUCTURE = [
|
|
8
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
9
|
+
// IAC — Infrastructure as Code
|
|
10
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
11
|
+
{
|
|
12
|
+
id: "iac-deep-terraform-public-s3",
|
|
13
|
+
description: "Terraform S3 bucket with public access enabled",
|
|
14
|
+
language: "hcl",
|
|
15
|
+
code: `resource "aws_s3_bucket" "data_bucket" {
|
|
16
|
+
bucket = "my-app-data-bucket"
|
|
17
|
+
acl = "public-read"
|
|
18
|
+
|
|
19
|
+
versioning {
|
|
20
|
+
enabled = false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
resource "aws_s3_bucket_policy" "public_policy" {
|
|
25
|
+
bucket = aws_s3_bucket.data_bucket.id
|
|
26
|
+
policy = jsonencode({
|
|
27
|
+
Version = "2012-10-17"
|
|
28
|
+
Statement = [
|
|
29
|
+
{
|
|
30
|
+
Sid = "PublicRead"
|
|
31
|
+
Effect = "Allow"
|
|
32
|
+
Principal = "*"
|
|
33
|
+
Action = ["s3:GetObject"]
|
|
34
|
+
Resource = ["\${aws_s3_bucket.data_bucket.arn}/*"]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
})
|
|
38
|
+
}`,
|
|
39
|
+
expectedRuleIds: ["IAC-001"],
|
|
40
|
+
category: "iac-security",
|
|
41
|
+
difficulty: "easy",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "iac-deep-terraform-open-sg",
|
|
45
|
+
description: "Terraform security group allowing all inbound traffic",
|
|
46
|
+
language: "hcl",
|
|
47
|
+
code: `resource "aws_security_group" "web" {
|
|
48
|
+
name = "web-sg"
|
|
49
|
+
description = "Web server security group"
|
|
50
|
+
vpc_id = var.vpc_id
|
|
51
|
+
|
|
52
|
+
ingress {
|
|
53
|
+
from_port = 0
|
|
54
|
+
to_port = 65535
|
|
55
|
+
protocol = "tcp"
|
|
56
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ingress {
|
|
60
|
+
from_port = 22
|
|
61
|
+
to_port = 22
|
|
62
|
+
protocol = "tcp"
|
|
63
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
egress {
|
|
67
|
+
from_port = 0
|
|
68
|
+
to_port = 0
|
|
69
|
+
protocol = "-1"
|
|
70
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
71
|
+
}
|
|
72
|
+
}`,
|
|
73
|
+
expectedRuleIds: ["IAC-001"],
|
|
74
|
+
category: "iac-security",
|
|
75
|
+
difficulty: "easy",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "iac-deep-terraform-no-encryption",
|
|
79
|
+
description: "Terraform RDS and EBS without encryption enabled",
|
|
80
|
+
language: "hcl",
|
|
81
|
+
code: `resource "aws_db_instance" "main" {
|
|
82
|
+
allocated_storage = 100
|
|
83
|
+
engine = "mysql"
|
|
84
|
+
engine_version = "8.0"
|
|
85
|
+
instance_class = "db.t3.medium"
|
|
86
|
+
name = "appdb"
|
|
87
|
+
username = "admin"
|
|
88
|
+
password = "Password123!"
|
|
89
|
+
publicly_accessible = true
|
|
90
|
+
storage_encrypted = false
|
|
91
|
+
skip_final_snapshot = true
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
resource "aws_ebs_volume" "data" {
|
|
95
|
+
availability_zone = "us-east-1a"
|
|
96
|
+
size = 500
|
|
97
|
+
encrypted = false
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
resource "aws_launch_template" "web" {
|
|
101
|
+
name_prefix = "web-"
|
|
102
|
+
image_id = "ami-12345678"
|
|
103
|
+
instance_type = "t3.large"
|
|
104
|
+
|
|
105
|
+
block_device_mappings {
|
|
106
|
+
device_name = "/dev/sda1"
|
|
107
|
+
ebs {
|
|
108
|
+
volume_size = 100
|
|
109
|
+
encrypted = false
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}`,
|
|
113
|
+
expectedRuleIds: ["IAC-001"],
|
|
114
|
+
category: "iac-security",
|
|
115
|
+
difficulty: "medium",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "iac-deep-dockerfile-root",
|
|
119
|
+
description: "Dockerfile running as root with no security hardening",
|
|
120
|
+
language: "dockerfile",
|
|
121
|
+
code: `FROM node:18
|
|
122
|
+
|
|
123
|
+
WORKDIR /app
|
|
124
|
+
|
|
125
|
+
COPY package*.json ./
|
|
126
|
+
RUN npm install
|
|
127
|
+
|
|
128
|
+
COPY . .
|
|
129
|
+
|
|
130
|
+
RUN apt-get update && apt-get install -y curl wget netcat
|
|
131
|
+
|
|
132
|
+
EXPOSE 3000 22
|
|
133
|
+
|
|
134
|
+
ENV NODE_ENV=production
|
|
135
|
+
ENV DB_PASSWORD=prod_password_123
|
|
136
|
+
ENV API_SECRET=sk-live-abc123
|
|
137
|
+
|
|
138
|
+
CMD ["node", "server.js"]`,
|
|
139
|
+
expectedRuleIds: ["IAC-001"],
|
|
140
|
+
category: "iac-security",
|
|
141
|
+
difficulty: "easy",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "iac-deep-k8s-privileged-pod",
|
|
145
|
+
description: "Kubernetes pod spec with privileged containers",
|
|
146
|
+
language: "yaml",
|
|
147
|
+
code: `apiVersion: v1
|
|
148
|
+
kind: Pod
|
|
149
|
+
metadata:
|
|
150
|
+
name: app-pod
|
|
151
|
+
spec:
|
|
152
|
+
containers:
|
|
153
|
+
- name: app
|
|
154
|
+
image: myapp:latest
|
|
155
|
+
securityContext:
|
|
156
|
+
privileged: true
|
|
157
|
+
runAsUser: 0
|
|
158
|
+
ports:
|
|
159
|
+
- containerPort: 8080
|
|
160
|
+
hostPort: 8080
|
|
161
|
+
volumeMounts:
|
|
162
|
+
- name: host-root
|
|
163
|
+
mountPath: /host
|
|
164
|
+
env:
|
|
165
|
+
- name: DB_PASSWORD
|
|
166
|
+
value: "production-password-123"
|
|
167
|
+
- name: API_KEY
|
|
168
|
+
value: "sk-live-secret-key"
|
|
169
|
+
volumes:
|
|
170
|
+
- name: host-root
|
|
171
|
+
hostPath:
|
|
172
|
+
path: /
|
|
173
|
+
type: Directory`,
|
|
174
|
+
expectedRuleIds: ["IAC-001"],
|
|
175
|
+
category: "iac-security",
|
|
176
|
+
difficulty: "medium",
|
|
177
|
+
},
|
|
178
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
179
|
+
// CLOUD prefix
|
|
180
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
181
|
+
{
|
|
182
|
+
id: "cloud-deep-aws-wildcard-iam",
|
|
183
|
+
description: "AWS IAM policy with wildcard actions and resources",
|
|
184
|
+
language: "json",
|
|
185
|
+
code: `{
|
|
186
|
+
"Version": "2012-10-17",
|
|
187
|
+
"Statement": [
|
|
188
|
+
{
|
|
189
|
+
"Sid": "AdminAccess",
|
|
190
|
+
"Effect": "Allow",
|
|
191
|
+
"Action": "*",
|
|
192
|
+
"Resource": "*"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"Sid": "S3FullAccess",
|
|
196
|
+
"Effect": "Allow",
|
|
197
|
+
"Action": "s3:*",
|
|
198
|
+
"Resource": "*"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"Sid": "LambdaFullAccess",
|
|
202
|
+
"Effect": "Allow",
|
|
203
|
+
"Action": "lambda:*",
|
|
204
|
+
"Resource": "*"
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}`,
|
|
208
|
+
expectedRuleIds: ["IAC-001"],
|
|
209
|
+
category: "cloud",
|
|
210
|
+
difficulty: "easy",
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: "cloud-deep-hardcoded-aws-creds",
|
|
214
|
+
description: "AWS SDK usage with hardcoded credentials",
|
|
215
|
+
language: "typescript",
|
|
216
|
+
code: `import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
|
|
217
|
+
|
|
218
|
+
const s3 = new S3Client({
|
|
219
|
+
region: "us-east-1",
|
|
220
|
+
credentials: {
|
|
221
|
+
accessKeyId: "AKIAIOSFODNN7EXAMPLE",
|
|
222
|
+
secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
export async function uploadFile(key: string, body: Buffer) {
|
|
227
|
+
await s3.send(new PutObjectCommand({
|
|
228
|
+
Bucket: "my-app-bucket",
|
|
229
|
+
Key: key,
|
|
230
|
+
Body: body,
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const AZURE_STORAGE_KEY = "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=abc123def456==;EndpointSuffix=core.windows.net";
|
|
235
|
+
const GCP_SERVICE_KEY = '{"type":"service_account","project_id":"my-project","private_key":"-----BEGIN RSA PRIVATE KEY-----\\nMIIEpA..."}';`,
|
|
236
|
+
expectedRuleIds: ["CLOUD-001", "AUTH-001"],
|
|
237
|
+
category: "cloud",
|
|
238
|
+
difficulty: "easy",
|
|
239
|
+
},
|
|
240
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
241
|
+
// CFG — Configuration
|
|
242
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
243
|
+
{
|
|
244
|
+
id: "cfg-deep-env-no-validation",
|
|
245
|
+
description: "Environment variables used without validation or defaults",
|
|
246
|
+
language: "typescript",
|
|
247
|
+
code: `const config = {
|
|
248
|
+
port: parseInt(process.env.PORT),
|
|
249
|
+
dbHost: process.env.DB_HOST,
|
|
250
|
+
dbPort: parseInt(process.env.DB_PORT),
|
|
251
|
+
dbName: process.env.DB_NAME,
|
|
252
|
+
apiKey: process.env.API_KEY,
|
|
253
|
+
redisUrl: process.env.REDIS_URL,
|
|
254
|
+
smtpHost: process.env.SMTP_HOST,
|
|
255
|
+
smtpPort: parseInt(process.env.SMTP_PORT),
|
|
256
|
+
jwtSecret: process.env.JWT_SECRET,
|
|
257
|
+
corsOrigin: process.env.CORS_ORIGIN,
|
|
258
|
+
logLevel: process.env.LOG_LEVEL,
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export default config;`,
|
|
262
|
+
expectedRuleIds: ["CFG-001"],
|
|
263
|
+
category: "configuration",
|
|
264
|
+
difficulty: "easy",
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
id: "cfg-deep-mixed-config-sources",
|
|
268
|
+
description: "Configuration scattered across hardcoded values and env vars",
|
|
269
|
+
language: "typescript",
|
|
270
|
+
code: `import express from "express";
|
|
271
|
+
|
|
272
|
+
const app = express();
|
|
273
|
+
|
|
274
|
+
const DB_URL = "postgres://admin:password@localhost:5432/myapp";
|
|
275
|
+
const REDIS_HOST = "localhost";
|
|
276
|
+
const REDIS_PORT = 6379;
|
|
277
|
+
const API_TIMEOUT = 5000;
|
|
278
|
+
|
|
279
|
+
app.listen(process.env.PORT || 3000, () => {
|
|
280
|
+
console.log("Server running");
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
const emailConfig = {
|
|
284
|
+
host: "smtp.gmail.com",
|
|
285
|
+
port: 587,
|
|
286
|
+
auth: {
|
|
287
|
+
user: "app@gmail.com",
|
|
288
|
+
pass: "app-password-123",
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const stripeConfig = {
|
|
293
|
+
secretKey: "sk_test_abc123",
|
|
294
|
+
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
|
|
295
|
+
};`,
|
|
296
|
+
expectedRuleIds: ["SCALE-001", "REL-001", "DB-001", "PORTA-001", "SEC-001"],
|
|
297
|
+
category: "configuration",
|
|
298
|
+
difficulty: "medium",
|
|
299
|
+
},
|
|
300
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
301
|
+
// COST — Cost Effectiveness
|
|
302
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
303
|
+
{
|
|
304
|
+
id: "cost-deep-full-table-scan",
|
|
305
|
+
description: "Full table scans on every request without caching",
|
|
306
|
+
language: "typescript",
|
|
307
|
+
code: `import { Pool } from "pg";
|
|
308
|
+
import express from "express";
|
|
309
|
+
|
|
310
|
+
const pool = new Pool();
|
|
311
|
+
const app = express();
|
|
312
|
+
|
|
313
|
+
app.get("/api/dashboard", async (req, res) => {
|
|
314
|
+
const totalUsers = await pool.query("SELECT COUNT(*) FROM users");
|
|
315
|
+
const totalOrders = await pool.query("SELECT COUNT(*) FROM orders");
|
|
316
|
+
const totalRevenue = await pool.query("SELECT SUM(amount) FROM orders");
|
|
317
|
+
const topProducts = await pool.query(
|
|
318
|
+
"SELECT p.name, COUNT(oi.id) as count FROM order_items oi JOIN products p ON p.id = oi.product_id GROUP BY p.name ORDER BY count DESC LIMIT 10"
|
|
319
|
+
);
|
|
320
|
+
const recentActivity = await pool.query(
|
|
321
|
+
"SELECT * FROM activity_log ORDER BY created_at DESC LIMIT 100"
|
|
322
|
+
);
|
|
323
|
+
res.json({
|
|
324
|
+
users: totalUsers.rows[0].count,
|
|
325
|
+
orders: totalOrders.rows[0].count,
|
|
326
|
+
revenue: totalRevenue.rows[0].sum,
|
|
327
|
+
topProducts: topProducts.rows,
|
|
328
|
+
recentActivity: recentActivity.rows,
|
|
329
|
+
});
|
|
330
|
+
});`,
|
|
331
|
+
expectedRuleIds: ["SEC-001"],
|
|
332
|
+
category: "cost-effectiveness",
|
|
333
|
+
difficulty: "medium",
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
id: "cost-deep-oversized-lambda",
|
|
337
|
+
description: "Lambda function with massive dependencies for simple task",
|
|
338
|
+
language: "typescript",
|
|
339
|
+
code: `import AWS from "aws-sdk";
|
|
340
|
+
import _ from "lodash";
|
|
341
|
+
import moment from "moment";
|
|
342
|
+
import axios from "axios";
|
|
343
|
+
import Joi from "joi";
|
|
344
|
+
|
|
345
|
+
const s3 = new AWS.S3();
|
|
346
|
+
const dynamodb = new AWS.DynamoDB.DocumentClient();
|
|
347
|
+
|
|
348
|
+
export const handler = async (event: any) => {
|
|
349
|
+
const timestamp = moment().format("YYYY-MM-DD");
|
|
350
|
+
const body = JSON.parse(event.body);
|
|
351
|
+
const name = _.get(body, "name", "unknown");
|
|
352
|
+
const validated = Joi.object({ name: Joi.string().required() }).validate(body);
|
|
353
|
+
if (validated.error) return { statusCode: 400, body: "Invalid" };
|
|
354
|
+
|
|
355
|
+
await dynamodb.put({
|
|
356
|
+
TableName: "events",
|
|
357
|
+
Item: { id: event.requestContext.requestId, name, timestamp },
|
|
358
|
+
}).promise();
|
|
359
|
+
|
|
360
|
+
return { statusCode: 200, body: JSON.stringify({ message: "OK" }) };
|
|
361
|
+
};`,
|
|
362
|
+
expectedRuleIds: ["SCALE-001", "DEPS-001", "PORTA-001", "AICS-001"],
|
|
363
|
+
category: "cost-effectiveness",
|
|
364
|
+
difficulty: "medium",
|
|
365
|
+
},
|
|
366
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
367
|
+
// SCALE — Scalability
|
|
368
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
369
|
+
{
|
|
370
|
+
id: "scale-deep-in-memory-session",
|
|
371
|
+
description: "In-memory session store that doesn't scale horizontally",
|
|
372
|
+
language: "typescript",
|
|
373
|
+
code: `import express from "express";
|
|
374
|
+
import crypto from "crypto";
|
|
375
|
+
|
|
376
|
+
const sessions = new Map<string, any>();
|
|
377
|
+
const app = express();
|
|
378
|
+
|
|
379
|
+
app.post("/login", (req, res) => {
|
|
380
|
+
const sessionId = crypto.randomUUID();
|
|
381
|
+
sessions.set(sessionId, {
|
|
382
|
+
userId: req.body.userId,
|
|
383
|
+
createdAt: Date.now(),
|
|
384
|
+
data: {},
|
|
385
|
+
});
|
|
386
|
+
res.cookie("session_id", sessionId);
|
|
387
|
+
res.json({ success: true });
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
app.use((req, res, next) => {
|
|
391
|
+
const sessionId = req.cookies?.session_id;
|
|
392
|
+
if (sessionId && sessions.has(sessionId)) {
|
|
393
|
+
req.session = sessions.get(sessionId);
|
|
394
|
+
next();
|
|
395
|
+
} else {
|
|
396
|
+
res.status(401).json({ error: "Not authenticated" });
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
setInterval(() => {
|
|
401
|
+
const now = Date.now();
|
|
402
|
+
for (const [id, session] of sessions) {
|
|
403
|
+
if (now - session.createdAt > 3600000) sessions.delete(id);
|
|
404
|
+
}
|
|
405
|
+
}, 60000);`,
|
|
406
|
+
expectedRuleIds: [
|
|
407
|
+
"DATA-001",
|
|
408
|
+
"RATE-001",
|
|
409
|
+
"CYBER-001",
|
|
410
|
+
"API-001",
|
|
411
|
+
"PERF-001",
|
|
412
|
+
"COMP-001",
|
|
413
|
+
"CONC-001",
|
|
414
|
+
"ERR-001",
|
|
415
|
+
"AUTH-001",
|
|
416
|
+
"AICS-001",
|
|
417
|
+
"SEC-001",
|
|
418
|
+
],
|
|
419
|
+
category: "scalability",
|
|
420
|
+
difficulty: "medium",
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
id: "scale-deep-local-filesystem-state",
|
|
424
|
+
description: "Application storing state on local filesystem",
|
|
425
|
+
language: "typescript",
|
|
426
|
+
code: `import fs from "fs";
|
|
427
|
+
import path from "path";
|
|
428
|
+
|
|
429
|
+
class FileBasedQueue {
|
|
430
|
+
private queueDir = "/tmp/app-queue";
|
|
431
|
+
|
|
432
|
+
constructor() {
|
|
433
|
+
fs.mkdirSync(this.queueDir, { recursive: true });
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
enqueue(job: any) {
|
|
437
|
+
const id = Date.now().toString();
|
|
438
|
+
fs.writeFileSync(path.join(this.queueDir, id + ".json"), JSON.stringify(job));
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
dequeue(): any | null {
|
|
442
|
+
const files = fs.readdirSync(this.queueDir).sort();
|
|
443
|
+
if (files.length === 0) return null;
|
|
444
|
+
const file = path.join(this.queueDir, files[0]);
|
|
445
|
+
const job = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
446
|
+
fs.unlinkSync(file);
|
|
447
|
+
return job;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
size(): number {
|
|
451
|
+
return fs.readdirSync(this.queueDir).length;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const uploadDir = "/var/app/uploads";
|
|
456
|
+
function saveUpload(name: string, data: Buffer) {
|
|
457
|
+
fs.writeFileSync(path.join(uploadDir, name), data);
|
|
458
|
+
}`,
|
|
459
|
+
expectedRuleIds: ["SCALE-001"],
|
|
460
|
+
category: "scalability",
|
|
461
|
+
difficulty: "medium",
|
|
462
|
+
},
|
|
463
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
464
|
+
// CACHE prefix
|
|
465
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
466
|
+
{
|
|
467
|
+
id: "cache-deep-no-caching-expensive",
|
|
468
|
+
description: "Expensive API calls repeated without caching",
|
|
469
|
+
language: "typescript",
|
|
470
|
+
code: `import express from "express";
|
|
471
|
+
|
|
472
|
+
const app = express();
|
|
473
|
+
|
|
474
|
+
app.get("/api/product/:id", async (req, res) => {
|
|
475
|
+
const product = await db.query("SELECT * FROM products WHERE id = $1", [req.params.id]);
|
|
476
|
+
const reviews = await db.query("SELECT * FROM reviews WHERE product_id = $1", [req.params.id]);
|
|
477
|
+
const related = await db.query(
|
|
478
|
+
"SELECT * FROM products WHERE category = $1 AND id != $2 LIMIT 10",
|
|
479
|
+
[product.rows[0].category, req.params.id]
|
|
480
|
+
);
|
|
481
|
+
const pricing = await fetch(\`https://pricing-service.internal/price/\${req.params.id}\`);
|
|
482
|
+
const inventory = await fetch(\`https://inventory-service.internal/stock/\${req.params.id}\`);
|
|
483
|
+
|
|
484
|
+
res.json({
|
|
485
|
+
product: product.rows[0],
|
|
486
|
+
reviews: reviews.rows,
|
|
487
|
+
related: related.rows,
|
|
488
|
+
price: await pricing.json(),
|
|
489
|
+
stock: await inventory.json(),
|
|
490
|
+
});
|
|
491
|
+
});`,
|
|
492
|
+
expectedRuleIds: ["CYBER-001", "REL-001", "SCALE-001", "API-001", "DB-001", "AICS-001", "SEC-001"],
|
|
493
|
+
category: "caching",
|
|
494
|
+
difficulty: "medium",
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
id: "cache-deep-cache-no-ttl",
|
|
498
|
+
description: "Cache implementation with no TTL or eviction policy",
|
|
499
|
+
language: "typescript",
|
|
500
|
+
code: `const cache = new Map<string, any>();
|
|
501
|
+
|
|
502
|
+
export function getFromCache(key: string): any {
|
|
503
|
+
return cache.get(key);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export function setInCache(key: string, value: any): void {
|
|
507
|
+
cache.set(key, value);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export async function getCachedUser(userId: string): Promise<User> {
|
|
511
|
+
const cached = cache.get(\`user:\${userId}\`);
|
|
512
|
+
if (cached) return cached;
|
|
513
|
+
const user = await db.findUser(userId);
|
|
514
|
+
cache.set(\`user:\${userId}\`, user);
|
|
515
|
+
return user;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export async function getCachedConfig(): Promise<Config> {
|
|
519
|
+
const cached = cache.get("config");
|
|
520
|
+
if (cached) return cached;
|
|
521
|
+
const config = await db.getConfig();
|
|
522
|
+
cache.set("config", config);
|
|
523
|
+
return config;
|
|
524
|
+
}`,
|
|
525
|
+
expectedRuleIds: ["CACHE-001"],
|
|
526
|
+
category: "caching",
|
|
527
|
+
difficulty: "easy",
|
|
528
|
+
},
|
|
529
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
530
|
+
// REL — Reliability
|
|
531
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
532
|
+
{
|
|
533
|
+
id: "rel-deep-no-retry-external",
|
|
534
|
+
description: "External API calls with no retry or circuit breaker",
|
|
535
|
+
language: "typescript",
|
|
536
|
+
code: `export async function processPayment(order: Order): Promise<PaymentResult> {
|
|
537
|
+
const response = await fetch("https://payment-api.example.com/charge", {
|
|
538
|
+
method: "POST",
|
|
539
|
+
headers: { "Content-Type": "application/json" },
|
|
540
|
+
body: JSON.stringify({ amount: order.total, currency: "USD" }),
|
|
541
|
+
});
|
|
542
|
+
return response.json();
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export async function sendNotification(userId: string, message: string): Promise<void> {
|
|
546
|
+
await fetch("https://notification-service.internal/send", {
|
|
547
|
+
method: "POST",
|
|
548
|
+
body: JSON.stringify({ userId, message }),
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export async function syncInventory(productId: string): Promise<void> {
|
|
553
|
+
const stock = await fetch(\`https://warehouse-api.example.com/stock/\${productId}\`);
|
|
554
|
+
const data = await stock.json();
|
|
555
|
+
await db.updateStock(productId, data.quantity);
|
|
556
|
+
}`,
|
|
557
|
+
expectedRuleIds: ["REL-001"],
|
|
558
|
+
category: "reliability",
|
|
559
|
+
difficulty: "medium",
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
id: "rel-deep-single-point-failure",
|
|
563
|
+
description: "System with single points of failure and no fallback",
|
|
564
|
+
language: "typescript",
|
|
565
|
+
code: `import express from "express";
|
|
566
|
+
|
|
567
|
+
const UPSTREAM_URL = "https://api.single-provider.com";
|
|
568
|
+
const app = express();
|
|
569
|
+
|
|
570
|
+
app.get("/api/data", async (req, res) => {
|
|
571
|
+
const response = await fetch(\`\${UPSTREAM_URL}/data?q=\${req.query.q}\`);
|
|
572
|
+
if (!response.ok) {
|
|
573
|
+
res.status(502).json({ error: "Upstream failed" });
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const data = await response.json();
|
|
577
|
+
const enriched = await fetch(\`\${UPSTREAM_URL}/enrich\`, {
|
|
578
|
+
method: "POST",
|
|
579
|
+
body: JSON.stringify(data),
|
|
580
|
+
});
|
|
581
|
+
res.json(await enriched.json());
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
// No fallback, no health check, no timeout config
|
|
585
|
+
app.listen(3000);`,
|
|
586
|
+
expectedRuleIds: ["REL-001"],
|
|
587
|
+
category: "reliability",
|
|
588
|
+
difficulty: "medium",
|
|
589
|
+
},
|
|
590
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
591
|
+
// RATE — Rate Limiting
|
|
592
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
593
|
+
{
|
|
594
|
+
id: "rate-deep-auth-no-rate-limit",
|
|
595
|
+
description: "Authentication endpoint with no rate limiting",
|
|
596
|
+
language: "typescript",
|
|
597
|
+
code: `import express from "express";
|
|
598
|
+
import bcrypt from "bcrypt";
|
|
599
|
+
|
|
600
|
+
const app = express();
|
|
601
|
+
app.use(express.json());
|
|
602
|
+
|
|
603
|
+
app.post("/auth/login", async (req, res) => {
|
|
604
|
+
const { email, password } = req.body;
|
|
605
|
+
const user = await db.findUserByEmail(email);
|
|
606
|
+
if (!user) return res.status(401).json({ error: "Invalid credentials" });
|
|
607
|
+
const valid = await bcrypt.compare(password, user.passwordHash);
|
|
608
|
+
if (!valid) return res.status(401).json({ error: "Invalid credentials" });
|
|
609
|
+
const token = generateJWT(user);
|
|
610
|
+
res.json({ token });
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
app.post("/auth/register", async (req, res) => {
|
|
614
|
+
const { email, password, name } = req.body;
|
|
615
|
+
const hash = await bcrypt.hash(password, 10);
|
|
616
|
+
const user = await db.createUser({ email, password: hash, name });
|
|
617
|
+
res.json({ userId: user.id });
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
app.post("/auth/forgot-password", async (req, res) => {
|
|
621
|
+
const user = await db.findUserByEmail(req.body.email);
|
|
622
|
+
if (user) await sendResetEmail(user);
|
|
623
|
+
res.json({ message: "If the email exists, a reset link was sent" });
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
app.listen(3000);`,
|
|
627
|
+
expectedRuleIds: ["RATE-001"],
|
|
628
|
+
category: "rate-limiting",
|
|
629
|
+
difficulty: "medium",
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
id: "rate-deep-no-body-limit",
|
|
633
|
+
description: "Express app with no request body size limits",
|
|
634
|
+
language: "typescript",
|
|
635
|
+
code: `import express from "express";
|
|
636
|
+
|
|
637
|
+
const app = express();
|
|
638
|
+
app.use(express.json());
|
|
639
|
+
app.use(express.urlencoded({ extended: true }));
|
|
640
|
+
|
|
641
|
+
app.post("/api/upload", async (req, res) => {
|
|
642
|
+
const data = req.body;
|
|
643
|
+
await processUpload(data);
|
|
644
|
+
res.json({ success: true });
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
app.post("/api/import", async (req, res) => {
|
|
648
|
+
const records = req.body.records;
|
|
649
|
+
for (const record of records) {
|
|
650
|
+
await db.insert(record);
|
|
651
|
+
}
|
|
652
|
+
res.json({ imported: records.length });
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
app.post("/api/webhook", async (req, res) => {
|
|
656
|
+
const payload = req.body;
|
|
657
|
+
await processWebhook(payload);
|
|
658
|
+
res.json({ received: true });
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
app.listen(3000);`,
|
|
662
|
+
expectedRuleIds: ["DATA-001", "API-001", "REL-001", "OBS-001", "DOC-001", "CONC-001", "COMPAT-001", "SEC-001"],
|
|
663
|
+
category: "rate-limiting",
|
|
664
|
+
difficulty: "easy",
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
id: "rate-deep-file-upload-no-limit",
|
|
668
|
+
description: "File upload endpoint without size or type restrictions",
|
|
669
|
+
language: "typescript",
|
|
670
|
+
code: `import express from "express";
|
|
671
|
+
import multer from "multer";
|
|
672
|
+
|
|
673
|
+
const upload = multer({ dest: "uploads/" });
|
|
674
|
+
const app = express();
|
|
675
|
+
|
|
676
|
+
app.post("/api/upload", upload.single("file"), async (req, res) => {
|
|
677
|
+
const file = req.file!;
|
|
678
|
+
await processFile(file.path);
|
|
679
|
+
res.json({ filename: file.originalname, size: file.size });
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
app.post("/api/bulk-upload", upload.array("files"), async (req, res) => {
|
|
683
|
+
const files = req.files as Express.Multer.File[];
|
|
684
|
+
for (const file of files) {
|
|
685
|
+
await processFile(file.path);
|
|
686
|
+
}
|
|
687
|
+
res.json({ count: files.length });
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
app.listen(3000);`,
|
|
691
|
+
expectedRuleIds: ["RATE-001"],
|
|
692
|
+
category: "rate-limiting",
|
|
693
|
+
difficulty: "easy",
|
|
694
|
+
},
|
|
695
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
696
|
+
// CICD — CI/CD deep
|
|
697
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
698
|
+
{
|
|
699
|
+
id: "cicd-deep-unpinned-actions",
|
|
700
|
+
description: "GitHub Actions with unpinned action versions",
|
|
701
|
+
language: "yaml",
|
|
702
|
+
code: `name: Build and Deploy
|
|
703
|
+
on: [push]
|
|
704
|
+
|
|
705
|
+
jobs:
|
|
706
|
+
build:
|
|
707
|
+
runs-on: ubuntu-latest
|
|
708
|
+
steps:
|
|
709
|
+
- uses: actions/checkout@master
|
|
710
|
+
- uses: actions/setup-node@latest
|
|
711
|
+
- run: npm ci && npm test
|
|
712
|
+
- uses: docker/build-push-action@main
|
|
713
|
+
with:
|
|
714
|
+
push: true
|
|
715
|
+
tags: myapp:latest
|
|
716
|
+
- uses: appleboy/ssh-action@master
|
|
717
|
+
with:
|
|
718
|
+
host: \${{ secrets.HOST }}
|
|
719
|
+
username: root
|
|
720
|
+
password: \${{ secrets.PASSWORD }}
|
|
721
|
+
script: docker pull myapp:latest && docker run -d myapp:latest`,
|
|
722
|
+
expectedRuleIds: ["CYBER-001"],
|
|
723
|
+
category: "cicd",
|
|
724
|
+
difficulty: "medium",
|
|
725
|
+
},
|
|
726
|
+
// ── IAC: Terraform advanced misconfigurations ──────────────────────────────
|
|
727
|
+
{
|
|
728
|
+
id: "iac-deep-terraform-no-logging",
|
|
729
|
+
description: "Terraform S3 bucket without access logging enabled",
|
|
730
|
+
language: "hcl",
|
|
731
|
+
code: `resource "aws_s3_bucket" "sensitive_data" {
|
|
732
|
+
bucket = "company-financial-records"
|
|
733
|
+
|
|
734
|
+
server_side_encryption_configuration {
|
|
735
|
+
rule {
|
|
736
|
+
apply_server_side_encryption_by_default {
|
|
737
|
+
sse_algorithm = "aws:kms"
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
# No logging configuration — compliance violation
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
resource "aws_s3_bucket_versioning" "sensitive_versioning" {
|
|
746
|
+
bucket = aws_s3_bucket.sensitive_data.id
|
|
747
|
+
versioning_configuration {
|
|
748
|
+
status = "Enabled"
|
|
749
|
+
}
|
|
750
|
+
}`,
|
|
751
|
+
expectedRuleIds: ["IAC-001"],
|
|
752
|
+
category: "iac-security",
|
|
753
|
+
difficulty: "medium",
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
id: "iac-deep-terraform-rds-public",
|
|
757
|
+
description: "Terraform RDS instance publicly accessible with weak password",
|
|
758
|
+
language: "hcl",
|
|
759
|
+
code: `resource "aws_db_instance" "production" {
|
|
760
|
+
identifier = "prod-database"
|
|
761
|
+
engine = "mysql"
|
|
762
|
+
engine_version = "8.0"
|
|
763
|
+
instance_class = "db.m5.large"
|
|
764
|
+
allocated_storage = 100
|
|
765
|
+
username = "admin"
|
|
766
|
+
password = "admin123"
|
|
767
|
+
publicly_accessible = true
|
|
768
|
+
skip_final_snapshot = true
|
|
769
|
+
|
|
770
|
+
vpc_security_group_ids = [aws_security_group.rds.id]
|
|
771
|
+
|
|
772
|
+
backup_retention_period = 0
|
|
773
|
+
multi_az = false
|
|
774
|
+
|
|
775
|
+
tags = {
|
|
776
|
+
Environment = "production"
|
|
777
|
+
}
|
|
778
|
+
}`,
|
|
779
|
+
expectedRuleIds: ["IAC-001"],
|
|
780
|
+
category: "iac-security",
|
|
781
|
+
difficulty: "easy",
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
id: "iac-deep-terraform-default-vpc",
|
|
785
|
+
description: "Terraform resources deployed in the default VPC",
|
|
786
|
+
language: "hcl",
|
|
787
|
+
code: `data "aws_vpc" "default" {
|
|
788
|
+
default = true
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
resource "aws_instance" "api_server" {
|
|
792
|
+
ami = "ami-0c55b159cbfafe1f0"
|
|
793
|
+
instance_type = "t3.medium"
|
|
794
|
+
subnet_id = data.aws_vpc.default.main_route_table_id
|
|
795
|
+
|
|
796
|
+
vpc_security_group_ids = [aws_security_group.default_sg.id]
|
|
797
|
+
|
|
798
|
+
user_data = <<-EOF
|
|
799
|
+
#!/bin/bash
|
|
800
|
+
yum update -y
|
|
801
|
+
yum install -y httpd
|
|
802
|
+
systemctl start httpd
|
|
803
|
+
systemctl enable httpd
|
|
804
|
+
EOF
|
|
805
|
+
|
|
806
|
+
tags = {
|
|
807
|
+
Name = "API-Server"
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
resource "aws_security_group" "default_sg" {
|
|
812
|
+
vpc_id = data.aws_vpc.default.id
|
|
813
|
+
ingress {
|
|
814
|
+
from_port = 22
|
|
815
|
+
to_port = 22
|
|
816
|
+
protocol = "tcp"
|
|
817
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
818
|
+
}
|
|
819
|
+
}`,
|
|
820
|
+
expectedRuleIds: ["IAC-001"],
|
|
821
|
+
category: "iac-security",
|
|
822
|
+
difficulty: "medium",
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
id: "iac-deep-terraform-unencrypted-ebs",
|
|
826
|
+
description: "Terraform EBS volumes without encryption",
|
|
827
|
+
language: "hcl",
|
|
828
|
+
code: `resource "aws_ebs_volume" "data_volume" {
|
|
829
|
+
availability_zone = "us-east-1a"
|
|
830
|
+
size = 500
|
|
831
|
+
type = "gp3"
|
|
832
|
+
encrypted = false
|
|
833
|
+
|
|
834
|
+
tags = {
|
|
835
|
+
Name = "data-volume"
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
resource "aws_volume_attachment" "data_attach" {
|
|
840
|
+
device_name = "/dev/sdf"
|
|
841
|
+
volume_id = aws_ebs_volume.data_volume.id
|
|
842
|
+
instance_id = aws_instance.app_server.id
|
|
843
|
+
}`,
|
|
844
|
+
expectedRuleIds: ["IAC-001"],
|
|
845
|
+
category: "iac-security",
|
|
846
|
+
difficulty: "easy",
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
id: "iac-deep-cloudformation-wildcard",
|
|
850
|
+
description: "CloudFormation template with wildcard IAM policy",
|
|
851
|
+
language: "yaml",
|
|
852
|
+
code: `AWSTemplateFormatVersion: '2010-09-09'
|
|
853
|
+
Resources:
|
|
854
|
+
LambdaRole:
|
|
855
|
+
Type: AWS::IAM::Role
|
|
856
|
+
Properties:
|
|
857
|
+
AssumeRolePolicyDocument:
|
|
858
|
+
Version: '2012-10-17'
|
|
859
|
+
Statement:
|
|
860
|
+
- Effect: Allow
|
|
861
|
+
Principal:
|
|
862
|
+
Service: lambda.amazonaws.com
|
|
863
|
+
Action: sts:AssumeRole
|
|
864
|
+
Policies:
|
|
865
|
+
- PolicyName: LambdaFullAccess
|
|
866
|
+
PolicyDocument:
|
|
867
|
+
Version: '2012-10-17'
|
|
868
|
+
Statement:
|
|
869
|
+
- Effect: Allow
|
|
870
|
+
Action: '*'
|
|
871
|
+
Resource: '*'
|
|
872
|
+
ApiFunction:
|
|
873
|
+
Type: AWS::Lambda::Function
|
|
874
|
+
Properties:
|
|
875
|
+
Runtime: nodejs18.x
|
|
876
|
+
Handler: index.handler
|
|
877
|
+
Role: !GetAtt LambdaRole.Arn
|
|
878
|
+
Code:
|
|
879
|
+
ZipFile: |
|
|
880
|
+
exports.handler = async (event) => {
|
|
881
|
+
return { statusCode: 200, body: 'OK' };
|
|
882
|
+
};`,
|
|
883
|
+
expectedRuleIds: ["AICS-001"],
|
|
884
|
+
category: "iac-security",
|
|
885
|
+
difficulty: "medium",
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
id: "iac-deep-terraform-azure-nsg-any",
|
|
889
|
+
description: "Terraform Azure NSG allowing any inbound traffic",
|
|
890
|
+
language: "hcl",
|
|
891
|
+
code: `resource "azurerm_network_security_group" "web_nsg" {
|
|
892
|
+
name = "web-nsg"
|
|
893
|
+
location = azurerm_resource_group.main.location
|
|
894
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
895
|
+
|
|
896
|
+
security_rule {
|
|
897
|
+
name = "AllowAll"
|
|
898
|
+
priority = 100
|
|
899
|
+
direction = "Inbound"
|
|
900
|
+
access = "Allow"
|
|
901
|
+
protocol = "*"
|
|
902
|
+
source_port_range = "*"
|
|
903
|
+
destination_port_range = "*"
|
|
904
|
+
source_address_prefix = "*"
|
|
905
|
+
destination_address_prefix = "*"
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
resource "azurerm_storage_account" "logs" {
|
|
910
|
+
name = "companylogsstorage"
|
|
911
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
912
|
+
location = azurerm_resource_group.main.location
|
|
913
|
+
account_tier = "Standard"
|
|
914
|
+
account_replication_type = "LRS"
|
|
915
|
+
min_tls_version = "TLS1_0"
|
|
916
|
+
}`,
|
|
917
|
+
expectedRuleIds: ["IAC-001"],
|
|
918
|
+
category: "iac-security",
|
|
919
|
+
difficulty: "medium",
|
|
920
|
+
},
|
|
921
|
+
// ── IAC: Kubernetes advanced misconfigurations ─────────────────────────────
|
|
922
|
+
{
|
|
923
|
+
id: "iac-deep-k8s-no-resource-limits",
|
|
924
|
+
description: "Kubernetes Pod without resource limits — risk of resource exhaustion",
|
|
925
|
+
language: "yaml",
|
|
926
|
+
code: `apiVersion: apps/v1
|
|
927
|
+
kind: Deployment
|
|
928
|
+
metadata:
|
|
929
|
+
name: api-server
|
|
930
|
+
namespace: production
|
|
931
|
+
spec:
|
|
932
|
+
replicas: 3
|
|
933
|
+
selector:
|
|
934
|
+
matchLabels:
|
|
935
|
+
app: api-server
|
|
936
|
+
template:
|
|
937
|
+
metadata:
|
|
938
|
+
labels:
|
|
939
|
+
app: api-server
|
|
940
|
+
spec:
|
|
941
|
+
containers:
|
|
942
|
+
- name: api
|
|
943
|
+
image: company/api-server:v2.4.1
|
|
944
|
+
ports:
|
|
945
|
+
- containerPort: 8080
|
|
946
|
+
# No resources block — unbounded CPU and memory usage
|
|
947
|
+
env:
|
|
948
|
+
- name: NODE_ENV
|
|
949
|
+
value: "production"
|
|
950
|
+
- name: DB_HOST
|
|
951
|
+
valueFrom:
|
|
952
|
+
configMapKeyRef:
|
|
953
|
+
name: db-config
|
|
954
|
+
key: host`,
|
|
955
|
+
expectedRuleIds: ["IAC-001"],
|
|
956
|
+
category: "iac-security",
|
|
957
|
+
difficulty: "medium",
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
id: "iac-deep-k8s-hostnetwork",
|
|
961
|
+
description: "Kubernetes Pod using host network namespace",
|
|
962
|
+
language: "yaml",
|
|
963
|
+
code: `apiVersion: v1
|
|
964
|
+
kind: Pod
|
|
965
|
+
metadata:
|
|
966
|
+
name: debug-pod
|
|
967
|
+
namespace: production
|
|
968
|
+
spec:
|
|
969
|
+
hostNetwork: true
|
|
970
|
+
hostPID: true
|
|
971
|
+
containers:
|
|
972
|
+
- name: debug
|
|
973
|
+
image: busybox:latest
|
|
974
|
+
command: ["sleep", "3600"]
|
|
975
|
+
volumeMounts:
|
|
976
|
+
- name: host-root
|
|
977
|
+
mountPath: /host
|
|
978
|
+
volumes:
|
|
979
|
+
- name: host-root
|
|
980
|
+
hostPath:
|
|
981
|
+
path: /
|
|
982
|
+
type: Directory`,
|
|
983
|
+
expectedRuleIds: ["IAC-001"],
|
|
984
|
+
category: "iac-security",
|
|
985
|
+
difficulty: "easy",
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
id: "iac-deep-k8s-default-sa",
|
|
989
|
+
description: "Kubernetes Deployment using default service account with auto-mount",
|
|
990
|
+
language: "yaml",
|
|
991
|
+
code: `apiVersion: apps/v1
|
|
992
|
+
kind: Deployment
|
|
993
|
+
metadata:
|
|
994
|
+
name: payment-service
|
|
995
|
+
namespace: default
|
|
996
|
+
spec:
|
|
997
|
+
replicas: 2
|
|
998
|
+
selector:
|
|
999
|
+
matchLabels:
|
|
1000
|
+
app: payment
|
|
1001
|
+
template:
|
|
1002
|
+
metadata:
|
|
1003
|
+
labels:
|
|
1004
|
+
app: payment
|
|
1005
|
+
spec:
|
|
1006
|
+
# using default service account — auto-mounts API token
|
|
1007
|
+
automountServiceAccountToken: true
|
|
1008
|
+
containers:
|
|
1009
|
+
- name: payment
|
|
1010
|
+
image: company/payment:latest
|
|
1011
|
+
ports:
|
|
1012
|
+
- containerPort: 3000
|
|
1013
|
+
env:
|
|
1014
|
+
- name: STRIPE_KEY
|
|
1015
|
+
value: "sk_live_abcdef123456"`,
|
|
1016
|
+
expectedRuleIds: ["IAC-001"],
|
|
1017
|
+
category: "iac-security",
|
|
1018
|
+
difficulty: "medium",
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
id: "iac-deep-k8s-latest-tag",
|
|
1022
|
+
description: "Kubernetes Deployment using :latest image tag with no pull policy",
|
|
1023
|
+
language: "yaml",
|
|
1024
|
+
code: `apiVersion: apps/v1
|
|
1025
|
+
kind: Deployment
|
|
1026
|
+
metadata:
|
|
1027
|
+
name: web-frontend
|
|
1028
|
+
spec:
|
|
1029
|
+
replicas: 3
|
|
1030
|
+
selector:
|
|
1031
|
+
matchLabels:
|
|
1032
|
+
app: frontend
|
|
1033
|
+
template:
|
|
1034
|
+
metadata:
|
|
1035
|
+
labels:
|
|
1036
|
+
app: frontend
|
|
1037
|
+
spec:
|
|
1038
|
+
containers:
|
|
1039
|
+
- name: frontend
|
|
1040
|
+
image: company/frontend:latest
|
|
1041
|
+
imagePullPolicy: IfNotPresent
|
|
1042
|
+
ports:
|
|
1043
|
+
- containerPort: 80
|
|
1044
|
+
- name: sidecar-proxy
|
|
1045
|
+
image: envoyproxy/envoy:latest
|
|
1046
|
+
ports:
|
|
1047
|
+
- containerPort: 15001`,
|
|
1048
|
+
expectedRuleIds: ["IAC-001"],
|
|
1049
|
+
category: "iac-security",
|
|
1050
|
+
difficulty: "easy",
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
id: "iac-deep-k8s-no-probes",
|
|
1054
|
+
description: "Kubernetes Deployment without readiness or liveness probes",
|
|
1055
|
+
language: "yaml",
|
|
1056
|
+
code: `apiVersion: apps/v1
|
|
1057
|
+
kind: Deployment
|
|
1058
|
+
metadata:
|
|
1059
|
+
name: order-service
|
|
1060
|
+
namespace: production
|
|
1061
|
+
spec:
|
|
1062
|
+
replicas: 5
|
|
1063
|
+
strategy:
|
|
1064
|
+
type: RollingUpdate
|
|
1065
|
+
rollingUpdate:
|
|
1066
|
+
maxSurge: 1
|
|
1067
|
+
maxUnavailable: 0
|
|
1068
|
+
selector:
|
|
1069
|
+
matchLabels:
|
|
1070
|
+
app: order-service
|
|
1071
|
+
template:
|
|
1072
|
+
metadata:
|
|
1073
|
+
labels:
|
|
1074
|
+
app: order-service
|
|
1075
|
+
spec:
|
|
1076
|
+
containers:
|
|
1077
|
+
- name: order
|
|
1078
|
+
image: company/order-service:v3.1.0
|
|
1079
|
+
ports:
|
|
1080
|
+
- containerPort: 8080
|
|
1081
|
+
resources:
|
|
1082
|
+
requests:
|
|
1083
|
+
cpu: 250m
|
|
1084
|
+
memory: 256Mi
|
|
1085
|
+
limits:
|
|
1086
|
+
cpu: 500m
|
|
1087
|
+
memory: 512Mi
|
|
1088
|
+
# No readiness or liveness probes configured`,
|
|
1089
|
+
expectedRuleIds: ["IAC-001"],
|
|
1090
|
+
category: "iac-security",
|
|
1091
|
+
difficulty: "medium",
|
|
1092
|
+
},
|
|
1093
|
+
// ── IAC: Dockerfile advanced issues ────────────────────────────────────────
|
|
1094
|
+
{
|
|
1095
|
+
id: "iac-deep-dockerfile-no-healthcheck",
|
|
1096
|
+
description: "Dockerfile without HEALTHCHECK instruction",
|
|
1097
|
+
language: "dockerfile",
|
|
1098
|
+
code: `FROM node:18
|
|
1099
|
+
WORKDIR /app
|
|
1100
|
+
COPY package*.json ./
|
|
1101
|
+
RUN npm ci --production
|
|
1102
|
+
COPY . .
|
|
1103
|
+
RUN npm run build
|
|
1104
|
+
EXPOSE 3000
|
|
1105
|
+
CMD ["node", "dist/server.js"]`,
|
|
1106
|
+
expectedRuleIds: ["IAC-001"],
|
|
1107
|
+
category: "iac-security",
|
|
1108
|
+
difficulty: "easy",
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
id: "iac-deep-dockerfile-add-url",
|
|
1112
|
+
description: "Dockerfile using ADD with URL instead of COPY/RUN curl",
|
|
1113
|
+
language: "dockerfile",
|
|
1114
|
+
code: `FROM ubuntu:22.04
|
|
1115
|
+
RUN apt-get update && apt-get install -y python3 python3-pip
|
|
1116
|
+
ADD https://example.com/scripts/setup.sh /tmp/setup.sh
|
|
1117
|
+
RUN chmod +x /tmp/setup.sh && /tmp/setup.sh
|
|
1118
|
+
ADD https://example.com/config/app.tar.gz /opt/
|
|
1119
|
+
COPY requirements.txt .
|
|
1120
|
+
RUN pip3 install -r requirements.txt
|
|
1121
|
+
COPY . /app
|
|
1122
|
+
WORKDIR /app
|
|
1123
|
+
CMD ["python3", "main.py"]`,
|
|
1124
|
+
expectedRuleIds: ["IAC-001"],
|
|
1125
|
+
category: "iac-security",
|
|
1126
|
+
difficulty: "easy",
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
id: "iac-deep-dockerfile-env-secrets",
|
|
1130
|
+
description: "Dockerfile embedding secrets in ENV directives",
|
|
1131
|
+
language: "dockerfile",
|
|
1132
|
+
code: `FROM python:3.11-slim
|
|
1133
|
+
WORKDIR /app
|
|
1134
|
+
ENV DATABASE_URL=postgresql://admin:s3cretP@ss@prod-db.internal:5432/maindb
|
|
1135
|
+
ENV AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
|
1136
|
+
ENV AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
1137
|
+
ENV STRIPE_SECRET_KEY=sk_live_51HxxxxBxxxxDxxxxAxxxxK
|
|
1138
|
+
COPY requirements.txt .
|
|
1139
|
+
RUN pip install -r requirements.txt
|
|
1140
|
+
COPY . .
|
|
1141
|
+
EXPOSE 8000
|
|
1142
|
+
CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:8000"]`,
|
|
1143
|
+
expectedRuleIds: ["IAC-001"],
|
|
1144
|
+
category: "iac-security",
|
|
1145
|
+
difficulty: "easy",
|
|
1146
|
+
},
|
|
1147
|
+
// ── CICD: Advanced pipeline security issues ────────────────────────────────
|
|
1148
|
+
{
|
|
1149
|
+
id: "cicd-deep-pr-target-injection",
|
|
1150
|
+
description: "GitHub Actions workflow vulnerable to PR title injection",
|
|
1151
|
+
language: "yaml",
|
|
1152
|
+
code: `name: Comment on PR
|
|
1153
|
+
on:
|
|
1154
|
+
pull_request_target:
|
|
1155
|
+
types: [opened, edited]
|
|
1156
|
+
|
|
1157
|
+
jobs:
|
|
1158
|
+
comment:
|
|
1159
|
+
runs-on: ubuntu-latest
|
|
1160
|
+
steps:
|
|
1161
|
+
- uses: actions/checkout@v4
|
|
1162
|
+
with:
|
|
1163
|
+
ref: \${{ github.event.pull_request.head.sha }}
|
|
1164
|
+
- name: Build and Test
|
|
1165
|
+
run: |
|
|
1166
|
+
echo "PR Title: \${{ github.event.pull_request.title }}"
|
|
1167
|
+
npm install
|
|
1168
|
+
npm test
|
|
1169
|
+
- name: Deploy Preview
|
|
1170
|
+
env:
|
|
1171
|
+
DEPLOY_TOKEN: \${{ secrets.DEPLOY_TOKEN }}
|
|
1172
|
+
run: |
|
|
1173
|
+
curl -X POST -H "Authorization: Bearer $DEPLOY_TOKEN" \\
|
|
1174
|
+
-d '{"ref": "\${{ github.event.pull_request.head.sha }}"}' \\
|
|
1175
|
+
https://api.deploy.example.com/preview`,
|
|
1176
|
+
expectedRuleIds: ["CYBER-001"],
|
|
1177
|
+
category: "cicd",
|
|
1178
|
+
difficulty: "hard",
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
id: "cicd-deep-secrets-in-logs",
|
|
1182
|
+
description: "CI pipeline printing secrets to build logs",
|
|
1183
|
+
language: "yaml",
|
|
1184
|
+
code: `name: Deploy
|
|
1185
|
+
on:
|
|
1186
|
+
push:
|
|
1187
|
+
branches: [main]
|
|
1188
|
+
|
|
1189
|
+
jobs:
|
|
1190
|
+
deploy:
|
|
1191
|
+
runs-on: ubuntu-latest
|
|
1192
|
+
steps:
|
|
1193
|
+
- uses: actions/checkout@v4
|
|
1194
|
+
- name: Debug Environment
|
|
1195
|
+
run: |
|
|
1196
|
+
echo "Deploying with token: \${{ secrets.DEPLOY_TOKEN }}"
|
|
1197
|
+
echo "Database: \${{ secrets.DATABASE_URL }}"
|
|
1198
|
+
env | sort
|
|
1199
|
+
- name: Deploy
|
|
1200
|
+
run: |
|
|
1201
|
+
export KUBECONFIG_DATA="\${{ secrets.KUBECONFIG }}"
|
|
1202
|
+
echo "$KUBECONFIG_DATA" | base64 -d > kubeconfig
|
|
1203
|
+
kubectl --kubeconfig=kubeconfig apply -f k8s/`,
|
|
1204
|
+
expectedRuleIds: ["CYBER-001", "SOV-001"],
|
|
1205
|
+
category: "cicd",
|
|
1206
|
+
difficulty: "easy",
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
id: "cicd-deep-no-artifact-integrity",
|
|
1210
|
+
description: "CI pipeline building and deploying without artifact verification",
|
|
1211
|
+
language: "yaml",
|
|
1212
|
+
code: `stages:
|
|
1213
|
+
- build
|
|
1214
|
+
- deploy
|
|
1215
|
+
|
|
1216
|
+
build:
|
|
1217
|
+
stage: build
|
|
1218
|
+
image: docker:latest
|
|
1219
|
+
services:
|
|
1220
|
+
- docker:dind
|
|
1221
|
+
script:
|
|
1222
|
+
- docker build -t registry.example.com/app:$CI_COMMIT_SHA .
|
|
1223
|
+
- docker push registry.example.com/app:$CI_COMMIT_SHA
|
|
1224
|
+
# No image signing, no SBOM, no vulnerability scan
|
|
1225
|
+
|
|
1226
|
+
deploy:
|
|
1227
|
+
stage: deploy
|
|
1228
|
+
image: bitnami/kubectl:latest
|
|
1229
|
+
script:
|
|
1230
|
+
- kubectl set image deployment/app app=registry.example.com/app:$CI_COMMIT_SHA
|
|
1231
|
+
environment:
|
|
1232
|
+
name: production
|
|
1233
|
+
# No approval gate, no rollback strategy`,
|
|
1234
|
+
expectedRuleIds: ["CICD-001"],
|
|
1235
|
+
category: "cicd",
|
|
1236
|
+
difficulty: "medium",
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
id: "cicd-deep-self-hosted-runner-risk",
|
|
1240
|
+
description: "GitHub Actions running untrusted code on self-hosted runners",
|
|
1241
|
+
language: "yaml",
|
|
1242
|
+
code: `name: CI
|
|
1243
|
+
on:
|
|
1244
|
+
pull_request:
|
|
1245
|
+
types: [opened, synchronize]
|
|
1246
|
+
|
|
1247
|
+
jobs:
|
|
1248
|
+
test:
|
|
1249
|
+
runs-on: self-hosted
|
|
1250
|
+
steps:
|
|
1251
|
+
- uses: actions/checkout@v4
|
|
1252
|
+
- name: Install Dependencies
|
|
1253
|
+
run: npm install
|
|
1254
|
+
- name: Run Tests
|
|
1255
|
+
run: npm test
|
|
1256
|
+
- name: Lint
|
|
1257
|
+
run: npm run lint
|
|
1258
|
+
- name: Integration Tests
|
|
1259
|
+
env:
|
|
1260
|
+
DB_URL: \${{ secrets.DB_URL }}
|
|
1261
|
+
run: npm run test:integration`,
|
|
1262
|
+
expectedRuleIds: ["CICD-001"],
|
|
1263
|
+
category: "cicd",
|
|
1264
|
+
difficulty: "hard",
|
|
1265
|
+
},
|
|
1266
|
+
// ── CLOUD: Multi-cloud misconfigurations ───────────────────────────────────
|
|
1267
|
+
{
|
|
1268
|
+
id: "cloud-deep-azure-public-blob",
|
|
1269
|
+
description: "Azure storage container with public blob access",
|
|
1270
|
+
language: "hcl",
|
|
1271
|
+
code: `resource "azurerm_storage_account" "uploads" {
|
|
1272
|
+
name = "companyuploads"
|
|
1273
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
1274
|
+
location = "eastus"
|
|
1275
|
+
account_tier = "Standard"
|
|
1276
|
+
account_replication_type = "LRS"
|
|
1277
|
+
min_tls_version = "TLS1_0"
|
|
1278
|
+
|
|
1279
|
+
blob_properties {
|
|
1280
|
+
cors_rule {
|
|
1281
|
+
allowed_headers = ["*"]
|
|
1282
|
+
allowed_methods = ["GET", "PUT", "POST", "DELETE"]
|
|
1283
|
+
allowed_origins = ["*"]
|
|
1284
|
+
exposed_headers = ["*"]
|
|
1285
|
+
max_age_in_seconds = 86400
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
resource "azurerm_storage_container" "public" {
|
|
1291
|
+
name = "user-uploads"
|
|
1292
|
+
storage_account_name = azurerm_storage_account.uploads.name
|
|
1293
|
+
container_access_type = "blob"
|
|
1294
|
+
}`,
|
|
1295
|
+
expectedRuleIds: ["AICS-001", "IAC-001"],
|
|
1296
|
+
category: "cloud",
|
|
1297
|
+
difficulty: "medium",
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
id: "cloud-deep-gcp-default-network",
|
|
1301
|
+
description: "GCP Compute instance on default network with public IP",
|
|
1302
|
+
language: "hcl",
|
|
1303
|
+
code: `resource "google_compute_instance" "web_server" {
|
|
1304
|
+
name = "web-server-prod"
|
|
1305
|
+
machine_type = "e2-medium"
|
|
1306
|
+
zone = "us-central1-a"
|
|
1307
|
+
|
|
1308
|
+
boot_disk {
|
|
1309
|
+
initialize_params {
|
|
1310
|
+
image = "debian-cloud/debian-11"
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
network_interface {
|
|
1315
|
+
network = "default"
|
|
1316
|
+
access_config {
|
|
1317
|
+
# Assigns a public IP
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
metadata = {
|
|
1322
|
+
enable-oslogin = "false"
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
metadata_startup_script = <<-EOT
|
|
1326
|
+
apt-get update
|
|
1327
|
+
apt-get install -y nginx
|
|
1328
|
+
echo "Hello" > /var/www/html/index.html
|
|
1329
|
+
EOT
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
resource "google_compute_firewall" "allow_all" {
|
|
1333
|
+
name = "allow-all"
|
|
1334
|
+
network = "default"
|
|
1335
|
+
|
|
1336
|
+
allow {
|
|
1337
|
+
protocol = "tcp"
|
|
1338
|
+
ports = ["0-65535"]
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
source_ranges = ["0.0.0.0/0"]
|
|
1342
|
+
}`,
|
|
1343
|
+
expectedRuleIds: ["CLOUD-001"],
|
|
1344
|
+
category: "cloud",
|
|
1345
|
+
difficulty: "medium",
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
id: "cloud-deep-aws-rds-no-ssl",
|
|
1349
|
+
description: "AWS RDS parameter group without SSL enforcement",
|
|
1350
|
+
language: "hcl",
|
|
1351
|
+
code: `resource "aws_db_parameter_group" "mysql" {
|
|
1352
|
+
family = "mysql8.0"
|
|
1353
|
+
name = "prod-mysql-params"
|
|
1354
|
+
|
|
1355
|
+
parameter {
|
|
1356
|
+
name = "require_secure_transport"
|
|
1357
|
+
value = "0"
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
parameter {
|
|
1361
|
+
name = "log_output"
|
|
1362
|
+
value = "NONE"
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
resource "aws_db_instance" "mysql_prod" {
|
|
1367
|
+
identifier = "prod-mysql"
|
|
1368
|
+
engine = "mysql"
|
|
1369
|
+
instance_class = "db.r5.large"
|
|
1370
|
+
allocated_storage = 200
|
|
1371
|
+
username = "dbadmin"
|
|
1372
|
+
password = var.db_password
|
|
1373
|
+
parameter_group_name = aws_db_parameter_group.mysql.name
|
|
1374
|
+
storage_encrypted = false
|
|
1375
|
+
deletion_protection = false
|
|
1376
|
+
backup_retention_period = 1
|
|
1377
|
+
}`,
|
|
1378
|
+
expectedRuleIds: ["CLOUD-001"],
|
|
1379
|
+
category: "cloud",
|
|
1380
|
+
difficulty: "hard",
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
id: "cloud-deep-aws-lambda-vpc-no-nat",
|
|
1384
|
+
description: "AWS Lambda in VPC without NAT gateway — no internet access",
|
|
1385
|
+
language: "hcl",
|
|
1386
|
+
code: `resource "aws_lambda_function" "processor" {
|
|
1387
|
+
function_name = "order-processor"
|
|
1388
|
+
runtime = "nodejs18.x"
|
|
1389
|
+
handler = "index.handler"
|
|
1390
|
+
role = aws_iam_role.lambda.arn
|
|
1391
|
+
filename = "lambda.zip"
|
|
1392
|
+
timeout = 300
|
|
1393
|
+
memory_size = 1024
|
|
1394
|
+
|
|
1395
|
+
vpc_config {
|
|
1396
|
+
subnet_ids = aws_subnet.private[*].id
|
|
1397
|
+
security_group_ids = [aws_security_group.lambda.id]
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
environment {
|
|
1401
|
+
variables = {
|
|
1402
|
+
EXTERNAL_API = "https://api.stripe.com"
|
|
1403
|
+
SQS_QUEUE = aws_sqs_queue.orders.url
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
# No NAT Gateway configured — Lambda cannot reach external APIs`,
|
|
1409
|
+
expectedRuleIds: ["CLOUD-001"],
|
|
1410
|
+
category: "cloud",
|
|
1411
|
+
difficulty: "hard",
|
|
1412
|
+
},
|
|
1413
|
+
// ── CFG: Configuration security issues ─────────────────────────────────────
|
|
1414
|
+
{
|
|
1415
|
+
id: "cfg-deep-hardcoded-urls",
|
|
1416
|
+
description: "Hardcoded service URLs instead of service discovery",
|
|
1417
|
+
language: "typescript",
|
|
1418
|
+
code: `const SERVICE_CONFIG = {
|
|
1419
|
+
authService: "http://10.0.1.45:3001",
|
|
1420
|
+
paymentService: "http://10.0.1.46:3002",
|
|
1421
|
+
inventoryService: "http://10.0.1.47:3003",
|
|
1422
|
+
notificationService: "http://10.0.1.48:3004",
|
|
1423
|
+
analyticsService: "http://10.0.1.49:3005",
|
|
1424
|
+
};
|
|
1425
|
+
|
|
1426
|
+
export async function processOrder(order: Order) {
|
|
1427
|
+
const user = await fetch(\`\${SERVICE_CONFIG.authService}/users/\${order.userId}\`);
|
|
1428
|
+
const stock = await fetch(\`\${SERVICE_CONFIG.inventoryService}/check/\${order.productId}\`);
|
|
1429
|
+
await fetch(\`\${SERVICE_CONFIG.paymentService}/charge\`, {
|
|
1430
|
+
method: "POST",
|
|
1431
|
+
body: JSON.stringify({ amount: order.total }),
|
|
1432
|
+
});
|
|
1433
|
+
await fetch(\`\${SERVICE_CONFIG.notificationService}/send\`, {
|
|
1434
|
+
method: "POST",
|
|
1435
|
+
body: JSON.stringify({ userId: order.userId, message: "Order placed" }),
|
|
1436
|
+
});
|
|
1437
|
+
}`,
|
|
1438
|
+
expectedRuleIds: ["DATA-001", "REL-001", "SCALE-001", "COMP-001", "SOV-001", "MAINT-001", "RATE-001"],
|
|
1439
|
+
category: "configuration",
|
|
1440
|
+
difficulty: "medium",
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
id: "cfg-deep-plaintext-secrets-yaml",
|
|
1444
|
+
description: "Application config file with plaintext secrets",
|
|
1445
|
+
language: "yaml",
|
|
1446
|
+
code: `# config/production.yml
|
|
1447
|
+
server:
|
|
1448
|
+
port: 8080
|
|
1449
|
+
host: 0.0.0.0
|
|
1450
|
+
|
|
1451
|
+
database:
|
|
1452
|
+
host: prod-db.internal.example.com
|
|
1453
|
+
port: 5432
|
|
1454
|
+
name: production_db
|
|
1455
|
+
username: app_user
|
|
1456
|
+
password: Pr0d_P@ssw0rd!2024
|
|
1457
|
+
|
|
1458
|
+
redis:
|
|
1459
|
+
url: redis://:RedisSecretKey@cache.internal:6379/0
|
|
1460
|
+
|
|
1461
|
+
auth:
|
|
1462
|
+
jwt_secret: my-super-secret-jwt-key-do-not-share
|
|
1463
|
+
oauth_client_secret: 7a8b9c0d1e2f3a4b5c6d7e8f
|
|
1464
|
+
|
|
1465
|
+
external_apis:
|
|
1466
|
+
stripe_key: sk_live_51HxxxxBxxxxDxxxxAxxxxK
|
|
1467
|
+
sendgrid_key: SG.xxxxxxxxxxxxxxxx
|
|
1468
|
+
twilio_auth_token: abcdef1234567890`,
|
|
1469
|
+
expectedRuleIds: ["CYBER-001", "DB-001"],
|
|
1470
|
+
category: "configuration",
|
|
1471
|
+
difficulty: "easy",
|
|
1472
|
+
},
|
|
1473
|
+
{
|
|
1474
|
+
id: "cfg-deep-no-schema-validation",
|
|
1475
|
+
description: "Config loading without schema validation or type checking",
|
|
1476
|
+
language: "typescript",
|
|
1477
|
+
code: `import fs from "fs";
|
|
1478
|
+
|
|
1479
|
+
export function loadConfig(configPath: string): any {
|
|
1480
|
+
const raw = fs.readFileSync(configPath, "utf-8");
|
|
1481
|
+
const config = JSON.parse(raw);
|
|
1482
|
+
|
|
1483
|
+
// No validation, no defaults, no type checking
|
|
1484
|
+
return config;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
const config = loadConfig("./config.json");
|
|
1488
|
+
|
|
1489
|
+
export function startServer() {
|
|
1490
|
+
const port = config.port; // might be undefined, string, or negative
|
|
1491
|
+
const host = config.host; // might be missing
|
|
1492
|
+
const maxConnections = config.db.maxConnections; // might throw if db is undefined
|
|
1493
|
+
const timeout = config.timeout; // no bounds checking
|
|
1494
|
+
|
|
1495
|
+
console.log(\`Starting on \${host}:\${port}\`);
|
|
1496
|
+
}`,
|
|
1497
|
+
expectedRuleIds: ["SCALE-001", "COST-001"],
|
|
1498
|
+
category: "configuration",
|
|
1499
|
+
difficulty: "medium",
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
id: "cfg-deep-feature-flags-code",
|
|
1503
|
+
description: "Feature flags hardcoded in source code instead of config",
|
|
1504
|
+
language: "typescript",
|
|
1505
|
+
code: `export function processPayment(order: Order) {
|
|
1506
|
+
// TODO: Remove after Q2 release
|
|
1507
|
+
const USE_NEW_PAYMENT_FLOW = true;
|
|
1508
|
+
const ENABLE_DISCOUNT_V2 = false;
|
|
1509
|
+
const MAX_RETRY_COUNT = 3;
|
|
1510
|
+
const FEATURE_DARK_MODE = true;
|
|
1511
|
+
const AB_TEST_CHECKOUT = "variant_b";
|
|
1512
|
+
|
|
1513
|
+
if (USE_NEW_PAYMENT_FLOW) {
|
|
1514
|
+
return newPaymentProcessor(order);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
if (ENABLE_DISCOUNT_V2) {
|
|
1518
|
+
applyNewDiscountRules(order);
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
if (AB_TEST_CHECKOUT === "variant_b") {
|
|
1522
|
+
return checkoutVariantB(order);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
return legacyPaymentProcessor(order);
|
|
1526
|
+
}`,
|
|
1527
|
+
expectedRuleIds: ["TEST-001"],
|
|
1528
|
+
category: "configuration",
|
|
1529
|
+
difficulty: "medium",
|
|
1530
|
+
},
|
|
1531
|
+
// ── COST: Additional cost-effectiveness issues ─────────────────────────────
|
|
1532
|
+
{
|
|
1533
|
+
id: "cost-deep-no-resource-tags",
|
|
1534
|
+
description: "Cloud resources deployed without cost allocation tags",
|
|
1535
|
+
language: "hcl",
|
|
1536
|
+
code: `resource "aws_instance" "worker_1" {
|
|
1537
|
+
ami = "ami-0c55b159cbfafe1f0"
|
|
1538
|
+
instance_type = "c5.4xlarge"
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
resource "aws_instance" "worker_2" {
|
|
1542
|
+
ami = "ami-0c55b159cbfafe1f0"
|
|
1543
|
+
instance_type = "c5.4xlarge"
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
resource "aws_instance" "worker_3" {
|
|
1547
|
+
ami = "ami-0c55b159cbfafe1f0"
|
|
1548
|
+
instance_type = "c5.4xlarge"
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
resource "aws_rds_cluster" "analytics" {
|
|
1552
|
+
engine = "aurora-mysql"
|
|
1553
|
+
engine_version = "5.7.mysql_aurora.2.11.2"
|
|
1554
|
+
master_username = "admin"
|
|
1555
|
+
master_password = var.db_password
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
# No tags on any resource — impossible to track costs per team/project`,
|
|
1559
|
+
expectedRuleIds: ["COST-001"],
|
|
1560
|
+
category: "cost-effectiveness",
|
|
1561
|
+
difficulty: "easy",
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
id: "cost-deep-over-provisioned-instance",
|
|
1565
|
+
description: "Over-provisioned compute resources for simple workloads",
|
|
1566
|
+
language: "typescript",
|
|
1567
|
+
code: `// serverless.yml config for a simple CRUD API
|
|
1568
|
+
const serverlessConfig = {
|
|
1569
|
+
service: "user-profile-api",
|
|
1570
|
+
provider: {
|
|
1571
|
+
name: "aws",
|
|
1572
|
+
runtime: "nodejs18.x",
|
|
1573
|
+
memorySize: 3008, // Max memory for a simple GET endpoint
|
|
1574
|
+
timeout: 900, // 15-minute timeout for < 100ms operations
|
|
1575
|
+
},
|
|
1576
|
+
functions: {
|
|
1577
|
+
getUser: {
|
|
1578
|
+
handler: "handler.getUser",
|
|
1579
|
+
memorySize: 3008,
|
|
1580
|
+
events: [{ http: { path: "users/{id}", method: "get" } }],
|
|
1581
|
+
},
|
|
1582
|
+
listUsers: {
|
|
1583
|
+
handler: "handler.listUsers",
|
|
1584
|
+
memorySize: 3008,
|
|
1585
|
+
events: [{ http: { path: "users", method: "get" } }],
|
|
1586
|
+
},
|
|
1587
|
+
healthCheck: {
|
|
1588
|
+
handler: "handler.health",
|
|
1589
|
+
memorySize: 3008,
|
|
1590
|
+
events: [{ schedule: "rate(1 minute)" }], // Health check every minute
|
|
1591
|
+
},
|
|
1592
|
+
},
|
|
1593
|
+
};`,
|
|
1594
|
+
expectedRuleIds: ["COST-001"],
|
|
1595
|
+
category: "cost-effectiveness",
|
|
1596
|
+
difficulty: "medium",
|
|
1597
|
+
},
|
|
1598
|
+
// ── SCALE: Additional scalability issues ───────────────────────────────────
|
|
1599
|
+
{
|
|
1600
|
+
id: "scale-deep-sync-queue",
|
|
1601
|
+
description: "Synchronous processing instead of async queue-based architecture",
|
|
1602
|
+
language: "typescript",
|
|
1603
|
+
code: `import express from "express";
|
|
1604
|
+
|
|
1605
|
+
const app = express();
|
|
1606
|
+
|
|
1607
|
+
app.post("/api/orders", async (req, res) => {
|
|
1608
|
+
const order = req.body;
|
|
1609
|
+
|
|
1610
|
+
// Process everything synchronously in the request
|
|
1611
|
+
const inventory = await checkInventory(order.items);
|
|
1612
|
+
const payment = await chargePayment(order.userId, order.total);
|
|
1613
|
+
const receipt = await generateReceipt(order, payment);
|
|
1614
|
+
await sendConfirmationEmail(order.userId, receipt);
|
|
1615
|
+
await updateAnalytics("order_placed", order);
|
|
1616
|
+
await notifyWarehouse(order);
|
|
1617
|
+
await updateLoyaltyPoints(order.userId, order.total);
|
|
1618
|
+
await syncToERP(order);
|
|
1619
|
+
|
|
1620
|
+
// Response delayed by all sequential operations
|
|
1621
|
+
res.json({ orderId: order.id, status: "completed" });
|
|
1622
|
+
});`,
|
|
1623
|
+
expectedRuleIds: ["API-001", "COMP-001", "SEC-001"],
|
|
1624
|
+
category: "scalability",
|
|
1625
|
+
difficulty: "medium",
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
id: "scale-deep-global-singleton-state",
|
|
1629
|
+
description: "Global singleton holding state that prevents horizontal scaling",
|
|
1630
|
+
language: "typescript",
|
|
1631
|
+
code: `class RateLimiter {
|
|
1632
|
+
private static instance: RateLimiter;
|
|
1633
|
+
private requestCounts: Map<string, { count: number; resetAt: number }> = new Map();
|
|
1634
|
+
private blockedIPs: Set<string> = new Set();
|
|
1635
|
+
|
|
1636
|
+
static getInstance(): RateLimiter {
|
|
1637
|
+
if (!RateLimiter.instance) {
|
|
1638
|
+
RateLimiter.instance = new RateLimiter();
|
|
1639
|
+
}
|
|
1640
|
+
return RateLimiter.instance;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
isAllowed(ip: string): boolean {
|
|
1644
|
+
if (this.blockedIPs.has(ip)) return false;
|
|
1645
|
+
|
|
1646
|
+
const now = Date.now();
|
|
1647
|
+
const record = this.requestCounts.get(ip);
|
|
1648
|
+
|
|
1649
|
+
if (!record || now > record.resetAt) {
|
|
1650
|
+
this.requestCounts.set(ip, { count: 1, resetAt: now + 60000 });
|
|
1651
|
+
return true;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
record.count++;
|
|
1655
|
+
if (record.count > 100) {
|
|
1656
|
+
this.blockedIPs.add(ip);
|
|
1657
|
+
return false;
|
|
1658
|
+
}
|
|
1659
|
+
return true;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
// Each instance has its own rate limiter — no coordination across replicas`,
|
|
1664
|
+
expectedRuleIds: ["SCALE-001"],
|
|
1665
|
+
category: "scalability",
|
|
1666
|
+
difficulty: "hard",
|
|
1667
|
+
},
|
|
1668
|
+
{
|
|
1669
|
+
id: "scale-deep-hardcoded-pool-size",
|
|
1670
|
+
description: "Hardcoded connection pool size not matching workload",
|
|
1671
|
+
language: "typescript",
|
|
1672
|
+
code: `import { Pool } from "pg";
|
|
1673
|
+
|
|
1674
|
+
const pool = new Pool({
|
|
1675
|
+
host: process.env.DB_HOST,
|
|
1676
|
+
database: "production",
|
|
1677
|
+
user: process.env.DB_USER,
|
|
1678
|
+
password: process.env.DB_PASS,
|
|
1679
|
+
max: 5, // Hardcoded low limit for production
|
|
1680
|
+
idleTimeoutMillis: 0, // Connections never idle out
|
|
1681
|
+
connectionTimeoutMillis: 0, // Wait forever for connection
|
|
1682
|
+
});
|
|
1683
|
+
|
|
1684
|
+
export async function query(sql: string, params: any[]) {
|
|
1685
|
+
const client = await pool.connect(); // Blocks indefinitely when pool exhausted
|
|
1686
|
+
try {
|
|
1687
|
+
return await client.query(sql, params);
|
|
1688
|
+
} finally {
|
|
1689
|
+
client.release();
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
// Under load with 100 concurrent requests, 95 will queue behind 5 connections`,
|
|
1694
|
+
expectedRuleIds: ["CYBER-001", "PERF-001", "DB-001", "CFG-001"],
|
|
1695
|
+
category: "scalability",
|
|
1696
|
+
difficulty: "medium",
|
|
1697
|
+
},
|
|
1698
|
+
// ── CACHE: Advanced caching antipatterns ────────────────────────────────────
|
|
1699
|
+
{
|
|
1700
|
+
id: "cache-deep-stampede",
|
|
1701
|
+
description: "Cache stampede / thundering herd on cache expiry",
|
|
1702
|
+
language: "typescript",
|
|
1703
|
+
code: `const cache = new Map<string, { value: any; expiry: number }>();
|
|
1704
|
+
|
|
1705
|
+
export async function getPopularProducts(): Promise<Product[]> {
|
|
1706
|
+
const key = "popular-products";
|
|
1707
|
+
const cached = cache.get(key);
|
|
1708
|
+
|
|
1709
|
+
if (cached && cached.expiry > Date.now()) {
|
|
1710
|
+
return cached.value;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
// Cache miss — ALL concurrent requests hit the database simultaneously
|
|
1714
|
+
const products = await db.query(\`
|
|
1715
|
+
SELECT p.*, COUNT(o.id) as order_count
|
|
1716
|
+
FROM products p
|
|
1717
|
+
JOIN order_items o ON o.product_id = p.id
|
|
1718
|
+
WHERE o.created_at > NOW() - INTERVAL '7 days'
|
|
1719
|
+
GROUP BY p.id
|
|
1720
|
+
ORDER BY order_count DESC
|
|
1721
|
+
LIMIT 100
|
|
1722
|
+
\`);
|
|
1723
|
+
|
|
1724
|
+
cache.set(key, { value: products, expiry: Date.now() + 60000 });
|
|
1725
|
+
return products;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
// With 1000 concurrent visitors and cache TTL=60s, all 1000 hit DB at once on expiry`,
|
|
1729
|
+
expectedRuleIds: ["CACHE-001"],
|
|
1730
|
+
category: "caching",
|
|
1731
|
+
difficulty: "hard",
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
id: "cache-deep-unbounded-growth",
|
|
1735
|
+
description: "In-memory cache growing without bounds causing OOM",
|
|
1736
|
+
language: "typescript",
|
|
1737
|
+
code: `const userCache: Record<string, any> = {};
|
|
1738
|
+
const sessionCache: Record<string, any> = {};
|
|
1739
|
+
const queryResultCache: Record<string, any> = {};
|
|
1740
|
+
|
|
1741
|
+
export function cacheUser(userId: string, data: any) {
|
|
1742
|
+
userCache[userId] = data;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
export function cacheSession(sessionId: string, data: any) {
|
|
1746
|
+
sessionCache[sessionId] = data;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
export function cacheQueryResult(queryHash: string, result: any) {
|
|
1750
|
+
queryResultCache[queryHash] = result;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
export function getCachedUser(userId: string) {
|
|
1754
|
+
return userCache[userId]; // Never evicted, never expired
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
// After processing millions of users, cache grows to gigabytes
|
|
1758
|
+
// No eviction policy, no max size, no TTL
|
|
1759
|
+
// Process eventually crashes with ENOMEM`,
|
|
1760
|
+
expectedRuleIds: ["AICS-001"],
|
|
1761
|
+
category: "caching",
|
|
1762
|
+
difficulty: "medium",
|
|
1763
|
+
},
|
|
1764
|
+
// ── REL: Advanced reliability antipatterns ─────────────────────────────────
|
|
1765
|
+
{
|
|
1766
|
+
id: "rel-deep-no-graceful-shutdown",
|
|
1767
|
+
description: "Server without graceful shutdown handling",
|
|
1768
|
+
language: "typescript",
|
|
1769
|
+
code: `import express from "express";
|
|
1770
|
+
import { Pool } from "pg";
|
|
1771
|
+
|
|
1772
|
+
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
1773
|
+
const app = express();
|
|
1774
|
+
|
|
1775
|
+
app.post("/api/orders", async (req, res) => {
|
|
1776
|
+
const client = await pool.connect();
|
|
1777
|
+
try {
|
|
1778
|
+
await client.query("BEGIN");
|
|
1779
|
+
await client.query("INSERT INTO orders ...", [req.body]);
|
|
1780
|
+
await client.query("UPDATE inventory ...", [req.body.items]);
|
|
1781
|
+
await client.query("COMMIT");
|
|
1782
|
+
res.json({ success: true });
|
|
1783
|
+
} catch (e) {
|
|
1784
|
+
await client.query("ROLLBACK");
|
|
1785
|
+
res.status(500).json({ error: "Failed" });
|
|
1786
|
+
} finally {
|
|
1787
|
+
client.release();
|
|
1788
|
+
}
|
|
1789
|
+
});
|
|
1790
|
+
|
|
1791
|
+
const server = app.listen(3000, () => {
|
|
1792
|
+
console.log("Server started on port 3000");
|
|
1793
|
+
});
|
|
1794
|
+
|
|
1795
|
+
// No SIGTERM/SIGINT handlers
|
|
1796
|
+
// On deployment: in-flight requests are killed mid-transaction
|
|
1797
|
+
// Database connections are leaked
|
|
1798
|
+
// No draining of existing connections`,
|
|
1799
|
+
expectedRuleIds: ["REL-001"],
|
|
1800
|
+
category: "reliability",
|
|
1801
|
+
difficulty: "medium",
|
|
1802
|
+
},
|
|
1803
|
+
{
|
|
1804
|
+
id: "rel-deep-no-deadletter",
|
|
1805
|
+
description: "Message queue consumer without dead letter handling",
|
|
1806
|
+
language: "typescript",
|
|
1807
|
+
code: `import { SQSClient, ReceiveMessageCommand, DeleteMessageCommand } from "@aws-sdk/client-sqs";
|
|
1808
|
+
|
|
1809
|
+
const sqs = new SQSClient({});
|
|
1810
|
+
const QUEUE_URL = process.env.QUEUE_URL!;
|
|
1811
|
+
|
|
1812
|
+
async function processMessages() {
|
|
1813
|
+
while (true) {
|
|
1814
|
+
const { Messages } = await sqs.send(new ReceiveMessageCommand({
|
|
1815
|
+
QueueUrl: QUEUE_URL,
|
|
1816
|
+
MaxNumberOfMessages: 10,
|
|
1817
|
+
WaitTimeSeconds: 20,
|
|
1818
|
+
}));
|
|
1819
|
+
|
|
1820
|
+
if (!Messages) continue;
|
|
1821
|
+
|
|
1822
|
+
for (const msg of Messages) {
|
|
1823
|
+
try {
|
|
1824
|
+
const payload = JSON.parse(msg.Body!);
|
|
1825
|
+
await processOrder(payload);
|
|
1826
|
+
await sqs.send(new DeleteMessageCommand({
|
|
1827
|
+
QueueUrl: QUEUE_URL,
|
|
1828
|
+
ReceiptHandle: msg.ReceiptHandle!,
|
|
1829
|
+
}));
|
|
1830
|
+
} catch (error) {
|
|
1831
|
+
console.error("Failed to process message:", error);
|
|
1832
|
+
// Message returns to queue, gets retried forever
|
|
1833
|
+
// No dead letter queue configured
|
|
1834
|
+
// Poison messages block the queue permanently
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}`,
|
|
1839
|
+
expectedRuleIds: ["COST-001", "TEST-001", "CONC-001"],
|
|
1840
|
+
category: "reliability",
|
|
1841
|
+
difficulty: "hard",
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
id: "rel-deep-cascade-failure",
|
|
1845
|
+
description: "Synchronous cascading service calls with no fallback",
|
|
1846
|
+
language: "typescript",
|
|
1847
|
+
code: `export async function getProductPage(productId: string) {
|
|
1848
|
+
// All calls are sequential and mandatory — any failure = full page failure
|
|
1849
|
+
const product = await fetch(\`http://product-service/products/\${productId}\`).then(r => r.json());
|
|
1850
|
+
const reviews = await fetch(\`http://review-service/reviews/\${productId}\`).then(r => r.json());
|
|
1851
|
+
const recommendations = await fetch(\`http://rec-service/recommend/\${productId}\`).then(r => r.json());
|
|
1852
|
+
const pricing = await fetch(\`http://pricing-service/price/\${productId}\`).then(r => r.json());
|
|
1853
|
+
const inventory = await fetch(\`http://inventory-service/stock/\${productId}\`).then(r => r.json());
|
|
1854
|
+
const shipping = await fetch(\`http://shipping-service/estimate/\${productId}\`).then(r => r.json());
|
|
1855
|
+
|
|
1856
|
+
return {
|
|
1857
|
+
product,
|
|
1858
|
+
reviews,
|
|
1859
|
+
recommendations,
|
|
1860
|
+
pricing,
|
|
1861
|
+
inventory,
|
|
1862
|
+
shipping,
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
// If review-service is slow, entire page load is delayed
|
|
1866
|
+
// If any service is down, entire page returns 500`,
|
|
1867
|
+
expectedRuleIds: ["REL-001"],
|
|
1868
|
+
category: "reliability",
|
|
1869
|
+
difficulty: "medium",
|
|
1870
|
+
},
|
|
1871
|
+
// ── RATE: Advanced rate-limiting omissions ──────────────────────────────────
|
|
1872
|
+
{
|
|
1873
|
+
id: "rate-deep-graphql-no-depth",
|
|
1874
|
+
description: "GraphQL endpoint without query depth or complexity limiting",
|
|
1875
|
+
language: "typescript",
|
|
1876
|
+
code: `import { ApolloServer } from "@apollo/server";
|
|
1877
|
+
import { startStandaloneServer } from "@apollo/server/standalone";
|
|
1878
|
+
|
|
1879
|
+
const typeDefs = \`
|
|
1880
|
+
type User {
|
|
1881
|
+
id: ID!
|
|
1882
|
+
friends: [User!]!
|
|
1883
|
+
posts: [Post!]!
|
|
1884
|
+
}
|
|
1885
|
+
type Post {
|
|
1886
|
+
id: ID!
|
|
1887
|
+
author: User!
|
|
1888
|
+
comments: [Comment!]!
|
|
1889
|
+
}
|
|
1890
|
+
type Comment {
|
|
1891
|
+
id: ID!
|
|
1892
|
+
author: User!
|
|
1893
|
+
replies: [Comment!]!
|
|
1894
|
+
}
|
|
1895
|
+
type Query {
|
|
1896
|
+
user(id: ID!): User
|
|
1897
|
+
users: [User!]!
|
|
1898
|
+
}
|
|
1899
|
+
\`;
|
|
1900
|
+
|
|
1901
|
+
const server = new ApolloServer({
|
|
1902
|
+
typeDefs,
|
|
1903
|
+
resolvers,
|
|
1904
|
+
// No depth limiting plugin
|
|
1905
|
+
// No query complexity analysis
|
|
1906
|
+
// No persisted queries
|
|
1907
|
+
// Attacker can craft: { user(id: 1) { friends { friends { friends { posts { comments { replies { replies ... } } } } } } } }
|
|
1908
|
+
});
|
|
1909
|
+
|
|
1910
|
+
startStandaloneServer(server, { listen: { port: 4000 } });`,
|
|
1911
|
+
expectedRuleIds: ["RATE-001"],
|
|
1912
|
+
category: "rate-limiting",
|
|
1913
|
+
difficulty: "hard",
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
id: "rate-deep-websocket-no-limit",
|
|
1917
|
+
description: "WebSocket server without message rate limiting",
|
|
1918
|
+
language: "typescript",
|
|
1919
|
+
code: `import { WebSocketServer } from "ws";
|
|
1920
|
+
|
|
1921
|
+
const wss = new WebSocketServer({ port: 8080 });
|
|
1922
|
+
const clients = new Map<string, WebSocket>();
|
|
1923
|
+
|
|
1924
|
+
wss.on("connection", (ws) => {
|
|
1925
|
+
const clientId = crypto.randomUUID();
|
|
1926
|
+
clients.set(clientId, ws);
|
|
1927
|
+
|
|
1928
|
+
ws.on("message", (data) => {
|
|
1929
|
+
// No per-client rate limiting
|
|
1930
|
+
// No message size check
|
|
1931
|
+
// No authentication
|
|
1932
|
+
const message = JSON.parse(data.toString());
|
|
1933
|
+
|
|
1934
|
+
switch (message.type) {
|
|
1935
|
+
case "broadcast":
|
|
1936
|
+
// Anyone can broadcast to all clients
|
|
1937
|
+
for (const [, client] of clients) {
|
|
1938
|
+
client.send(JSON.stringify(message));
|
|
1939
|
+
}
|
|
1940
|
+
break;
|
|
1941
|
+
case "chat":
|
|
1942
|
+
handleChat(message);
|
|
1943
|
+
break;
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1946
|
+
|
|
1947
|
+
ws.on("close", () => clients.delete(clientId));
|
|
1948
|
+
});`,
|
|
1949
|
+
expectedRuleIds: ["RATE-001"],
|
|
1950
|
+
category: "rate-limiting",
|
|
1951
|
+
difficulty: "medium",
|
|
1952
|
+
},
|
|
1953
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1954
|
+
// CLEAN infrastructure cases — FP validation
|
|
1955
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1956
|
+
{
|
|
1957
|
+
id: "clean-iac-terraform-secure",
|
|
1958
|
+
description: "Clean: Secure Terraform S3 bucket configuration",
|
|
1959
|
+
language: "hcl",
|
|
1960
|
+
code: `resource "aws_s3_bucket" "data" {
|
|
1961
|
+
bucket = "my-app-data-\${var.environment}"
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
resource "aws_s3_bucket_versioning" "data" {
|
|
1965
|
+
bucket = aws_s3_bucket.data.id
|
|
1966
|
+
versioning_configuration {
|
|
1967
|
+
status = "Enabled"
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
resource "aws_s3_bucket_server_side_encryption_configuration" "data" {
|
|
1972
|
+
bucket = aws_s3_bucket.data.id
|
|
1973
|
+
rule {
|
|
1974
|
+
apply_server_side_encryption_by_default {
|
|
1975
|
+
sse_algorithm = "aws:kms"
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
resource "aws_s3_bucket_public_access_block" "data" {
|
|
1981
|
+
bucket = aws_s3_bucket.data.id
|
|
1982
|
+
block_public_acls = true
|
|
1983
|
+
block_public_policy = true
|
|
1984
|
+
ignore_public_acls = true
|
|
1985
|
+
restrict_public_buckets = true
|
|
1986
|
+
}`,
|
|
1987
|
+
expectedRuleIds: [],
|
|
1988
|
+
category: "clean",
|
|
1989
|
+
difficulty: "easy",
|
|
1990
|
+
},
|
|
1991
|
+
{
|
|
1992
|
+
id: "clean-iac-dockerfile-hardened",
|
|
1993
|
+
description: "Clean: Hardened Dockerfile with non-root user and multi-stage build",
|
|
1994
|
+
language: "dockerfile",
|
|
1995
|
+
code: `FROM node:20-alpine AS builder
|
|
1996
|
+
WORKDIR /app
|
|
1997
|
+
COPY package*.json ./
|
|
1998
|
+
RUN npm ci --only=production
|
|
1999
|
+
COPY src/ ./src/
|
|
2000
|
+
COPY tsconfig.json ./
|
|
2001
|
+
RUN npm run build
|
|
2002
|
+
|
|
2003
|
+
FROM node:20-alpine
|
|
2004
|
+
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
|
2005
|
+
WORKDIR /app
|
|
2006
|
+
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
|
|
2007
|
+
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
|
|
2008
|
+
USER appuser
|
|
2009
|
+
EXPOSE 3000
|
|
2010
|
+
HEALTHCHECK --interval=30s --timeout=5s CMD wget --spider -q http://localhost:3000/health || exit 1
|
|
2011
|
+
CMD ["node", "dist/index.js"]`,
|
|
2012
|
+
expectedRuleIds: [],
|
|
2013
|
+
category: "clean",
|
|
2014
|
+
difficulty: "medium",
|
|
2015
|
+
},
|
|
2016
|
+
{
|
|
2017
|
+
id: "clean-iac-k8s-secure-pod",
|
|
2018
|
+
description: "Clean: Kubernetes pod with security context and resource limits",
|
|
2019
|
+
language: "yaml",
|
|
2020
|
+
code: `apiVersion: v1
|
|
2021
|
+
kind: Pod
|
|
2022
|
+
metadata:
|
|
2023
|
+
name: secure-app
|
|
2024
|
+
spec:
|
|
2025
|
+
serviceAccountName: app-service-account
|
|
2026
|
+
securityContext:
|
|
2027
|
+
runAsNonRoot: true
|
|
2028
|
+
runAsUser: 1000
|
|
2029
|
+
fsGroup: 1000
|
|
2030
|
+
containers:
|
|
2031
|
+
- name: app
|
|
2032
|
+
image: myapp:1.2.3@sha256:abc123
|
|
2033
|
+
securityContext:
|
|
2034
|
+
allowPrivilegeEscalation: false
|
|
2035
|
+
readOnlyRootFilesystem: true
|
|
2036
|
+
capabilities:
|
|
2037
|
+
drop:
|
|
2038
|
+
- ALL
|
|
2039
|
+
resources:
|
|
2040
|
+
requests:
|
|
2041
|
+
memory: "128Mi"
|
|
2042
|
+
cpu: "250m"
|
|
2043
|
+
limits:
|
|
2044
|
+
memory: "256Mi"
|
|
2045
|
+
cpu: "500m"
|
|
2046
|
+
livenessProbe:
|
|
2047
|
+
httpGet:
|
|
2048
|
+
path: /health
|
|
2049
|
+
port: 8080
|
|
2050
|
+
readinessProbe:
|
|
2051
|
+
httpGet:
|
|
2052
|
+
path: /ready
|
|
2053
|
+
port: 8080
|
|
2054
|
+
env:
|
|
2055
|
+
- name: DB_PASSWORD
|
|
2056
|
+
valueFrom:
|
|
2057
|
+
secretKeyRef:
|
|
2058
|
+
name: app-secrets
|
|
2059
|
+
key: db-password`,
|
|
2060
|
+
expectedRuleIds: [],
|
|
2061
|
+
category: "clean",
|
|
2062
|
+
difficulty: "medium",
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
id: "clean-cfg-validated-config",
|
|
2066
|
+
description: "Clean: Environment config with validation and typed defaults",
|
|
2067
|
+
language: "typescript",
|
|
2068
|
+
code: `import { z } from "zod";
|
|
2069
|
+
|
|
2070
|
+
const configSchema = z.object({
|
|
2071
|
+
PORT: z.coerce.number().int().min(1).max(65535).default(3000),
|
|
2072
|
+
DB_HOST: z.string().min(1),
|
|
2073
|
+
DB_PORT: z.coerce.number().int().default(5432),
|
|
2074
|
+
DB_NAME: z.string().min(1),
|
|
2075
|
+
DB_PASSWORD: z.string().min(8),
|
|
2076
|
+
REDIS_URL: z.string().url().optional(),
|
|
2077
|
+
LOG_LEVEL: z.enum(["debug", "info", "warn", "error"]).default("info"),
|
|
2078
|
+
JWT_SECRET: z.string().min(32),
|
|
2079
|
+
CORS_ORIGINS: z.string().transform(s => s.split(",")),
|
|
2080
|
+
});
|
|
2081
|
+
|
|
2082
|
+
function loadConfig() {
|
|
2083
|
+
const result = configSchema.safeParse(process.env);
|
|
2084
|
+
if (!result.success) {
|
|
2085
|
+
console.error("Invalid configuration:", result.error.format());
|
|
2086
|
+
process.exit(1);
|
|
2087
|
+
}
|
|
2088
|
+
return Object.freeze(result.data);
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
export const config = loadConfig();`,
|
|
2092
|
+
expectedRuleIds: [],
|
|
2093
|
+
category: "clean",
|
|
2094
|
+
difficulty: "easy",
|
|
2095
|
+
},
|
|
2096
|
+
{
|
|
2097
|
+
id: "clean-rate-express-limits",
|
|
2098
|
+
description: "Clean: Express app with proper rate limiting and body limits",
|
|
2099
|
+
language: "typescript",
|
|
2100
|
+
code: `import express from "express";
|
|
2101
|
+
import rateLimit from "express-rate-limit";
|
|
2102
|
+
import helmet from "helmet";
|
|
2103
|
+
|
|
2104
|
+
const app = express();
|
|
2105
|
+
app.use(helmet());
|
|
2106
|
+
app.use(express.json({ limit: "1mb" }));
|
|
2107
|
+
|
|
2108
|
+
const generalLimiter = rateLimit({
|
|
2109
|
+
windowMs: 15 * 60 * 1000,
|
|
2110
|
+
max: 100,
|
|
2111
|
+
standardHeaders: true,
|
|
2112
|
+
legacyHeaders: false,
|
|
2113
|
+
});
|
|
2114
|
+
|
|
2115
|
+
const authLimiter = rateLimit({
|
|
2116
|
+
windowMs: 15 * 60 * 1000,
|
|
2117
|
+
max: 5,
|
|
2118
|
+
message: { error: "Too many login attempts" },
|
|
2119
|
+
});
|
|
2120
|
+
|
|
2121
|
+
app.use("/api/", generalLimiter);
|
|
2122
|
+
app.use("/auth/", authLimiter);
|
|
2123
|
+
|
|
2124
|
+
app.post("/auth/login", async (req, res) => {
|
|
2125
|
+
const { email, password } = req.body;
|
|
2126
|
+
const user = await authenticateUser(email, password);
|
|
2127
|
+
if (!user) return res.status(401).json({ error: "Invalid credentials" });
|
|
2128
|
+
const token = generateToken(user);
|
|
2129
|
+
res.json({ token });
|
|
2130
|
+
});
|
|
2131
|
+
|
|
2132
|
+
app.listen(3000);`,
|
|
2133
|
+
expectedRuleIds: [],
|
|
2134
|
+
category: "clean",
|
|
2135
|
+
difficulty: "medium",
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
id: "clean-rel-retry-circuit",
|
|
2139
|
+
description: "Clean: External API call with retry and circuit breaker",
|
|
2140
|
+
language: "typescript",
|
|
2141
|
+
code: `import CircuitBreaker from "opossum";
|
|
2142
|
+
|
|
2143
|
+
const circuitOptions = {
|
|
2144
|
+
timeout: 5000,
|
|
2145
|
+
errorThresholdPercentage: 50,
|
|
2146
|
+
resetTimeout: 30000,
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
async function fetchWithRetry(url: string, retries = 3, backoff = 1000): Promise<Response> {
|
|
2150
|
+
for (let i = 0; i < retries; i++) {
|
|
2151
|
+
try {
|
|
2152
|
+
const response = await fetch(url, { signal: AbortSignal.timeout(5000) });
|
|
2153
|
+
if (response.ok) return response;
|
|
2154
|
+
if (response.status >= 500 && i < retries - 1) {
|
|
2155
|
+
await new Promise(r => setTimeout(r, backoff * Math.pow(2, i)));
|
|
2156
|
+
continue;
|
|
2157
|
+
}
|
|
2158
|
+
return response;
|
|
2159
|
+
} catch (error) {
|
|
2160
|
+
if (i === retries - 1) throw error;
|
|
2161
|
+
await new Promise(r => setTimeout(r, backoff * Math.pow(2, i)));
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
throw new Error("Max retries exceeded");
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
const paymentBreaker = new CircuitBreaker(
|
|
2168
|
+
(order: Order) => fetchWithRetry("https://payment-api.example.com/charge"),
|
|
2169
|
+
circuitOptions
|
|
2170
|
+
);
|
|
2171
|
+
|
|
2172
|
+
paymentBreaker.fallback(() => ({ status: "queued", message: "Payment will be processed shortly" }));`,
|
|
2173
|
+
expectedRuleIds: [],
|
|
2174
|
+
category: "clean",
|
|
2175
|
+
difficulty: "hard",
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
id: "clean-cache-with-ttl",
|
|
2179
|
+
description: "Clean: Cache with TTL, LRU eviction, and invalidation",
|
|
2180
|
+
language: "typescript",
|
|
2181
|
+
code: `import { LRUCache } from "lru-cache";
|
|
2182
|
+
|
|
2183
|
+
const cache = new LRUCache<string, any>({
|
|
2184
|
+
max: 1000,
|
|
2185
|
+
ttl: 5 * 60 * 1000,
|
|
2186
|
+
updateAgeOnGet: true,
|
|
2187
|
+
});
|
|
2188
|
+
|
|
2189
|
+
export async function getCachedUser(userId: string): Promise<User> {
|
|
2190
|
+
const key = \`user:\${userId}\`;
|
|
2191
|
+
const cached = cache.get(key);
|
|
2192
|
+
if (cached) return cached;
|
|
2193
|
+
const user = await db.findUser(userId);
|
|
2194
|
+
cache.set(key, user);
|
|
2195
|
+
return user;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
export function invalidateUser(userId: string): void {
|
|
2199
|
+
cache.delete(\`user:\${userId}\`);
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
export function clearCategoryCache(category: string): void {
|
|
2203
|
+
for (const [key] of cache.entries()) {
|
|
2204
|
+
if (key.startsWith(\`category:\${category}\`)) {
|
|
2205
|
+
cache.delete(key);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
}`,
|
|
2209
|
+
expectedRuleIds: [],
|
|
2210
|
+
category: "clean",
|
|
2211
|
+
difficulty: "easy",
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
id: "clean-scale-redis-session",
|
|
2215
|
+
description: "Clean: Redis-backed session store for horizontal scaling",
|
|
2216
|
+
language: "typescript",
|
|
2217
|
+
code: `import express from "express";
|
|
2218
|
+
import session from "express-session";
|
|
2219
|
+
import RedisStore from "connect-redis";
|
|
2220
|
+
import { createClient } from "redis";
|
|
2221
|
+
|
|
2222
|
+
const redisClient = createClient({ url: process.env.REDIS_URL });
|
|
2223
|
+
redisClient.connect();
|
|
2224
|
+
|
|
2225
|
+
const app = express();
|
|
2226
|
+
app.use(session({
|
|
2227
|
+
store: new RedisStore({ client: redisClient, prefix: "sess:" }),
|
|
2228
|
+
secret: process.env.SESSION_SECRET!,
|
|
2229
|
+
resave: false,
|
|
2230
|
+
saveUninitialized: false,
|
|
2231
|
+
cookie: {
|
|
2232
|
+
secure: process.env.NODE_ENV === "production",
|
|
2233
|
+
httpOnly: true,
|
|
2234
|
+
maxAge: 3600000,
|
|
2235
|
+
sameSite: "strict",
|
|
2236
|
+
},
|
|
2237
|
+
}));
|
|
2238
|
+
|
|
2239
|
+
app.post("/login", async (req, res) => {
|
|
2240
|
+
const user = await authenticate(req.body);
|
|
2241
|
+
if (!user) return res.status(401).json({ error: "Invalid credentials" });
|
|
2242
|
+
req.session.userId = user.id;
|
|
2243
|
+
res.json({ success: true });
|
|
2244
|
+
});`,
|
|
2245
|
+
expectedRuleIds: [],
|
|
2246
|
+
category: "clean",
|
|
2247
|
+
difficulty: "medium",
|
|
2248
|
+
},
|
|
2249
|
+
{
|
|
2250
|
+
id: "clean-cloud-aws-iam-least-priv",
|
|
2251
|
+
description: "Clean: AWS IAM policy following least privilege principle",
|
|
2252
|
+
language: "json",
|
|
2253
|
+
code: `{
|
|
2254
|
+
"Version": "2012-10-17",
|
|
2255
|
+
"Statement": [
|
|
2256
|
+
{
|
|
2257
|
+
"Sid": "AllowS3ReadAppBucket",
|
|
2258
|
+
"Effect": "Allow",
|
|
2259
|
+
"Action": [
|
|
2260
|
+
"s3:GetObject",
|
|
2261
|
+
"s3:ListBucket"
|
|
2262
|
+
],
|
|
2263
|
+
"Resource": [
|
|
2264
|
+
"arn:aws:s3:::my-app-bucket",
|
|
2265
|
+
"arn:aws:s3:::my-app-bucket/*"
|
|
2266
|
+
]
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
"Sid": "AllowDynamoDBAccess",
|
|
2270
|
+
"Effect": "Allow",
|
|
2271
|
+
"Action": [
|
|
2272
|
+
"dynamodb:GetItem",
|
|
2273
|
+
"dynamodb:PutItem",
|
|
2274
|
+
"dynamodb:Query"
|
|
2275
|
+
],
|
|
2276
|
+
"Resource": "arn:aws:dynamodb:us-east-1:123456789:table/my-app-table"
|
|
2277
|
+
}
|
|
2278
|
+
]
|
|
2279
|
+
}`,
|
|
2280
|
+
expectedRuleIds: [],
|
|
2281
|
+
category: "clean",
|
|
2282
|
+
difficulty: "easy",
|
|
2283
|
+
},
|
|
2284
|
+
// ── Additional clean infrastructure cases ──────────────────────────────────
|
|
2285
|
+
{
|
|
2286
|
+
id: "clean-k8s-secure-deployment",
|
|
2287
|
+
description: "Clean: Kubernetes Deployment with all security best practices",
|
|
2288
|
+
language: "yaml",
|
|
2289
|
+
code: `apiVersion: apps/v1
|
|
2290
|
+
kind: Deployment
|
|
2291
|
+
metadata:
|
|
2292
|
+
name: api-server
|
|
2293
|
+
namespace: production
|
|
2294
|
+
labels:
|
|
2295
|
+
app: api-server
|
|
2296
|
+
version: v2.4.1
|
|
2297
|
+
spec:
|
|
2298
|
+
replicas: 3
|
|
2299
|
+
selector:
|
|
2300
|
+
matchLabels:
|
|
2301
|
+
app: api-server
|
|
2302
|
+
template:
|
|
2303
|
+
metadata:
|
|
2304
|
+
labels:
|
|
2305
|
+
app: api-server
|
|
2306
|
+
spec:
|
|
2307
|
+
serviceAccountName: api-server-sa
|
|
2308
|
+
automountServiceAccountToken: false
|
|
2309
|
+
securityContext:
|
|
2310
|
+
runAsNonRoot: true
|
|
2311
|
+
runAsUser: 1000
|
|
2312
|
+
fsGroup: 2000
|
|
2313
|
+
containers:
|
|
2314
|
+
- name: api
|
|
2315
|
+
image: company/api-server:v2.4.1@sha256:abc123def456
|
|
2316
|
+
imagePullPolicy: Always
|
|
2317
|
+
ports:
|
|
2318
|
+
- containerPort: 8080
|
|
2319
|
+
resources:
|
|
2320
|
+
requests:
|
|
2321
|
+
cpu: 250m
|
|
2322
|
+
memory: 256Mi
|
|
2323
|
+
limits:
|
|
2324
|
+
cpu: 500m
|
|
2325
|
+
memory: 512Mi
|
|
2326
|
+
readinessProbe:
|
|
2327
|
+
httpGet:
|
|
2328
|
+
path: /healthz
|
|
2329
|
+
port: 8080
|
|
2330
|
+
initialDelaySeconds: 5
|
|
2331
|
+
periodSeconds: 10
|
|
2332
|
+
livenessProbe:
|
|
2333
|
+
httpGet:
|
|
2334
|
+
path: /healthz
|
|
2335
|
+
port: 8080
|
|
2336
|
+
initialDelaySeconds: 15
|
|
2337
|
+
periodSeconds: 20
|
|
2338
|
+
securityContext:
|
|
2339
|
+
allowPrivilegeEscalation: false
|
|
2340
|
+
readOnlyRootFilesystem: true
|
|
2341
|
+
capabilities:
|
|
2342
|
+
drop: ["ALL"]`,
|
|
2343
|
+
expectedRuleIds: [],
|
|
2344
|
+
category: "clean",
|
|
2345
|
+
difficulty: "hard",
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
id: "clean-dockerfile-multi-stage",
|
|
2349
|
+
description: "Clean: Multi-stage Dockerfile with security hardening",
|
|
2350
|
+
language: "dockerfile",
|
|
2351
|
+
code: `# Build stage
|
|
2352
|
+
FROM node:20-alpine AS builder
|
|
2353
|
+
WORKDIR /app
|
|
2354
|
+
COPY package.json package-lock.json ./
|
|
2355
|
+
RUN npm ci --ignore-scripts
|
|
2356
|
+
COPY tsconfig.json ./
|
|
2357
|
+
COPY src/ ./src/
|
|
2358
|
+
RUN npm run build && npm prune --production
|
|
2359
|
+
|
|
2360
|
+
# Production stage
|
|
2361
|
+
FROM node:20-alpine AS production
|
|
2362
|
+
RUN apk add --no-cache tini && \\
|
|
2363
|
+
addgroup -g 1001 appgroup && \\
|
|
2364
|
+
adduser -D -u 1001 -G appgroup appuser
|
|
2365
|
+
WORKDIR /app
|
|
2366
|
+
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
|
|
2367
|
+
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
|
|
2368
|
+
COPY --from=builder --chown=appuser:appgroup /app/package.json ./
|
|
2369
|
+
USER appuser
|
|
2370
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\
|
|
2371
|
+
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
|
|
2372
|
+
EXPOSE 3000
|
|
2373
|
+
ENTRYPOINT ["/sbin/tini", "--"]
|
|
2374
|
+
CMD ["node", "dist/server.js"]`,
|
|
2375
|
+
expectedRuleIds: [],
|
|
2376
|
+
category: "clean",
|
|
2377
|
+
difficulty: "medium",
|
|
2378
|
+
},
|
|
2379
|
+
{
|
|
2380
|
+
id: "clean-cicd-secure-pipeline",
|
|
2381
|
+
description: "Clean: Secure CI/CD pipeline with artifact verification",
|
|
2382
|
+
language: "yaml",
|
|
2383
|
+
code: `name: Secure CI/CD
|
|
2384
|
+
on:
|
|
2385
|
+
push:
|
|
2386
|
+
branches: [main]
|
|
2387
|
+
|
|
2388
|
+
permissions:
|
|
2389
|
+
contents: read
|
|
2390
|
+
packages: write
|
|
2391
|
+
id-token: write
|
|
2392
|
+
|
|
2393
|
+
jobs:
|
|
2394
|
+
build-and-deploy:
|
|
2395
|
+
runs-on: ubuntu-latest
|
|
2396
|
+
environment: production
|
|
2397
|
+
steps:
|
|
2398
|
+
- uses: actions/checkout@v4
|
|
2399
|
+
with:
|
|
2400
|
+
fetch-depth: 0
|
|
2401
|
+
- uses: actions/setup-node@v4
|
|
2402
|
+
with:
|
|
2403
|
+
node-version: '20'
|
|
2404
|
+
cache: 'npm'
|
|
2405
|
+
- run: npm ci --ignore-scripts
|
|
2406
|
+
- run: npm audit --audit-level=high
|
|
2407
|
+
- run: npm test
|
|
2408
|
+
- name: Build
|
|
2409
|
+
run: npm run build
|
|
2410
|
+
- name: Container scan
|
|
2411
|
+
uses: aquasecurity/trivy-action@0.20.0
|
|
2412
|
+
with:
|
|
2413
|
+
scan-type: fs
|
|
2414
|
+
exit-code: 1
|
|
2415
|
+
severity: CRITICAL,HIGH
|
|
2416
|
+
- name: Sign artifact
|
|
2417
|
+
uses: sigstore/cosign-installer@v3
|
|
2418
|
+
with:
|
|
2419
|
+
cosign-release: 'v2.2.0'`,
|
|
2420
|
+
expectedRuleIds: [],
|
|
2421
|
+
category: "clean",
|
|
2422
|
+
difficulty: "hard",
|
|
2423
|
+
},
|
|
2424
|
+
{
|
|
2425
|
+
id: "clean-terraform-azure-secure",
|
|
2426
|
+
description: "Clean: Secure Azure Terraform with private endpoints",
|
|
2427
|
+
language: "hcl",
|
|
2428
|
+
code: `resource "azurerm_storage_account" "secure" {
|
|
2429
|
+
name = "companysecurestorage"
|
|
2430
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
2431
|
+
location = azurerm_resource_group.main.location
|
|
2432
|
+
account_tier = "Standard"
|
|
2433
|
+
account_replication_type = "GRS"
|
|
2434
|
+
min_tls_version = "TLS1_2"
|
|
2435
|
+
|
|
2436
|
+
network_rules {
|
|
2437
|
+
default_action = "Deny"
|
|
2438
|
+
ip_rules = []
|
|
2439
|
+
bypass = ["AzureServices"]
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
blob_properties {
|
|
2443
|
+
delete_retention_policy {
|
|
2444
|
+
days = 30
|
|
2445
|
+
}
|
|
2446
|
+
versioning_enabled = true
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
tags = {
|
|
2450
|
+
Environment = "production"
|
|
2451
|
+
Team = "platform"
|
|
2452
|
+
CostCenter = "CC-1234"
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
resource "azurerm_storage_container" "private" {
|
|
2457
|
+
name = "app-data"
|
|
2458
|
+
storage_account_name = azurerm_storage_account.secure.name
|
|
2459
|
+
container_access_type = "private"
|
|
2460
|
+
}`,
|
|
2461
|
+
expectedRuleIds: [],
|
|
2462
|
+
category: "clean",
|
|
2463
|
+
difficulty: "medium",
|
|
2464
|
+
},
|
|
2465
|
+
{
|
|
2466
|
+
id: "clean-cfg-vault-secrets",
|
|
2467
|
+
description: "Clean: Configuration using HashiCorp Vault for secrets",
|
|
2468
|
+
language: "typescript",
|
|
2469
|
+
code: `import Vault from "node-vault";
|
|
2470
|
+
import { z } from "zod";
|
|
2471
|
+
|
|
2472
|
+
const ConfigSchema = z.object({
|
|
2473
|
+
port: z.number().int().min(1).max(65535),
|
|
2474
|
+
host: z.string().min(1),
|
|
2475
|
+
database: z.object({
|
|
2476
|
+
host: z.string().min(1),
|
|
2477
|
+
port: z.number().int(),
|
|
2478
|
+
name: z.string().min(1),
|
|
2479
|
+
maxPoolSize: z.number().int().min(1).max(100).default(20),
|
|
2480
|
+
}),
|
|
2481
|
+
logLevel: z.enum(["debug", "info", "warn", "error"]).default("info"),
|
|
2482
|
+
});
|
|
2483
|
+
|
|
2484
|
+
export type AppConfig = z.infer<typeof ConfigSchema>;
|
|
2485
|
+
|
|
2486
|
+
export async function loadConfig(): Promise<AppConfig> {
|
|
2487
|
+
const vault = Vault({
|
|
2488
|
+
apiVersion: "v1",
|
|
2489
|
+
endpoint: process.env.VAULT_ADDR!,
|
|
2490
|
+
token: process.env.VAULT_TOKEN!,
|
|
2491
|
+
});
|
|
2492
|
+
|
|
2493
|
+
const secrets = await vault.read("secret/data/app/production");
|
|
2494
|
+
const envConfig = {
|
|
2495
|
+
port: parseInt(process.env.PORT || "3000", 10),
|
|
2496
|
+
host: process.env.HOST || "0.0.0.0",
|
|
2497
|
+
database: {
|
|
2498
|
+
host: secrets.data.data.db_host,
|
|
2499
|
+
port: parseInt(secrets.data.data.db_port, 10),
|
|
2500
|
+
name: secrets.data.data.db_name,
|
|
2501
|
+
maxPoolSize: parseInt(process.env.DB_POOL_SIZE || "20", 10),
|
|
2502
|
+
},
|
|
2503
|
+
logLevel: process.env.LOG_LEVEL || "info",
|
|
2504
|
+
};
|
|
2505
|
+
|
|
2506
|
+
return ConfigSchema.parse(envConfig);
|
|
2507
|
+
}`,
|
|
2508
|
+
expectedRuleIds: [],
|
|
2509
|
+
category: "clean",
|
|
2510
|
+
difficulty: "hard",
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
id: "clean-rel-graceful-shutdown",
|
|
2514
|
+
description: "Clean: Server with proper graceful shutdown handling",
|
|
2515
|
+
language: "typescript",
|
|
2516
|
+
code: `import express from "express";
|
|
2517
|
+
import { Pool } from "pg";
|
|
2518
|
+
import { createTerminus } from "@godaddy/terminus";
|
|
2519
|
+
import http from "http";
|
|
2520
|
+
|
|
2521
|
+
const pool = new Pool({ connectionString: process.env.DATABASE_URL, max: 20 });
|
|
2522
|
+
const app = express();
|
|
2523
|
+
|
|
2524
|
+
app.post("/api/orders", async (req, res) => {
|
|
2525
|
+
const client = await pool.connect();
|
|
2526
|
+
try {
|
|
2527
|
+
await client.query("BEGIN");
|
|
2528
|
+
await client.query("INSERT INTO orders (data) VALUES ($1)", [req.body]);
|
|
2529
|
+
await client.query("COMMIT");
|
|
2530
|
+
res.json({ success: true });
|
|
2531
|
+
} catch (e) {
|
|
2532
|
+
await client.query("ROLLBACK");
|
|
2533
|
+
res.status(500).json({ error: "Failed" });
|
|
2534
|
+
} finally {
|
|
2535
|
+
client.release();
|
|
2536
|
+
}
|
|
2537
|
+
});
|
|
2538
|
+
|
|
2539
|
+
const server = http.createServer(app);
|
|
2540
|
+
|
|
2541
|
+
createTerminus(server, {
|
|
2542
|
+
signals: ["SIGTERM", "SIGINT"],
|
|
2543
|
+
timeout: 30000,
|
|
2544
|
+
healthChecks: {
|
|
2545
|
+
"/healthz": async () => {
|
|
2546
|
+
await pool.query("SELECT 1");
|
|
2547
|
+
},
|
|
2548
|
+
},
|
|
2549
|
+
onSignal: async () => {
|
|
2550
|
+
console.log("Shutting down gracefully...");
|
|
2551
|
+
await pool.end();
|
|
2552
|
+
},
|
|
2553
|
+
onShutdown: async () => {
|
|
2554
|
+
console.log("Cleanup finished, server is shutting down");
|
|
2555
|
+
},
|
|
2556
|
+
});
|
|
2557
|
+
|
|
2558
|
+
server.listen(3000, () => console.log("Server running on 3000"));`,
|
|
2559
|
+
expectedRuleIds: [],
|
|
2560
|
+
category: "clean",
|
|
2561
|
+
difficulty: "medium",
|
|
2562
|
+
},
|
|
2563
|
+
{
|
|
2564
|
+
id: "clean-rate-graphql-depth",
|
|
2565
|
+
description: "Clean: GraphQL server with depth and complexity limiting",
|
|
2566
|
+
language: "typescript",
|
|
2567
|
+
code: `import { ApolloServer } from "@apollo/server";
|
|
2568
|
+
import depthLimit from "graphql-depth-limit";
|
|
2569
|
+
import { createComplexityLimitRule } from "graphql-validation-complexity";
|
|
2570
|
+
import { startStandaloneServer } from "@apollo/server/standalone";
|
|
2571
|
+
|
|
2572
|
+
const server = new ApolloServer({
|
|
2573
|
+
typeDefs,
|
|
2574
|
+
resolvers,
|
|
2575
|
+
validationRules: [
|
|
2576
|
+
depthLimit(5),
|
|
2577
|
+
createComplexityLimitRule(1000, {
|
|
2578
|
+
scalarCost: 1,
|
|
2579
|
+
objectCost: 2,
|
|
2580
|
+
listFactor: 10,
|
|
2581
|
+
onCost: (cost: number) => {
|
|
2582
|
+
if (cost > 500) {
|
|
2583
|
+
console.warn(\`High complexity query: \${cost}\`);
|
|
2584
|
+
}
|
|
2585
|
+
},
|
|
2586
|
+
}),
|
|
2587
|
+
],
|
|
2588
|
+
plugins: [
|
|
2589
|
+
{
|
|
2590
|
+
async requestDidStart() {
|
|
2591
|
+
return {
|
|
2592
|
+
async didResolveOperation(ctx) {
|
|
2593
|
+
// Reject introspection in production
|
|
2594
|
+
if (process.env.NODE_ENV === "production" && ctx.operation?.operation === "query") {
|
|
2595
|
+
const isIntrospection = ctx.document.definitions.some(
|
|
2596
|
+
(d: any) => d.selectionSet?.selections?.some(
|
|
2597
|
+
(s: any) => s.name?.value?.startsWith("__")
|
|
2598
|
+
)
|
|
2599
|
+
);
|
|
2600
|
+
if (isIntrospection) {
|
|
2601
|
+
throw new Error("Introspection disabled in production");
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
},
|
|
2605
|
+
};
|
|
2606
|
+
},
|
|
2607
|
+
},
|
|
2608
|
+
],
|
|
2609
|
+
});
|
|
2610
|
+
|
|
2611
|
+
startStandaloneServer(server, { listen: { port: 4000 } });`,
|
|
2612
|
+
expectedRuleIds: [],
|
|
2613
|
+
category: "clean",
|
|
2614
|
+
difficulty: "hard",
|
|
2615
|
+
},
|
|
2616
|
+
{
|
|
2617
|
+
id: "clean-cost-tagged-resources",
|
|
2618
|
+
description: "Clean: AWS resources with comprehensive tagging strategy",
|
|
2619
|
+
language: "hcl",
|
|
2620
|
+
code: `locals {
|
|
2621
|
+
common_tags = {
|
|
2622
|
+
Environment = var.environment
|
|
2623
|
+
Team = var.team_name
|
|
2624
|
+
Project = var.project_name
|
|
2625
|
+
CostCenter = var.cost_center
|
|
2626
|
+
ManagedBy = "terraform"
|
|
2627
|
+
CreatedAt = timestamp()
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
resource "aws_instance" "worker" {
|
|
2632
|
+
count = var.worker_count
|
|
2633
|
+
ami = data.aws_ami.amazon_linux.id
|
|
2634
|
+
instance_type = var.worker_instance_type
|
|
2635
|
+
|
|
2636
|
+
tags = merge(local.common_tags, {
|
|
2637
|
+
Name = "worker-\${count.index + 1}"
|
|
2638
|
+
Role = "worker"
|
|
2639
|
+
})
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
resource "aws_rds_cluster" "analytics" {
|
|
2643
|
+
engine = "aurora-mysql"
|
|
2644
|
+
engine_version = "8.0.mysql_aurora.3.04.0"
|
|
2645
|
+
master_username = var.db_admin_user
|
|
2646
|
+
master_password = random_password.db.result
|
|
2647
|
+
backup_retention_period = 7
|
|
2648
|
+
deletion_protection = true
|
|
2649
|
+
storage_encrypted = true
|
|
2650
|
+
|
|
2651
|
+
tags = merge(local.common_tags, {
|
|
2652
|
+
Name = "analytics-db"
|
|
2653
|
+
Role = "database"
|
|
2654
|
+
})
|
|
2655
|
+
}`,
|
|
2656
|
+
expectedRuleIds: [],
|
|
2657
|
+
category: "clean",
|
|
2658
|
+
difficulty: "easy",
|
|
2659
|
+
},
|
|
2660
|
+
{
|
|
2661
|
+
id: "clean-scale-distributed-workers",
|
|
2662
|
+
description: "Clean: Queue-based async workers for horizontal scaling",
|
|
2663
|
+
language: "typescript",
|
|
2664
|
+
code: `import { SQSClient, SendMessageCommand } from "@aws-sdk/client-sqs";
|
|
2665
|
+
import express from "express";
|
|
2666
|
+
|
|
2667
|
+
const sqs = new SQSClient({});
|
|
2668
|
+
const app = express();
|
|
2669
|
+
|
|
2670
|
+
// API handler: enqueue work and return immediately
|
|
2671
|
+
app.post("/api/orders", async (req, res) => {
|
|
2672
|
+
const orderId = crypto.randomUUID();
|
|
2673
|
+
|
|
2674
|
+
await sqs.send(new SendMessageCommand({
|
|
2675
|
+
QueueUrl: process.env.ORDER_QUEUE_URL!,
|
|
2676
|
+
MessageBody: JSON.stringify({ orderId, ...req.body }),
|
|
2677
|
+
MessageGroupId: req.body.userId,
|
|
2678
|
+
MessageDeduplicationId: orderId,
|
|
2679
|
+
}));
|
|
2680
|
+
|
|
2681
|
+
res.status(202).json({
|
|
2682
|
+
orderId,
|
|
2683
|
+
status: "accepted",
|
|
2684
|
+
statusUrl: \`/api/orders/\${orderId}/status\`,
|
|
2685
|
+
});
|
|
2686
|
+
});
|
|
2687
|
+
|
|
2688
|
+
// Status endpoint for polling
|
|
2689
|
+
app.get("/api/orders/:id/status", async (req, res) => {
|
|
2690
|
+
const status = await redis.get(\`order:\${req.params.id}:status\`);
|
|
2691
|
+
res.json({ orderId: req.params.id, status: status || "processing" });
|
|
2692
|
+
});
|
|
2693
|
+
|
|
2694
|
+
app.listen(3000);`,
|
|
2695
|
+
expectedRuleIds: [],
|
|
2696
|
+
category: "clean",
|
|
2697
|
+
difficulty: "medium",
|
|
2698
|
+
},
|
|
2699
|
+
{
|
|
2700
|
+
id: "clean-cache-stampede-prevention",
|
|
2701
|
+
description: "Clean: Cache with stampede prevention using locking",
|
|
2702
|
+
language: "typescript",
|
|
2703
|
+
code: `import Redis from "ioredis";
|
|
2704
|
+
|
|
2705
|
+
const redis = new Redis(process.env.REDIS_URL!);
|
|
2706
|
+
|
|
2707
|
+
async function getWithStampedeProtection<T>(
|
|
2708
|
+
key: string,
|
|
2709
|
+
ttlSeconds: number,
|
|
2710
|
+
fetchFn: () => Promise<T>
|
|
2711
|
+
): Promise<T> {
|
|
2712
|
+
const cached = await redis.get(key);
|
|
2713
|
+
if (cached) return JSON.parse(cached);
|
|
2714
|
+
|
|
2715
|
+
const lockKey = \`lock:\${key}\`;
|
|
2716
|
+
const lockAcquired = await redis.set(lockKey, "1", "EX", 10, "NX");
|
|
2717
|
+
|
|
2718
|
+
if (lockAcquired) {
|
|
2719
|
+
try {
|
|
2720
|
+
const value = await fetchFn();
|
|
2721
|
+
await redis.setex(key, ttlSeconds, JSON.stringify(value));
|
|
2722
|
+
return value;
|
|
2723
|
+
} finally {
|
|
2724
|
+
await redis.del(lockKey);
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
// Another request is refreshing — wait and retry
|
|
2729
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
2730
|
+
const retried = await redis.get(key);
|
|
2731
|
+
if (retried) return JSON.parse(retried);
|
|
2732
|
+
|
|
2733
|
+
// Fallback: fetch directly if lock holder failed
|
|
2734
|
+
return fetchFn();
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
export async function getPopularProducts(): Promise<Product[]> {
|
|
2738
|
+
return getWithStampedeProtection(
|
|
2739
|
+
"popular-products",
|
|
2740
|
+
60,
|
|
2741
|
+
() => db.query("SELECT * FROM popular_products_view LIMIT 100")
|
|
2742
|
+
);
|
|
2743
|
+
}`,
|
|
2744
|
+
expectedRuleIds: [],
|
|
2745
|
+
category: "clean",
|
|
2746
|
+
difficulty: "hard",
|
|
2747
|
+
},
|
|
2748
|
+
{
|
|
2749
|
+
id: "clean-cloud-gcp-secure",
|
|
2750
|
+
description: "Clean: Secure GCP Compute instance with private networking",
|
|
2751
|
+
language: "hcl",
|
|
2752
|
+
code: `resource "google_compute_network" "private" {
|
|
2753
|
+
name = "private-network"
|
|
2754
|
+
auto_create_subnetworks = false
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
resource "google_compute_subnetwork" "app" {
|
|
2758
|
+
name = "app-subnet"
|
|
2759
|
+
ip_cidr_range = "10.0.1.0/24"
|
|
2760
|
+
network = google_compute_network.private.id
|
|
2761
|
+
region = "us-central1"
|
|
2762
|
+
|
|
2763
|
+
private_ip_google_access = true
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
resource "google_compute_instance" "app_server" {
|
|
2767
|
+
name = "app-server"
|
|
2768
|
+
machine_type = "e2-medium"
|
|
2769
|
+
zone = "us-central1-a"
|
|
2770
|
+
|
|
2771
|
+
boot_disk {
|
|
2772
|
+
initialize_params {
|
|
2773
|
+
image = "debian-cloud/debian-12"
|
|
2774
|
+
size = 20
|
|
2775
|
+
type = "pd-ssd"
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
network_interface {
|
|
2780
|
+
subnetwork = google_compute_subnetwork.app.id
|
|
2781
|
+
# No access_config — no public IP
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
metadata = {
|
|
2785
|
+
enable-oslogin = "TRUE"
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
shielded_instance_config {
|
|
2789
|
+
enable_secure_boot = true
|
|
2790
|
+
enable_vtpm = true
|
|
2791
|
+
enable_integrity_monitoring = true
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
tags = ["app-server", "internal-only"]
|
|
2795
|
+
|
|
2796
|
+
labels = {
|
|
2797
|
+
environment = "production"
|
|
2798
|
+
team = "platform"
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
resource "google_compute_firewall" "allow_internal" {
|
|
2803
|
+
name = "allow-internal"
|
|
2804
|
+
network = google_compute_network.private.id
|
|
2805
|
+
|
|
2806
|
+
allow {
|
|
2807
|
+
protocol = "tcp"
|
|
2808
|
+
ports = ["8080"]
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
source_ranges = ["10.0.0.0/8"]
|
|
2812
|
+
target_tags = ["app-server"]
|
|
2813
|
+
}`,
|
|
2814
|
+
expectedRuleIds: [],
|
|
2815
|
+
category: "clean",
|
|
2816
|
+
difficulty: "hard",
|
|
2817
|
+
},
|
|
2818
|
+
{
|
|
2819
|
+
id: "clean-rel-deadletter-queue",
|
|
2820
|
+
description: "Clean: Message queue consumer with dead letter handling and retry",
|
|
2821
|
+
language: "typescript",
|
|
2822
|
+
code: `import { SQSClient, ReceiveMessageCommand, DeleteMessageCommand, SendMessageCommand } from "@aws-sdk/client-sqs";
|
|
2823
|
+
|
|
2824
|
+
const sqs = new SQSClient({});
|
|
2825
|
+
const QUEUE_URL = process.env.QUEUE_URL!;
|
|
2826
|
+
const DLQ_URL = process.env.DLQ_URL!;
|
|
2827
|
+
const MAX_RETRIES = 3;
|
|
2828
|
+
|
|
2829
|
+
interface MessageAttributes {
|
|
2830
|
+
retryCount?: number;
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
async function processMessages() {
|
|
2834
|
+
while (true) {
|
|
2835
|
+
const { Messages } = await sqs.send(new ReceiveMessageCommand({
|
|
2836
|
+
QueueUrl: QUEUE_URL,
|
|
2837
|
+
MaxNumberOfMessages: 10,
|
|
2838
|
+
WaitTimeSeconds: 20,
|
|
2839
|
+
MessageAttributeNames: ["All"],
|
|
2840
|
+
}));
|
|
2841
|
+
|
|
2842
|
+
if (!Messages) continue;
|
|
2843
|
+
|
|
2844
|
+
for (const msg of Messages) {
|
|
2845
|
+
const retryCount = parseInt(
|
|
2846
|
+
msg.MessageAttributes?.retryCount?.StringValue || "0",
|
|
2847
|
+
10
|
|
2848
|
+
);
|
|
2849
|
+
|
|
2850
|
+
try {
|
|
2851
|
+
const payload = JSON.parse(msg.Body!);
|
|
2852
|
+
await processOrder(payload);
|
|
2853
|
+
await sqs.send(new DeleteMessageCommand({
|
|
2854
|
+
QueueUrl: QUEUE_URL,
|
|
2855
|
+
ReceiptHandle: msg.ReceiptHandle!,
|
|
2856
|
+
}));
|
|
2857
|
+
} catch (error) {
|
|
2858
|
+
if (retryCount >= MAX_RETRIES) {
|
|
2859
|
+
await sqs.send(new SendMessageCommand({
|
|
2860
|
+
QueueUrl: DLQ_URL,
|
|
2861
|
+
MessageBody: msg.Body!,
|
|
2862
|
+
MessageAttributes: {
|
|
2863
|
+
error: { DataType: "String", StringValue: String(error) },
|
|
2864
|
+
originalQueue: { DataType: "String", StringValue: QUEUE_URL },
|
|
2865
|
+
},
|
|
2866
|
+
}));
|
|
2867
|
+
await sqs.send(new DeleteMessageCommand({
|
|
2868
|
+
QueueUrl: QUEUE_URL,
|
|
2869
|
+
ReceiptHandle: msg.ReceiptHandle!,
|
|
2870
|
+
}));
|
|
2871
|
+
console.error(\`Message sent to DLQ after \${MAX_RETRIES} retries\`, error);
|
|
2872
|
+
}
|
|
2873
|
+
// Otherwise let visibility timeout expire for automatic retry
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
}`,
|
|
2878
|
+
expectedRuleIds: [],
|
|
2879
|
+
category: "clean",
|
|
2880
|
+
difficulty: "hard",
|
|
2881
|
+
},
|
|
2882
|
+
];
|