diff --git a/.changeset/113-malicious-markdown-links.md b/.changeset/113-malicious-markdown-links.md new file mode 100644 index 000000000..88e553a72 --- /dev/null +++ b/.changeset/113-malicious-markdown-links.md @@ -0,0 +1,5 @@ +--- +type: Security +pr: 113 +--- +**Scanner now detects malicious markdown link schemes** — `scanForInjection()` previously passed markdown links containing `javascript:`, `data:` (non-image/font), `https://user:pass@host` userinfo credentials, and sensitive query-string key names (`token=`, `api_key=`, etc.) as clean. Four new rules (`MD-LINK-JS-SCHEME`, `MD-LINK-DATA-SCHEME`, `MD-LINK-USERINFO`, `MD-LINK-TOKEN-IN-QUERY`) now flag these patterns in both the scanner and the `gsd-read-injection-scanner.js` hook. The `data:` safe-list permits image and font MIME types; `data:image/svg+xml` is intentionally blocked because SVG can host inline scripts. diff --git a/get-shit-done/bin/lib/security.cjs b/get-shit-done/bin/lib/security.cjs index 48b0f0c6c..be64ce549 100644 --- a/get-shit-done/bin/lib/security.cjs +++ b/get-shit-done/bin/lib/security.cjs @@ -152,6 +152,76 @@ const INJECTION_PATTERNS = [ /(?:run|execute|call|invoke)\s+(?:the\s+)?(?:bash|shell|exec|spawn)\s+(?:tool|command)/i, ]; +/** + * Patterns that flag hostile markdown link targets. + * + * These address browser-side and agent-side risks when GSD plan files containing + * markdown links are rendered or consumed by agents: + * + * MD-LINK-JS-SCHEME — javascript: URI in link target. + * Source: OWASP Cross-Site Scripting Prevention Cheat Sheet + * https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html + * + * MD-LINK-DATA-SCHEME — data: URI that is NOT in the explicit safe-list. + * Safe-list: image/(png|jpeg|gif|webp|bmp|ico|avif|heic) and font/(woff2?|otf|ttf). + * data:image/svg+xml is UNSAFE — SVG can host