-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Guards: Generalise ValidationWrapper to support GuardValue-based BarrierGuards #21001
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
Guards: Generalise ValidationWrapper to support GuardValue-based BarrierGuards #21001
Conversation
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 generalizes the ValidationWrapper module in the Guards library to support GuardValue-based barrier guards and renames related components to better reflect their general parameter usage rather than being constrained to flow-state.
- Changes the
guardChecksSigsignature from acceptingboolean branchto acceptingGuardValue gv - Renames
StateSigtoParamSig,WithStatetoWithParam, andValidationWrapperWithStatetoParameterizedValidationWrapper - Updates Java and C++ implementations to adapt to the new GuardValue-based interface
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| shared/controlflow/codeql/controlflow/Guards.qll | Generalizes validation wrapper signatures to use GuardValue instead of boolean, and renames state-related identifiers to more general parameter naming |
| java/ql/lib/semmle/code/java/dataflow/internal/SsaImpl.qll | Adds adaptation layer to convert from boolean-based guard checks to GuardValue-based interface |
| cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll | Updates module references and adds adaptation layer for GuardValue-based interface |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
af8f4e8 to
7d8e2d6
Compare
hvitved
left a comment
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, but could we have a test case?
|
Also, remember to run DCA. |
fd4a503 to
eaa9686
Compare
First commit as the title says - in particular, this allows BarrierGuards that work like assertions, i.e. they potentially throw instead of returning a boolean.
Second commit renames the module as the WithState naming felt a bit too constrained - it's not just (flow-)state, it's a general parameter that can be used for whatever.