cwe1321-protection-suite
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 1
- Forks
- 0
02 资源文件 13
- 参考文档HANDOFF.md585 B
- 其他js/codeql-query.ql1.3 KB
- 参考文档js/eslint-rules.json709 B
- 脚本js/sanitize.js3.4 KB
- 参考文档js/semgrep-cwe1321-js.yml2.7 KB
- 参考文档manifest.json992 B
- 其他python/bandit.config540 B
- 脚本python/safe_parser.py3.4 KB
- 参考文档python/semgrep-cwe1321-py.yml2.2 KB
- 参考文档README.md3.9 KB
- 参考文档TEST-REPORT.md2.1 KB
- 脚本tests/sanitize.test.mjs2.9 KB
- 脚本tests/test_safe_parser.py2.6 KB
03 SKILL.md 正文
Security Module: CWE-1321 — Prototype Pollution Protection
ID: cwe1321-protection-suite-v1.0.0 Version: 1.0.0 Type: Security Module
Tags: cwe-1321, prototype-pollution, security, semgrep, bandit, eslint, codeql, sanitizer
Severity: P0 (Critical) Visibility: Public · Production Ready
Overview
Detection rules (ESLint / Semgrep / CodeQL / Bandit) plus runtime sanitization helpers (JS + Python) that together eliminate CWE-1321 Prototype Pollution from the NotebookLM Skill Suite and any FastAPI/JS code paths that ingest untrusted JSON.
Files (in deliverables/cwe1321-protection-suite/)
js/sanitize.js runtime helpers (sanitizePrototypeKeys, safeMerge, safeClone, nullObject)
js/eslint-rules.json no-proto / no-prototype-builtins / detect-object-injection
js/semgrep-cwe1321-js.yml
js/codeql-query.ql
python/safe_parser.py safe_load_json / safe_update_dict / fastapi_safe_dict
python/bandit.config
python/semgrep-cwe1321-py.yml
tests/ 8 JS tests (node --test) + 9 Python tests (pytest)
Threat model (CWE-1321)
Untrusted input carrying __proto__, prototype, or constructor keys can,
when merged/assigned onto an object or mapped onto attributes by a framework
(Pydantic coercion, ORM **kwargs, setattr), mutate shared prototype / class
state. This often escalates to RCE or auth bypass.
Protection gates
| Layer | Engine | What it enforces |
|---|---|---|
| Static JS | ESLint | no-proto, no-prototype-builtins, security/detect-object-injection |
| Static JS | Semgrep | __proto__/prototype/constructor writes, naive merge |
| Data-flow | CodeQL | writes to __proto__/prototype/constructor |
| Static Py | Semgrep | setattr / dict / merge pollution patterns |
| Static Py | Bandit | severity baseline (medium+) |
| Runtime | JS/Python helpers | strip blocked keys at every depth, safe merge, safe loaders |
Verification gates (Gate 5 of skill template)
- Structure valid — YAML/JSON rules parse; helpers are dependency-free.
- Vuln scan — Semgrep + Bandit flag the target patterns in real payloads.
- Permission check — safe loaders never write outside the target object.
- Output verify — report shape is the suite standard
{status, keys, remediation}.
Skill wiring
notebooklm-link-resolver→ run query params throughsanitizePrototypeKeys.artifact-router→ sanitize paths / IDs viasafe_parser.strip_blocked_keys.link-to-knowledge→ accept only payloads that passfastapi_safe_dict.link-security→ remediation hook (safe loaders).
Import
Place under skills/ (registry) or keep in deliverables/cwe1321-protection-suite/ as the source
of truth. Both copies are kept in sync. Register in skills/index.json with
provides: ["cwe-1321-protection", "prototype-pollution-detection", "prototype-pollution-sanitization"].
04 同仓库更多 Skills
workflow_dispatch
暂无简介
research
Multi-source research & knowledge synthesis with cross-validation, provenance graph, confidence score
pr-triage-automove
暂无简介
patch
暂无简介
git-patch-merge
暂无简介
fetching
Low-level async HTTP/GraphQL fetch — SSRF-safe, retry, cache, provenance