{{ message }}
Java: Always use both "javax" and "jakarta" at the beginning of Jave EE packages#21319
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes Java EE package matching to support both javax.* and jakarta.* prefixes by introducing and adopting a shared javaxOrJakarta() helper.
Changes:
- Added a shared predicate
javaxOrJakarta()and replaced many hard-codedjavax.*package checks withjavaxOrJakarta() + .... - Updated a wide range of framework models and security queries to recognize Jakarta EE equivalents.
- Added a changelog entry documenting expected alert changes.
Reviewed changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.
Show a summary per file
Comments suppressed due to low confidence (2)
java/ql/src/utils/modelgenerator/internal/CaptureModels.qll:1
- Swing is a Java SE API (
javax.swing) and does not have ajakarta.swingequivalent. UsingjavaxOrJakarta()here can causejakarta.swing...(including any user-defined packages) to be treated as Swing, changing behavior unexpectedly. Suggest keeping this match restricted tojavax.swing%."
java/ql/src/experimental/Security/CWE/CWE-094/ScriptInjection.ql:1 javax.scriptis part of Java SE (JSR-223) and does not have ajakarta.scriptpackage. Broadening this tojakarta.scriptrisks matching unrelated/user-defined packages and producing false positives. Suggest reverting these checks tojavax.scriptonly."
8978d63 to
b811314
Compare
This is just a find-replace of `"javax` with `javaxOrJakarta() + "`.
6266dab to
91c731f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Previously this was done in some places but not all. I have added a predicate to make it easier. Hopefully this will make it more discoverable as well.
The first commit is a find-replace-all on all .ql and .qll files in the
javasubdirectory, replacing"javaxwithjavaOrJakarta() + ".