-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: Misc Guards-related cleanup. #20738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d0f1bf5 to
eb93e8e
Compare
|
Dca is fairly uneventful. I dug into one of the weird alert diffs for NullMaybe, but it turned out to be due to missing types in buildless, so 🤷 |
There was a problem hiding this comment.
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 refactors control flow guard usage across the C# codebase, replacing the deprecated controlsBlock predicate with newer guard APIs. The main changes include:
- Removal of complex split-based control flow analysis from
ControlFlowElement.qll - Simplification of guard-based constant value tracking in dataflow analysis
- Migration to shared guard libraries (
Guards::Guard.valueControls) - Updates to boolean constant detection to use value-based checks
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
ConditionalBypassQuery.qll |
Replaced manual control flow checking with Guard.directlyControls API |
DataFlowPrivate.qll |
Generalized boolean constant tracking to support any constant value type using GuardValue |
Guards.qll |
Extended boolean constant detection beyond just BoolLiteral to any boolean-typed expression with a value |
ControlFlowElement.qll |
Deprecated complex controlsBlock predicate in favor of simpler implementation |
Caching.qll |
Removed caching dependency on deprecated controlsBlock predicate |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
csharp/ql/lib/semmle/code/csharp/security/dataflow/ConditionalBypassQuery.qll
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What the title says.
There's a little bit of semantic impact from the first commit: Since the tweaked
isUnreachableInCallreferred to a slightly larger set of boolean constants than mere literals, I've expanded the input to Guards in the same way to recognize those constants.