From cb16a55ee273a1fdc040b1e7dc701b448fa42fec Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 05:56:27 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20[CRITICAL]?= =?UTF-8?q?=20Fix=20masking=20of=20sensitive=20environment=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: bobdivx <6737167+bobdivx@users.noreply.github.com> --- .jules/sentinel.md | 4 ++++ crates/runner/src/docker.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.jules/sentinel.md b/.jules/sentinel.md index ffc0bd2ced..a32b8b562d 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -2,3 +2,7 @@ **Vulnerability:** The manual SVG sanitizer `apps/web/src/lib/sanitize-svg.ts` used an insufficient allowlist/blocklist. It allowed ``, ``, ``, ``, ``, and `` which could lead to mutation XSS (mXSS) and other attack vectors when rendering untrusted Mermaid or Math blocks. **Learning:** Manual DOM tree sanitization is notoriously hard to get right because attackers can hide active elements (e.g. `` tags with `javascript:` payloads) inside grandchild trees (like ``) or use SVG-specific tricks (like ``) which naive list-based cleaners overlook. **Prevention:** Rather than adding heavy third-party dependencies (like DOMPurify) against explicit project instructions, expanding the `BLOCKED` Set to include these structural injection vectors provides a robust, zero-dependency mitigation. Future expansions should verify nested elements carefully. +## 2023-10-25 - [Fix Masking of Secrets in Environment Variables] +**Vulnerability:** The `mask_sensitive_env_key` function in `docker.rs` was not properly masking environment variables that contained sensitive keywords (like `AWS_SECRET_ACCESS_KEY`) because it only checked for exact matches or suffix matches (e.g., ends with `_SECRET`). +**Learning:** Only matching for suffixes or exact values can leave secrets exposed when developers prefix or infix the sensitive word in the environment variable name. +**Prevention:** Use substring matching (`contains`) for sensitive keywords to ensure all variables containing words like `SECRET` or `TOKEN` are masked. diff --git a/crates/runner/src/docker.rs b/crates/runner/src/docker.rs index 7971774564..b206390900 100644 --- a/crates/runner/src/docker.rs +++ b/crates/runner/src/docker.rs @@ -486,7 +486,7 @@ pub fn mask_sensitive_env_key(key: &str) -> bool { let upper = key.to_uppercase(); SENSITIVE .iter() - .any(|n| upper == *n || upper.ends_with(&format!("_{n}"))) + .any(|n| upper.contains(n)) } pub fn parse_inspect_env(inspect: &serde_json::Value) -> Vec {