84884 Commits

Author SHA1 Message Date
Taus
c75329d7b7 Python: Move metrics-related API to LegacyPointsTo module
Gets rid of the `getMetrics` methods on the `Function`, `Class`, and
`Module` classes. To access the metrics, one must first import the
`LegacyPointsTo` module, and then either change the type to
`{Function,Class,Module}Metrics` or cast to the appropriate type.
2025-11-26 17:06:55 +00:00
Taus
cd1619b43e Python: Fix queries and tests 2025-11-26 17:06:55 +00:00
Taus
b9a5b3b628 Python: Remove points-to from SSA.ql
Happily, this was not as deeply entwined as it looked at first glance.
2025-11-26 17:06:55 +00:00
Jeroen Ketema
982950ffc6 Merge pull request #20923 from github/felicity-fix-query-names
Remove trailing periods from @name metadata in query files
2025-11-26 17:08:02 +01:00
Joe Farebrother
16018e91a2 Minor test fix 2025-11-26 15:47:56 +00:00
Owen Mansel-Chan
38cb6e5a00 Delete dummy.ql for now
This is needed because a PR to another repo is needed to update the
location of the consistency queries, and until that PR is merged we
don't want to runny dummy.ql as a consistency query. After that PR is
merged we should reinstate these files so that consistency tests are
run on this test folder.
2025-11-26 15:03:09 +00:00
Jeroen Ketema
4a8fbba521 Merge branch 'main' into felicity-fix-query-names 2025-11-26 16:01:34 +01:00
Simon Friis Vindum
329df20e55 Rust: Fix typo
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-26 15:48:34 +01:00
Owen Mansel-Chan
6fbed9037f Be more specific to avoid CP 2025-11-26 14:39:58 +00:00
Owen Mansel-Chan
9481fc9451 Add QLDoc explaining reverseRead 2025-11-26 14:30:23 +00:00
Felicity Chapman
caf6b950ac Remove trailing periods from @name metadata in query files
Fixed 73 .ql query files where the @name metadata contained an ending period.
This ensures consistency with the CodeQL query metadata style guidelines.
2025-11-26 14:29:51 +00:00
Mathias Vorreiter Pedersen
d869b00672 Merge pull request #20899 from MathiasVP/ignore-non-type-template-params
C++: Ignore non-type template parameters when matching signatures in MaD
2025-11-26 14:26:45 +00:00
Jeroen Ketema
adc13e374e Merge pull request #20920 from jketema/feature-incorrect
C++: Remove incorrect tests
2025-11-26 15:01:50 +01:00
Simon Friis Vindum
815af34c66 Rust: Add additional barriers to queries 2025-11-26 14:54:11 +01:00
Simon Friis Vindum
081ab499c2 Rust: Add barrier for fieldless enum types 2025-11-26 14:46:58 +01:00
Simon Friis Vindum
6050a0e1a8 Rust: Split boolean from number barriers 2025-11-26 14:45:31 +01:00
yoff
2c835dc33c python: add changenote 2025-11-26 14:03:15 +01:00
yoff
24e55c0691 python: update MAD expectations 2025-11-26 14:00:22 +01:00
Jeroen Ketema
33c7057066 C++: Remove incorrect tests
`__has_feature` is not available in GCC versions before GCC 14.

Our frontend was exposing `__has_feature` when emulating earlier versions of
GCC. This will be fixed with the latest major frontend update though.
2025-11-26 13:42:43 +01:00
yoff
ebe29dd143 python: model urllib.ParseResult 2025-11-26 13:36:05 +01:00
yoff
a878bc61e1 python: add model for urllib.urlparse 2025-11-26 13:32:54 +01:00
yoff
d59f721341 python: add test for header injection 2025-11-26 13:32:54 +01:00
Taus
5b47fcbfa4 Python: Remove dependence on Builtins from attribute module
The `Builtins` module is deeply entwined with points-to, so it would be
nice to not have this dependence. Happily, the only thing we used
`Builtin` for was to get the names of known builtins, and for this we
already maintain such a set of names in
`dataflow.new.internal.Builtins`.
2025-11-26 12:30:31 +00:00
Taus
9dc774aaa3 Python: Remove points-to dependency from parts of SSA
For whatever reason, the CFG node for exceptions and exception groups
was placed with the points-to code. (Probably because a lot of the
predicates depended on points-to.)

However, as it turned out, two of the SSA modules only depended on
non-points-to properties of these nodes, and so it was fairly
straightforward to remove the imports of `LegacyPointsTo` for those
modules.

In the process, I moved the aforementioned CFG node types into
`Flow.qll`, and changed the classes in the `Exceptions` module to the
`...WithPointsTo` form that we introduced elsewhere.
2025-11-26 12:30:31 +00:00
Taus
e09840426c Python: Get rid of points-to from Definitions.qll
Turns out the `ImportTime` module (despite living in
`semmle.python.types` does not actually depend on points-to, so some of
the `LegacyPointsTo` imports could be replaced or removed.
2025-11-26 12:30:31 +00:00
Taus
7328f26311 Python: Fix reachability-related test failures 2025-11-26 12:30:31 +00:00
Taus
21e74a3f01 Python: Fully remove points-to from Flow.qll
Gets rid of a bunch of predicates relating to reachability (which
depended on the modelling of exceptions, which uses points-to), moving
them to `LegacyPointsTo`. In the process, we gained a new class
`BasicBlockWithPointsTo`.
2025-11-26 12:30:31 +00:00
Taus
7176898503 Python: Fix library tests 2025-11-26 12:30:31 +00:00
Taus
b3b87c968b Python: Fix extractor/experimental tests 2025-11-26 12:30:31 +00:00
Taus
665104e626 Python: Fix Python 3 tests 2025-11-26 12:30:31 +00:00
Taus
85029bd77d Python: Fix Python 2 tests 2025-11-26 12:30:30 +00:00
Taus
5b63b4957c Python: Fix query tests
Mostly just adding `private import LegacyPointsTo`. Sometimes getting
rid of other imports that are superceded by that module.
2025-11-26 12:30:30 +00:00
Taus
2732a652ab Python: Fix example snippets
One might argue that these should be rewritten entirely to use more
modern APIs, but for now I'll be content with just having them compile
properly.
2025-11-26 12:30:30 +00:00
Taus
0a4ec2ca10 Python: Move some non-points-to methods out of points-to
These methods were in `pointsto.Base` but did not actually interact with
the points-to machinery directly, so they were easy to move out.
2025-11-26 12:30:30 +00:00
Taus
f0465f441f Python: Get rid of some get...Object methods
This frees `Class.qll`, `Exprs.qll`, and `Function.qll` from the
clutches of points-to. For the somewhat complicated setup with
`getLiteralObject` (an abstract method), I opted for a slightly ugly but
workable solution of just defining a predicate on `ImmutableLiteral`
that inlines each predicate body, special-cased to the specific instance
to which it applies.
2025-11-26 12:30:30 +00:00
Taus
78c33ab55a Python: Remove points-to references from python.qll
For now, these have just been made into `private` imports. After doing
this, I went through all of the (now not compiling) files and added in
private imports to the modules that they actually depended on.

I also added an explicit import of `LegacyPointsTo` (even though it may
be unnecessary) in cases where the points-to dependency was somewhat
surprising (and one we want to get rid of). This was primarily inside
the various SSA layers.

For modules inside `semmle.python.{types, objects, pointsto}` I did not
bother, as these are fairly clearly related to points-to.
2025-11-26 12:30:30 +00:00
Simon Friis Vindum
1c8cc39a6a Merge pull request #20906 from paldepind/rust/enum-fieldless
Rust: Add predicates for fieldless and unit-only enums
2025-11-26 12:52:28 +01:00
Owen Mansel-Chan
1d0fcd77d8 Add change note 2025-11-26 11:24:04 +00:00
Joe Farebrother
8d313ff85b qldoc fixes 2025-11-26 11:23:04 +00:00
Joe Farebrother
6207137ef0 Add changenote 2025-11-26 11:21:05 +00:00
Owen Mansel-Chan
eca9ec59c4 Add exclusions to data flow consistency checks 2025-11-26 11:12:44 +00:00
Owen Mansel-Chan
a2e68487ea Shared: allow exclusions to localFlowIsLocal 2025-11-26 11:00:30 +00:00
Owen Mansel-Chan
916fe69e65 Accept data flow consistency test results 2025-11-26 11:00:25 +00:00
Joe Farebrother
eb7fe71557 Fix namespace instances and update tests 2025-11-26 10:51:16 +00:00
Tom Hvitved
7e5131891c Rust: Special-case Self::AssocType in path resolution 2025-11-26 11:50:35 +01:00
Asger F
dbf14c190a Factor XML discard predicates into OverlayXml.qll 2025-11-26 11:48:32 +01:00
Owen Mansel-Chan
7cd04e346e Move existing consistency query to new place 2025-11-26 10:44:59 +00:00
Owen Mansel-Chan
fba53b58f8 Run data flow consistency tests in CI 2025-11-26 10:44:56 +00:00
Asger F
b33af5b377 JS: Fix typo 2025-11-26 11:40:41 +01:00
Tom Hvitved
0d46dc0461 Rust: More path resolution tests 2025-11-26 11:33:17 +01:00