🛡️ Sentinel: [CRITICAL] Fix deserialization sinks missing from taint propagation#98
Conversation
…propagation Added `dill.load`, `dill.loads`, `jsonpickle.decode`, `joblib.load`, `torch.load`, and `numpy.load` to `_SERIALISATION_SINKS` in `variable_level.py`. Also adjusted a unit test `examples_clean` to accommodate the change in taint tracking behavior for `numpy.load`. Co-authored-by: tachyon-beep <544926+tachyon-beep@users.noreply.github.com>
|
đź‘‹ 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR hardens Wardline’s Python taint propagation by ensuring additional third-party (de)serialization entrypoints are treated as representation-boundary calls, preventing validated inputs from incorrectly conferring “trusted” provenance onto deserialized outputs and reducing security-scanning false negatives.
Changes:
- Added missing third-party deserialization functions (
dill.*,jsonpickle.decode,joblib.load,torch.load,numpy.load) to the core_SERIALISATION_SINKSfrozenset used by variable-level taint propagation. - Updated the
PY-WL-106rule’s “clean” example so it remains clean under the new taint tracking semantics. - Documented the incident/learning in
.jules/sentinel.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/wardline/scanner/taint/variable_level.py |
Expands core serialization/deserialization sink list so these calls shed validation provenance to UNKNOWN_RAW. |
src/wardline/scanner/rules/untrusted_to_deserialization.py |
Adjusts rule metadata example to avoid unintended findings after taint behavior changes. |
.jules/sentinel.md |
Adds a Sentinel log entry capturing the vulnerability, learning, and prevention guidance. |
đź’ˇ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| **Vulnerability:** The static analyzer was missing `yaml.unsafe_load` and `yaml.full_load` in its `_SERIALISATION_SINKS` mapping, potentially leading to false negatives when tracking untrusted data flowing into these dangerous deserialization functions. | ||
| **Learning:** Even if functions are listed in rule specifications (like `_SINK_SPECS`), they also need to be properly categorized in the core taint propagation logic (`_SERIALISATION_SINKS`) to ensure the analyzer correctly sheds validation provenance (converting output to `UNKNOWN_RAW`). | ||
| **Prevention:** When adding new sinks to rule definitions, always verify if they need to be added to core propagation mappings like `_SERIALISATION_SINKS` or `_PROPAGATING_BUILTINS`. | ||
| ## 2025-02-14 - Add Unsafe Third-party Loaders to Taint Tracking |
🚨 Severity: CRITICAL
đź’ˇ Vulnerability: The static analyzer was missing
dill.load,dill.loads,jsonpickle.decode,joblib.load,torch.load, andnumpy.loadin its_SERIALISATION_SINKSmapping.🎯 Impact: Untrusted data flowing into these dangerous deserialization functions might not have shed validation provenance correctly, leading to false negatives in security scanning.
đź”§ Fix: Added these missing deserialization sinks to the
_SERIALISATION_SINKSset insrc/wardline/scanner/taint/variable_level.py. Adjusted a unit test insrc/wardline/scanner/rules/untrusted_to_deserialization.pyto ensure it passes with the new taint tracking behavior.âś… Verification: Ran
uv run pytest tests/unit/scanner/taint/test_variable_level.pyanduv run pytest tests/unit/scanner/rules/test_rule_examples_meta.pylocally and all passed.PR created automatically by Jules for task 17940626351355831895 started by @tachyon-beep