Taus
3402d0eaeb
Python: Add self-validating CFG tests
...
These tests consist of various Python constructions (hopefully a
somewhat comprehensive set) with specific timestamp annotations
scattered throughout. When the tests are run using the Python 3
interpreter, these annotations are checked and compared to the "current
timestamp" to see that they are in agreement. This is what makes the
tests "self-validating".
There are a few different kinds of annotations: the basic `t[4]` style
(meaning this is executed at timestamp 4), the `t.dead[4]` variant
(meaning this _would_ happen at timestamp 4, but it is in a dead
branch), and `t.never` (meaning this is never executed at all).
In addition to this, there is a query, MissingAnnotations, which checks
whether we have applied these annotations maximally. Many expression
nodes are not actually annotatable, so there is a sizeable list of
excluded nodes for that query.
2026-05-05 15:21:39 +00:00
Josef Svenningsson
68be006a29
Merge pull request #21641 from github/josefs/promptInjectionImprovements
...
Improve prompt inject for Python
2026-04-29 11:23:52 +01:00
Josef Svenningsson
25a8aa97b2
Fix openai prompt injection tests
2026-04-28 18:24:26 +01:00
Josef Svenningsson
691aeb0815
Remove the chat completion create logic.
2026-04-28 18:24:24 +01:00
Josef Svenningsson
a05e191518
Add tests for anthropic prompt injection models
2026-04-28 18:24:22 +01:00
Josef Svenningsson
e069c9c2ee
Fix tests
2026-04-28 18:24:19 +01:00
Josef Svenningsson
bb18bb084c
Improve prompt inject for Python
2026-04-28 18:24:16 +01:00
Owen Mansel-Chan
6efb21314a
Merge pull request #21523 from owen-mc/docs/mad/barriers
...
Document models-as-data barriers and barrier guards and add change notes
2026-04-21 13:49:19 +01:00
Michael B. Gale
58e9bad0a0
Merge pull request #21737 from github/post-release-prep/codeql-cli-2.25.3
...
Post-release preparation for codeql-cli-2.25.3
2026-04-21 11:48:30 +02:00
Taus
b108e173a5
Merge pull request #21695 from github/tausbn/python-add-support-for-pep-798
...
Python: Add support for PEP-798
2026-04-20 15:01:01 +02:00
github-actions[bot]
a0bab539bb
Post-release preparation for codeql-cli-2.25.3
2026-04-20 12:40:34 +00:00
github-actions[bot]
c861d99802
Release preparation for version 2.25.3
2026-04-20 09:27:23 +00:00
Taus
ac23e16786
Python: Move Python 3.15 data-flow tests to a separate file
...
We won't be able to run these tests until Python 3.15 is actually out
(and our CI is using it), so it seemed easiest to just put them in their
own test directory.
2026-04-17 13:16:46 +00:00
Taus
dc36609743
Python: Add data-flow tests
...
Alas, all these demonstrate is that we already don't fully support the
desugared `yield from` form.
2026-04-17 12:15:04 +00:00
Owen Mansel-Chan
8f17b73796
Fix link formatting in change notes
2026-04-14 15:27:37 +01:00
Owen Mansel-Chan
c86ba38a4e
Add change notes
2026-04-14 15:27:31 +01:00
Henry Mercer
43c9b95e6f
Merge branch 'main' into post-release-prep/codeql-cli-2.25.2
2026-04-14 13:56:52 +01:00
Taus
8b1ecf05c9
Python: Update test output
...
This change reflects the `(value, key)` to `(key, value)` fix in an
earlier commit.
2026-04-14 13:27:31 +02:00
Taus
15790aa00c
Python: Add change note
2026-04-14 13:27:31 +02:00
Taus
de900fc3b5
Python: Add QL test for comprehensions with unpacking
2026-04-14 13:27:31 +02:00
Taus
c748fdf8ee
Merge pull request #21694 from github/tausbn/python-add-support-for-pep-810
...
Python: Add support for PEP 810
2026-04-14 13:27:08 +02:00
Owen Mansel-Chan
7458674470
Merge pull request #21584 from owen-mc/shared/update-mad-comments
...
Shared: update code comments explaining models-as-data format to include barriers and barrier guards
2026-04-14 09:30:28 +01:00
Taus
2eeb31b472
Python: Add tests for lazy from ... import * as well
2026-04-13 11:49:06 +00:00
Taus
81468daf9c
Merge pull request #21603 from github/tausbn/python-port-use-of-exit
...
Python: Port UseOfExit.ql
2026-04-13 13:20:29 +02:00
Taus
720ea702fe
Merge pull request #21602 from github/tausbn/python-port-modification-of-locals
...
Python: Port ModificationOfLocals.ql
2026-04-13 13:19:40 +02:00
Taus
36bbc8ca14
Merge pull request #21601 from github/tausbn/python-port-unused-exception-object
...
Python: Port UnusedExceptionObject.ql
2026-04-13 13:19:12 +02:00
Taus
cc9bc746a1
Merge pull request #21597 from github/tausbn/python-port-unreachable-code
...
Python: Port UnreachableCode.ql
2026-04-13 13:17:59 +02:00
Taus
86020d9eed
Python: Add change note
2026-04-10 14:43:30 +00:00
Taus
6b7d47ee7d
Python: Add QL test for the new syntax
2026-04-10 14:39:13 +00:00
Taus
1ddfed6b6b
Python: Add QL support for lazy imports
...
Adds a new `isLazy` predicate to the relevant classes, and adds the
relevant dbscheme (and up/downgrade) changes. On upgrades we do nothing,
and on downgrades we remove the `is_lazy` bits.
2026-04-10 14:25:08 +00:00
Taus
e3688444d7
Python: Also exclude class scope
...
Changing the `locals()` dictionary actually _does_ change the attributes
of the class being defined, so we shouldn't alert in this case.
2026-04-07 23:46:03 +02:00
Taus
8d79248ea7
Python: Port ModificationOfLocals.ql
2026-04-07 23:46:03 +02:00
Taus
16683aee0e
Merge pull request #21590 from github/tausbn/python-improve-bind-all-interfaces-query
...
Python: Improve "bind all interfaces" query
2026-04-07 17:59:48 +02:00
Taus
4cb238f1af
Merge pull request #21598 from github/tausbn/python-port-should-use-with
...
Python: Port ShouldUseWithStatement.ql
2026-04-07 14:16:41 +02:00
github-actions[bot]
242090e0ac
Post-release preparation for codeql-cli-2.25.2
2026-04-06 13:49:20 +00:00
github-actions[bot]
4fe2f6d2b4
Release preparation for version 2.25.2
2026-04-06 10:30:38 +00:00
Óscar San José
59eec7ffa2
Merge branch 'main' of https://github.com/github/codeql into post-release-prep/codeql-cli-2.25.1
2026-03-30 10:51:12 +02:00
github-actions[bot]
ce6e6d5db3
Post-release preparation for codeql-cli-2.25.1
2026-03-30 08:43:48 +00:00
Taus
a0b3c2f13a
Python: Update change note
...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2026-03-27 23:46:50 +01:00
Taus
187f7c7bcf
Python: Move isNetworkBind check into isSink
2026-03-27 22:45:26 +00:00
Owen Mansel-Chan
37aac05964
Replace branch with acceptingValue
2026-03-27 22:39:10 +00:00
Taus
c5ef1f6342
Python: Port UseOfExit.ql
2026-03-27 22:28:38 +00:00
Taus
4f74d421b9
Python: Exclude AF_UNIX sockets from BindToAllInterfaces
...
Looking at the results of the the previous DCA run, there was a bunch of
false positives where `bind` was being used with a `AF_UNIX` socket (a
filesystem path encoded as a string), not a `(host, port)` tuple. These
results should be excluded from the query, as they are not vulnerable.
Ideally, we would just add `.TupleElement[0]` to the MaD sink, except we
don't actually support this in Python MaD...
So, instead I opted for a more low-tech solution: check that the
argument in question flows from a tuple in the local scope.
This eliminates a bunch of false positives on `python/cpython` leaving
behind four true positive results.
2026-03-27 16:55:10 +00:00
Taus
47d24632e6
Python: Port ShouldUseWithStatement.ql
...
Only trivial test changes.
2026-03-27 12:34:20 +00:00
Taus
0ea80ac184
Python: Port UnusedExceptionObject.ql
...
Depending on whether other queries depend on this, we may end up moving
the exception utility functions to a more central location.
2026-03-27 12:34:14 +00:00
Taus
60f9ce4ce7
Python: Port UnreachableCode.ql
2026-03-27 12:33:04 +00:00
Owen Mansel-Chan
10fddc7b96
Add barriers and barrier guards to MaD format explanations
2026-03-27 09:47:24 +00:00
yoff
08e115056d
Merge pull request #21519 from github/tausbn/python-port-no-alert-change
2026-03-27 08:44:28 +01:00
Taus
c9832c330a
Python: Convert BindToAllInterfaces to path-problem
...
Now that we're using global data-flow, we might as well make use of the
fact that we know where the source is.
2026-03-26 21:10:43 +00:00
Taus
c0ce6699a5
Python: Add change note
2026-03-26 15:35:33 +00:00