Skip to content

Conversation

alexet
Copy link
Contributor

@alexet alexet commented Oct 7, 2025

This makes some expensive predicates in "query" libraries local. These all seem obviously local to me and they are all slow (mostly due to regexes, but soemtiems for other reasons)

@github-actions github-actions bot added the Java label Oct 7, 2025
@alexet alexet requested a review from kaspersv October 8, 2025 17:46
@alexet alexet marked this pull request as ready for review October 8, 2025 17:46
@alexet alexet requested a review from a team as a code owner October 8, 2025 17:46
@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 17:46
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 optimizes performance in Java query libraries by adding the overlay[local?] annotation to expensive predicates. The purpose is to make certain predicates local to improve query execution performance, particularly for predicates that contain slow operations like regular expressions.

Key changes:

  • Added overlay[local?] annotations to three expensive predicate classes
  • Targets predicates with known performance issues due to regex operations and other expensive computations
  • Maintains existing functionality while improving execution efficiency

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
java/ql/lib/semmle/code/java/security/UrlForwardQuery.qll Added local overlay annotation to BarrierPrefix class
java/ql/lib/semmle/code/java/security/StaticInitializationVectorQuery.qll Added local overlay annotation to ArrayUpdate class
java/ql/lib/semmle/code/java/security/BrokenCryptoAlgorithmQuery.qll Added local overlay annotation to BrokenAlgoLiteral class

Copy link
Contributor

@kaspersv kaspersv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you run a DCA overlay experiment to test if these changes had any impact on overlay accuracy for these queries?

ma = this and
ma.getArgument(0) = array
|
m.getAnOverride*().hasQualifiedName("java.io", ["InputStream", "RandomAccessFile"], "read") or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These m.getAnOverride*() aren't file-local though they seem unlikely to matter in practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point as these are getAnOverride so point backwards to what I thought they did.

@alexet
Copy link
Contributor Author

alexet commented Oct 10, 2025

I have a DCA experiment here; https://github.com/github/codeql-dca-main/issues/32115 . it's in progress as it failed the first time.

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.

2 participants