You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust unsafe-deserialization: guidance for byte-bounded serde_json input #23372
The Rust rust/unsafe-deserialization rule recommends validating input size before deserialization. Its good example checks a byte limit before calling serde_json::from_slice.
With CodeQL CLI 2.27.6 and codeql/rust-queries@0.1.48, I observed that the query still reports this call pattern when the input is a modeled remote source and the oversized branch returns before parsing. The public example illustrates the guard I mean. I am not including application source or alert URLs.
The current query extension appears to handle modeled and type-based barriers, but does not appear to recognize dominating byte-length checks by default. Is the continued report intentional because a size check alone is insufficient? If so, what additional validation does the rule expect, and can the help clarify what the query recognizes? If this is a modeling gap, could you add a query test covering the documented pattern with a modeled remote source?
I am not asking to treat all bounded JSON as safe: a byte limit is not a bound on every downstream allocation or operation. The goal is to distinguish what the documented check actually mitigates from the risk that the rule still intends to report.
Activity