opencode-skills-collection 4.0.68 → 4.0.69
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/bundled-skills/.antigravity-install-manifest.json +266 -1
- package/bundled-skills/access-review/SKILL.md +394 -0
- package/bundled-skills/access-review/references/details.md +121 -0
- package/bundled-skills/agent-evals/SKILL.md +420 -0
- package/bundled-skills/agent-observability/SKILL.md +346 -0
- package/bundled-skills/agent-observability/references/details.md +786 -0
- package/bundled-skills/ai-agent-security/SKILL.md +393 -0
- package/bundled-skills/ai-agent-security/references/details.md +912 -0
- package/bundled-skills/ai-coding-agent-guardrails/SKILL.md +442 -0
- package/bundled-skills/ai-coding-agent-guardrails/references/details.md +753 -0
- package/bundled-skills/ai-inference-service-mesh/SKILL.md +449 -0
- package/bundled-skills/ai-pipeline-orchestration/SKILL.md +287 -0
- package/bundled-skills/ai-red-teaming/SKILL.md +409 -0
- package/bundled-skills/ai-security-hardening/SKILL.md +343 -0
- package/bundled-skills/ai-sre-incident-response/SKILL.md +336 -0
- package/bundled-skills/alerting-oncall/SKILL.md +458 -0
- package/bundled-skills/alerting-oncall/references/details.md +84 -0
- package/bundled-skills/apk-redteam-pipeline/SKILL.md +446 -0
- package/bundled-skills/argocd-gitops/SKILL.md +469 -0
- package/bundled-skills/arm-templates/SKILL.md +438 -0
- package/bundled-skills/arm-templates/references/details.md +64 -0
- package/bundled-skills/asset-inventory/SKILL.md +412 -0
- package/bundled-skills/asset-inventory/references/details.md +127 -0
- package/bundled-skills/audit-logging/SKILL.md +476 -0
- package/bundled-skills/aws-cloudtrail/SKILL.md +486 -0
- package/bundled-skills/aws-cost-optimization/SKILL.md +331 -0
- package/bundled-skills/aws-ec2/SKILL.md +426 -0
- package/bundled-skills/aws-ecs-fargate/SKILL.md +388 -0
- package/bundled-skills/aws-iam/SKILL.md +463 -0
- package/bundled-skills/aws-lambda/SKILL.md +428 -0
- package/bundled-skills/aws-rds/SKILL.md +380 -0
- package/bundled-skills/aws-s3/SKILL.md +434 -0
- package/bundled-skills/aws-secrets-manager/SKILL.md +486 -0
- package/bundled-skills/aws-vpc/SKILL.md +436 -0
- package/bundled-skills/azure-ai-document-intelligence-ts/SKILL.md +1 -1
- package/bundled-skills/azure-aks/SKILL.md +423 -0
- package/bundled-skills/azure-devops/SKILL.md +457 -0
- package/bundled-skills/azure-functions-devsec/SKILL.md +436 -0
- package/bundled-skills/azure-keyvault/SKILL.md +455 -0
- package/bundled-skills/azure-keyvault/references/details.md +83 -0
- package/bundled-skills/azure-monitor-audit/SKILL.md +379 -0
- package/bundled-skills/azure-networking/SKILL.md +448 -0
- package/bundled-skills/azure-networking/references/details.md +135 -0
- package/bundled-skills/azure-sql/SKILL.md +413 -0
- package/bundled-skills/azure-sql/references/details.md +113 -0
- package/bundled-skills/azure-vms/SKILL.md +402 -0
- package/bundled-skills/azure-vms/references/details.md +134 -0
- package/bundled-skills/backup-recovery/SKILL.md +388 -0
- package/bundled-skills/bb-methodology/SKILL.md +451 -0
- package/bundled-skills/bb-methodology/references/details.md +120 -0
- package/bundled-skills/block-storage/SKILL.md +371 -0
- package/bundled-skills/blue-green-deploy/SKILL.md +453 -0
- package/bundled-skills/blue-green-deploy/references/details.md +90 -0
- package/bundled-skills/bug-bounty/SKILL.md +447 -0
- package/bundled-skills/bug-bounty/references/details.md +1316 -0
- package/bundled-skills/bugcrowd-reporting/SKILL.md +351 -0
- package/bundled-skills/business-continuity/SKILL.md +463 -0
- package/bundled-skills/career-ops/SKILL.md +186 -0
- package/bundled-skills/cdn-setup/SKILL.md +374 -0
- package/bundled-skills/change-management/SKILL.md +438 -0
- package/bundled-skills/change-management/references/details.md +105 -0
- package/bundled-skills/circleci/SKILL.md +475 -0
- package/bundled-skills/cis-benchmarks/SKILL.md +150 -0
- package/bundled-skills/cloudflare-pages/SKILL.md +318 -0
- package/bundled-skills/cloudflare-r2/SKILL.md +353 -0
- package/bundled-skills/cloudflare-workers/SKILL.md +415 -0
- package/bundled-skills/cloudflare-zero-trust/SKILL.md +361 -0
- package/bundled-skills/cloudformation/SKILL.md +461 -0
- package/bundled-skills/constraint-driven-development/SKILL.md +335 -0
- package/bundled-skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/bundled-skills/container-hardening/SKILL.md +126 -0
- package/bundled-skills/container-registries/SKILL.md +435 -0
- package/bundled-skills/container-scanning/SKILL.md +416 -0
- package/bundled-skills/convex-backend/SKILL.md +338 -0
- package/bundled-skills/dast-scanning/SKILL.md +437 -0
- package/bundled-skills/database-backups/SKILL.md +425 -0
- package/bundled-skills/datadog/SKILL.md +487 -0
- package/bundled-skills/dependency-scanning/SKILL.md +457 -0
- package/bundled-skills/devcontainers-nix/SKILL.md +416 -0
- package/bundled-skills/disaster-recovery/SKILL.md +374 -0
- package/bundled-skills/disaster-recovery/references/details.md +219 -0
- package/bundled-skills/dns-management/SKILL.md +375 -0
- package/bundled-skills/docker-compose/SKILL.md +482 -0
- package/bundled-skills/docker-management/SKILL.md +426 -0
- package/bundled-skills/ebpf-observability/SKILL.md +436 -0
- package/bundled-skills/ebpf-observability/references/details.md +542 -0
- package/bundled-skills/elk-stack/SKILL.md +487 -0
- package/bundled-skills/enterprise-vpn-attack/SKILL.md +395 -0
- package/bundled-skills/evidence-hygiene/SKILL.md +404 -0
- package/bundled-skills/feature-flags/SKILL.md +426 -0
- package/bundled-skills/feature-flags/references/details.md +86 -0
- package/bundled-skills/fedramp-compliance/SKILL.md +453 -0
- package/bundled-skills/firebase-app-platform/SKILL.md +381 -0
- package/bundled-skills/firewall-config/SKILL.md +479 -0
- package/bundled-skills/gcp-audit-logs/SKILL.md +452 -0
- package/bundled-skills/gcp-audit-logs/references/details.md +56 -0
- package/bundled-skills/gcp-cloud-functions/SKILL.md +284 -0
- package/bundled-skills/gcp-cloud-sql/SKILL.md +277 -0
- package/bundled-skills/gcp-compute/SKILL.md +319 -0
- package/bundled-skills/gcp-gke/SKILL.md +307 -0
- package/bundled-skills/gcp-networking/SKILL.md +293 -0
- package/bundled-skills/gcp-secret-manager/SKILL.md +421 -0
- package/bundled-skills/gcp-secret-manager/references/details.md +131 -0
- package/bundled-skills/gdpr-compliance/SKILL.md +451 -0
- package/bundled-skills/gdpr-compliance/references/details.md +145 -0
- package/bundled-skills/geo-audit/SKILL.md +368 -0
- package/bundled-skills/geo-brand-mentions/SKILL.md +68 -0
- package/bundled-skills/geo-brand-mentions/references/details.md +471 -0
- package/bundled-skills/geo-citability/SKILL.md +350 -0
- package/bundled-skills/geo-compare/SKILL.md +340 -0
- package/bundled-skills/geo-content/SKILL.md +383 -0
- package/bundled-skills/geo-crawlers/SKILL.md +408 -0
- package/bundled-skills/geo-llmstxt/SKILL.md +464 -0
- package/bundled-skills/geo-platform-optimizer/SKILL.md +314 -0
- package/bundled-skills/geo-proposal/SKILL.md +378 -0
- package/bundled-skills/geo-prospect/SKILL.md +225 -0
- package/bundled-skills/geo-report/SKILL.md +436 -0
- package/bundled-skills/geo-report-pdf/SKILL.md +157 -0
- package/bundled-skills/geo-schema/SKILL.md +408 -0
- package/bundled-skills/geo-technical/SKILL.md +78 -0
- package/bundled-skills/geo-technical/references/details.md +543 -0
- package/bundled-skills/git-workflow/SKILL.md +460 -0
- package/bundled-skills/github-actions/SKILL.md +368 -0
- package/bundled-skills/gitlab-ci/SKILL.md +340 -0
- package/bundled-skills/gpu-kubernetes-operations/SKILL.md +468 -0
- package/bundled-skills/gpu-server-management/SKILL.md +236 -0
- package/bundled-skills/hashicorp-vault/SKILL.md +408 -0
- package/bundled-skills/helm-charts/SKILL.md +469 -0
- package/bundled-skills/hipaa-compliance/SKILL.md +451 -0
- package/bundled-skills/hunt-aspnet/SKILL.md +321 -0
- package/bundled-skills/hunt-ato/SKILL.md +184 -0
- package/bundled-skills/hunt-auth-bypass/SKILL.md +426 -0
- package/bundled-skills/hunt-auth-bypass/references/details.md +80 -0
- package/bundled-skills/hunt-brute-force/SKILL.md +341 -0
- package/bundled-skills/hunt-business-logic/SKILL.md +281 -0
- package/bundled-skills/hunt-cache-poison/SKILL.md +382 -0
- package/bundled-skills/hunt-captcha-bypass/SKILL.md +136 -0
- package/bundled-skills/hunt-cicd/SKILL.md +311 -0
- package/bundled-skills/hunt-clickjacking/SKILL.md +110 -0
- package/bundled-skills/hunt-cors/SKILL.md +335 -0
- package/bundled-skills/hunt-dom/SKILL.md +323 -0
- package/bundled-skills/hunt-exceptional-conditions/SKILL.md +111 -0
- package/bundled-skills/hunt-file-upload/SKILL.md +202 -0
- package/bundled-skills/hunt-fintech-graphql/SKILL.md +289 -0
- package/bundled-skills/hunt-forgot-password/SKILL.md +114 -0
- package/bundled-skills/hunt-grpc/SKILL.md +317 -0
- package/bundled-skills/hunt-host-header/SKILL.md +309 -0
- package/bundled-skills/hunt-html-injection/SKILL.md +106 -0
- package/bundled-skills/hunt-http-smuggling/SKILL.md +129 -0
- package/bundled-skills/hunt-http-smuggling/references/phase2h-smuggling-cachepoison.md +177 -0
- package/bundled-skills/hunt-idor/SKILL.md +434 -0
- package/bundled-skills/hunt-jwt-crypto/SKILL.md +221 -0
- package/bundled-skills/hunt-k8s/SKILL.md +337 -0
- package/bundled-skills/hunt-laravel/SKILL.md +255 -0
- package/bundled-skills/hunt-ldap/SKILL.md +351 -0
- package/bundled-skills/hunt-lfi/SKILL.md +311 -0
- package/bundled-skills/hunt-llm-ai/SKILL.md +289 -0
- package/bundled-skills/hunt-mfa-bypass/SKILL.md +177 -0
- package/bundled-skills/hunt-misc/SKILL.md +378 -0
- package/bundled-skills/hunt-nextjs/SKILL.md +299 -0
- package/bundled-skills/hunt-nodejs/SKILL.md +263 -0
- package/bundled-skills/hunt-nosqli/SKILL.md +210 -0
- package/bundled-skills/hunt-ntlm-info/SKILL.md +314 -0
- package/bundled-skills/hunt-oauth/SKILL.md +459 -0
- package/bundled-skills/hunt-open-redirect/SKILL.md +223 -0
- package/bundled-skills/hunt-race-condition/SKILL.md +381 -0
- package/bundled-skills/hunt-race-condition/references/details.md +159 -0
- package/bundled-skills/hunt-rag-vector/SKILL.md +212 -0
- package/bundled-skills/hunt-rce/SKILL.md +444 -0
- package/bundled-skills/hunt-rce/references/details.md +110 -0
- package/bundled-skills/hunt-saml/SKILL.md +156 -0
- package/bundled-skills/hunt-session/SKILL.md +342 -0
- package/bundled-skills/hunt-shadow-api/SKILL.md +198 -0
- package/bundled-skills/hunt-source-leak/SKILL.md +345 -0
- package/bundled-skills/hunt-spa-api/SKILL.md +163 -0
- package/bundled-skills/hunt-springboot/SKILL.md +285 -0
- package/bundled-skills/hunt-sqli/SKILL.md +466 -0
- package/bundled-skills/hunt-ssrf/SKILL.md +396 -0
- package/bundled-skills/hunt-ssrf/references/details.md +179 -0
- package/bundled-skills/hunt-ssti/SKILL.md +163 -0
- package/bundled-skills/hunt-subdomain/SKILL.md +379 -0
- package/bundled-skills/hunt-tls-network/SKILL.md +399 -0
- package/bundled-skills/hunt-xxe/SKILL.md +466 -0
- package/bundled-skills/i-have-adhd/SKILL.md +170 -0
- package/bundled-skills/identity-access-management/SKILL.md +382 -0
- package/bundled-skills/identity-access-management/references/details.md +524 -0
- package/bundled-skills/incident-management/SKILL.md +484 -0
- package/bundled-skills/incident-response/SKILL.md +448 -0
- package/bundled-skills/incident-response/references/details.md +113 -0
- package/bundled-skills/interview-me/SKILL.md +248 -0
- package/bundled-skills/iso27001-compliance/SKILL.md +460 -0
- package/bundled-skills/jenkins/SKILL.md +462 -0
- package/bundled-skills/jev-use/SKILL.md +158 -0
- package/bundled-skills/kubernetes-hardening/SKILL.md +154 -0
- package/bundled-skills/kubernetes-ops/SKILL.md +449 -0
- package/bundled-skills/kubernetes-ops/references/details.md +108 -0
- package/bundled-skills/kustomize/SKILL.md +478 -0
- package/bundled-skills/linux-administration/SKILL.md +367 -0
- package/bundled-skills/linux-hardening/SKILL.md +154 -0
- package/bundled-skills/llm-app-security/SKILL.md +389 -0
- package/bundled-skills/llm-app-security/references/details.md +674 -0
- package/bundled-skills/llm-caching/SKILL.md +334 -0
- package/bundled-skills/llm-cost-optimization/SKILL.md +311 -0
- package/bundled-skills/llm-fine-tuning/SKILL.md +329 -0
- package/bundled-skills/llm-gateway/SKILL.md +282 -0
- package/bundled-skills/llm-inference-scaling/SKILL.md +286 -0
- package/bundled-skills/llmops-platform-engineering/SKILL.md +472 -0
- package/bundled-skills/load-balancing/SKILL.md +403 -0
- package/bundled-skills/loki-logging/SKILL.md +479 -0
- package/bundled-skills/m365-entra-attack/SKILL.md +423 -0
- package/bundled-skills/mac-mini-llm-lab/SKILL.md +350 -0
- package/bundled-skills/mcp-server-security/SKILL.md +356 -0
- package/bundled-skills/mcp-server-security/references/details.md +745 -0
- package/bundled-skills/mdm-device-management/SKILL.md +404 -0
- package/bundled-skills/mdm-device-management/references/details.md +410 -0
- package/bundled-skills/meme-coin-audit/SKILL.md +402 -0
- package/bundled-skills/mid-engagement-ir-detection/SKILL.md +377 -0
- package/bundled-skills/model-registry-governance/SKILL.md +452 -0
- package/bundled-skills/model-serving-kubernetes/SKILL.md +339 -0
- package/bundled-skills/model-supply-chain-security/SKILL.md +427 -0
- package/bundled-skills/mongodb/SKILL.md +436 -0
- package/bundled-skills/multi-tenant-llm-hosting/SKILL.md +435 -0
- package/bundled-skills/multi-tenant-llm-hosting/references/details.md +211 -0
- package/bundled-skills/mysql/SKILL.md +390 -0
- package/bundled-skills/new-relic/SKILL.md +472 -0
- package/bundled-skills/nfs-storage/SKILL.md +356 -0
- package/bundled-skills/object-storage/SKILL.md +378 -0
- package/bundled-skills/offensive-osint/SKILL.md +443 -0
- package/bundled-skills/okta-attack/SKILL.md +436 -0
- package/bundled-skills/ollama-stack/SKILL.md +379 -0
- package/bundled-skills/openclaw-deployment-hardening/SKILL.md +135 -0
- package/bundled-skills/openclaw-local-mac-mini/SKILL.md +426 -0
- package/bundled-skills/openclaw-local-mac-mini/references/details.md +221 -0
- package/bundled-skills/openclaw-security-hardening/SKILL.md +135 -0
- package/bundled-skills/openshift/SKILL.md +485 -0
- package/bundled-skills/opentelemetry/SKILL.md +438 -0
- package/bundled-skills/opentelemetry/references/details.md +78 -0
- package/bundled-skills/opentofu-migration/SKILL.md +349 -0
- package/bundled-skills/osint-methodology/SKILL.md +460 -0
- package/bundled-skills/osint-methodology/references/details.md +1350 -0
- package/bundled-skills/pci-dss-compliance/SKILL.md +446 -0
- package/bundled-skills/penetration-testing/SKILL.md +152 -0
- package/bundled-skills/performance-tuning/SKILL.md +381 -0
- package/bundled-skills/planetscale/SKILL.md +297 -0
- package/bundled-skills/platform-engineering/SKILL.md +348 -0
- package/bundled-skills/platform-engineering/references/details.md +944 -0
- package/bundled-skills/podman/SKILL.md +405 -0
- package/bundled-skills/policy-as-code/SKILL.md +434 -0
- package/bundled-skills/policy-as-code/references/details.md +204 -0
- package/bundled-skills/postgresql-devsec/SKILL.md +378 -0
- package/bundled-skills/prometheus-grafana/SKILL.md +469 -0
- package/bundled-skills/prompt-injection-defense/SKILL.md +483 -0
- package/bundled-skills/rag-infrastructure/SKILL.md +269 -0
- package/bundled-skills/rag-observability-evals/SKILL.md +444 -0
- package/bundled-skills/rag-observability-evals/references/details.md +92 -0
- package/bundled-skills/recon-scope-triage/SKILL.md +128 -0
- package/bundled-skills/redis/SKILL.md +421 -0
- package/bundled-skills/redteam-report-template/SKILL.md +370 -0
- package/bundled-skills/report-writing/SKILL.md +426 -0
- package/bundled-skills/report-writing/references/details.md +187 -0
- package/bundled-skills/reverse-proxy/SKILL.md +420 -0
- package/bundled-skills/runbook-creation/SKILL.md +438 -0
- package/bundled-skills/runbook-creation/references/details.md +71 -0
- package/bundled-skills/saas-security-posture/SKILL.md +415 -0
- package/bundled-skills/sast-scanning/SKILL.md +444 -0
- package/bundled-skills/sbom-supply-chain/SKILL.md +433 -0
- package/bundled-skills/security-arsenal/SKILL.md +446 -0
- package/bundled-skills/security-arsenal/references/details.md +540 -0
- package/bundled-skills/security-automation/SKILL.md +146 -0
- package/bundled-skills/semantic-versioning/SKILL.md +434 -0
- package/bundled-skills/semantic-versioning/references/details.md +83 -0
- package/bundled-skills/service-mesh/SKILL.md +422 -0
- package/bundled-skills/soc2-compliance/SKILL.md +409 -0
- package/bundled-skills/sops-encryption/SKILL.md +124 -0
- package/bundled-skills/sre-dashboards/SKILL.md +143 -0
- package/bundled-skills/ssh-configuration/SKILL.md +324 -0
- package/bundled-skills/ssl-tls-management/SKILL.md +428 -0
- package/bundled-skills/ssl-tls-management/references/details.md +99 -0
- package/bundled-skills/startup-it-troubleshooting/SKILL.md +415 -0
- package/bundled-skills/supply-chain-attack-recon/SKILL.md +453 -0
- package/bundled-skills/supply-chain-attack-recon/references/details.md +258 -0
- package/bundled-skills/systemd-services/SKILL.md +379 -0
- package/bundled-skills/terraform-aws/SKILL.md +125 -0
- package/bundled-skills/terraform-azure/SKILL.md +415 -0
- package/bundled-skills/terraform-azure/references/details.md +231 -0
- package/bundled-skills/terraform-gcp/SKILL.md +369 -0
- package/bundled-skills/threat-modeling/SKILL.md +487 -0
- package/bundled-skills/user-management/SKILL.md +383 -0
- package/bundled-skills/using-agent-skills/SKILL.md +220 -0
- package/bundled-skills/vector-database-ops/SKILL.md +300 -0
- package/bundled-skills/vendor-management/SKILL.md +439 -0
- package/bundled-skills/vendor-management/references/details.md +109 -0
- package/bundled-skills/vercel-deployments/SKILL.md +296 -0
- package/bundled-skills/vllm-server/SKILL.md +236 -0
- package/bundled-skills/vmware-vcenter-attack/SKILL.md +412 -0
- package/bundled-skills/vpn-setup/SKILL.md +452 -0
- package/bundled-skills/vulnerability-scanning/SKILL.md +448 -0
- package/bundled-skills/waf-setup/SKILL.md +354 -0
- package/bundled-skills/waf-setup/references/details.md +211 -0
- package/bundled-skills/web2-recon/SKILL.md +440 -0
- package/bundled-skills/web2-recon/references/details.md +319 -0
- package/bundled-skills/web3-audit/SKILL.md +445 -0
- package/bundled-skills/web3-audit/references/details.md +224 -0
- package/bundled-skills/windows-hardening/SKILL.md +454 -0
- package/bundled-skills/windows-hardening/references/details.md +204 -0
- package/bundled-skills/windows-server/SKILL.md +318 -0
- package/bundled-skills/zero-trust/SKILL.md +461 -0
- package/package.json +1 -1
- package/skills_index.json +6943 -323
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
# Details (moved from SKILL.md)
|
|
2
|
+
|
|
3
|
+
> Extended reference content for `ai-coding-agent-guardrails`, kept under `references/` so the entrypoint stays within the audit budget.
|
|
4
|
+
|
|
5
|
+
## Code Review Gates
|
|
6
|
+
|
|
7
|
+
### GitHub Actions Workflow for Agent PRs
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
# .github/workflows/agent-pr-review.yaml
|
|
11
|
+
name: Agent PR Security Review
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
pull_request:
|
|
15
|
+
types: [opened, synchronize]
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
detect-agent-pr:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
outputs:
|
|
21
|
+
is_agent: ${{ steps.check.outputs.is_agent }}
|
|
22
|
+
steps:
|
|
23
|
+
- name: Check if PR is from an AI agent
|
|
24
|
+
id: check
|
|
25
|
+
run: |
|
|
26
|
+
BRANCH="${{ github.head_ref }}"
|
|
27
|
+
AUTHOR="${{ github.event.pull_request.user.login }}"
|
|
28
|
+
BODY="${{ github.event.pull_request.body }}"
|
|
29
|
+
|
|
30
|
+
IS_AGENT="false"
|
|
31
|
+
if [[ "$BRANCH" == ai/* ]] || [[ "$BRANCH" == agent/* ]]; then
|
|
32
|
+
IS_AGENT="true"
|
|
33
|
+
fi
|
|
34
|
+
if echo "$BODY" | grep -qi "generated with.*claude\|generated by.*copilot\|generated by.*cursor\|generated by.*codex"; then
|
|
35
|
+
IS_AGENT="true"
|
|
36
|
+
fi
|
|
37
|
+
if [[ "$AUTHOR" == *"bot"* ]] || [[ "$AUTHOR" == *"agent"* ]]; then
|
|
38
|
+
IS_AGENT="true"
|
|
39
|
+
fi
|
|
40
|
+
echo "is_agent=$IS_AGENT" >> "$GITHUB_OUTPUT"
|
|
41
|
+
|
|
42
|
+
security-scan:
|
|
43
|
+
needs: detect-agent-pr
|
|
44
|
+
if: needs.detect-agent-pr.outputs.is_agent == 'true'
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
with:
|
|
49
|
+
fetch-depth: 0
|
|
50
|
+
|
|
51
|
+
- name: Run Semgrep security scan
|
|
52
|
+
uses: semgrep/semgrep-action@v1
|
|
53
|
+
with:
|
|
54
|
+
config: >-
|
|
55
|
+
p/default
|
|
56
|
+
p/owasp-top-ten
|
|
57
|
+
p/command-injection
|
|
58
|
+
p/sql-injection
|
|
59
|
+
p/xss
|
|
60
|
+
|
|
61
|
+
- name: Scan for secrets with Trufflehog
|
|
62
|
+
uses: trufflesecurity/trufflehog@main
|
|
63
|
+
with:
|
|
64
|
+
extra_args: --only-verified
|
|
65
|
+
|
|
66
|
+
- name: Check for dependency changes
|
|
67
|
+
run: |
|
|
68
|
+
CHANGED_FILES=$(git diff --name-only origin/main...HEAD)
|
|
69
|
+
DEP_FILES="package.json package-lock.json requirements.txt Pipfile.lock go.sum Cargo.lock"
|
|
70
|
+
|
|
71
|
+
for dep_file in $DEP_FILES; do
|
|
72
|
+
if echo "$CHANGED_FILES" | grep -q "$dep_file"; then
|
|
73
|
+
echo "::warning::Agent modified dependency file: $dep_file"
|
|
74
|
+
echo "DEPENDENCY_CHANGED=true" >> "$GITHUB_ENV"
|
|
75
|
+
fi
|
|
76
|
+
done
|
|
77
|
+
|
|
78
|
+
- name: Require extra review for dependency changes
|
|
79
|
+
if: env.DEPENDENCY_CHANGED == 'true'
|
|
80
|
+
run: |
|
|
81
|
+
gh pr edit "${{ github.event.pull_request.number }}" \
|
|
82
|
+
--add-label "agent-dependency-change" \
|
|
83
|
+
--add-label "requires-security-review"
|
|
84
|
+
env:
|
|
85
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
86
|
+
|
|
87
|
+
enforce-review:
|
|
88
|
+
needs: detect-agent-pr
|
|
89
|
+
if: needs.detect-agent-pr.outputs.is_agent == 'true'
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
steps:
|
|
92
|
+
- name: Label as agent-generated
|
|
93
|
+
run: |
|
|
94
|
+
gh pr edit "${{ github.event.pull_request.number }}" \
|
|
95
|
+
--add-label "ai-generated"
|
|
96
|
+
env:
|
|
97
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
98
|
+
|
|
99
|
+
- name: Enforce minimum reviewers
|
|
100
|
+
run: |
|
|
101
|
+
echo "Agent-generated PR detected."
|
|
102
|
+
echo "This PR requires at least 2 human approvals before merge."
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Branch Protection for Agent Branches
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
#!/bin/bash
|
|
109
|
+
# configure-branch-protection.sh
|
|
110
|
+
# Set up branch protection rules for agent-generated PRs via GitHub API
|
|
111
|
+
|
|
112
|
+
OWNER="your-org"
|
|
113
|
+
REPO="your-repo"
|
|
114
|
+
|
|
115
|
+
gh api repos/${OWNER}/${REPO}/rulesets \
|
|
116
|
+
--method POST \
|
|
117
|
+
--input - <<'EOF'
|
|
118
|
+
{
|
|
119
|
+
"name": "Agent Branch Protection",
|
|
120
|
+
"target": "branch",
|
|
121
|
+
"enforcement": "active",
|
|
122
|
+
"conditions": {
|
|
123
|
+
"ref_name": {
|
|
124
|
+
"include": ["refs/heads/ai/*", "refs/heads/agent/*"],
|
|
125
|
+
"exclude": []
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"rules": [
|
|
129
|
+
{
|
|
130
|
+
"type": "pull_request",
|
|
131
|
+
"parameters": {
|
|
132
|
+
"required_approving_review_count": 2,
|
|
133
|
+
"dismiss_stale_reviews_on_push": true,
|
|
134
|
+
"require_code_owner_review": true,
|
|
135
|
+
"require_last_push_approval": true
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"type": "required_status_checks",
|
|
140
|
+
"parameters": {
|
|
141
|
+
"required_status_checks": [
|
|
142
|
+
{ "context": "security-scan" },
|
|
143
|
+
{ "context": "test-suite" },
|
|
144
|
+
{ "context": "secret-detection" }
|
|
145
|
+
],
|
|
146
|
+
"strict_required_status_checks_policy": true
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
EOF
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## Repository Configuration
|
|
158
|
+
|
|
159
|
+
### Cursor Rules (.cursorrules)
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
# .cursorrules
|
|
163
|
+
|
|
164
|
+
You are working in a production codebase. Follow these rules strictly:
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
## Security Rules
|
|
168
|
+
- Never hardcode secrets, API keys, tokens, or passwords in source code.
|
|
169
|
+
- Never read or display the contents of .env files or secret configuration files.
|
|
170
|
+
- Never disable SSL verification, CSRF protection, or authentication middleware.
|
|
171
|
+
- Never use eval(), exec(), or similar dynamic code execution functions. <!-- security-allowlist: documented payload technique reference, do not execute outside authorized scope -->
|
|
172
|
+
- Never introduce SQL string concatenation; always use parameterized queries.
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
## File Restrictions
|
|
176
|
+
- Do not modify any files in: infrastructure/, terraform/, .github/workflows/, deploy/
|
|
177
|
+
- Do not create or modify Dockerfiles without explicit approval.
|
|
178
|
+
- Do not modify CI/CD configuration files.
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
## Code Quality
|
|
182
|
+
- Every new function must have a corresponding unit test.
|
|
183
|
+
- All error handling must be explicit; never silently swallow exceptions.
|
|
184
|
+
- Follow existing patterns for logging, error handling, and API responses.
|
|
185
|
+
- Maximum function length: 50 lines. Refactor if exceeded.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
## Git Behavior
|
|
189
|
+
- Create branches with the prefix: ai/
|
|
190
|
+
- Write descriptive commit messages referencing the task or issue.
|
|
191
|
+
- Never force push or rebase shared branches.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### GitHub Copilot Configuration
|
|
195
|
+
|
|
196
|
+
```yaml
|
|
197
|
+
# .github/copilot-config.yml
|
|
198
|
+
#
|
|
199
|
+
# Note: Copilot content exclusion is configured at the org/repo level
|
|
200
|
+
# via GitHub settings. This file documents intended exclusions and
|
|
201
|
+
# can be referenced by org admins when configuring the settings at
|
|
202
|
+
# github.com > Org Settings > Copilot > Content Exclusions.
|
|
203
|
+
|
|
204
|
+
content_exclusions:
|
|
205
|
+
paths:
|
|
206
|
+
- "**/.env*"
|
|
207
|
+
- "**/secrets/**"
|
|
208
|
+
- "**/*.pem"
|
|
209
|
+
- "**/*.key"
|
|
210
|
+
- "**/infrastructure/**"
|
|
211
|
+
- "**/terraform/**"
|
|
212
|
+
- "**/.aws/**"
|
|
213
|
+
- "**/credentials*"
|
|
214
|
+
|
|
215
|
+
# Copilot content exclusion via organization settings (recommended):
|
|
216
|
+
# 1. Go to Organization Settings > Copilot > Content exclusion
|
|
217
|
+
# 2. Add repository paths:
|
|
218
|
+
# - ".env*"
|
|
219
|
+
# - "secrets/**"
|
|
220
|
+
# - "infrastructure/**"
|
|
221
|
+
# - "*.pem"
|
|
222
|
+
# - "*.key"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### OpenAI Codex Configuration
|
|
226
|
+
|
|
227
|
+
```markdown
|
|
228
|
+
<!-- codex.md or AGENTS.md for Codex CLI -->
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
## Rules
|
|
232
|
+
|
|
233
|
+
- Do not modify files outside of src/ and tests/ directories.
|
|
234
|
+
- Do not install packages or modify dependency files without listing changes first.
|
|
235
|
+
- Run `npm test` after every code change to verify nothing is broken.
|
|
236
|
+
- Never access network resources or make HTTP requests during code generation.
|
|
237
|
+
- All generated code must include error handling.
|
|
238
|
+
- Prefix all branch names with `agent/codex/`.
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
## Network Controls
|
|
245
|
+
|
|
246
|
+
### Firewall Rules for Agent Environments
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
#!/bin/bash
|
|
250
|
+
# agent-network-controls.sh
|
|
251
|
+
# Restrict network access for agent execution environments
|
|
252
|
+
|
|
253
|
+
# Create a dedicated chain for agent traffic
|
|
254
|
+
iptables -N AGENT_CHAIN
|
|
255
|
+
|
|
256
|
+
# Allow DNS resolution
|
|
257
|
+
iptables -A AGENT_CHAIN -p udp --dport 53 -j ACCEPT
|
|
258
|
+
iptables -A AGENT_CHAIN -p tcp --dport 53 -j ACCEPT
|
|
259
|
+
|
|
260
|
+
# Allow package registries
|
|
261
|
+
iptables -A AGENT_CHAIN -d registry.npmjs.org -p tcp --dport 443 -j ACCEPT
|
|
262
|
+
iptables -A AGENT_CHAIN -d pypi.org -p tcp --dport 443 -j ACCEPT
|
|
263
|
+
iptables -A AGENT_CHAIN -d files.pythonhosted.org -p tcp --dport 443 -j ACCEPT
|
|
264
|
+
iptables -A AGENT_CHAIN -d proxy.golang.org -p tcp --dport 443 -j ACCEPT
|
|
265
|
+
|
|
266
|
+
# Allow GitHub for git operations
|
|
267
|
+
iptables -A AGENT_CHAIN -d github.com -p tcp --dport 443 -j ACCEPT
|
|
268
|
+
iptables -A AGENT_CHAIN -d github.com -p tcp --dport 22 -j ACCEPT
|
|
269
|
+
|
|
270
|
+
# Block everything else
|
|
271
|
+
iptables -A AGENT_CHAIN -j DROP
|
|
272
|
+
|
|
273
|
+
# Apply to agent user
|
|
274
|
+
iptables -A OUTPUT -m owner --uid-owner ai-agent -j AGENT_CHAIN
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Squid Proxy for Agent Traffic
|
|
278
|
+
|
|
279
|
+
```conf
|
|
280
|
+
# /etc/squid/squid-agent.conf
|
|
281
|
+
# Transparent proxy for AI agent network requests
|
|
282
|
+
|
|
283
|
+
acl agent_user proxy_auth ai-agent
|
|
284
|
+
acl allowed_domains dstdomain .npmjs.org .pypi.org .github.com .golang.org
|
|
285
|
+
|
|
286
|
+
# Allow only specific domains
|
|
287
|
+
http_access allow agent_user allowed_domains
|
|
288
|
+
http_access deny agent_user
|
|
289
|
+
|
|
290
|
+
# Log all agent requests for auditing
|
|
291
|
+
access_log /var/log/squid/agent-access.log squid
|
|
292
|
+
log_mime_hdrs on
|
|
293
|
+
|
|
294
|
+
# Request size limits
|
|
295
|
+
request_body_max_size 10 MB
|
|
296
|
+
reply_body_max_size 50 MB
|
|
297
|
+
|
|
298
|
+
http_port 3128
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Docker Compose with Network Isolation
|
|
302
|
+
|
|
303
|
+
```yaml
|
|
304
|
+
# docker-compose.agent.yaml
|
|
305
|
+
version: "3.8"
|
|
306
|
+
|
|
307
|
+
services:
|
|
308
|
+
agent-sandbox:
|
|
309
|
+
build:
|
|
310
|
+
context: .
|
|
311
|
+
dockerfile: Dockerfile.agent-sandbox
|
|
312
|
+
networks:
|
|
313
|
+
- agent-restricted
|
|
314
|
+
volumes:
|
|
315
|
+
- ./src:/workspace/src
|
|
316
|
+
- ./tests:/workspace/tests:rw
|
|
317
|
+
mem_limit: 4g
|
|
318
|
+
cpus: 2
|
|
319
|
+
pids_limit: 256
|
|
320
|
+
security_opt:
|
|
321
|
+
- no-new-privileges:true
|
|
322
|
+
read_only: true
|
|
323
|
+
tmpfs:
|
|
324
|
+
- /tmp:size=512m
|
|
325
|
+
|
|
326
|
+
agent-proxy:
|
|
327
|
+
image: ubuntu/squid:latest
|
|
328
|
+
networks:
|
|
329
|
+
- agent-restricted
|
|
330
|
+
- external
|
|
331
|
+
volumes:
|
|
332
|
+
- ./squid-agent.conf:/etc/squid/squid.conf:ro
|
|
333
|
+
ports:
|
|
334
|
+
- "3128:3128"
|
|
335
|
+
|
|
336
|
+
networks:
|
|
337
|
+
agent-restricted:
|
|
338
|
+
internal: true # No external access from this network
|
|
339
|
+
external:
|
|
340
|
+
driver: bridge
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
## Audit Trail
|
|
347
|
+
|
|
348
|
+
### Git Trailers for AI-Generated Code
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
#!/bin/bash
|
|
352
|
+
# git-ai-commit.sh
|
|
353
|
+
# Wrapper for committing agent-generated code with proper attribution
|
|
354
|
+
|
|
355
|
+
AGENT_NAME="${AI_AGENT_NAME:-unknown-agent}"
|
|
356
|
+
AGENT_VERSION="${AI_AGENT_VERSION:-unknown}"
|
|
357
|
+
TASK_ID="${AI_TASK_ID:-none}"
|
|
358
|
+
|
|
359
|
+
git commit -m "$(cat <<EOF
|
|
360
|
+
$1
|
|
361
|
+
|
|
362
|
+
AI-Generated-By: ${AGENT_NAME} ${AGENT_VERSION}
|
|
363
|
+
AI-Task-ID: ${TASK_ID}
|
|
364
|
+
AI-Reviewed-By: pending
|
|
365
|
+
Co-Authored-By: ${AGENT_NAME} <noreply@${AGENT_NAME}.ai>
|
|
366
|
+
EOF
|
|
367
|
+
)"
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Agent Action Logger
|
|
371
|
+
|
|
372
|
+
```python
|
|
373
|
+
#!/usr/bin/env python3
|
|
374
|
+
"""agent_audit_logger.py - Log all AI agent actions for compliance."""
|
|
375
|
+
|
|
376
|
+
import json
|
|
377
|
+
import logging
|
|
378
|
+
import os
|
|
379
|
+
import time
|
|
380
|
+
from datetime import datetime, timezone
|
|
381
|
+
from pathlib import Path
|
|
382
|
+
|
|
383
|
+
LOG_DIR = Path(os.environ.get("AGENT_LOG_DIR", "/var/log/ai-agents"))
|
|
384
|
+
LOG_DIR.mkdir(parents=True, exist_ok=True)
|
|
385
|
+
|
|
386
|
+
logger = logging.getLogger("agent_audit")
|
|
387
|
+
handler = logging.FileHandler(LOG_DIR / "agent-actions.jsonl")
|
|
388
|
+
handler.setFormatter(logging.Formatter("%(message)s"))
|
|
389
|
+
logger.addHandler(handler)
|
|
390
|
+
logger.setLevel(logging.INFO)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def log_action(
|
|
394
|
+
agent: str,
|
|
395
|
+
action: str,
|
|
396
|
+
target: str,
|
|
397
|
+
details: dict | None = None,
|
|
398
|
+
user: str = "system",
|
|
399
|
+
) -> None:
|
|
400
|
+
entry = {
|
|
401
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
402
|
+
"agent": agent,
|
|
403
|
+
"user": user,
|
|
404
|
+
"action": action,
|
|
405
|
+
"target": target,
|
|
406
|
+
"details": details or {},
|
|
407
|
+
"session_id": os.environ.get("AGENT_SESSION_ID", "unknown"),
|
|
408
|
+
}
|
|
409
|
+
logger.info(json.dumps(entry))
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
def log_file_read(agent: str, filepath: str) -> None:
|
|
413
|
+
log_action(agent, "file_read", filepath)
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def log_file_write(agent: str, filepath: str, lines_changed: int) -> None:
|
|
417
|
+
log_action(agent, "file_write", filepath, {"lines_changed": lines_changed})
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
def log_command(agent: str, command: str, exit_code: int) -> None:
|
|
421
|
+
log_action(agent, "command_exec", command, {"exit_code": exit_code})
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
def log_pr_created(agent: str, pr_url: str, files_changed: list[str]) -> None:
|
|
425
|
+
log_action(agent, "pr_created", pr_url, {"files_changed": files_changed})
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
# Usage example:
|
|
429
|
+
# log_file_write("claude-code", "src/api/handler.py", 42)
|
|
430
|
+
# log_command("claude-code", "npm test", 0)
|
|
431
|
+
# log_pr_created("claude-code", "https://github.com/org/repo/pull/99", ["src/main.py"])
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Querying the Audit Log
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
#!/bin/bash
|
|
438
|
+
# query-agent-audit.sh
|
|
439
|
+
# Query agent audit logs for compliance reporting
|
|
440
|
+
|
|
441
|
+
LOG_FILE="/var/log/ai-agents/agent-actions.jsonl"
|
|
442
|
+
|
|
443
|
+
echo "=== Agent Activity Summary ==="
|
|
444
|
+
|
|
445
|
+
echo ""
|
|
446
|
+
echo "Actions by agent (last 24h):"
|
|
447
|
+
jq -r 'select(.timestamp > (now - 86400 | todate)) | .agent' "$LOG_FILE" \
|
|
448
|
+
| sort | uniq -c | sort -rn
|
|
449
|
+
|
|
450
|
+
echo ""
|
|
451
|
+
echo "File writes by agent:"
|
|
452
|
+
jq -r 'select(.action == "file_write") | "\(.agent) -> \(.target)"' "$LOG_FILE" \
|
|
453
|
+
| sort | uniq -c | sort -rn
|
|
454
|
+
|
|
455
|
+
echo ""
|
|
456
|
+
echo "Commands executed:"
|
|
457
|
+
jq -r 'select(.action == "command_exec") | "\(.agent): \(.target) (exit: \(.details.exit_code))"' "$LOG_FILE" \
|
|
458
|
+
| tail -20
|
|
459
|
+
|
|
460
|
+
echo ""
|
|
461
|
+
echo "PRs created by agents:"
|
|
462
|
+
jq -r 'select(.action == "pr_created") | "\(.agent): \(.target)"' "$LOG_FILE"
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
## Team Policies
|
|
469
|
+
|
|
470
|
+
### Agent Usage Policy Template
|
|
471
|
+
|
|
472
|
+
```yaml
|
|
473
|
+
# .github/agent-policy.yaml
|
|
474
|
+
# Team policy for AI coding agent usage
|
|
475
|
+
|
|
476
|
+
policy:
|
|
477
|
+
version: "1.0"
|
|
478
|
+
last_updated: "2025-06-01"
|
|
479
|
+
|
|
480
|
+
general:
|
|
481
|
+
- All developers may use AI coding agents for code generation
|
|
482
|
+
- Agent-generated code has the same quality and security bar as human code
|
|
483
|
+
- Developers are responsible for all code they submit, regardless of origin
|
|
484
|
+
|
|
485
|
+
required_review:
|
|
486
|
+
standard_code:
|
|
487
|
+
min_reviewers: 1
|
|
488
|
+
agent_generated: 2
|
|
489
|
+
infrastructure_changes:
|
|
490
|
+
min_reviewers: 2
|
|
491
|
+
agent_generated: "blocked" # Agents may not modify infra
|
|
492
|
+
security_sensitive:
|
|
493
|
+
min_reviewers: 2
|
|
494
|
+
requires: ["security-team-member"]
|
|
495
|
+
agent_generated: 2
|
|
496
|
+
additional_requires: ["security-team-lead"]
|
|
497
|
+
|
|
498
|
+
escalation:
|
|
499
|
+
- type: "dependency_addition"
|
|
500
|
+
action: "require security review"
|
|
501
|
+
- type: "auth_or_crypto_changes"
|
|
502
|
+
action: "require security team approval"
|
|
503
|
+
- type: "ci_cd_changes"
|
|
504
|
+
action: "blocked for agents"
|
|
505
|
+
- type: "database_migration"
|
|
506
|
+
action: "require DBA review"
|
|
507
|
+
- type: "api_contract_change"
|
|
508
|
+
action: "require API owner approval"
|
|
509
|
+
|
|
510
|
+
allowed_use_cases:
|
|
511
|
+
- "Writing unit and integration tests"
|
|
512
|
+
- "Implementing well-specified features with clear requirements"
|
|
513
|
+
- "Refactoring code with existing test coverage"
|
|
514
|
+
- "Writing documentation and code comments"
|
|
515
|
+
- "Fixing linter warnings and code style issues"
|
|
516
|
+
- "Generating boilerplate code from templates"
|
|
517
|
+
|
|
518
|
+
prohibited_use_cases:
|
|
519
|
+
- "Modifying authentication or authorization logic"
|
|
520
|
+
- "Writing or changing cryptographic implementations"
|
|
521
|
+
- "Modifying CI/CD pipelines or deployment configs"
|
|
522
|
+
- "Changing infrastructure-as-code without human authorship"
|
|
523
|
+
- "Accessing production databases or systems"
|
|
524
|
+
- "Modifying security controls or audit logging"
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### CODEOWNERS for Agent Oversight
|
|
528
|
+
|
|
529
|
+
```text
|
|
530
|
+
# .github/CODEOWNERS
|
|
531
|
+
# Require specific reviewers for agent-sensitive areas
|
|
532
|
+
|
|
533
|
+
# All agent-generated branches require security team review
|
|
534
|
+
# (enforced via branch protection rules for ai/* and agent/* branches)
|
|
535
|
+
|
|
536
|
+
# Infrastructure is off-limits to agents and requires platform team
|
|
537
|
+
/infrastructure/ @platform-team
|
|
538
|
+
/terraform/ @platform-team
|
|
539
|
+
/.github/workflows/ @platform-team @security-team
|
|
540
|
+
|
|
541
|
+
# Security-sensitive code requires security team
|
|
542
|
+
/src/auth/ @security-team
|
|
543
|
+
/src/crypto/ @security-team
|
|
544
|
+
/src/middleware/auth* @security-team
|
|
545
|
+
|
|
546
|
+
# Dependency files require security review
|
|
547
|
+
package.json @security-team @tech-leads
|
|
548
|
+
package-lock.json @security-team
|
|
549
|
+
requirements.txt @security-team @tech-leads
|
|
550
|
+
go.sum @security-team
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
## Testing Agent Output
|
|
557
|
+
|
|
558
|
+
### Mandatory Test Coverage for Agent Code
|
|
559
|
+
|
|
560
|
+
```yaml
|
|
561
|
+
# .github/workflows/agent-test-gate.yaml
|
|
562
|
+
name: Agent Code Test Gate
|
|
563
|
+
|
|
564
|
+
on:
|
|
565
|
+
pull_request:
|
|
566
|
+
types: [opened, synchronize]
|
|
567
|
+
|
|
568
|
+
jobs:
|
|
569
|
+
test-coverage:
|
|
570
|
+
runs-on: ubuntu-latest
|
|
571
|
+
steps:
|
|
572
|
+
- uses: actions/checkout@v4
|
|
573
|
+
with:
|
|
574
|
+
fetch-depth: 0
|
|
575
|
+
|
|
576
|
+
- name: Detect changed files
|
|
577
|
+
id: changes
|
|
578
|
+
run: |
|
|
579
|
+
FILES=$(git diff --name-only origin/main...HEAD -- '*.py' '*.js' '*.ts' '*.go')
|
|
580
|
+
echo "changed_files=$FILES" >> "$GITHUB_OUTPUT"
|
|
581
|
+
|
|
582
|
+
- name: Run tests with coverage
|
|
583
|
+
run: |
|
|
584
|
+
# Python
|
|
585
|
+
if ls tests/*.py &>/dev/null; then
|
|
586
|
+
pip install pytest pytest-cov
|
|
587
|
+
pytest --cov=src --cov-report=json --cov-fail-under=80
|
|
588
|
+
fi
|
|
589
|
+
|
|
590
|
+
# Node.js
|
|
591
|
+
if [ -f package.json ]; then
|
|
592
|
+
npm ci
|
|
593
|
+
npm test -- --coverage --coverageThreshold='{"global":{"branches":80,"functions":80,"lines":80}}'
|
|
594
|
+
fi
|
|
595
|
+
|
|
596
|
+
- name: Verify new code has tests
|
|
597
|
+
run: |
|
|
598
|
+
NEW_FILES=$(git diff --name-only --diff-filter=A origin/main...HEAD -- 'src/**')
|
|
599
|
+
for file in $NEW_FILES; do
|
|
600
|
+
base=$(basename "$file" | sed 's/\.[^.]*$//')
|
|
601
|
+
if ! find tests/ -name "*${base}*" | grep -q .; then
|
|
602
|
+
echo "::error::New file $file has no corresponding test file"
|
|
603
|
+
exit 1
|
|
604
|
+
fi
|
|
605
|
+
done
|
|
606
|
+
|
|
607
|
+
security-scan:
|
|
608
|
+
runs-on: ubuntu-latest
|
|
609
|
+
steps:
|
|
610
|
+
- uses: actions/checkout@v4
|
|
611
|
+
|
|
612
|
+
- name: Run Bandit (Python)
|
|
613
|
+
if: hashFiles('**/*.py') != ''
|
|
614
|
+
run: |
|
|
615
|
+
pip install bandit
|
|
616
|
+
bandit -r src/ -f json -o bandit-report.json || true
|
|
617
|
+
ISSUES=$(jq '.results | length' bandit-report.json)
|
|
618
|
+
if [ "$ISSUES" -gt 0 ]; then
|
|
619
|
+
echo "::warning::Bandit found $ISSUES security issue(s) in agent-generated code"
|
|
620
|
+
jq -r '.results[] | " \(.severity): \(.issue_text) in \(.filename):\(.line_number)"' bandit-report.json
|
|
621
|
+
fi
|
|
622
|
+
|
|
623
|
+
- name: Run ESLint security plugin (JavaScript/TypeScript)
|
|
624
|
+
if: hashFiles('**/*.js') != '' || hashFiles('**/*.ts') != ''
|
|
625
|
+
run: |
|
|
626
|
+
npm ci
|
|
627
|
+
npx eslint --no-eslintrc \
|
|
628
|
+
--plugin security \
|
|
629
|
+
--rule '{"security/detect-eval-with-expression": "error"}' \
|
|
630
|
+
--rule '{"security/detect-non-literal-fs-filename": "warn"}' \
|
|
631
|
+
--rule '{"security/detect-possible-timing-attacks": "error"}' \
|
|
632
|
+
--rule '{"security/detect-no-csrf-before-method-override": "error"}' \
|
|
633
|
+
src/ || true
|
|
634
|
+
|
|
635
|
+
mutation-testing:
|
|
636
|
+
runs-on: ubuntu-latest
|
|
637
|
+
steps:
|
|
638
|
+
- uses: actions/checkout@v4
|
|
639
|
+
|
|
640
|
+
- name: Run mutation testing on agent-changed files
|
|
641
|
+
run: |
|
|
642
|
+
CHANGED=$(git diff --name-only origin/main...HEAD -- 'src/**/*.py')
|
|
643
|
+
if [ -n "$CHANGED" ]; then
|
|
644
|
+
pip install mutmut
|
|
645
|
+
for file in $CHANGED; do
|
|
646
|
+
echo "Mutation testing: $file"
|
|
647
|
+
mutmut run --paths-to-mutate="$file" --no-progress || true
|
|
648
|
+
done
|
|
649
|
+
mutmut results
|
|
650
|
+
fi
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
### Pre-merge Validation Script
|
|
654
|
+
|
|
655
|
+
```bash
|
|
656
|
+
#!/bin/bash
|
|
657
|
+
# validate-agent-pr.sh
|
|
658
|
+
# Run all validation checks before merging an agent-generated PR
|
|
659
|
+
|
|
660
|
+
set -euo pipefail
|
|
661
|
+
|
|
662
|
+
PR_BRANCH="${1:?Usage: validate-agent-pr.sh <branch-name>}"
|
|
663
|
+
RED='\033[0;31m'
|
|
664
|
+
GREEN='\033[0;32m'
|
|
665
|
+
YELLOW='\033[1;33m'
|
|
666
|
+
NC='\033[0m'
|
|
667
|
+
|
|
668
|
+
PASS=0
|
|
669
|
+
FAIL=0
|
|
670
|
+
WARN=0
|
|
671
|
+
|
|
672
|
+
check() {
|
|
673
|
+
local name="$1"
|
|
674
|
+
shift
|
|
675
|
+
if "$@" >/dev/null 2>&1; then
|
|
676
|
+
echo -e "${GREEN}PASS${NC}: $name"
|
|
677
|
+
((PASS++))
|
|
678
|
+
else
|
|
679
|
+
echo -e "${RED}FAIL${NC}: $name"
|
|
680
|
+
((FAIL++))
|
|
681
|
+
fi
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
warn_check() {
|
|
685
|
+
local name="$1"
|
|
686
|
+
shift
|
|
687
|
+
if "$@" >/dev/null 2>&1; then
|
|
688
|
+
echo -e "${GREEN}PASS${NC}: $name"
|
|
689
|
+
((PASS++))
|
|
690
|
+
else
|
|
691
|
+
echo -e "${YELLOW}WARN${NC}: $name"
|
|
692
|
+
((WARN++))
|
|
693
|
+
fi
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
echo "Validating agent PR: $PR_BRANCH"
|
|
697
|
+
echo "=============================="
|
|
698
|
+
|
|
699
|
+
# Check that branch follows naming convention
|
|
700
|
+
check "Branch naming convention" [[ "$PR_BRANCH" == ai/* || "$PR_BRANCH" == agent/* ]]
|
|
701
|
+
|
|
702
|
+
# Check for secrets in diff
|
|
703
|
+
check "No secrets in diff" git secrets --scan
|
|
704
|
+
|
|
705
|
+
# Check that tests pass
|
|
706
|
+
check "Test suite passes" npm test
|
|
707
|
+
|
|
708
|
+
# Check test coverage threshold
|
|
709
|
+
warn_check "Coverage above 80%" npm test -- --coverage --coverageThreshold='{"global":{"lines":80}}'
|
|
710
|
+
|
|
711
|
+
# Check for forbidden file modifications
|
|
712
|
+
FORBIDDEN_CHANGES=$(git diff --name-only origin/main..."$PR_BRANCH" -- \
|
|
713
|
+
'infrastructure/' 'terraform/' '.github/workflows/' '.env*' '*.pem' '*.key')
|
|
714
|
+
check "No forbidden file changes" [ -z "$FORBIDDEN_CHANGES" ]
|
|
715
|
+
|
|
716
|
+
# Check for new dependencies
|
|
717
|
+
DEP_CHANGES=$(git diff --name-only origin/main..."$PR_BRANCH" -- \
|
|
718
|
+
'package.json' 'requirements.txt' 'go.mod' 'Cargo.toml')
|
|
719
|
+
warn_check "No dependency changes" [ -z "$DEP_CHANGES" ]
|
|
720
|
+
|
|
721
|
+
# Check commit messages have AI trailers
|
|
722
|
+
MISSING_TRAILERS=$(git log origin/main.."$PR_BRANCH" --format='%B' \
|
|
723
|
+
| grep -cL "AI-Generated-By:" || true)
|
|
724
|
+
warn_check "All commits have AI attribution trailers" [ "$MISSING_TRAILERS" -eq 0 ]
|
|
725
|
+
|
|
726
|
+
echo ""
|
|
727
|
+
echo "=============================="
|
|
728
|
+
echo -e "Results: ${GREEN}${PASS} passed${NC}, ${RED}${FAIL} failed${NC}, ${YELLOW}${WARN} warnings${NC}"
|
|
729
|
+
|
|
730
|
+
if [ "$FAIL" -gt 0 ]; then
|
|
731
|
+
echo -e "${RED}PR validation FAILED. Address issues before merging.${NC}"
|
|
732
|
+
exit 1
|
|
733
|
+
fi
|
|
734
|
+
|
|
735
|
+
echo -e "${GREEN}PR validation passed.${NC}"
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
## Quick Reference
|
|
742
|
+
|
|
743
|
+
| Control | Tool | Purpose |
|
|
744
|
+
|---|---|---|
|
|
745
|
+
| Permission boundaries | CLAUDE.md, .cursorrules, codex.md | Restrict agent behavior per-repo |
|
|
746
|
+
| Secret scanning | git-secrets, pre-commit hooks | Block credential leaks |
|
|
747
|
+
| Sandbox isolation | Docker, seccomp, network=none | Contain agent execution |
|
|
748
|
+
| Code review gates | GitHub Actions, branch protection | Enforce human review |
|
|
749
|
+
| Network controls | iptables, Squid proxy | Limit agent internet access |
|
|
750
|
+
| Audit trail | Git trailers, JSONL logger | Track AI-generated code |
|
|
751
|
+
| Test requirements | Coverage gates, mutation testing | Validate agent output quality |
|
|
752
|
+
| Team policies | agent-policy.yaml, CODEOWNERS | Govern agent usage org-wide |
|
|
753
|
+
|