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
2 changes: 1 addition & 1 deletion src/wardline/scanner/rules/untrusted_to_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _has_literal_true_kw(call: ast.Call, name: str) -> bool:
" obj = pickle.loads(blob)\n return blob",
# numpy.load without allow_pickle=True is safe by default (no object unpickling).
"@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))\n return p",
),
)

Expand Down
13 changes: 13 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,19 @@
"tomllib.load",
"tomli_w.dumps",
"tomli_w.dump",
"dill.dumps",
"dill.dump",
"dill.loads",
"dill.load",
"jsonpickle.encode",
Comment on lines +70 to +74
"jsonpickle.decode",
"joblib.dump",
"joblib.load",
"torch.save",
"torch.load",
"numpy.save",
Comment on lines +76 to +80

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 Do not mark write-only save calls as raw returns

For trusted wrappers that return the result of these write-side APIs, _resolve_call now reports UNKNOWN_RAW just because the callee is in _SERIALISATION_SINKS; however joblib.dump(...) returns filenames and torch.save(...)/numpy.save(...) return no serialized data. This turns otherwise clean patterns such as return torch.save(obj, path) or return joblib.dump(obj, path) into PY-WL-101/downstream taint defects, so the write-only APIs should either be excluded from this return-taint set or modeled with their real return taint.

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

"numpy.load",
Comment on lines +79 to +81

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 Apply safe-loader gates before tainting returns

When numpy.load is called without literal allow_pickle=True, or torch.load is called with weights_only=True, PY-WL-106 explicitly treats the call as safe and suppresses it. Adding these names to the unconditional _SERIALISATION_SINKS set makes _resolve_call return UNKNOWN_RAW before any keyword gate, so a trusted producer like return numpy.load(read_raw(x)) or return torch.load(read_raw(x), weights_only=True) now raises PY-WL-101/downstream taint even though the deserialization rule is silent. Please either keep these gated APIs out of the unconditional set or mirror the same gates in variable-level tainting.

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

"shelve.open",
}
)

Expand Down