opencode-skills-collection 4.0.68 → 4.0.70
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 +304 -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/api-integration-architect/SKILL.md +241 -0
- package/bundled-skills/apify-generate-output-schema/SKILL.md +438 -0
- package/bundled-skills/apify-integration-development/SKILL.md +168 -0
- package/bundled-skills/apify-integration-development/references/ai-framework-package.md +158 -0
- package/bundled-skills/apify-integration-development/references/ai-harness-plugin.md +192 -0
- package/bundled-skills/apify-integration-development/references/sdk-integration.md +236 -0
- package/bundled-skills/apify-integration-development/references/workflow-automation.md +163 -0
- package/bundled-skills/apk-redteam-pipeline/SKILL.md +446 -0
- package/bundled-skills/architecture-review/README.md +42 -0
- package/bundled-skills/architecture-review/SKILL.md +77 -0
- package/bundled-skills/architecture-review/examples.md +11 -0
- package/bundled-skills/architecture-review/reference/best-practices.md +7 -0
- package/bundled-skills/architecture-review/reference/capabilities.md +20 -0
- package/bundled-skills/architecture-review/reference/fallbacks.md +11 -0
- package/bundled-skills/architecture-review/reference/graph.md +15 -0
- package/bundled-skills/architecture-review/reference/mcp.md +14 -0
- package/bundled-skills/architecture-review/reference/workflow.md +15 -0
- package/bundled-skills/architecture-review/templates/architecture-review.md +21 -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/code-review-sensei/SKILL.md +177 -0
- package/bundled-skills/codebase-onboarding/README.md +42 -0
- package/bundled-skills/codebase-onboarding/SKILL.md +77 -0
- package/bundled-skills/codebase-onboarding/examples.md +11 -0
- package/bundled-skills/codebase-onboarding/reference/best-practices.md +7 -0
- package/bundled-skills/codebase-onboarding/reference/capabilities.md +20 -0
- package/bundled-skills/codebase-onboarding/reference/fallbacks.md +11 -0
- package/bundled-skills/codebase-onboarding/reference/graph.md +15 -0
- package/bundled-skills/codebase-onboarding/reference/mcp.md +14 -0
- package/bundled-skills/codebase-onboarding/reference/workflow.md +15 -0
- package/bundled-skills/codebase-onboarding/templates/repository-onboarding.md +21 -0
- package/bundled-skills/connection-auth-rules/SKILL.md +199 -0
- package/bundled-skills/connection-auth-rules/fetch_schema.py +320 -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-analysis/README.md +42 -0
- package/bundled-skills/dependency-analysis/SKILL.md +76 -0
- package/bundled-skills/dependency-analysis/examples.md +11 -0
- package/bundled-skills/dependency-analysis/reference/best-practices.md +7 -0
- package/bundled-skills/dependency-analysis/reference/capabilities.md +20 -0
- package/bundled-skills/dependency-analysis/reference/fallbacks.md +11 -0
- package/bundled-skills/dependency-analysis/reference/graph.md +15 -0
- package/bundled-skills/dependency-analysis/reference/mcp.md +14 -0
- package/bundled-skills/dependency-analysis/reference/workflow.md +15 -0
- package/bundled-skills/dependency-analysis/templates/dependency-review.md +21 -0
- package/bundled-skills/dependency-scanning/SKILL.md +457 -0
- package/bundled-skills/devcontainers-nix/SKILL.md +416 -0
- package/bundled-skills/devops-pipeline-builder/SKILL.md +200 -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/eas-app-stores/SKILL.md +197 -0
- package/bundled-skills/eas-app-stores/agents/openai.yaml +4 -0
- package/bundled-skills/eas-app-stores/references/app-store-metadata.md +497 -0
- package/bundled-skills/eas-app-stores/references/ios-app-store.md +376 -0
- package/bundled-skills/eas-app-stores/references/native-ios.md +167 -0
- package/bundled-skills/eas-app-stores/references/play-store.md +244 -0
- package/bundled-skills/eas-app-stores/references/testflight.md +62 -0
- package/bundled-skills/eas-app-stores/references/workflows.md +120 -0
- package/bundled-skills/eas-hosting/SKILL.md +448 -0
- package/bundled-skills/eas-hosting/agents/openai.yaml +4 -0
- package/bundled-skills/eas-observe/SKILL.md +75 -0
- package/bundled-skills/eas-observe/agents/openai.yaml +4 -0
- package/bundled-skills/eas-observe/references/metrics.md +98 -0
- package/bundled-skills/eas-observe/references/queries.md +403 -0
- package/bundled-skills/eas-observe/references/setup.md +476 -0
- package/bundled-skills/eas-observe/references/third-party.md +136 -0
- package/bundled-skills/eas-simulator/SKILL.md +251 -0
- package/bundled-skills/eas-simulator/agents/openai.yaml +4 -0
- package/bundled-skills/eas-simulator/references/controllers.md +135 -0
- package/bundled-skills/eas-simulator/references/run-your-app.md +240 -0
- package/bundled-skills/eas-simulator/references/troubleshooting.md +47 -0
- package/bundled-skills/eas-workflows/SKILL.md +119 -0
- package/bundled-skills/eas-workflows/agents/openai.yaml +4 -0
- package/bundled-skills/eas-workflows/scripts/fetch.js +109 -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/expo-animation/LICENSE +21 -0
- package/bundled-skills/expo-animation/RECIPES.md +385 -0
- package/bundled-skills/expo-animation/SKILL.md +295 -0
- package/bundled-skills/expo-animation/agents/openai.yaml +4 -0
- package/bundled-skills/fact-check-x-unified/SKILL.md +178 -0
- package/bundled-skills/fact-check-x-unified/agents/openai.yaml +4 -0
- package/bundled-skills/fact-check-x-unified/references/acceptance-criteria.md +44 -0
- package/bundled-skills/fact-check-x-unified/references/contracts.md +39 -0
- package/bundled-skills/fact-check-x-unified/scripts/common.py +31 -0
- package/bundled-skills/fact-check-x-unified/scripts/fact_check_x.py +1832 -0
- package/bundled-skills/fact-check-x-unified/scripts/trusted_search_config.py +324 -0
- package/bundled-skills/fact-check-x-unified/tests/anchor_downgrade_test.py +90 -0
- package/bundled-skills/fact-check-x-unified/tests/multi_platform_test.py +369 -0
- package/bundled-skills/fact-check-x-unified/tests/smoke_test.py +740 -0
- package/bundled-skills/fact-check-x-unified/tests/stage_checkpoint_test.py +103 -0
- package/bundled-skills/fact-check-x-unified/tests/trusted_search_config_test.py +156 -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/gpt-taste/SKILL.md +8 -1
- 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/hf-cli/SKILL.md +263 -0
- package/bundled-skills/hipaa-compliance/SKILL.md +451 -0
- package/bundled-skills/huggingface-community-evals/SKILL.md +228 -0
- package/bundled-skills/huggingface-community-evals/examples/.env.example +3 -0
- package/bundled-skills/huggingface-community-evals/examples/USAGE_EXAMPLES.md +101 -0
- package/bundled-skills/huggingface-community-evals/scripts/inspect_eval_uv.py +104 -0
- package/bundled-skills/huggingface-community-evals/scripts/inspect_vllm_uv.py +306 -0
- package/bundled-skills/huggingface-community-evals/scripts/lighteval_vllm_uv.py +297 -0
- package/bundled-skills/huggingface-datasets/SKILL.md +130 -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-social/SKILL.md +182 -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/longbridge-derivatives/SKILL.md +117 -0
- package/bundled-skills/longbridge-derivatives/references/option.md +36 -0
- package/bundled-skills/longbridge-derivatives/references/options-advanced.md +101 -0
- package/bundled-skills/longbridge-derivatives/references/options-pnl.md +74 -0
- package/bundled-skills/longbridge-derivatives/references/options-strategy.md +82 -0
- package/bundled-skills/longbridge-derivatives/references/options-volatility.md +70 -0
- package/bundled-skills/longbridge-derivatives/references/warrant.md +12 -0
- package/bundled-skills/longbridge-quant/SKILL.md +151 -0
- package/bundled-skills/longbridge-quant/references/correlation.md +51 -0
- package/bundled-skills/longbridge-quant/references/execution-model.md +68 -0
- package/bundled-skills/longbridge-quant/references/factor-research.md +95 -0
- package/bundled-skills/longbridge-quant/references/factor-screen.md +101 -0
- package/bundled-skills/longbridge-quant/references/hedging.md +136 -0
- package/bundled-skills/longbridge-quant/references/ml-strategy.md +77 -0
- package/bundled-skills/longbridge-quant/references/multifactor.md +68 -0
- package/bundled-skills/longbridge-quant/references/pairs-trading.md +61 -0
- package/bundled-skills/longbridge-quant/references/quant-cli.md +133 -0
- package/bundled-skills/longbridge-quant/references/quant-stats.md +150 -0
- package/bundled-skills/longbridge-quant/references/seasonality.md +50 -0
- package/bundled-skills/longbridge-quant/references/strategy-optimizer.md +68 -0
- package/bundled-skills/longbridge-quant/references/volatility-strategy.md +52 -0
- package/bundled-skills/longbridge-research/SKILL.md +187 -0
- package/bundled-skills/longbridge-research/references/company-profile.md +96 -0
- package/bundled-skills/longbridge-research/references/company-tearsheet.md +82 -0
- package/bundled-skills/longbridge-research/references/competitive-analysis.md +81 -0
- package/bundled-skills/longbridge-research/references/consensus.md +92 -0
- package/bundled-skills/longbridge-research/references/coverage-initiation.md +76 -0
- package/bundled-skills/longbridge-research/references/defi-yield.md +60 -0
- package/bundled-skills/longbridge-research/references/finance-calendar.md +165 -0
- package/bundled-skills/longbridge-research/references/financial-planning.md +77 -0
- package/bundled-skills/longbridge-research/references/forecast-eps.md +39 -0
- package/bundled-skills/longbridge-research/references/fund-holder.md +44 -0
- package/bundled-skills/longbridge-research/references/hkipo-analysis.md +101 -0
- package/bundled-skills/longbridge-research/references/industry-peers.md +46 -0
- package/bundled-skills/longbridge-research/references/industry-rank.md +62 -0
- package/bundled-skills/longbridge-research/references/insider-trades.md +48 -0
- package/bundled-skills/longbridge-research/references/institution-rating.md +62 -0
- package/bundled-skills/longbridge-research/references/investment-ideas.md +69 -0
- package/bundled-skills/longbridge-research/references/investment-proposal.md +95 -0
- package/bundled-skills/longbridge-research/references/investors.md +87 -0
- package/bundled-skills/longbridge-research/references/onchain.md +70 -0
- package/bundled-skills/longbridge-research/references/post-investment.md +76 -0
- package/bundled-skills/longbridge-research/references/shareholder.md +72 -0
- package/bundled-skills/longbridge-research/references/short-positions.md +50 -0
- package/bundled-skills/longbridge-research/references/short-trades.md +50 -0
- package/bundled-skills/longbridge-research/references/stock-research.md +61 -0
- package/bundled-skills/longbridge-research/references/thesis-tracker.md +64 -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/makepad-2-0-animation/SKILL.md +318 -0
- package/bundled-skills/makepad-2-0-animation/references/animator-reference.md +433 -0
- package/bundled-skills/makepad-2-0-dsl/SKILL.md +492 -0
- package/bundled-skills/makepad-2-0-dsl/references/dsl-syntax-reference.md +511 -0
- package/bundled-skills/makepad-2-0-dsl/references/extended-guide.md +56 -0
- package/bundled-skills/makepad-2-0-dsl/references/property-system.md +757 -0
- package/bundled-skills/makepad-2-0-events/SKILL.md +497 -0
- package/bundled-skills/makepad-2-0-events/references/event-patterns.md +802 -0
- package/bundled-skills/makepad-2-0-events/references/extended-guide.md +590 -0
- package/bundled-skills/makepad-2-0-layout/SKILL.md +499 -0
- package/bundled-skills/makepad-2-0-layout/references/extended-guide.md +243 -0
- package/bundled-skills/makepad-2-0-layout/references/layout-patterns.md +881 -0
- package/bundled-skills/makepad-2-0-widgets/SKILL.md +261 -0
- package/bundled-skills/makepad-2-0-widgets/references/widget-advanced.md +648 -0
- package/bundled-skills/makepad-2-0-widgets/references/widget-catalog.md +547 -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/meeting-distiller-pro/SKILL.md +120 -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/monte-carlo-analyze-root-cause/SKILL.md +12 -1
- package/bundled-skills/monte-carlo-asset-health/SKILL.md +12 -1
- package/bundled-skills/monte-carlo-context-detection/SKILL.md +170 -0
- package/bundled-skills/monte-carlo-context-detection/references/signal-definitions.md +46 -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/remotion-captions/SKILL.md +57 -0
- package/bundled-skills/remotion-captions/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-captions/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-captions/display-captions.md +190 -0
- package/bundled-skills/remotion-captions/import-srt-captions.md +73 -0
- package/bundled-skills/remotion-captions/transcribe-captions.md +70 -0
- package/bundled-skills/remotion-create/SKILL.md +106 -0
- package/bundled-skills/remotion-create/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-create/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-create/tailwind.md +11 -0
- package/bundled-skills/remotion-create/video-layout.md +9 -0
- package/bundled-skills/remotion-docs/SKILL.md +67 -0
- package/bundled-skills/remotion-docs/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-docs/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-interactivity/SKILL.md +270 -0
- package/bundled-skills/remotion-interactivity/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-interactivity/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-render/SKILL.md +48 -0
- package/bundled-skills/remotion-render/agents/openai.yaml +7 -0
- package/bundled-skills/remotion-render/assets/remotion-icon.svg +4 -0
- package/bundled-skills/remotion-render/transparent-videos.md +106 -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-pricing-strategist/SKILL.md +169 -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/score-eval/SKILL.md +35 -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/writing-guidelines/SKILL.md +60 -0
- package/bundled-skills/zero-trust/SKILL.md +461 -0
- package/package.json +1 -1
- package/skills_index.json +7874 -277
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
# Details (moved from SKILL.md)
|
|
2
|
+
|
|
3
|
+
> Extended reference content for `llm-app-security`, kept under `references/` so the entrypoint stays within the audit budget.
|
|
4
|
+
|
|
5
|
+
## Secure RAG Pipeline
|
|
6
|
+
|
|
7
|
+
Retrieval-Augmented Generation introduces a document supply chain. Every stage -- ingestion, indexing, retrieval, and generation -- has its own attack surface.
|
|
8
|
+
|
|
9
|
+
### Document Ingestion Scanning
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
import hashlib
|
|
13
|
+
import magic # python-magic
|
|
14
|
+
import clamd
|
|
15
|
+
|
|
16
|
+
def scan_document(file_path: str, allowed_types: set = None) -> dict:
|
|
17
|
+
"""Scan an uploaded document before indexing."""
|
|
18
|
+
if allowed_types is None:
|
|
19
|
+
allowed_types = {
|
|
20
|
+
"application/pdf", "text/plain", "text/markdown",
|
|
21
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
mime = magic.from_file(file_path, mime=True)
|
|
25
|
+
if mime not in allowed_types:
|
|
26
|
+
return {"safe": False, "reason": f"disallowed_type: {mime}"}
|
|
27
|
+
|
|
28
|
+
# ClamAV malware scan
|
|
29
|
+
cd = clamd.ClamdUnixSocket()
|
|
30
|
+
scan_result = cd.scan(file_path)
|
|
31
|
+
if scan_result and scan_result[file_path][0] == "FOUND":
|
|
32
|
+
return {"safe": False, "reason": f"malware: {scan_result[file_path][1]}"}
|
|
33
|
+
|
|
34
|
+
# Compute content hash for provenance
|
|
35
|
+
with open(file_path, "rb") as f:
|
|
36
|
+
sha256 = hashlib.sha256(f.read()).hexdigest()
|
|
37
|
+
|
|
38
|
+
return {"safe": True, "sha256": sha256, "mime": mime}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Secret Detection in Documents
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import re
|
|
45
|
+
|
|
46
|
+
SECRET_PATTERNS = [
|
|
47
|
+
(r"AKIA[0-9A-Z]{16}", "AWS Access Key"),
|
|
48
|
+
(r"ghp_[A-Za-z0-9_]{36}", "GitHub PAT"),
|
|
49
|
+
(r"sk-[A-Za-z0-9]{48}", "OpenAI API Key"),
|
|
50
|
+
(r"-----BEGIN (RSA |EC )?PRIVATE KEY-----", "Private Key"),
|
|
51
|
+
(r"xox[bpsar]-[A-Za-z0-9-]+", "Slack Token"),
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
def scan_for_secrets(text: str) -> list[dict]:
|
|
55
|
+
findings = []
|
|
56
|
+
for pattern, label in SECRET_PATTERNS:
|
|
57
|
+
for match in re.finditer(pattern, text):
|
|
58
|
+
findings.append({
|
|
59
|
+
"type": label,
|
|
60
|
+
"start": match.start(),
|
|
61
|
+
"end": match.end(),
|
|
62
|
+
"snippet": text[max(0, match.start()-10):match.end()+10],
|
|
63
|
+
})
|
|
64
|
+
return findings
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Access-Controlled Retrieval (Pinecone)
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from pinecone import Pinecone
|
|
71
|
+
|
|
72
|
+
pc = Pinecone(api_key="YOUR_KEY")
|
|
73
|
+
index = pc.Index("knowledge-base")
|
|
74
|
+
|
|
75
|
+
def retrieve_for_user(query_embedding: list[float], user: dict, top_k: int = 5):
|
|
76
|
+
"""Retrieve documents the user is authorized to see."""
|
|
77
|
+
# Build a metadata filter that enforces tenant + role boundaries.
|
|
78
|
+
filter_expr = {
|
|
79
|
+
"$and": [
|
|
80
|
+
{"tenant_id": {"$eq": user["tenant_id"]}},
|
|
81
|
+
{
|
|
82
|
+
"$or": [
|
|
83
|
+
{"access_level": {"$eq": "public"}},
|
|
84
|
+
{"access_roles": {"$in": user["roles"]}},
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
results = index.query(
|
|
91
|
+
vector=query_embedding,
|
|
92
|
+
top_k=top_k,
|
|
93
|
+
filter=filter_expr,
|
|
94
|
+
include_metadata=True,
|
|
95
|
+
)
|
|
96
|
+
return results["matches"]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Access-Controlled Retrieval (Weaviate)
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import weaviate
|
|
103
|
+
|
|
104
|
+
client = weaviate.connect_to_local()
|
|
105
|
+
|
|
106
|
+
def retrieve_weaviate(query: str, tenant_id: str, roles: list[str], limit: int = 5):
|
|
107
|
+
collection = client.collections.get("Document")
|
|
108
|
+
response = collection.query.near_text(
|
|
109
|
+
query=query,
|
|
110
|
+
limit=limit,
|
|
111
|
+
filters=(
|
|
112
|
+
weaviate.classes.query.Filter.by_property("tenant_id").equal(tenant_id)
|
|
113
|
+
& (
|
|
114
|
+
weaviate.classes.query.Filter.by_property("access_level").equal("public")
|
|
115
|
+
| weaviate.classes.query.Filter.by_property("access_role").contains_any(roles)
|
|
116
|
+
)
|
|
117
|
+
),
|
|
118
|
+
return_metadata=weaviate.classes.query.MetadataQuery(distance=True),
|
|
119
|
+
)
|
|
120
|
+
return response.objects
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Provenance Tracking
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
def attach_provenance(response_text: str, source_docs: list[dict]) -> dict:
|
|
127
|
+
"""Wrap the LLM response with source attribution."""
|
|
128
|
+
citations = []
|
|
129
|
+
for doc in source_docs:
|
|
130
|
+
citations.append({
|
|
131
|
+
"doc_id": doc["id"],
|
|
132
|
+
"title": doc["metadata"].get("title", "Unknown"),
|
|
133
|
+
"sha256": doc["metadata"].get("sha256"),
|
|
134
|
+
"chunk_index": doc["metadata"].get("chunk_index"),
|
|
135
|
+
"score": doc.get("score"),
|
|
136
|
+
})
|
|
137
|
+
return {
|
|
138
|
+
"answer": response_text,
|
|
139
|
+
"citations": citations,
|
|
140
|
+
"citation_count": len(citations),
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## Tenant Isolation
|
|
148
|
+
|
|
149
|
+
In multi-tenant systems, one customer must never see another customer's data -- in prompts, retrieval results, conversation history, or logs.
|
|
150
|
+
|
|
151
|
+
### Namespace Isolation in Pinecone
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
def get_tenant_index(tenant_id: str):
|
|
155
|
+
"""Each tenant gets its own namespace inside the shared index."""
|
|
156
|
+
pc = Pinecone(api_key="YOUR_KEY")
|
|
157
|
+
index = pc.Index("shared-knowledge-base")
|
|
158
|
+
# All operations scoped to a namespace
|
|
159
|
+
return index, tenant_id # pass namespace= to every call
|
|
160
|
+
|
|
161
|
+
def upsert_tenant_docs(tenant_id: str, vectors: list[dict]):
|
|
162
|
+
index, ns = get_tenant_index(tenant_id)
|
|
163
|
+
index.upsert(vectors=vectors, namespace=ns)
|
|
164
|
+
|
|
165
|
+
def query_tenant(tenant_id: str, embedding: list[float], top_k: int = 5):
|
|
166
|
+
index, ns = get_tenant_index(tenant_id)
|
|
167
|
+
return index.query(vector=embedding, top_k=top_k, namespace=ns,
|
|
168
|
+
include_metadata=True)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Session Boundary Enforcement (Redis)
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
import redis
|
|
175
|
+
import json
|
|
176
|
+
import uuid
|
|
177
|
+
|
|
178
|
+
r = redis.Redis(host="localhost", port=6379, decode_responses=True)
|
|
179
|
+
|
|
180
|
+
SESSION_TTL = 3600 # 1 hour
|
|
181
|
+
|
|
182
|
+
def create_session(tenant_id: str, user_id: str) -> str:
|
|
183
|
+
session_id = str(uuid.uuid4())
|
|
184
|
+
key = f"session:{session_id}"
|
|
185
|
+
r.hset(key, mapping={
|
|
186
|
+
"tenant_id": tenant_id,
|
|
187
|
+
"user_id": user_id,
|
|
188
|
+
"messages": json.dumps([]),
|
|
189
|
+
})
|
|
190
|
+
r.expire(key, SESSION_TTL)
|
|
191
|
+
return session_id
|
|
192
|
+
|
|
193
|
+
def append_message(session_id: str, tenant_id: str, role: str, content: str):
|
|
194
|
+
key = f"session:{session_id}"
|
|
195
|
+
session = r.hgetall(key)
|
|
196
|
+
if not session:
|
|
197
|
+
raise ValueError("session_expired")
|
|
198
|
+
if session["tenant_id"] != tenant_id:
|
|
199
|
+
raise PermissionError("tenant_mismatch")
|
|
200
|
+
|
|
201
|
+
messages = json.loads(session["messages"])
|
|
202
|
+
messages.append({"role": role, "content": content})
|
|
203
|
+
r.hset(key, "messages", json.dumps(messages))
|
|
204
|
+
r.expire(key, SESSION_TTL) # refresh TTL
|
|
205
|
+
|
|
206
|
+
def get_history(session_id: str, tenant_id: str) -> list[dict]:
|
|
207
|
+
key = f"session:{session_id}"
|
|
208
|
+
session = r.hgetall(key)
|
|
209
|
+
if not session:
|
|
210
|
+
return []
|
|
211
|
+
if session["tenant_id"] != tenant_id:
|
|
212
|
+
raise PermissionError("tenant_mismatch")
|
|
213
|
+
return json.loads(session["messages"])
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Conversation Memory Isolation (Node.js)
|
|
217
|
+
|
|
218
|
+
```javascript
|
|
219
|
+
const Redis = require("ioredis");
|
|
220
|
+
const redis = new Redis();
|
|
221
|
+
|
|
222
|
+
const SESSION_TTL = 3600;
|
|
223
|
+
|
|
224
|
+
async function createSession(tenantId, userId) {
|
|
225
|
+
const sessionId = crypto.randomUUID();
|
|
226
|
+
const key = `session:${sessionId}`;
|
|
227
|
+
await redis.hmset(key, {
|
|
228
|
+
tenant_id: tenantId,
|
|
229
|
+
user_id: userId,
|
|
230
|
+
messages: JSON.stringify([]),
|
|
231
|
+
});
|
|
232
|
+
await redis.expire(key, SESSION_TTL);
|
|
233
|
+
return sessionId;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async function appendMessage(sessionId, tenantId, role, content) {
|
|
237
|
+
const key = `session:${sessionId}`;
|
|
238
|
+
const session = await redis.hgetall(key);
|
|
239
|
+
if (!session || !session.tenant_id) throw new Error("session_expired");
|
|
240
|
+
if (session.tenant_id !== tenantId) throw new Error("tenant_mismatch");
|
|
241
|
+
|
|
242
|
+
const messages = JSON.parse(session.messages);
|
|
243
|
+
messages.push({ role, content });
|
|
244
|
+
await redis.hset(key, "messages", JSON.stringify(messages));
|
|
245
|
+
await redis.expire(key, SESSION_TTL);
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
## Rate Limiting
|
|
253
|
+
|
|
254
|
+
LLM calls are expensive. Without rate limiting, a single abusive user can exhaust your budget or degrade service for everyone.
|
|
255
|
+
|
|
256
|
+
### Per-User Token Budget (Python + Redis)
|
|
257
|
+
|
|
258
|
+
```python
|
|
259
|
+
import time
|
|
260
|
+
import redis
|
|
261
|
+
|
|
262
|
+
r = redis.Redis(host="localhost", port=6379, decode_responses=True)
|
|
263
|
+
|
|
264
|
+
# Budget: 100,000 tokens per user per hour
|
|
265
|
+
TOKEN_BUDGET = 100_000
|
|
266
|
+
WINDOW_SECONDS = 3600
|
|
267
|
+
|
|
268
|
+
def check_and_deduct(user_id: str, tokens_used: int) -> dict:
|
|
269
|
+
key = f"token_budget:{user_id}"
|
|
270
|
+
now = int(time.time())
|
|
271
|
+
|
|
272
|
+
current = r.hgetall(key)
|
|
273
|
+
if not current or int(current.get("window_start", 0)) < now - WINDOW_SECONDS:
|
|
274
|
+
# New window
|
|
275
|
+
r.hset(key, mapping={"used": tokens_used, "window_start": now})
|
|
276
|
+
r.expire(key, WINDOW_SECONDS)
|
|
277
|
+
return {"allowed": True, "remaining": TOKEN_BUDGET - tokens_used}
|
|
278
|
+
|
|
279
|
+
used = int(current["used"]) + tokens_used
|
|
280
|
+
if used > TOKEN_BUDGET:
|
|
281
|
+
return {"allowed": False, "remaining": 0, "retry_after":
|
|
282
|
+
WINDOW_SECONDS - (now - int(current["window_start"]))}
|
|
283
|
+
|
|
284
|
+
r.hset(key, "used", used)
|
|
285
|
+
return {"allowed": True, "remaining": TOKEN_BUDGET - used}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Daily Cost Cap per Tenant
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
DAILY_COST_CAP_USD = 50.0
|
|
292
|
+
COST_PER_1K_INPUT = 0.003 # adjust per model
|
|
293
|
+
COST_PER_1K_OUTPUT = 0.015
|
|
294
|
+
|
|
295
|
+
def estimate_cost(input_tokens: int, output_tokens: int) -> float:
|
|
296
|
+
return (input_tokens / 1000 * COST_PER_1K_INPUT +
|
|
297
|
+
output_tokens / 1000 * COST_PER_1K_OUTPUT)
|
|
298
|
+
|
|
299
|
+
def check_cost_cap(tenant_id: str, input_tokens: int, output_tokens: int) -> dict:
|
|
300
|
+
key = f"daily_cost:{tenant_id}:{time.strftime('%Y-%m-%d')}"
|
|
301
|
+
cost = estimate_cost(input_tokens, output_tokens)
|
|
302
|
+
current = float(r.get(key) or 0)
|
|
303
|
+
|
|
304
|
+
if current + cost > DAILY_COST_CAP_USD:
|
|
305
|
+
return {"allowed": False, "spent": current, "cap": DAILY_COST_CAP_USD}
|
|
306
|
+
|
|
307
|
+
r.incrbyfloat(key, cost)
|
|
308
|
+
r.expire(key, 86400)
|
|
309
|
+
return {"allowed": True, "spent": current + cost, "cap": DAILY_COST_CAP_USD}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### NGINX Rate Limiting for the LLM Endpoint
|
|
313
|
+
|
|
314
|
+
```nginx
|
|
315
|
+
# /etc/nginx/conf.d/llm-rate-limit.conf
|
|
316
|
+
|
|
317
|
+
# Define a rate limit zone keyed on the API key header
|
|
318
|
+
limit_req_zone $http_x_api_key zone=llm_api:10m rate=10r/s;
|
|
319
|
+
|
|
320
|
+
# Define a connection limit zone
|
|
321
|
+
limit_conn_zone $http_x_api_key zone=llm_conn:10m;
|
|
322
|
+
|
|
323
|
+
server {
|
|
324
|
+
listen 443 ssl;
|
|
325
|
+
server_name api.example.com;
|
|
326
|
+
|
|
327
|
+
location /v1/chat {
|
|
328
|
+
# Burst of 20 requests, then delay
|
|
329
|
+
limit_req zone=llm_api burst=20 delay=10;
|
|
330
|
+
# Max 5 concurrent connections per API key
|
|
331
|
+
limit_conn llm_conn 5;
|
|
332
|
+
|
|
333
|
+
# Return 429 instead of 503
|
|
334
|
+
limit_req_status 429;
|
|
335
|
+
limit_conn_status 429;
|
|
336
|
+
|
|
337
|
+
proxy_pass http://llm-backend;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Kong API Gateway Rate Limiting
|
|
343
|
+
|
|
344
|
+
```yaml
|
|
345
|
+
# kong.yml - declarative config
|
|
346
|
+
plugins:
|
|
347
|
+
- name: rate-limiting-advanced
|
|
348
|
+
config:
|
|
349
|
+
limit:
|
|
350
|
+
- 100 # requests
|
|
351
|
+
window_size:
|
|
352
|
+
- 60 # per 60 seconds
|
|
353
|
+
identifier: consumer
|
|
354
|
+
strategy: redis
|
|
355
|
+
redis:
|
|
356
|
+
host: redis
|
|
357
|
+
port: 6379
|
|
358
|
+
retry_after_jitter_max: 1
|
|
359
|
+
route: llm-chat-route
|
|
360
|
+
|
|
361
|
+
- name: request-size-limiting
|
|
362
|
+
config:
|
|
363
|
+
allowed_payload_size: 64 # KB - prevents huge prompt payloads
|
|
364
|
+
route: llm-chat-route
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
## Monitoring and Alerting
|
|
371
|
+
|
|
372
|
+
Detecting attacks in real time is as important as preventing them. Instrument every stage of the LLM pipeline.
|
|
373
|
+
|
|
374
|
+
### Structured Logging for LLM Requests
|
|
375
|
+
|
|
376
|
+
```python
|
|
377
|
+
import structlog
|
|
378
|
+
import time
|
|
379
|
+
|
|
380
|
+
logger = structlog.get_logger()
|
|
381
|
+
|
|
382
|
+
def log_llm_request(
|
|
383
|
+
user_id: str,
|
|
384
|
+
tenant_id: str,
|
|
385
|
+
input_tokens: int,
|
|
386
|
+
output_tokens: int,
|
|
387
|
+
latency_ms: float,
|
|
388
|
+
injection_detected: bool,
|
|
389
|
+
pii_scrubbed: bool,
|
|
390
|
+
model: str,
|
|
391
|
+
):
|
|
392
|
+
logger.info(
|
|
393
|
+
"llm_request",
|
|
394
|
+
user_id=user_id,
|
|
395
|
+
tenant_id=tenant_id,
|
|
396
|
+
input_tokens=input_tokens,
|
|
397
|
+
output_tokens=output_tokens,
|
|
398
|
+
latency_ms=latency_ms,
|
|
399
|
+
injection_detected=injection_detected,
|
|
400
|
+
pii_scrubbed=pii_scrubbed,
|
|
401
|
+
model=model,
|
|
402
|
+
cost_usd=estimate_cost(input_tokens, output_tokens),
|
|
403
|
+
)
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Prompt Injection Alert (Prometheus + Alertmanager)
|
|
407
|
+
|
|
408
|
+
```yaml
|
|
409
|
+
# prometheus/rules/llm-security.yml
|
|
410
|
+
groups:
|
|
411
|
+
- name: llm-security
|
|
412
|
+
rules:
|
|
413
|
+
- alert: HighPromptInjectionRate
|
|
414
|
+
expr: |
|
|
415
|
+
sum(rate(llm_injection_detected_total[5m])) by (tenant_id)
|
|
416
|
+
/ sum(rate(llm_requests_total[5m])) by (tenant_id)
|
|
417
|
+
> 0.05
|
|
418
|
+
for: 2m
|
|
419
|
+
labels:
|
|
420
|
+
severity: critical
|
|
421
|
+
annotations:
|
|
422
|
+
summary: "Tenant {{ $labels.tenant_id }} has >5% prompt injection rate"
|
|
423
|
+
runbook: "https://wiki.internal/runbooks/llm-injection"
|
|
424
|
+
|
|
425
|
+
- alert: AnomalousCostSpike
|
|
426
|
+
expr: |
|
|
427
|
+
sum(increase(llm_cost_usd_total[1h])) by (tenant_id)
|
|
428
|
+
> 2 * sum(avg_over_time(llm_cost_usd_total[7d:1h])) by (tenant_id)
|
|
429
|
+
for: 10m
|
|
430
|
+
labels:
|
|
431
|
+
severity: warning
|
|
432
|
+
annotations:
|
|
433
|
+
summary: "Tenant {{ $labels.tenant_id }} cost is 2x the 7-day average"
|
|
434
|
+
|
|
435
|
+
- alert: HighTokenUsageSingleUser
|
|
436
|
+
expr: |
|
|
437
|
+
sum(increase(llm_tokens_total[1h])) by (user_id)
|
|
438
|
+
> 500000
|
|
439
|
+
for: 5m
|
|
440
|
+
labels:
|
|
441
|
+
severity: warning
|
|
442
|
+
annotations:
|
|
443
|
+
summary: "User {{ $labels.user_id }} consumed >500k tokens in 1 hour"
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Anomaly Detection in Usage Patterns
|
|
447
|
+
|
|
448
|
+
```python
|
|
449
|
+
from collections import defaultdict
|
|
450
|
+
import statistics
|
|
451
|
+
|
|
452
|
+
class UsageAnomalyDetector:
|
|
453
|
+
"""Simple z-score based anomaly detection for LLM usage."""
|
|
454
|
+
|
|
455
|
+
def __init__(self, window_size: int = 100, z_threshold: float = 3.0):
|
|
456
|
+
self.window_size = window_size
|
|
457
|
+
self.z_threshold = z_threshold
|
|
458
|
+
self.history = defaultdict(list) # user_id -> list of token counts
|
|
459
|
+
|
|
460
|
+
def record_and_check(self, user_id: str, token_count: int) -> dict:
|
|
461
|
+
history = self.history[user_id]
|
|
462
|
+
history.append(token_count)
|
|
463
|
+
|
|
464
|
+
if len(history) > self.window_size:
|
|
465
|
+
history.pop(0)
|
|
466
|
+
|
|
467
|
+
if len(history) < 10:
|
|
468
|
+
return {"anomaly": False, "reason": "insufficient_data"}
|
|
469
|
+
|
|
470
|
+
mean = statistics.mean(history[:-1])
|
|
471
|
+
stdev = statistics.stdev(history[:-1])
|
|
472
|
+
if stdev == 0:
|
|
473
|
+
return {"anomaly": False, "reason": "zero_variance"}
|
|
474
|
+
|
|
475
|
+
z_score = (token_count - mean) / stdev
|
|
476
|
+
is_anomaly = abs(z_score) > self.z_threshold
|
|
477
|
+
|
|
478
|
+
return {
|
|
479
|
+
"anomaly": is_anomaly,
|
|
480
|
+
"z_score": round(z_score, 2),
|
|
481
|
+
"mean": round(mean, 2),
|
|
482
|
+
"current": token_count,
|
|
483
|
+
}
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### Grafana Dashboard Query (PromQL)
|
|
487
|
+
|
|
488
|
+
```promql
|
|
489
|
+
# Request rate by tenant
|
|
490
|
+
sum(rate(llm_requests_total[5m])) by (tenant_id)
|
|
491
|
+
|
|
492
|
+
# Injection detection rate
|
|
493
|
+
sum(rate(llm_injection_detected_total[5m])) / sum(rate(llm_requests_total[5m]))
|
|
494
|
+
|
|
495
|
+
# P95 latency
|
|
496
|
+
histogram_quantile(0.95, sum(rate(llm_request_duration_seconds_bucket[5m])) by (le))
|
|
497
|
+
|
|
498
|
+
# Hourly cost by model
|
|
499
|
+
sum(increase(llm_cost_usd_total[1h])) by (model)
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
## Compliance
|
|
506
|
+
|
|
507
|
+
LLM applications generate and process data that falls under GDPR, CCPA, SOC 2, and industry-specific regulations. Address data retention, right-to-forget, and audit trails.
|
|
508
|
+
|
|
509
|
+
### Data Retention Policy for LLM Logs
|
|
510
|
+
|
|
511
|
+
```python
|
|
512
|
+
import datetime
|
|
513
|
+
import redis
|
|
514
|
+
|
|
515
|
+
r = redis.Redis(host="localhost", port=6379, decode_responses=True)
|
|
516
|
+
|
|
517
|
+
RETENTION_POLICIES = {
|
|
518
|
+
"conversation_logs": 90, # days
|
|
519
|
+
"audit_events": 365, # days
|
|
520
|
+
"raw_prompts": 30, # days - minimize exposure
|
|
521
|
+
"embeddings": 180, # days
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
def apply_retention_ttl(key: str, category: str):
|
|
525
|
+
days = RETENTION_POLICIES.get(category, 30)
|
|
526
|
+
r.expire(key, days * 86400)
|
|
527
|
+
|
|
528
|
+
def purge_expired_logs(db_conn, category: str):
|
|
529
|
+
"""Delete logs older than the retention period."""
|
|
530
|
+
cutoff = datetime.datetime.utcnow() - datetime.timedelta(
|
|
531
|
+
days=RETENTION_POLICIES[category]
|
|
532
|
+
)
|
|
533
|
+
db_conn.execute(
|
|
534
|
+
f"DELETE FROM {category} WHERE created_at < %s", (cutoff,)
|
|
535
|
+
)
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### GDPR Right-to-Forget for Embeddings
|
|
539
|
+
|
|
540
|
+
When a user requests deletion, you must remove their data from the vector store, conversation logs, and any derived embeddings.
|
|
541
|
+
|
|
542
|
+
```python
|
|
543
|
+
def delete_user_data(user_id: str, tenant_id: str, pc_index, redis_client):
|
|
544
|
+
"""GDPR Article 17 - Right to erasure."""
|
|
545
|
+
results = []
|
|
546
|
+
|
|
547
|
+
# 1. Delete from vector store (Pinecone)
|
|
548
|
+
# Fetch all vector IDs belonging to this user
|
|
549
|
+
query_response = pc_index.query(
|
|
550
|
+
vector=[0.0] * 1536, # dummy vector
|
|
551
|
+
top_k=10000,
|
|
552
|
+
namespace=tenant_id,
|
|
553
|
+
filter={"user_id": {"$eq": user_id}},
|
|
554
|
+
include_values=False,
|
|
555
|
+
)
|
|
556
|
+
vector_ids = [m["id"] for m in query_response["matches"]]
|
|
557
|
+
if vector_ids:
|
|
558
|
+
# Delete in batches of 1000
|
|
559
|
+
for i in range(0, len(vector_ids), 1000):
|
|
560
|
+
batch = vector_ids[i:i + 1000]
|
|
561
|
+
pc_index.delete(ids=batch, namespace=tenant_id)
|
|
562
|
+
results.append(f"deleted {len(vector_ids)} vectors")
|
|
563
|
+
|
|
564
|
+
# 2. Delete conversation history from Redis
|
|
565
|
+
pattern = f"session:*"
|
|
566
|
+
cursor = 0
|
|
567
|
+
deleted_sessions = 0
|
|
568
|
+
while True:
|
|
569
|
+
cursor, keys = redis_client.scan(cursor, match=pattern, count=100)
|
|
570
|
+
for key in keys:
|
|
571
|
+
session = redis_client.hgetall(key)
|
|
572
|
+
if (session.get("user_id") == user_id and
|
|
573
|
+
session.get("tenant_id") == tenant_id):
|
|
574
|
+
redis_client.delete(key)
|
|
575
|
+
deleted_sessions += 1
|
|
576
|
+
if cursor == 0:
|
|
577
|
+
break
|
|
578
|
+
results.append(f"deleted {deleted_sessions} sessions")
|
|
579
|
+
|
|
580
|
+
# 3. Delete from relational DB
|
|
581
|
+
# db.execute("DELETE FROM llm_logs WHERE user_id = %s AND tenant_id = %s",
|
|
582
|
+
# (user_id, tenant_id))
|
|
583
|
+
|
|
584
|
+
return {
|
|
585
|
+
"user_id": user_id,
|
|
586
|
+
"tenant_id": tenant_id,
|
|
587
|
+
"actions": results,
|
|
588
|
+
"status": "completed",
|
|
589
|
+
}
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
### Audit Trail Schema
|
|
593
|
+
|
|
594
|
+
```sql
|
|
595
|
+
CREATE TABLE llm_audit_log (
|
|
596
|
+
id BIGSERIAL PRIMARY KEY,
|
|
597
|
+
timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
598
|
+
tenant_id VARCHAR(64) NOT NULL,
|
|
599
|
+
user_id VARCHAR(64) NOT NULL,
|
|
600
|
+
session_id VARCHAR(64),
|
|
601
|
+
action VARCHAR(32) NOT NULL, -- 'query', 'injection_blocked', 'pii_scrubbed', 'data_deleted'
|
|
602
|
+
model VARCHAR(64),
|
|
603
|
+
input_tokens INTEGER,
|
|
604
|
+
output_tokens INTEGER,
|
|
605
|
+
cost_usd NUMERIC(10, 6),
|
|
606
|
+
injection_detected BOOLEAN DEFAULT FALSE,
|
|
607
|
+
pii_detected BOOLEAN DEFAULT FALSE,
|
|
608
|
+
metadata JSONB,
|
|
609
|
+
INDEX idx_tenant_time (tenant_id, timestamp),
|
|
610
|
+
INDEX idx_user_time (user_id, timestamp),
|
|
611
|
+
INDEX idx_action (action)
|
|
612
|
+
);
|
|
613
|
+
|
|
614
|
+
-- Partition by month for efficient retention
|
|
615
|
+
CREATE TABLE llm_audit_log_2026_03 PARTITION OF llm_audit_log
|
|
616
|
+
FOR VALUES FROM ('2026-03-01') TO ('2026-04-01');
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### Model Supply Chain Verification
|
|
620
|
+
|
|
621
|
+
```python
|
|
622
|
+
import hashlib
|
|
623
|
+
|
|
624
|
+
APPROVED_MODELS = {
|
|
625
|
+
"gpt-4o-2024-08-06": {
|
|
626
|
+
"provider": "openai",
|
|
627
|
+
"approved_date": "2024-09-01",
|
|
628
|
+
"risk_assessment": "RA-2024-087",
|
|
629
|
+
},
|
|
630
|
+
"claude-sonnet-4-20250514": {
|
|
631
|
+
"provider": "anthropic",
|
|
632
|
+
"approved_date": "2025-06-01",
|
|
633
|
+
"risk_assessment": "RA-2025-012",
|
|
634
|
+
},
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
def validate_model(model_id: str) -> dict:
|
|
638
|
+
if model_id not in APPROVED_MODELS:
|
|
639
|
+
return {"approved": False, "reason": f"model_not_in_allowlist: {model_id}"}
|
|
640
|
+
return {"approved": True, **APPROVED_MODELS[model_id]}
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
## Baseline Security Checklist
|
|
647
|
+
|
|
648
|
+
Use this as a pre-launch gate. Every item should be verified before production.
|
|
649
|
+
|
|
650
|
+
- [ ] All user input passes structural validation, injection detection, and content moderation.
|
|
651
|
+
- [ ] System prompts are separated from user content via distinct message roles.
|
|
652
|
+
- [ ] System prompt contains explicit refusal instructions for override attempts.
|
|
653
|
+
- [ ] LLM output passes PII scrubbing and toxicity detection before reaching the user.
|
|
654
|
+
- [ ] RAG document ingestion includes malware scanning and secret detection.
|
|
655
|
+
- [ ] Retrieval queries are filtered by tenant ID and user access roles.
|
|
656
|
+
- [ ] Source citations are attached to every RAG-generated answer.
|
|
657
|
+
- [ ] Conversation history is isolated per tenant with enforced session boundaries.
|
|
658
|
+
- [ ] Per-user token budgets and per-tenant cost caps are enforced.
|
|
659
|
+
- [ ] API endpoints have NGINX or gateway-level rate limiting.
|
|
660
|
+
- [ ] Structured logs capture every LLM request with security metadata.
|
|
661
|
+
- [ ] Prometheus alerts fire on injection spikes, cost anomalies, and token abuse.
|
|
662
|
+
- [ ] Data retention policies are enforced with automated purge jobs.
|
|
663
|
+
- [ ] GDPR deletion workflow covers vector store, session store, and relational DB.
|
|
664
|
+
- [ ] Only approved models from the allowlist are callable in production.
|
|
665
|
+
- [ ] Audit log captures all security-relevant events with tenant and user context.
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
## Related Skills
|
|
671
|
+
|
|
672
|
+
- ai-agent-security (`ai-agent-security`) -- Agent-specific controls for autonomous tool-using systems.
|
|
673
|
+
- sast-scanning (`sast-scanning`) -- Static analysis to catch insecure coding patterns.
|
|
674
|
+
|