Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
**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-10-09 - [Add Missing Deserialization Sinks to Core Taint Propagation]
**Vulnerability:** The static analyzer was missing `shelve.open`, `dill.load`, `dill.loads`, `jsonpickle.decode`, `joblib.load`, `torch.load`, and `numpy.load` in its `_SERIALISATION_SINKS` mapping, potentially leading to false negatives when tracking untrusted data flowing into these dangerous deserialization functions.
Comment on lines +11 to +12
**Learning:** Even if functions are listed in rule specifications (like `_SINK_SPECS` in `untrusted_to_deserialization.py`), 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`.
3 changes: 2 additions & 1 deletion src/wardline/scanner/rules/untrusted_to_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ def _has_literal_true_kw(call: ast.Call, name: str) -> bool:
"@trusted(level='ASSURED')\ndef f(p):\n blob = validate(read_raw(p))\n"
" obj = pickle.loads(blob)\n return blob",
# numpy.load without allow_pickle=True is safe by default (no object unpickling).
"import numpy\n"
"@external_boundary\ndef read_raw(p):\n return p\n"
"@trusted(level='ASSURED')\ndef f(p):\n return numpy.load(read_raw(p))",
"@trusted(level='ASSURED')\ndef f(p):\n numpy.load(read_raw(p))",
),
)

Expand Down
7 changes: 7 additions & 0 deletions src/wardline/scanner/taint/variable_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
"tomllib.load",
"tomli_w.dumps",
"tomli_w.dump",
"shelve.open",
"dill.load",
"dill.loads",
"jsonpickle.decode",
"joblib.load",
"torch.load",
"numpy.load",
Comment on lines +75 to +76

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve safe load gates during taint propagation

Adding torch.load and numpy.load to this ungated serialization set makes _resolve_call return UNKNOWN_RAW for every call before the deserialization rule's gates can matter. In code that uses the documented safe forms (numpy.load(path)/allow_pickle=False or torch.load(..., weights_only=True)) and then returns or forwards the loaded value from a trusted function, this now triggers downstream taint defects such as PY-WL-101 even though UntrustedToDeserialization._accept_call explicitly suppresses those same calls as non-sinks at lines 153-155. These two entries need the same keyword gating in the propagation path rather than being treated as unconditional representation-boundary sinks.

Useful? React with πŸ‘Β / πŸ‘Ž.

}
)

Expand Down