Skip to content

🛡️ Sentinel: [CRITICAL] Fix Parameter Default Taint Evaluation - #170

Open
tachyon-beep wants to merge 1 commit into
mainfrom
sentinel-fix-taint-leakage-8964354402898991093
Open

🛡️ Sentinel: [CRITICAL] Fix Parameter Default Taint Evaluation#170
tachyon-beep wants to merge 1 commit into
mainfrom
sentinel-fix-taint-leakage-8964354402898991093

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

🚨 Severity: CRITICAL
đź’ˇ Vulnerability: Parameter default value expressions were evaluated using function_taint as the fallback base taint in the L2 static analyzer. This caused untrusted data in default expressions (e.g., x=get_untrusted_data()) to erroneously inherit ASSURED when the parent function was decorated with @trusted(level="ASSURED"), effectively masking the leakage.
🎯 Impact: If exploited, untrusted data could leak into trusted functions via default arguments without triggering PY-WL-101, bypassing the security gate.
đź”§ Fix: Modified _seed_parameters in src/wardline/scanner/taint/variable_level.py to evaluate default parameter expressions using a clean base state (TaintState.INTEGRAL) rather than inheriting function_taint. Added a regression test case to verify parameter default expressions do not inherit function_taint. Added learning to journal.
âś… Verification: Verified using make test which exercises the newly added test file tests/unit/scanner/taint/test_wl_crit_01_defaults.py.


PR created automatically by Jules for task 8964354402898991093 started by @tachyon-beep

…tion

When evaluating parameter default expressions in `wardline`'s L2 taint analysis (`_seed_parameters`), the expressions were erroneously inheriting `function_taint` as their fallback base taint. This allowed untrusted data in default expressions (e.g., `x=get_untrusted_data()`) to inherit `ASSURED` status when the parent function was `@trusted(level="ASSURED")`, masking the leakage of untrusted data into trusted code without triggering PY-WL-101. This commit changes the base state to a clean `TaintState.INTEGRAL` to prevent taint leakage via parameter defaults.

Co-authored-by: tachyon-beep <544926+tachyon-beep@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 28, 2026 16:34
@google-labs-jules

Copy link
Copy Markdown
Contributor

đź‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a đź‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a taint-analysis vulnerability where default parameter value expressions were evaluated using function_taint as the base taint, allowing trusted-function taint to inappropriately influence the taint of default expressions.

Changes:

  • Update _seed_parameters in src/wardline/scanner/taint/variable_level.py to evaluate default expressions with TaintState.INTEGRAL instead of function_taint.
  • Add a regression test module for default/kw-only default taint evaluation.
  • Record the incident/learning in .jules/sentinel.md and apply minor formatting-only edits in a few MCP/install-related tests and server code.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/wardline/scanner/taint/variable_level.py Changes the base taint used when resolving parameter default expressions.
tests/unit/scanner/taint/test_wl_crit_01_defaults.py Adds unit coverage for default-expression taint behavior (needs strengthening to actually cover the regression).
.jules/sentinel.md Adds a sentinel journal entry for the vulnerability/learning (contains a Python semantics inaccuracy).
src/wardline/mcp/server.py Formatting-only change to a trust_packs merge expression.
src/wardline/install/block.py Adds blank lines (formatting-only).
tests/unit/mcp/test_server_trust_grants.py Formatting-only change to write_text(...) call.
tests/unit/install/test_mcp_json.py Formatting-only changes (line wrapping / signature layout).
tests/unit/install/test_doctor_pack_grants.py Formatting-only change (test signature layout).

đź’ˇ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +13 to +21
def test_default_expression_evaluated():
src = "def f(x=get_untrusted_data()):\n pass\n"
out = _vt(src, function_taint=T.ASSURED, taint_map={"get_untrusted_data": T.EXTERNAL_RAW})
assert out["x"] == T.EXTERNAL_RAW, out["x"]

src = "def f(x=get_untrusted_data(), y=other()):\n pass\n"
out = _vt(src, function_taint=T.ASSURED, taint_map={"get_untrusted_data": T.EXTERNAL_RAW, "other": T.ASSURED})
assert out["x"] == T.EXTERNAL_RAW, out["x"]
assert out["y"] == T.ASSURED, out["y"]
Comment thread .jules/sentinel.md

## 2026-08-28 - Prevent Taint Leakage via Parameter Defaults
**Vulnerability:** Parameter default value expressions were evaluated using `function_taint` as the fallback base taint in the L2 static analyzer. This caused untrusted data in default expressions (e.g., `x=get_untrusted_data()`) to inherit `ASSURED` when the function was `@trusted(level="ASSURED")`, masking the leakage.
**Learning:** Default parameter expressions are evaluated at the call site at runtime, not from within the function's scope. They should not inherit the function's overall trust level during static analysis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants