@runsec/mcp 1.0.28 → 1.0.37
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/dist/data/.rag-cache.json +1 -0
- package/dist/data/skills/_exploit_overrides.json +16 -0
- package/dist/data/skills/advanced-agent-cloud/index.md +94 -0
- package/dist/data/skills/advanced-agent-cloud/patterns.md +46 -0
- package/dist/data/skills/advanced-agent-cloud/skill.json +38 -0
- package/dist/data/skills/app-logic/index.md +69 -0
- package/dist/data/skills/app-logic/patterns.md +23 -0
- package/dist/data/skills/app-logic/skill.json +24 -0
- package/dist/data/skills/auth-keycloak/index.md +69 -0
- package/dist/data/skills/auth-keycloak/patterns.md +46 -0
- package/dist/data/skills/auth-keycloak/skill.json +51 -0
- package/dist/data/skills/browser-agent/index.md +58 -0
- package/dist/data/skills/browser-agent/patterns.md +15 -0
- package/dist/data/skills/browser-agent/skill.json +24 -0
- package/dist/data/skills/cloud-secrets/index.md +66 -0
- package/dist/data/skills/cloud-secrets/patterns.md +19 -0
- package/dist/data/skills/cloud-secrets/skill.json +28 -0
- package/dist/data/skills/csharp-dotnet/index.md +103 -0
- package/dist/data/skills/csharp-dotnet/patterns.md +270 -0
- package/dist/data/skills/csharp-dotnet/skill.json +27 -0
- package/dist/data/skills/desktop-vsto-suite/index.md +202 -0
- package/dist/data/skills/desktop-vsto-suite/patterns.md +154 -0
- package/dist/data/skills/desktop-vsto-suite/skill.json +26 -0
- package/dist/data/skills/devops-security/index.md +64 -0
- package/dist/data/skills/devops-security/patterns.md +23 -0
- package/dist/data/skills/devops-security/skill.json +42 -0
- package/dist/data/skills/domain-access-management/index.md +123 -0
- package/dist/data/skills/domain-access-management/patterns.md +58 -0
- package/dist/data/skills/domain-access-management/skill.json +36 -0
- package/dist/data/skills/domain-data-privacy/index.md +98 -0
- package/dist/data/skills/domain-data-privacy/patterns.md +48 -0
- package/dist/data/skills/domain-data-privacy/skill.json +36 -0
- package/dist/data/skills/domain-input-validation/index.md +210 -0
- package/dist/data/skills/domain-input-validation/patterns.md +158 -0
- package/dist/data/skills/domain-input-validation/skill.json +24 -0
- package/dist/data/skills/domain-platform-hardening/index.md +169 -0
- package/dist/data/skills/domain-platform-hardening/patterns.md +96 -0
- package/dist/data/skills/domain-platform-hardening/skill.json +27 -0
- package/dist/data/skills/ds-ml-security/patterns.md +137 -0
- package/dist/data/skills/fastapi-async/index.md +83 -0
- package/dist/data/skills/fastapi-async/patterns.md +329 -0
- package/dist/data/skills/fastapi-async/skill.json +32 -0
- package/dist/data/skills/frontend-react/index.md +26 -0
- package/dist/data/skills/frontend-react/patterns.md +226 -0
- package/dist/data/skills/frontend-react/skill.json +24 -0
- package/dist/data/skills/go-core/index.md +86 -0
- package/dist/data/skills/go-core/patterns.md +272 -0
- package/dist/data/skills/go-core/skill.json +22 -0
- package/dist/data/skills/hft-cpp-security/patterns.md +37 -0
- package/dist/data/skills/index.md +73 -0
- package/dist/data/skills/infra-k8s-helm/index.md +138 -0
- package/dist/data/skills/infra-k8s-helm/patterns.md +279 -0
- package/dist/data/skills/infra-k8s-helm/skill.json +41 -0
- package/dist/data/skills/integration-security/index.md +73 -0
- package/dist/data/skills/integration-security/patterns.md +132 -0
- package/dist/data/skills/integration-security/skill.json +30 -0
- package/dist/data/skills/java-enterprise/index.md +31 -0
- package/dist/data/skills/java-enterprise/patterns.md +816 -0
- package/dist/data/skills/java-enterprise/skill.json +26 -0
- package/dist/data/skills/java-spring/index.md +65 -0
- package/dist/data/skills/java-spring/patterns.md +22 -0
- package/dist/data/skills/java-spring/skill.json +23 -0
- package/dist/data/skills/license-compliance/index.md +58 -0
- package/dist/data/skills/license-compliance/patterns.md +12 -0
- package/dist/data/skills/license-compliance/skill.json +28 -0
- package/dist/data/skills/mobile-security/patterns.md +42 -0
- package/dist/data/skills/nodejs-nestjs/index.md +71 -0
- package/dist/data/skills/nodejs-nestjs/patterns.md +288 -0
- package/dist/data/skills/nodejs-nestjs/skill.json +24 -0
- package/dist/data/skills/observability/index.md +68 -0
- package/dist/data/skills/observability/patterns.md +22 -0
- package/dist/data/skills/observability/skill.json +26 -0
- package/dist/data/skills/php-security/patterns.md +202 -0
- package/dist/data/skills/ru-regulatory/index.md +72 -0
- package/dist/data/skills/ru-regulatory/patterns.md +28 -0
- package/dist/data/skills/ru-regulatory/skill.json +53 -0
- package/dist/data/skills/ruby-rails/index.md +65 -0
- package/dist/data/skills/ruby-rails/patterns.md +172 -0
- package/dist/data/skills/ruby-rails/skill.json +24 -0
- package/dist/data/skills/rust-security/patterns.md +152 -0
- package/dist/data/trufflehog-config.yaml +407 -0
- package/dist/index.js +3830 -400
- package/package.json +2 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
| ID | Название метрики | Anti-Pattern (Vulnerable Code/YAML) | Safe-Pattern (Remediation) | Stack | Источник fix_template | Exploit scenario |
|
|
2
|
+
|---|---|---|---|---|---|---|
|
|
3
|
+
| FTS-002 | Sensitive data in client storage | `localStorage.setItem("jwt", token)` | Хранить чувствительные данные в httpOnly cookies/secure storage. | Node.js/JavaScript | Privacy Controls | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
4
|
+
| FTS-003 | Sensitive console logging | `console.log("token", token)` | Удалять/маскировать чувствительные поля в логах. | Node.js/JavaScript | Privacy Controls | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
5
|
+
| FTS-008 | Source-map data exposure | Публичные `.map` файлы в production | Не публиковать source maps публично. | Node.js/JavaScript | Privacy Controls | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
6
|
+
| PY-002 | Error detail leakage | `except Exception as e:`<br>` return {"error": str(e)}` | Generic error response, детали только во внутренних логах. | Python | Privacy Controls | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
7
|
+
| PY-009 | Hardcoded secret in code | `SECRET_KEY = "dev-secret"` | Хранить секреты во внешнем Secret Manager/Vault. | Python | Privacy Controls | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
8
|
+
| PY-026 | Secrets in logs | `logger.info("token=%s", token)` | Redaction policy и structured logging без секретов. | Python | Privacy Controls | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
9
|
+
| NJS-010 | Stacktrace leakage in API | `res.json({error: err.stack})` | Клиенту только generic message, детали в secure logs. | Node.js/JavaScript | Privacy Controls | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
10
|
+
| NJS-035 | Sensitive data retained in memory | Долгоживущие plaintext значения | Минимизировать lifetime, очищать буферы/объекты. | Node.js/JavaScript | Privacy Controls | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
11
|
+
| RRC-001 | PII leakage in logs (152-FZ) | Логирование ФИО/СНИЛС/email в stdout | Маскирование ПДн и policy-based log redaction. | Compliance/Identity | 152-FZ | Маскирование ПДн и policy-based log redaction. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
12
|
+
| LOG-012 | PII/secret leakage in observability | Full payload logging in traces | Sanitization pipeline до отправки в telemetry backend. | Observability | Observability Security | Sanitization pipeline до отправки в telemetry backend. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
13
|
+
| DJA-008 | Hardcoded Secret Key | `SECRET_KEY = "django-insecure-hardcoded-secret"` | `SECRET_KEY = os.environ["DJANGO_SECRET_KEY"]` | Python | `CWE-798` | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
14
|
+
| DJA-010 | Verbose error leakage to client | `try:`<br>` ...`<br>`except Exception as e:`<br>` return JsonResponse({"error": str(e)}, status=500)` | `try:`<br>` ...`<br>`except Exception:`<br>` logger.exception("internal error")`<br>` return JsonResponse({"error": "internal server error"}, status=500)` | Python | `CWE-209` | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
15
|
+
| DJA-015 | Unsafe logout redirect | `LOGOUT_REDIRECT_URL = request.GET.get("next")` | `LOGOUT_REDIRECT_URL = "/accounts/login/"`<br>`...`<br>`safe_next = url_has_allowed_host_and_scheme(next_url, allowed_hosts={host})` | Python | `CWE-601` | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
16
|
+
| DJA-018 | Missing `LoginRequiredMixin` on CBV | `class PaymentsView(View):`<br>` def dispatch(self, request, *args, **kwargs):`<br>` ...` | `class PaymentsView(LoginRequiredMixin, View):`<br>` def dispatch(self, request, *args, **kwargs):`<br>` ...` | Python | `CWE-20` | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
17
|
+
| MOB-021 | UI Privacy Missing FLAG_SECURE | `class MainActivity: FlutterActivity() {`<br>` override fun onCreate(...) {`<br>` super.onCreate(...)`<br>` }`<br>`}` | Включить `window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)` для защиты экрана от скриншотов и записи. | Flutter | Silk Mobile SAR | Включить `window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)` для защиты экрана от скриншотов и записи. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
18
|
+
| NJS-005 | Missing process crash guards for async/runtime failures | `# no process.on("uncaughtException")`<br>`# no process.on("unhandledRejection")` | Добавить обработчики `uncaughtException`/`unhandledRejection` с audit logging, graceful shutdown и restart strategy. | Node.js/JavaScript | Node.js Production Hardening | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
19
|
+
| NJS-019 | Abuse of process.env directly in business logic | `if (process.env.VIP_MODE === "1") approveTransfer()` | Читать env только через централизованный config service с type validation (convict/ConfigService) и неизменяемым контрактом настроек. | Node.js/JavaScript | Twelve-Factor + Secure Config | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
20
|
+
| NJS-034 | Unsafe stream piping without error handlers | `readable.pipe(writable)` (без `.on("error")`) | Обрабатывать ошибки обоих stream endpoints, использовать `pipeline(...)`/`finished(...)` для корректного cleanup ресурсов. | Node.js/JavaScript | Node.js Streams Security | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
21
|
+
| FTS-017 | Unsafe Message Parsing in message handlers | `window.addEventListener("message", (e) => JSON.parse(e.data))` | Перед `JSON.parse` валидировать тип/размер `data`, origin/source, schema сообщения и обрабатывать parse errors безопасно. | Node.js/JavaScript | OWASP HTML5 Messaging Security | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
22
|
+
| FTS-020 | Unhandled Async Errors in Promise/async flows | `doCritical().then(saveAudit)`<br>`async function run(){ await step(); }` (без try/catch) | Оборачивать async-цепочки в `try/catch`, добавлять `.catch(...)`, централизованный error boundary и rollback/compensation логику. | Node.js/JavaScript | Async Error Handling Best Practices | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
23
|
+
| CWE-327-PY | Weak Hash Algorithms in Python (MD5/SHA1) | `hashlib.md5(data).hexdigest()`<br>`hashlib.sha1(data).digest()` | Использовать устойчивые алгоритмы (`hashlib.sha256`/`sha512` или `blake2`), а для паролей — Argon2/bcrypt/scrypt. | Python | CWE Compliance | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
24
|
+
| CWE-328-PY | Weak Crypto Mode (ECB) in Python | `Cipher(algorithms.AES(key), modes.ECB())` | Исключить ECB; использовать AEAD-режимы (AES-GCM/ChaCha20-Poly1305) с уникальным nonce/iv и проверкой тега. | Python | CWE Compliance | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
25
|
+
| CWE-338-PY | Predictable Random for tokens/passwords in Python | `token = str(random.random())`<br>`pwd = str(random.randint(100000, 999999))` | Для security-значений использовать `secrets.token_urlsafe()`/`secrets.randbelow()` и криптографически стойкий PRNG. | Python | CWE Compliance | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
26
|
+
| CWE-327-JS | Weak Hash/Cipher in Node.js crypto | `crypto.createHash("md5").update(data).digest("hex")`<br>`crypto.createCipher("des", key)` | Использовать `sha256/sha512` для хеширования и современные шифры (`aes-256-gcm`), отказаться от `createCipher` legacy API. | Node.js/JavaScript | CWE Compliance | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
27
|
+
| CWE-338-JS | Predictable Random for session IDs in JavaScript | `const sid = Math.random().toString(36).slice(2)` | Генерировать сессионные идентификаторы через `crypto.randomBytes()` / `crypto.webcrypto.getRandomValues()`. | Node.js/JavaScript | CWE Compliance | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
28
|
+
| CWE-200-PY | Information Disclosure via hardcoded internal/Sheets URLs | `INTERNAL_API = "http://10.0.0.5:8080/admin"`<br>`SHEET_URL = "https://docs.google.com/spreadsheets/d/..."` | Вынести внутренние URL в защищенный конфиг, исключить публикацию приватных endpoint/документов в коде и логах. | Python | CWE Compliance | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
29
|
+
| CWE-200-JS | Source leak via sensitive fields in model toString | `toString(){ return "User(token="+this.token+",password="+this.password+")"; }` | Не включать секреты в `toString`/debug-дампы, использовать redaction (`***`) и отдельные безопасные serializer-методы. | Node.js/JavaScript | CWE Compliance | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
30
|
+
| CWE-117-PY | Log Injection in Python logging with unsanitized user input | `logging.info("user=%s", user_input)` (где `user_input` содержит `\n/\r`) | Перед логированием удалять/экранировать управляющие символы (`\n`, `\r`, `\t`) и применять structured logging с sanitizer. | Python | CWE Compliance - Logic/Resources | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
31
|
+
| CWE-117-JS | Log Injection in JS/Node logs | `console.log(req.body)`<br>`winston.info(req.body.message)` без sanitize | Санитизировать управляющие символы в пользовательских данных до логирования и использовать структурированный logger с фильтрами. | Node.js/JavaScript | CWE Compliance - Logic/Resources | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
32
|
+
| CWE-404-JS | Resource Leak with stream handles in Node.js | `const rs = fs.createReadStream(path)` без обработки `error/close` | Использовать `pipeline()`/`finished()` и всегда обрабатывать `error`, закрывая дескрипторы и освобождая ресурсы. | Node.js/JavaScript | CWE Compliance - Logic/Resources | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
33
|
+
| CWE-312-JS | Cleartext token storage in browser localStorage | `localStorage.setItem("token", accessToken)` | Не хранить токены в cleartext browser storage; использовать httpOnly secure cookies или защищенный storage abstraction. | Node.js/JavaScript | CWE Compliance Final | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
34
|
+
| CWE-312-PY | Cleartext secret/password in Python settings | `DB_PASSWORD = "supersecret"` в `settings.py` | Вынести секреты в environment/secret manager, исключить hardcoded credentials из исходников. | Python | CWE Compliance Final | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
35
|
+
| CWE-532-PY | Sensitive data written to logs in plaintext | `logger.info("password=%s", password)` | Маскировать секреты и исключать пароли/токены из логов через redaction policy. | Python | CWE Compliance Final | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
36
|
+
| CWE-312-ENV | Cleartext secrets in environment/Docker configuration | `ENV DB_PASSWORD=secret`<br>`export API_TOKEN=plain` | Передавать секреты через Secret Manager/ESO/Vault, исключать plaintext ENV в Docker/K8s manifests. | Kubernetes/Infra | CWE Final Certification | Передавать секреты через Secret Manager/ESO/Vault, исключать plaintext ENV в Docker/K8s manifests. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
37
|
+
| CWE-532-PY-DECORATOR | PII leak in Python decorator-based logging | `@log_request` декоратор пишет полный payload с PII | В декораторах логирования внедрить redaction/masking и запретить вывод чувствительных полей по умолчанию. | Python | CWE Final Certification | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
38
|
+
| CWE-117-UNIVERSAL-CRLF | Log Injection via unsanitized CRLF in user-controlled log fields | `logger.info("msg=%s", user_input)` где `user_input` содержит `\r\n`<br>`console.log(req.body.message)` без sanitize | Перед логированием принудительно заменять/экранировать `\r` и `\n` (например, `\\r`/`\\n`), применять centralized log sanitizer. | Universal | CWE Final Certification | Перед логированием принудительно заменять/экранировать `\r` и `\n` (например, `\\r`/`\\n`), применять centralized log sanitizer. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
39
|
+
| CWE-74-PY-LDAP | LDAP Injection in Python (`ldap3`) filter construction | `conn.search(base_dn, "(uid=" + username + ")")` | Формировать LDAP-фильтры через безопасные escape-функции (`escape_filter_chars`) и строгую валидацию пользовательского ввода. | Python | CWE Final Certification | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
40
|
+
| CWE-74-JS-LDAP | LDAP Injection in Node.js (`ldapjs`) filter concatenation | `const filter = "(uid=" + req.query.user + ")"` | Экранировать LDAP special chars и использовать безопасные builder API/allowlist для компонентов LDAP filter. | Node.js/JavaScript | CWE Final Certification | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
41
|
+
| CWE-359-AXIOS-PARAMS-LEAK | Sensitive data exposure via Axios `params` query string (`token/password/secret`) | `axios.get(url, { params: { token, password, secret } })` | Не передавать секреты в query string; использовать Authorization header/body и redaction policy для логов/телеметрии. | Universal/Axios | CWE Final Certification | Не передавать секреты в query string; использовать Authorization header/body и redaction policy для логов/телеметрии. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
42
|
+
| CWE-524-AXIOS-CACHE-AUTH | Missing `Cache-Control: no-store` on Axios GET to `/api/user/*` or `/api/auth/*` | `axios.get("/api/user/profile")` без cache headers | Для чувствительных GET endpoint-ов устанавливать `Cache-Control: no-store` и предотвращать кэширование auth/user данных на клиенте/прокси. | Node.js/React/Next.js/Axios | CWE Final Certification | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
43
|
+
| CWE-200-NEXTJS-CLIENT-ENV | Secret env leak: server-side env vars used in `use client` components | `\"use client\"` + `process.env.DB_PASSWORD`/`process.env.API_SECRET` | В client-компонентах использовать только `NEXT_PUBLIC_*`; серверные secrets держать в server-only коде и не экспортировать в клиентский bundle. | Node.js/Next.js/React | CWE Final Certification | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
44
|
+
| CWE-200-OPENROUTER-APIKEY-LEAK | Hardcoded OpenRouter/OpenAI API keys in code/logs | `OPENROUTER_API_KEY = "sk-..."`<br>`logger.info(api_key)` | Хранить ключи только во внешнем secret manager/env, маскировать в логах и исключать из репозитория/trace output. | Universal/OpenRouter/OpenAI/httpx | CWE Final Certification | Хранить ключи только во внешнем secret manager/env, маскировать в логах и исключать из репозитория/trace output. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
45
|
+
| CWE-922-FASTAPI-HEADER-LOG | Sensitive headers (`Authorization`, `Set-Cookie`) logged by request middleware | `logger.info("headers=%s", dict(request.headers))` | Перед логированием удалять/маскировать чувствительные заголовки (`Authorization`, `Cookie`, `Set-Cookie`) и применять centralized redaction policy. | Python/FastAPI | CWE Final Certification | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
46
|
+
| CWE-798-CSH-CONFIG-SECRETS | Hardcoded API keys/passwords in `.config`, `Settings.settings`, `.resx` for C# desktop apps | `<add key="ApiKey" value="secret-123"/>`<br>`<Setting Name="Password" ...>` | Выносить секреты в защищенное хранилище (DPAPI/Windows Credential Manager/Key Vault), исключать plaintext secrets из config/resources. | C#/.NET Desktop | CWE Final Certification | Use using/try-finally and safe .NET APIs; enforce strict allowlists for untrusted input. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
47
|
+
| CWE-384-CSH-STATIC-TOKEN-CONTEXT | Session fixation risk via `public static` token/user context fields in VSTO classes | `public static string AccessToken;`<br>`public static UserContext CurrentUser;` | Не хранить auth/session state в public static полях; использовать scoped secure session storage и ротацию/re-auth для смены контекста. | C#/.NET Desktop | CWE Final Certification | Use using/try-finally and safe .NET APIs; enforce strict allowlists for untrusted input. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
48
|
+
| CWE-532-CSH-OFFICE-PII-LOG | PII leakage: logging Office object properties (`MailItem.SenderEmailAddress`, `Document.FullName`) to files | `logger.Info(mail.SenderEmailAddress)`<br>`File.AppendAllText(log, doc.FullName)` | Маскировать/редактировать PII перед логированием, исключать чувствительные Office-атрибуты из публичных/долгоживущих логов. | C#/.NET Desktop | CWE Final Certification | Use using/try-finally and safe .NET APIs; enforce strict allowlists for untrusted input. | Атакующий доставляет входные данные, соответствующие anti-pattern; реальный ущерб зависит от приёмника (sink), конфигурации и границ доверия. |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill_id": "domain-data-privacy",
|
|
3
|
+
"name": "Domain Data Privacy",
|
|
4
|
+
"activation_triggers": [
|
|
5
|
+
"pii-log-redaction",
|
|
6
|
+
"secret-log-leak",
|
|
7
|
+
"privacy-source-map",
|
|
8
|
+
"sensitive-memory-retention"
|
|
9
|
+
],
|
|
10
|
+
"relevant_extensions": [
|
|
11
|
+
".py",
|
|
12
|
+
".js",
|
|
13
|
+
".ts",
|
|
14
|
+
".yaml",
|
|
15
|
+
".yml"
|
|
16
|
+
],
|
|
17
|
+
"tools": [
|
|
18
|
+
"semgrep",
|
|
19
|
+
"syft",
|
|
20
|
+
"trufflehog"
|
|
21
|
+
],
|
|
22
|
+
"rules_path": "core/skills/domain-data-privacy/patterns.md",
|
|
23
|
+
"few_shot_examples": "core/gold-standard-testbed/gap_fill_vulnerable.py",
|
|
24
|
+
"mitigation_logic": {
|
|
25
|
+
"AAC-004": {
|
|
26
|
+
"exception_rule": "Риск insecure serialization для RQ считается закрытым, если в конфигурации Redis Queue явно задан JSON-сериализатор.",
|
|
27
|
+
"status_override": "OK",
|
|
28
|
+
"evidence_requirements": [
|
|
29
|
+
"Наличие serializer=json/json.dumps/json.loads в конфигурации RQ worker/queue.",
|
|
30
|
+
"Отсутствие использования pickle.loads или эквивалентных unsafe deserializer-ов в пути обработки задач."
|
|
31
|
+
],
|
|
32
|
+
"rationale": "JSON-сериализация устраняет класс уязвимостей, связанных с произвольной десериализацией pickle payload."
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"security_priority": 8
|
|
36
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Domain Input Validation
|
|
2
|
+
|
|
3
|
+
## Stack overview
|
|
4
|
+
|
|
5
|
+
Canonical validation controls for untrusted input: traversal, SSRF, code/command injection, and unsafe parsing.
|
|
6
|
+
|
|
7
|
+
## Top threats
|
|
8
|
+
|
|
9
|
+
- **Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists.**: 75 metrics (`PY-007`, `PY-012`, `PY-014`, `PY-015`)
|
|
10
|
+
- **Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering.**: 66 metrics (`NJS-001`, `NJS-002`, `NJS-007`, `NJS-003`)
|
|
11
|
+
- **Use using/try-finally and safe .NET APIs; enforce strict allowlists for untrusted input.**: 4 metrics (`CWE-601-CSH-PROCESS-START-URL`, `CWE-81-CSH-WEBBROWSER-XSS`, `CWE-1321-CSH-DYNAMIC-EXPANDO`, `CWE-749-CSH-COMVISIBLE-DANGEROUS`)
|
|
12
|
+
- **CWE Final Certification**: 3 metrics (`CWE-79-PY-DJANGO-SAFE`, `CWE-89-PG-COPY-PROGRAM`, `CWE-89-PLPGSQL-EXECUTE`)
|
|
13
|
+
- **Атомарные temp API; для concurrent writes — file locks; валидировать path после `mkstemp`.**: 1 metrics (`CWE-123-PY-TEMPFILE-TOCTOU`)
|
|
14
|
+
- **Выполнять нормализацию до фиксированной точки (loop until stable), затем строгую canonicalization-проверку и allowlist-валидацию итогового значения.**: 1 metrics (`CWE-85-174-UNIVERSAL-ONCE`)
|
|
15
|
+
- **Для динамических ответов всегда добавлять `X-Content-Type-Options: nosniff` и корректный `Content-Type`, исключая MIME sniffing.**: 1 metrics (`CWE-80-UNIVERSAL-NOSNIFF`)
|
|
16
|
+
- **Исключить динамическое исполнение строкового JS из недоверенных данных; передавать данные через безопасный IPC API с валидацией схемы.**: 1 metrics (`DSK-100`)
|
|
17
|
+
- **Нормализовать/валидировать тип параметров (single-value), отклонять массивы/дубликаты в критичных auth/ACL полях.**: 1 metrics (`CWE-20-HPP`)
|
|
18
|
+
- **Перед системными вызовами удалять/блокировать `\\x00` и управляющие символы, нормализовать input и применять allowlist форматов аргументов.**: 1 metrics (`CWE-20-UNIVERSAL-NULLBYTE`)
|
|
19
|
+
- **Проверять `start/end` против `buffer.byteLength`; отклонять отрицательные/NaN индексы; использовать typed array helpers с валидацией.**: 1 metrics (`CWE-124-JS-ARRAYBUFFER-SLICE`)
|
|
20
|
+
- **Строить XML через безопасные builder API и обязательно экранировать спецсимволы (`<`, `>`, `&`, `'`, `"`).**: 1 metrics (`CWE-91-UNIVERSAL-XML-CONCAT`)
|
|
21
|
+
|
|
22
|
+
## Pattern catalog
|
|
23
|
+
|
|
24
|
+
Complete Anti-Pattern / Safe-Pattern definitions live in [`patterns.md`](patterns.md). The table below is a **table of contents** by metric ID.
|
|
25
|
+
|
|
26
|
+
| ID | Metric | Stack |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `PY-007` | SSRF via user URL fetch | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
29
|
+
| `PY-012` | SQL injection in dynamic execute | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
30
|
+
| `PY-014` | Path traversal in file operations | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
31
|
+
| `PY-015` | eval/exec on untrusted data | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
32
|
+
| `PY-021` | SQLAlchemy text injection | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
33
|
+
| `PY-025` | Missing webhook signature check | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
34
|
+
| `PY-110` | Media path traversal | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
35
|
+
| `NJS-001` | Command injection in exec | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
36
|
+
| `NJS-002` | Path traversal in fs access | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
37
|
+
| `NJS-007` | SSRF in fetch | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
38
|
+
| `PY-001` | FastAPI debug enabled in production | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
39
|
+
| `PY-003` | Unsafe pickle deserialization | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
40
|
+
| `PY-004` | Subprocess shell injection | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
41
|
+
| `PY-005` | YAML unsafe loader | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
42
|
+
| `PY-006` | Weak temp file handling | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
43
|
+
| `PY-008` | Missing request timeout in outgoing calls | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
44
|
+
| `PY-013` | ORM mass assignment | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
45
|
+
| `PY-016` | Insecure CORS wildcard with credentials | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
46
|
+
| `PY-018` | Async endpoint with blocking I/O | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
47
|
+
| `PY-019` | Playwright launch with insecure flags | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
48
|
+
| `PY-020` | FastAPI route without response_model returning DB object | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
49
|
+
| `PY-022` | Pydantic construct bypass for external input | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
50
|
+
| `PY-029` | Celery task deserialization risk | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
51
|
+
| `PY-030` | Unvalidated redirect target | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
52
|
+
| `DJA-001` | CSRF Disabled: view без CSRF-защиты | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
53
|
+
| `DJA-002` | Raw SQL Injection: строковая конкатенация в SQL | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
54
|
+
| `DJA-003` | DEBUG=True in Production | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
55
|
+
| `DJA-004` | Mass Assignment: `ModelForm` без явных `fields` | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
56
|
+
| `DJA-005` | Insecure ALLOWED_HOSTS wildcard | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
57
|
+
| `DJA-006` | Open Redirect через `next` без проверки | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
58
|
+
| `DJA-009` | Unsafe file upload path (path traversal) | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
59
|
+
| `DJA-011` | XSS via `mark_safe`: доверие пользовательскому HTML | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
60
|
+
| `DJA-013` | Insecure `.extra()` where clause | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
61
|
+
| `DJA-016` | ReDoS in URL patterns via complex `re_path` | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
62
|
+
| `DJA-017` | ModelForm `exclude=[]` abuse | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
63
|
+
| `DSK-100` | Remote Code Injection via executeJavaScript | Исключить динамическое исполнение строкового JS из недоверенных данных; передавать данные через безопасный IPC API с валидацией схемы. |
|
|
64
|
+
| `NJS-003` | Event Loop Blocking через `*Sync` API в request handlers | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
65
|
+
| `NJS-004` | Insecure Serialization / unsafe eval processing | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
66
|
+
| `NJS-006` | Open Redirect via untrusted URL forwarding | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
67
|
+
| `NJS-008` | Broken CORS policy with wildcard + credentials | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
68
|
+
| `NJS-011` | Server-Side Prototype Pollution in merge/parsing flows | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
69
|
+
| `NJS-012` | Unsafe Buffer allocation | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
70
|
+
| `NJS-013` | HTTP Parameter Pollution without type guards | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
71
|
+
| `NJS-014` | Insecure Sandbox with `vm` module execution | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
72
|
+
| `NJS-015` | Event Loop ReDoS in server validators/routes | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
73
|
+
| `NJS-017` | Dependency Confusion & Integrity gaps in package sources | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
74
|
+
| `NJS-018` | Insecure Header Leakage: X-Powered-By exposed | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
75
|
+
| `NJS-020` | Unsafe File Deletion/Cleanup with user-controlled paths | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
76
|
+
| `NJS-022` | Weak password hashing parameters | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
77
|
+
| `NJS-023` | NoSQL Injection in Mongo-style filters | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
78
|
+
| `NJS-025` | Open CORS preflight methods/headers overexposure | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
79
|
+
| `NJS-026` | Mass Assignment через прямую передачу `req.body` в ORM | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
80
|
+
| `NJS-027` | Safe Buffer Creation: `Buffer.from(variable)` без type guard | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
81
|
+
| `NJS-028` | SCA / Audit Gate отсутствует в npm scripts | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
82
|
+
| `NJS-029` | SSTI / Unsafe template raw output tags | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
83
|
+
| `NJS-031` | Prototype Pollution через spread operator из user input | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
84
|
+
| `NJS-035` | Sensitive data retained in long-lived heap strings | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
85
|
+
| `FTS-001` | XSS Prevention: unsafe HTML rendering without sanitization | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
86
|
+
| `FTS-004` | Insecure Communication: postMessage without origin validation | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
87
|
+
| `FTS-006` | Missing CSP Hardening for script execution | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
88
|
+
| `FTS-007` | Clickjacking Protection Missing | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
89
|
+
| `FTS-010` | Service Worker Cache Poisoning Risk | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
90
|
+
| `FTS-011` | Unsafe Execution: dynamic code execution from strings | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
91
|
+
| `FTS-012` | Prototype Pollution: unsafe deep merge without key guards | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
92
|
+
| `FTS-013` | Global Namespace Pollution and native prototype extension | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
93
|
+
| `FTS-015` | RegExp DoS / ReDoS with catastrophic backtracking | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
94
|
+
| `FTS-016` | Sequential Await DoS in loops for external calls | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
95
|
+
| `CWE-78-PY` | CWE-78 OS Command Injection (Python dangerous process APIs) | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
96
|
+
| `CWE-89-PY` | CWE-89 SQL Injection (Python raw execute string formatting) | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
97
|
+
| `CWE-94-PY` | CWE-94 Code Injection (Python dynamic execution) | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
98
|
+
| `CWE-78-JS` | CWE-78 OS Command Injection (Node.js command execution) | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
99
|
+
| `CWE-79-JS` | CWE-79 XSS (unsafe HTML rendering in React/Vue) | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
100
|
+
| `CWE-94-JS` | CWE-94 Code Injection (JavaScript dynamic execution) | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
101
|
+
| `CWE-22-PY` | Path Traversal in Python file path join | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
102
|
+
| `CWE-434-PY` | Unsafe File Upload with original filename | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
103
|
+
| `CWE-22-JS` | Path Traversal in Node IPC file operations | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
104
|
+
| `CWE-614-JS` | Insecure Cookie flags in web builds | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
105
|
+
| `CWE-611-PY` | XXE in XML parsing (Python lxml) | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
106
|
+
| `CWE-502-PY` | Insecure deserialization in Python | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
107
|
+
| `CWE-1321-JS` | Prototype Pollution via unsafe object merge | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
108
|
+
| `CWE-502-JS` | Insecure deserialization in Node.js libs | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
109
|
+
| `CWE-918-PY` | SSRF in Python HTTP client calls with untrusted URL | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
110
|
+
| `CWE-918-JS` | SSRF in JS/Node HTTP calls with untrusted URL | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
111
|
+
| `CWE-1333-JS` | ReDoS via dynamic RegExp from user input | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
112
|
+
| `CWE-601-PY` | Open Redirect in Python without allowlist validation | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
113
|
+
| `CWE-601-JS` | Open Redirect in Express/Fastify without host/protocol checks | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
114
|
+
| `CWE-91-PY` | XML Injection via unsanitized user fragments in XML templates | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
115
|
+
| `CWE-918-PY-PROTO` | SSRF with missing protocol allowlist in Python | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
116
|
+
| `CWE-918-JS-PROTO` | SSRF with missing protocol validation in JS/Node | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
117
|
+
| `CWE-91-PY-IDENTITY` | Incorrect identity comparison (`is`) for strings/numbers in Python validation/auth logic | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
118
|
+
| `CWE-1025-JS` | Loose equality (`==`) in token/authorization checks | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
119
|
+
| `CWE-89-PY-DJA-RAW` | Django SQL Injection via `.extra(where=...)` / `.raw()` with string concatenation | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
120
|
+
| `CWE-89-JS-ORM-RAW` | SQL Injection in Sequelize/Knex raw query APIs with interpolation | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
121
|
+
| `CWE-20-UNIVERSAL-NULLBYTE` | Missing null-byte/control-char sanitization in inputs sent to system calls | Перед системными вызовами удалять/блокировать `\\x00` и управляющие символы, нормализовать input и применять allowlist форматов аргументов. |
|
|
122
|
+
| `CWE-20-HPP` | HTTP Parameter Pollution in security-critical parameter parsing | Нормализовать/валидировать тип параметров (single-value), отклонять массивы/дубликаты в критичных auth/ACL полях. |
|
|
123
|
+
| `CWE-611-PY-MINIDOM` | XML parser DoS risk with `xml.dom.minidom.parse()` on untrusted XML | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
124
|
+
| `CWE-611-PY-ELEMENTTREE` | XML parser DoS risk with `xml.etree.ElementTree.parse()` (billion laughs) | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
125
|
+
| `CWE-611-JS-LIBXMLJS-NOENT` | XXE/entity expansion risk in `libxmljs.parseXml(..., { noent: true })` | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
126
|
+
| `CWE-91-UNIVERSAL-XML-CONCAT` | XML Injection via string concatenation with user-controlled fragments | Строить XML через безопасные builder API и обязательно экранировать спецсимволы (`<`, `>`, `&`, `'`, `"`). |
|
|
127
|
+
| `CWE-85-174-UNIVERSAL-ONCE` | Single-pass normalization bypass via one-time `replace()` / `re.sub()` filtering | Выполнять нормализацию до фиксированной точки (loop until stable), затем строгую canonicalization-проверку и allowlist-валидацию итогового значения. |
|
|
128
|
+
| `CWE-85-JS-SLASH-FILTER` | Incomplete slash filtering in Node.js checks (`/` only, ignores `//`) | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
129
|
+
| `CWE-79-PY-DJANGO-SAFE` | XSS via Django ` | CWE Final Certification |
|
|
130
|
+
| `CWE-79-PY-DJANGO-AUTOESCAPE-OFF` | XSS via `{% autoescape off %}` around untrusted variables | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
131
|
+
| `CWE-79-PY-HTMLRESPONSE` | XSS in FastAPI/Flask HTML responses built via f-strings/concatenation | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
132
|
+
| `CWE-79-JS-SSR-RAW` | Unescaped SSR template output (`<%-` in EJS / `{{{` in Handlebars) | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
133
|
+
| `CWE-80-UNIVERSAL-NOSNIFF` | Missing `X-Content-Type-Options: nosniff` with dynamic content responses | Для динамических ответов всегда добавлять `X-Content-Type-Options: nosniff` и корректный `Content-Type`, исключая MIME sniffing. |
|
|
134
|
+
| `CWE-1336-PY-JINJA2-RTS` | SSTI risk: Jinja2 template created directly from user input | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
135
|
+
| `CWE-1336-PY-MAKO-RTS` | SSTI risk: Mako Template from user-controlled source | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
136
|
+
| `CWE-1336-JS-PUG-EJS-RTS` | SSTI risk in Node.js when compiling/rendering user template source | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
137
|
+
| `CWE-1336-JS-LODASH-TEMPLATE` | Code/template injection via `_.template(userInput)` | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
138
|
+
| `CWE-943-PY-MONGO-DICT` | NoSQL Injection: passing raw `request.json` dict into PyMongo/MongoEngine queries | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
139
|
+
| `CWE-943-PY-DJANGO-KWARGS` | Unsafe `**kwargs` unpacking from user input in Django ORM filters | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
140
|
+
| `CWE-943-JS-MONGO-FILTER` | NoSQL Injection in Node.js by using `req.body/req.query` as Mongo filter | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
141
|
+
| `CWE-943-JS-SEQUELIZE-WHERE` | Unsafe Sequelize `where` from full `req.query` object | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
142
|
+
| `CWE-23-PY-TEMPLATE-FILE` | Path Traversal via user-controlled template/file path in Django/Flask | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
143
|
+
| `CWE-23-JS-EXPRESS-SENDFILE` | Path Traversal in Express `res.sendFile`/`res.render` with `req.params/query` | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
144
|
+
| `CWE-23-JS-DYNAMIC-REQUIRE` | Dynamic `require()`/`import()` path from request data | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
145
|
+
| `CWE-89-PY-SQLALCHEMY-TEXT` | SQL Injection in SQLAlchemy `text()` with user concatenation | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
146
|
+
| `CWE-89-PY-SQLALCHEMY-ORDERBY` | Unsafe dynamic `order_by(user_input)` without allowlist mapping | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
147
|
+
| `CWE-89-JS-ORM-QUERYRAW` | SQL Injection via TypeORM/Sequelize raw query builders with concatenation | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
148
|
+
| `CWE-89-PG-COPY-PROGRAM` | PostgreSQL command/file injection via `COPY ... FROM PROGRAM` or `lo_import()` with use... | CWE Final Certification |
|
|
149
|
+
| `CWE-89-PLPGSQL-EXECUTE` | SQL Injection in PL/pgSQL dynamic `EXECUTE` without proper quoting | CWE Final Certification |
|
|
150
|
+
| `CWE-943-REDIS-CMD` | Redis command injection via dynamic `execute_command` / `send_command` arguments | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
151
|
+
| `CWE-943-REDIS-LUA-EVAL` | Redis Lua injection via `eval()`/`evalsha()` script body concatenation | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
152
|
+
| `CWE-89-PY-SQLALCHEMY-ASYNC-TEXT` | SQL Injection in SQLAlchemy Async via `await session.execute(text(...))` concatenation | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
153
|
+
| `CWE-943-REDIS-RQ-IREDIS-CMD` | Redis command injection in RQ/ioredis command APIs | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
154
|
+
| `CWE-943-REDIS-RQ-IREDIS-EVAL` | Lua script injection in Redis `eval()` from user-concatenated script body | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
155
|
+
| `CWE-918-NEXTJS-AXIOS-SSRF` | SSRF in Next.js (`getServerSideProps`/API routes) via `axios.get/post(userInput)` witho... | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
156
|
+
| `CWE-346-AXIOS-WITHCREDENTIALS` | Insecure global `axios.defaults.withCredentials = true` without trusted `baseURL` restr... | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
157
|
+
| `CWE-79-REACT-DANGEROUSLYSETHTML` | React XSS via `dangerouslySetInnerHTML` without `DOMPurify.sanitize()` wrapper | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
158
|
+
| `CWE-1321-TS-DEEPMERGE` | Prototype pollution risk in recursive deep merge without `__proto__/constructor` key gu... | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
159
|
+
| `CWE-94-OPENROUTER-PROMPT-CONCAT` | Prompt injection risk: user input concatenated into OpenRouter/OpenAI `messages` withou... | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
160
|
+
| `CWE-116-LLM-HTML-UNTRUSTED` | Untrusted LLM output (GigaAM/OpenRouter) rendered as HTML without sanitization | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
161
|
+
| `CWE-915-NODE-ASSIGN-MERGE` | Prototype pollution via `Object.assign()` / `_.merge()` with untrusted `req.body` object | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
162
|
+
| `CWE-915-SQLMODEL-MASS-ASSIGN` | SQLModel mass assignment via `model_validate()`/`from_orm()`/`**request.json` without `... | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
163
|
+
| `CWE-89-SQLMODEL-TEXT-FSTRING` | SQL injection in SQLModel query with `select().where(text(f"...{var}"))` | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
164
|
+
| `CWE-601-CSH-PROCESS-START-URL` | Open redirect / unsafe URL launch via `Process.Start(url)` from untrusted input | Use using/try-finally and safe .NET APIs; enforce strict allowlists for untrusted input. |
|
|
165
|
+
| `CWE-81-CSH-WEBBROWSER-XSS` | XSS risk in desktop WebView/WebBrowser via unescaped `DocumentText` / `InvokeScript` input | Use using/try-finally and safe .NET APIs; enforce strict allowlists for untrusted input. |
|
|
166
|
+
| `CWE-1321-CSH-DYNAMIC-EXPANDO` | Mapping JSON into `dynamic`/`ExpandoObject` without strict schema validation | Use using/try-finally and safe .NET APIs; enforce strict allowlists for untrusted input. |
|
|
167
|
+
| `CWE-749-CSH-COMVISIBLE-DANGEROUS` | `[ComVisible(true)]` class exposes public methods executing sensitive operations (`File... | Use using/try-finally and safe .NET APIs; enforce strict allowlists for untrusted input. |
|
|
168
|
+
| `CWE-123-PY-TEMPFILE-TOCTOU` | TOCTOU: проверка `os.path.exists` перед `open` без атомарного создания | Атомарные temp API; для concurrent writes — file locks; валидировать path после `mkstemp`. |
|
|
169
|
+
| `CWE-124-JS-ARRAYBUFFER-SLICE` | Небезопасное копирование из `ArrayBuffer` без проверки границ среза | Проверять `start/end` против `buffer.byteLength`; отклонять отрицательные/NaN индексы; использовать typed array helpers с валидацией. |
|
|
170
|
+
| `CWE-20-PY-VAL-EXTRA-01` | Невалидированный `float()` из query для критичного лимита | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
171
|
+
| `CWE-20-PY-VAL-EXTRA-02` | Пустая строка как путь к файлу после `strip()` | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
172
|
+
| `CWE-20-JS-VAL-EXTRA-01` | `parseInt` без radix на пользовательском вводе | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
173
|
+
| `CWE-20-JS-VAL-EXTRA-02` | Доверие `JSON.parse` без try/catch на внешнем теле | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
174
|
+
| `CWE-89-PY-VAL-EXTRA-01` | Конкатенация в `ORDER BY` с «белым списком» только в комментарии | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
175
|
+
| `CWE-79-JS-VAL-EXTRA-01` | `href` из API без протокольной проверки | Validate data with Zod and sanitize DOM/HTML sinks with DOMPurify before rendering. |
|
|
176
|
+
| `CWE-918-PY-VAL-EXTRA-01` | `ipaddress.ip_address` на пользовательском хосте без blocklist | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
177
|
+
| `CWE-502-PY-VAL-EXTRA-01` | `yaml.load` на конфиге из upload | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
178
|
+
| `CWE-611-PY-VAL-EXTRA-01` | `lxml.etree.fromstring` с `resolve_entities` по умолчанию на внешнем XML | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
179
|
+
| `CWE-20-PY-VAL-EXTRA-03` | Непроверенный `int()` из multipart filename | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
180
|
+
| `CWE-1268-PY-IPC-CHANNEL` | Подмена IPC/сокетного канала без проверки peer identity | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
181
|
+
| `CWE-1271-PY-SIGNED-ERR` | Игнорирование ошибки проверки подписи в цепочке обновлений | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
182
|
+
| `CWE-1280-PY-MARK-CRITICAL` | Критичный код помечен как «optional» в политике | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
183
|
+
| `CWE-1285-PY-NEGOTIATION` | Небезопасный downgrade при согласовании протокола | Use strict Pydantic BaseModel schemas for input/output, including response_model and field allowlists. |
|
|
184
|
+
|
|
185
|
+
## Verification
|
|
186
|
+
|
|
187
|
+
**Verification:** Check the gold testbed file(s) below for `Vulnerable: <ID>` markers (static Semgrep + `detection-matrix.md` ground truth).
|
|
188
|
+
|
|
189
|
+
- [`gold-standard-testbed/gap_fill_vulnerable.py`](../gold-standard-testbed/gap_fill_vulnerable.py)
|
|
190
|
+
|
|
191
|
+
After changing [`patterns.md`](patterns.md), run from the repo root:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
python scripts/sync_semgrep.py
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Workflow: Recon → Scan → Verify
|
|
198
|
+
|
|
199
|
+
### 1) Recon
|
|
200
|
+
- Map entrypoints, data flows, and trust boundaries for this stack.
|
|
201
|
+
- Identify which metrics in [`patterns.md`](patterns.md) apply to the code under review.
|
|
202
|
+
|
|
203
|
+
### 2) Scan
|
|
204
|
+
- Run Semgrep with `semgrep-rules/<skill>.yaml` (generated) and correlate with Anti-Patterns.
|
|
205
|
+
- Eliminate findings that cannot bind to a metric row.
|
|
206
|
+
|
|
207
|
+
### 3) Verify
|
|
208
|
+
- Confirm markers or scanner hits for touched IDs in the gold testbed when adding metrics.
|
|
209
|
+
- Emit findings as `Vulnerable: <PREFIX>-<NNN>` in written reviews.
|
|
210
|
+
|