Skip to content

Guards: Improve support for wrapped guards #20121

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

aschackmull
Copy link
Contributor

This improves the shared library implementation of guard wrappers in several ways. Commit-by-commit review is strongly encouraged.

  • Improves the Guards instantiation interface by removing the nesting of parameteristion of the CustomGuard/WrapperGuard module.
  • Generalises wrappers to support all sorts of return values - not just booleans.
  • Generalises wrappers to also support exceptional/normal return.
  • Adds a (currently unused) module intended to be connected to BarrierGuard to support wrapped sanitizers.

@Copilot Copilot AI review requested due to automatic review settings July 24, 2025 11:12
@aschackmull aschackmull requested a review from a team as a code owner July 24, 2025 11:12
@github-actions github-actions bot added the Java label Jul 24, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 improves the shared library implementation of guard wrappers by generalizing the wrapper support and simplifying the interface. The changes extend wrapper functionality to handle all return value types (not just booleans), support both normal and exceptional returns, and prepare for wrapped sanitizer support.

  • Removes the nested parameterization of CustomGuard/WrapperGuard modules to simplify the interface
  • Generalizes wrapper support to handle all return value types and exceptional/normal returns
  • Adds infrastructure for wrapped sanitizers through new ValidationWrapper modules

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
shared/controlflow/codeql/controlflow/Guards.qll Core implementation with generalized wrapper support, new validation wrapper modules, and simplified interface
java/ql/lib/semmle/code/java/controlflow/Guards.qll Java-specific implementation updates to use new wrapper interface and remove old CustomGuard module
java/ql/test/library-tests/guards/Guards.java Test cases for new wrapper functionality including non-boolean returns and exception handling
java/ql/test/library-tests/guards/GuardsInline.expected Expected test output for new wrapper test cases

@aschackmull aschackmull force-pushed the guards/wrapperguard branch from 940bd35 to f0be0ae Compare July 24, 2025 11:31
@aschackmull
Copy link
Contributor Author

Dca looks good. A bunch of FPs for java/dereferenced-value-may-be-null are removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy