-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Share XML discard predicates #20873
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
Share XML discard predicates #20873
Conversation
8ed22e1 to
dbf14c1
Compare
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 XML discard predicates by extracting them into shared OverlayXml.qll modules across five languages (Python, JavaScript, Java, Go, and C#). The shared code is synchronized via the identical-files.json configuration since parameterized modules and qlpacks cannot be used in this case.
- Introduces identical
OverlayXml.qllfiles in each language's internal directory - Removes duplicate XML handling code from existing
Overlay.qllfiles - Adds imports to the new shared modules
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/ql/lib/semmle/python/internal/OverlayXml.qll | New shared module containing XML discard predicates for overlay analysis |
| python/ql/lib/semmle/python/Overlay.qll | Removes duplicate XML handling code and imports the new OverlayXml module |
| javascript/ql/lib/semmle/javascript/internal/OverlayXml.qll | New shared module containing XML discard predicates for overlay analysis |
| javascript/ql/lib/semmle/javascript/internal/Overlay.qll | Removes xmllocations reference and imports the new OverlayXml module |
| java/ql/lib/semmle/code/xml/XML.qll | Removes unnecessary Overlay import and discardable XML classes |
| java/ql/lib/semmle/code/java/internal/OverlayXml.qll | New shared module containing XML discard predicates for overlay analysis |
| java/ql/lib/semmle/code/java/Overlay.qll | Removes duplicate XML handling code, updates getRawFile to exclude xmllocations, and imports the new OverlayXml module |
| go/ql/lib/semmle/go/internal/OverlayXml.qll | New shared module containing XML discard predicates for overlay analysis |
| go/ql/lib/semmle/go/Overlay.qll | Removes duplicate XML predicates and imports the new OverlayXml module |
| csharp/ql/lib/semmle/code/csharp/internal/OverlayXml.qll | New shared module containing XML discard predicates for overlay analysis |
| csharp/ql/lib/semmle/code/csharp/internal/Overlay.qll | Removes duplicate XML handling code and imports the new OverlayXml module |
| config/identical-files.json | Registers all five OverlayXml.qll files as synchronized identical files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
michaelnebel
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.
C# LGTM!
owen-mc
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.
Go 👍🏻
tausbn
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.
Python 👍
| */ | ||
| private predicate isOverlay() { databaseMetadata("isOverlay", "true") } | ||
|
|
||
| private @file getXmlFile(@xmllocatable locatable) { |
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.
Do all languages extract @file using named trap ids? Because if not, then this identification change from string to @file won't work. I'm guessing that they do, but this is a subtle change, so I figured it would be best to check.
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.
If string is the more robust option, let's go with that.
6257bed
Shares the discard predicates for XML entities.
This happens via synchronized-files since parameterised modules and qlpacks can't be used in this case.