Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
869 commits
Select commit Hold shift + click to select a range
0dd756d
PS: Add support for variables.
MathiasVP Mar 26, 2025
31f14ba
PS: Add synthesis framework for cleaning up the AST.
MathiasVP Mar 26, 2025
faa9473
PS: Add an implicit this parameter to all methods.
MathiasVP Mar 26, 2025
5bc0a26
PS: A call to set-variable is an explicit assignment.
MathiasVP Mar 26, 2025
0b4a7f9
PS: Synthesize a simpler notion of parameters.
MathiasVP Mar 26, 2025
1766134
PS: expr-to-stmt conversions.
MathiasVP Mar 26, 2025
8eb5e65
PS: Synthesize Function and Type classes instead of relying on the st…
MathiasVP Mar 26, 2025
3bb6021
PS: Remove the CmdExpr AST elements and synthesize StmtExpr instead w…
MathiasVP Mar 26, 2025
7adb020
PS: Remove arguments that are just names for a named argument.
MathiasVP Mar 26, 2025
9f4d1c6
PS: PowerShell doesn't have a notion of true, false, null, etc. In th…
MathiasVP Mar 26, 2025
171f5ca
PS: Inside a process block the name of a pipeline parameter actually …
MathiasVP Mar 26, 2025
cc13922
PS: Make the experimental query compile again.
MathiasVP Mar 26, 2025
9efc3ec
PS: Make dataflow compile again.
MathiasVP Mar 25, 2025
c2e24ea
PS: Make CFG construction compile again.
MathiasVP Mar 25, 2025
8f9bc1e
PS: Make SSA compile again.
MathiasVP Mar 25, 2025
8092345
PS: Make type-tracking and taint-tracking compile again.
MathiasVP Mar 25, 2025
7551cce
PS: Make API graphs compile again. There is still some TODOs here, bu…
MathiasVP Mar 25, 2025
655d80e
PS: Repair tests and accept test changes in syntax tests.
MathiasVP Mar 26, 2025
c840f86
PS: Accept CFG test changes.
MathiasVP Mar 26, 2025
0fc5778
PS: Accept dataflow/taint-tracking/type-tracking regressions.
MathiasVP Mar 27, 2025
cea435c
Merge pull request #178 from microsoft/powershell-ipa-the-ast
MathiasVP Mar 27, 2025
dcb98ab
PS: Don't include the this parameter in getParameter.
MathiasVP Mar 27, 2025
7b9a41a
PS: Handle this parameters in a few more places.
MathiasVP Mar 27, 2025
ee0a21e
PS: Make child mapping classes private.
MathiasVP Mar 28, 2025
2da8da0
PS: Add helper predicates for if statements.
MathiasVP Mar 28, 2025
18d94f2
PS: Don't include the variable in the IPA definition for variable acc…
MathiasVP Mar 28, 2025
19454a5
PS: Small additions to the CFG classes and a small bugfix.
MathiasVP Mar 28, 2025
f85767f
PS: add a super class for all loop-related CFG nodes.
MathiasVP Mar 28, 2025
a9861e1
PS: Add a library that calculated escaping values much more efficient…
MathiasVP Mar 28, 2025
ee8c586
PS: Use the new library to calculate returned expressions.
MathiasVP Mar 28, 2025
b2cf155
PS: Define pre-return node and implicit-wrapping nodes using the scri…
MathiasVP Mar 28, 2025
5d5448d
PS: Also use the new library to handle array expressions.
MathiasVP Mar 28, 2025
3643b93
fixup! PS: Define pre-return node and implicit-wrapping nodes using t…
MathiasVP Mar 28, 2025
7102ebb
PS: Accept test changes.
MathiasVP Mar 28, 2025
e17a169
Merge pull request #180 from microsoft/powershell-ast-modernization-f…
MathiasVP Mar 28, 2025
a6a1734
PS: Easier debugging with strings for child indices.
MathiasVP Mar 29, 2025
ee4104b
PS: Fix parent-child mapping for iterator pipeline access synthesis.
MathiasVP Mar 29, 2025
88f638d
PS: Fix more pipeline flow.
MathiasVP Mar 31, 2025
0b9720c
PS: Accept test changes.
MathiasVP Mar 31, 2025
08dc818
PS: Add Chanel's missing flow example.
MathiasVP Apr 1, 2025
129b787
PS: Allow shadowing of automatic variables.
MathiasVP Apr 1, 2025
8ae92a5
PS: Accept test changes.
MathiasVP Apr 1, 2025
898297b
Merge pull request #181 from microsoft/powershell-ast-modernization-f…
chanel-y Apr 1, 2025
1c380fb
PS: Add another missing flow found by Chanel.
MathiasVP Apr 1, 2025
5fa3beb
PS: Normalize parameter keywords and accept test changes.
MathiasVP Apr 1, 2025
b452339
Merge pull request #182 from microsoft/fix-parameter-by-name-flow-2
chanel-y Apr 1, 2025
6125973
C#: Add a hash-cons library for C#.
MathiasVP Apr 3, 2025
70ca686
C#: Make a few more modules private.
MathiasVP Apr 3, 2025
cd8e5e6
PS: Subclass AnyElement into positional or key-ional.
MathiasVP Apr 1, 2025
4d04b11
PS: Add some implicit reads at process blocks, and fix CFG for proces…
MathiasVP Apr 3, 2025
3acbd83
PS: Drive-by fix: The variable access in a foreach loop implicitly wr…
MathiasVP Apr 3, 2025
86ec291
PS: Improve toString on phi nodes.
MathiasVP Apr 3, 2025
5151eb3
PS: Add dataflow for pipeline-by-property-name variables.
MathiasVP Apr 3, 2025
38536a9
PS: Accept test changes.
MathiasVP Apr 3, 2025
7c59a74
Merge pull request #184 from microsoft/fix-parameter-by-name-flow-3
chanel-y Apr 3, 2025
656b734
initial query
chanel-y Apr 3, 2025
22ff3a3
Merge branch 'main' of https://github.com/microsoft/codeql into power…
chanel-y Apr 3, 2025
403c182
PS: Fixup SSA after GitHub's recent changes.
MathiasVP Apr 3, 2025
2f215c1
PS: Accept test changes.
MathiasVP Apr 3, 2025
e261510
Merge branch 'main' into hashcons-for-csharp
ropwareJB Apr 3, 2025
6873eba
Merge pull request #185 from microsoft/fix-ssa-for-powershell-2
dilanbhalla Apr 3, 2025
50c57c2
PS: Drive-by: Assign a location to top-level functions.
MathiasVP Apr 3, 2025
4b14e5e
PS: Lift automatic variables to the cfg and dataflow layers.
MathiasVP Apr 3, 2025
4df449d
PS: Add an edge from the root node to automatic variables, and from a…
MathiasVP Apr 3, 2025
22bdcf0
PS: Force lower casing on method edges.
MathiasVP Apr 3, 2025
c5c3236
Merge branch 'main' into hashcons-for-csharp
ropwareJB Apr 3, 2025
16348b5
PS: Consistently use the pipeline parameter as the parameter when it …
MathiasVP Apr 4, 2025
ebc7327
PS: Get rid of the pipelineVARIABLE and only have pipelinePARAMETER (…
MathiasVP Apr 4, 2025
cdd68b3
PS: Improve the location of synthesized variables.
MathiasVP Apr 4, 2025
03f3561
PS: Accept test changes.
MathiasVP Apr 4, 2025
f482c9d
PS: Make the implementation of 'getExtraNodeFromType' more complete. …
MathiasVP Apr 4, 2025
65abf48
PS: Add missing taint-flow and dataflow dispatch from models.
MathiasVP Apr 4, 2025
8a58af8
PS: Add a model for 'EscapeSingleQuotedStringContent' and add a test.
MathiasVP Apr 4, 2025
a2d4296
Merge branch 'main' into powershell-automatic-variables-as-member-edges
chanel-y Apr 4, 2025
38f0f07
modeled some user input, sanitizers
chanel-y Apr 4, 2025
6db354e
Merge branch 'main' of https://github.com/microsoft/codeql into power…
chanel-y Apr 4, 2025
6da7e4c
Update sync-main.yml
dilanbhalla Apr 4, 2025
e0b8e20
Update sync-main.yml
dilanbhalla Apr 4, 2025
2af5513
Update sync-main.yml
dilanbhalla Apr 4, 2025
6cbc80a
Merge pull request #187 from microsoft/dilan/sync-main-createpr
dilanbhalla Apr 4, 2025
3c45925
Update sync-main.yml
dilanbhalla Apr 4, 2025
452f56f
Merge pull request #188 from microsoft/dilan/sync-main-trigger
dilanbhalla Apr 4, 2025
157c57a
Update sync-main.yml
dilanbhalla Apr 4, 2025
13e5305
Merge pull request #189 from microsoft/dilan/sync-main-bugs-1
dilanbhalla Apr 4, 2025
cda36a8
Update sync-main.yml
dilanbhalla Apr 4, 2025
8568260
Merge branch 'main' into dilan/sync-main-bugs-2
dilanbhalla Apr 4, 2025
52ceda1
Merge pull request #190 from microsoft/dilan/sync-main-bugs-2
dilanbhalla Apr 4, 2025
e0a6a4e
Update sync-main.yml
dilanbhalla Apr 4, 2025
fb938ab
Merge pull request #191 from microsoft/dilan/sync-main-bugs-3
dilanbhalla Apr 4, 2025
3c92f6b
Update sync-main.yml
dilanbhalla Apr 4, 2025
41406d1
Merge pull request #192 from microsoft/dilan/sync-main-bugs-4
dilanbhalla Apr 4, 2025
ae5709d
Update sync-main.yml
dilanbhalla Apr 5, 2025
e098dd3
Merge pull request #193 from microsoft/dilan/sync-main-bugs-5
dilanbhalla Apr 8, 2025
7e90d99
Update sync-main.yml
dilanbhalla Apr 8, 2025
db6d82c
Update sync-main.yml
dilanbhalla Apr 8, 2025
c1665fd
Update sync-main.yml
dilanbhalla Apr 8, 2025
dc9fdb5
Update sync-main.yml
dilanbhalla Apr 8, 2025
b676246
Update sync-main.yml
dilanbhalla Apr 8, 2025
75fb343
Update sync-main.yml
dilanbhalla Apr 8, 2025
d81989f
Update sync-main.yml
dilanbhalla Apr 8, 2025
ed31f43
Update sync-main.yml
dilanbhalla Apr 8, 2025
e2bac16
Update sync-main.yml
dilanbhalla Apr 8, 2025
0d40476
Update sync-main.yml
dilanbhalla Apr 8, 2025
9442bf3
Update sync-main.yml
dilanbhalla Apr 8, 2025
3324c30
Update sync-main.yml
dilanbhalla Apr 8, 2025
d384e41
Update sync-main.yml
dilanbhalla Apr 8, 2025
bc8220f
Update sync-main.yml
dilanbhalla Apr 8, 2025
71ccc96
Update sync-main.yml
dilanbhalla Apr 8, 2025
7259356
Update sync-main.yml
dilanbhalla Apr 8, 2025
3a630ad
Update sync-main.yml
dilanbhalla Apr 8, 2025
d92e61e
Update sync-main.yml
dilanbhalla Apr 8, 2025
9a59b1c
Update sync-main.yml
dilanbhalla Apr 8, 2025
9bbffb6
Update sync-main.yml
dilanbhalla Apr 8, 2025
eb41d97
Update sync-main.yml
dilanbhalla Apr 8, 2025
be4f1f1
Update sync-main.yml
dilanbhalla Apr 8, 2025
7a168b0
Update sync-main.yml
dilanbhalla Apr 8, 2025
544f0ca
Update sync-main.yml
dilanbhalla Apr 8, 2025
826d43d
Update sync-main.yml
dilanbhalla Apr 8, 2025
9f2b3eb
Update sync-main.yml
dilanbhalla Apr 8, 2025
87d5592
Update sync-main.yml
dilanbhalla Apr 8, 2025
d2eadbf
Update sync-main.yml
dilanbhalla Apr 8, 2025
2a8c8db
Update sync-main.yml
dilanbhalla Apr 8, 2025
98338fe
Update sync-main.yml
dilanbhalla Apr 8, 2025
3d57ea9
Update sync-main.yml
dilanbhalla Apr 8, 2025
a7dcc9f
Update sync-main.yml
dilanbhalla Apr 8, 2025
1e24627
Merge tag 'codeql-cli/latest' into auto/sync-main-pr
github-actions[bot] Apr 8, 2025
70f9401
Update sync-main.yml
dilanbhalla Apr 8, 2025
79909e9
Update sync-main.yml
dilanbhalla Apr 8, 2025
7612ef9
Merge pull request #186 from microsoft/powershell-automatic-variables…
MathiasVP Apr 9, 2025
02c027d
Merge pull request #183 from microsoft/hashcons-for-csharp
MathiasVP Apr 9, 2025
f38c5f5
PS: Add lots of models.
MathiasVP Apr 4, 2025
763effb
PS: Add more models and support pipeline parameters in MaD.
MathiasVP Apr 8, 2025
5f12d7c
PS: Taint flow through all calls to 'toString'.
MathiasVP Apr 8, 2025
a5afc3c
PS: Flow through pipelines.
MathiasVP Apr 8, 2025
6de4765
PS: Support implicit imports in API graphs.
MathiasVP Apr 8, 2025
ebb91dc
PS: Add a few more models after fixing MaD for Element content.
MathiasVP Apr 8, 2025
f8207fa
PS: Add a testcase to demonstrate flow through Join-String.
MathiasVP Apr 8, 2025
a93d65b
Update sync-main.yml
dilanbhalla Apr 9, 2025
e7edf1b
Update sync-main.yml
dilanbhalla Apr 9, 2025
88a7c3a
Update sync-main.yml
dilanbhalla Apr 9, 2025
0d97cd6
Merge branch 'main' of https://github.com/microsoft/codeql into auto/…
Apr 9, 2025
86b3eae
Merge branch 'main' into dilan/sync-main-bugs-6
dilanbhalla Apr 9, 2025
b8b4e44
Update sync-main.yml
dilanbhalla Apr 9, 2025
c5b024a
Update sync-main.yml
dilanbhalla Apr 9, 2025
0f034b3
Merge pull request #194 from microsoft/dilan/sync-main-bugs-6
dilanbhalla Apr 9, 2025
89ddb30
Merge pull request #197 from microsoft/auto/sync-main-pr
dilanbhalla Apr 9, 2025
b55ee68
Merge branch 'main' into autogenerate-lots-of-models
MathiasVP Apr 9, 2025
419de4f
Merge pull request #196 from microsoft/autogenerate-lots-of-models
chanel-y Apr 9, 2025
4628c18
Update sync-main.yml
dilanbhalla Apr 10, 2025
5abde74
Merge pull request #198 from microsoft/dilan/sync-main-bugs-7
dilanbhalla Apr 10, 2025
793fd5e
PS: Delete a redundant file.
MathiasVP Apr 10, 2025
6084789
PS: Fix the top level arguments after the AST cleanup.
MathiasVP Apr 10, 2025
bf9ed3b
PS: Accept test changes.
MathiasVP Apr 10, 2025
9adf028
PS: Fix environment variables.
MathiasVP Apr 10, 2025
4aa9f85
PS: Accept test changes.
MathiasVP Apr 10, 2025
1637df0
Merge pull request #199 from microsoft/fix-top-level-arguments
chanel-y Apr 10, 2025
43de3a1
PS: Use the existing MaD rows to model file reads as flow sources.
MathiasVP Apr 10, 2025
3d18175
PS: Make it possible to specify a named argument that must be present…
MathiasVP Apr 10, 2025
6455992
PS: Add two more flow sources.
MathiasVP Apr 10, 2025
b4d8673
Merge branch 'main' of https://github.com/microsoft/codeql into power…
chanel-y Apr 14, 2025
9935117
PS: Make method names lower case.
MathiasVP Apr 15, 2025
f389487
PS: Make type names lower case.
MathiasVP Apr 15, 2025
43d9c70
PS: Rename Field and Property to Member.
MathiasVP Apr 15, 2025
a146630
PS: Delete redundant files.
MathiasVP Apr 15, 2025
fa3fc4a
PS: Fix more problems in MaD rows for sources.
MathiasVP Apr 15, 2025
dcc1278
PS: Make remote flow sources flow sources.
MathiasVP Apr 15, 2025
826e6a9
PS: Add an inline expectations test library for flow sources.
MathiasVP Apr 15, 2025
396a283
PS: Add tests for flow sources.
MathiasVP Apr 15, 2025
c9b1356
Merge pull request #200 from microsoft/files-reads-as-flow-sources
chanel-y Apr 16, 2025
5f64350
added script block, expandstring sinks, moved sanitizers to separate …
chanel-y Apr 16, 2025
50a771e
Merge branch 'main' into powershell-injectionhunter-port
chanel-y Apr 16, 2025
2266cd2
moved folder, added tests/docs
chanel-y Apr 16, 2025
ed553d3
merged work into CommandInjection query
chanel-y Apr 16, 2025
b09d9f6
PS: Autoformat.
MathiasVP Apr 17, 2025
7d72683
PS: Add an example with a missing toString.
MathiasVP Apr 17, 2025
b70f7e2
PS: Fix missing toString and accept test changes.
MathiasVP Apr 17, 2025
12b918e
pr feedback: removed toString, updated .expected
chanel-y Apr 17, 2025
fe7d8ff
Merge pull request #201 from microsoft/powershell-injectionhunter-port
chanel-y Apr 17, 2025
e7e88d3
PS: Add upgrade script from some unknown dbscheme to the dbscheme tha…
MathiasVP Apr 18, 2025
4518f18
PS: Delete a cycle in the upgrade script.
MathiasVP Apr 18, 2025
21210c6
Merge pull request #203 from microsoft/add-missing-downgrade-and-upgr…
MathiasVP Apr 18, 2025
37a6b04
Merge branch 'main' into fix-to-string-on-unknown-static-read
chanel-y Apr 18, 2025
03bce1c
Merge pull request #202 from microsoft/fix-to-string-on-unknown-stati…
chanel-y Apr 18, 2025
7553e14
sync upstream tags to main
Apr 21, 2025
57f060b
Update DataFlowImpl.qll
LWSimpkins Apr 21, 2025
2007479
Merge pull request #205 from microsoft/LWSimpkins/rust-module-import-fix
dilanbhalla Apr 21, 2025
7e32709
Merge branch 'main' into dilan/sync-main-tags
dilanbhalla Apr 21, 2025
7462e40
Merge pull request #204 from microsoft/dilan/sync-main-tags
dilanbhalla Apr 21, 2025
7359f91
added initial psscriptanalyzer rules, docs, tests
chanel-y Apr 21, 2025
e91912e
cleanup
chanel-y Apr 21, 2025
43954b7
removed irrelevant tags
chanel-y Apr 22, 2025
b9fdc78
PS: Add argument tests.
MathiasVP Apr 22, 2025
72266cb
PS: Drive-by cleanup in Constant.qll
MathiasVP Apr 22, 2025
e9fd50b
PS: Handle switch arguments by synthesizing a boolean true literal an…
MathiasVP Apr 22, 2025
09ebc76
PS: Accept test changes.
MathiasVP Apr 22, 2025
ff154b1
Merge tag 'codeql-cli/latest' into auto/sync-main-pr
Apr 22, 2025
a98a7b8
Merge branch 'main' into switch-parameters
chanel-y Apr 22, 2025
6a5d087
Merge pull request #207 from microsoft/switch-parameters
MathiasVP Apr 22, 2025
bfb7b0b
Merge branch 'main' into psscriptanalyzer-port
MathiasVP Apr 22, 2025
9f44cb2
Merge branch 'main' of https://github.com/microsoft/codeql into auto/…
Apr 22, 2025
7432884
Merge branch 'main' into psscriptanalyzer-port
chanel-y Apr 22, 2025
2898910
Merge branch 'psscriptanalyzer-port' of https://github.com/microsoft/…
chanel-y Apr 22, 2025
faa47f9
ConvertToSecureStringAsPlainText
chanel-y Apr 22, 2025
6419794
Update powershell/ql/src/experimental/HardcodedComputerName.qhelp
chanel-y Apr 22, 2025
f82cfc7
Update powershell/ql/src/experimental/UsernameOrPasswordParameter.qhelp
chanel-y Apr 22, 2025
3a66e8e
Update powershell/ql/src/experimental/UsernameOrPasswordParameter.qhelp
chanel-y Apr 22, 2025
f375b81
remove reference to command injection owasp
chanel-y Apr 22, 2025
12db85a
Merge pull request #206 from microsoft/psscriptanalyzer-port
chanel-y Apr 22, 2025
b28b84f
Merge branch 'main' of https://github.com/microsoft/codeql into auto/…
Apr 22, 2025
d3c6c3b
Merge pull request #208 from microsoft/auto/sync-main-pr
dilanbhalla Apr 22, 2025
4b3c612
Merge branch 'main' into dilan/publish-opensource-packs
dilanbhalla Apr 22, 2025
916b264
Update sync-main-tags.yml
dilanbhalla Apr 22, 2025
358862e
Update sync-main.yml
dilanbhalla Apr 22, 2025
0544343
Merge pull request #209 from microsoft/dilan/workflow-bugs
dilanbhalla Apr 22, 2025
082141e
Update microsoft-codeql-pack-publish.yml
dilanbhalla Apr 22, 2025
a3c5e48
Update microsoft-codeql-pack-publish.yml
dilanbhalla Apr 22, 2025
b112947
Merge branch 'main' into dilan/publish-opensource-packs
dilanbhalla Apr 22, 2025
3126366
Merge pull request #170 from microsoft/dilan/publish-opensource-packs
chanel-y Apr 22, 2025
47fc9f2
Update go language references in mod and sum files to prevent vulnera…
Apr 22, 2025
9efbecc
Update microsoft-codeql-pack-publish.yml
dilanbhalla Apr 22, 2025
e669dc6
Merge pull request #210 from microsoft/dilan/pack-publish-typo
chanel-y Apr 22, 2025
ba58c01
Update microsoft-codeql-pack-publish.yml
dilanbhalla Apr 22, 2025
2f62351
Merge pull request #211 from microsoft/dilan/publish-pack-bug-2
dilanbhalla Apr 22, 2025
42776fb
Merge branch 'main' into denisl/goreferenceupdate
denislevin Apr 22, 2025
7360d80
PS: Rename getName to getLowerCaseName.
MathiasVP Apr 23, 2025
2e05601
PS: Add matchesName and getAName to make it easier to match case inse…
MathiasVP Apr 23, 2025
b65d41b
PS: Cleanup and autoformat.
MathiasVP Apr 23, 2025
f5e7af1
PS: Fix tests.
MathiasVP Apr 23, 2025
9e83dee
PS: Accept test changes.
MathiasVP Apr 23, 2025
5ec59c3
PS: Get rid of unnecessary module.
MathiasVP Apr 23, 2025
06fd1c6
PS: Delete deprecated unnecessary predicates.
MathiasVP Apr 23, 2025
0a1f89b
PS: Delete more stuff that's being deprecated and replace with non-de…
MathiasVP Apr 23, 2025
b1cd672
Merge branch 'main' into powershell-better-api-for-normalizednames
chanel-y Apr 23, 2025
a3b32af
Update qlpack.yml
dilanbhalla Apr 23, 2025
c3926d3
Update qlpack.yml
dilanbhalla Apr 23, 2025
084c75c
changing microsoft-sdl/powershell-all to microsoft/powershell-all
Apr 23, 2025
1930059
Merge pull request #214 from microsoft/dilan/powershell-lib-pack-org
chanel-y Apr 23, 2025
4d00aa3
Merge pull request #213 from microsoft/powershell-better-api-for-norm…
MathiasVP Apr 24, 2025
b672950
Merge branch 'main' into denisl/goreferenceupdate
ropwareJB Apr 24, 2025
aee5b23
Merge pull request #212 from microsoft/denisl/goreferenceupdate
denislevin Apr 28, 2025
c015c74
PS: Lower case more predicate results for consistency.
MathiasVP Apr 29, 2025
e4d5b1e
PS: Add a query for SQL injection.
MathiasVP Apr 29, 2025
c667894
PS: Add query test for the new SQL injection query.
MathiasVP Apr 29, 2025
64dd13d
Merge pull request #215 from microsoft/ps-add-sql-injection-query
chanel-y Apr 29, 2025
a7c0305
PS: Lift StringLiterals to the public AST from the raw AST.
MathiasVP Apr 30, 2025
dbfd070
PS: Add some tests for string literals.
MathiasVP Apr 30, 2025
f6aec28
Merge pull request #216 from microsoft/ps-string-literals
chanel-y Apr 30, 2025
2f03911
PS: Accept test changes.
MathiasVP Apr 30, 2025
f7d0818
Merge pull request #217 from microsoft/accept-parent-test-changes
MathiasVP Apr 30, 2025
b87431a
Looks like I've missed a few CG changes - checking in
May 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
152 changes: 152 additions & 0 deletions .github/workflows/microsoft-codeql-pack-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Microsoft CodeQL Pack Publish

on:
workflow_dispatch:

jobs:
check-branch:
runs-on: ubuntu-latest
steps:
- name: Fail if not on main branch
run: |
if [ "$GITHUB_REF" != "refs/heads/main" ]; then
echo "This workflow can only run on the 'main' branch."
exit 1
fi
codeqlversion:
needs: check-branch
runs-on: ubuntu-latest
outputs:
codeql_version: ${{ steps.set_codeql_version.outputs.codeql_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set CodeQL Version
id: set_codeql_version
run: |
git fetch
git fetch --tags
CURRENT_COMMIT=$(git rev-list -1 HEAD)
CURRENT_TAG=$(git describe --tags --abbrev=0 --match 'codeql-cli/v*' $CURRENT_COMMIT)
CODEQL_VERSION="${CURRENT_TAG#codeql-cli/}"
echo "CODEQL_VERSION=$CODEQL_VERSION" >> $GITHUB_OUTPUT
publishlibs:
environment: secure-publish
needs: codeqlversion
runs-on: ubuntu-latest
strategy:
matrix:
language: ['powershell']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install CodeQL
shell: bash
run: |
gh extension install github/gh-codeql
gh codeql download "${{ needs.codeqlversion.outputs.codeql_version }}"
gh codeql set-version "${{ needs.codeqlversion.outputs.codeql_version }}"
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Publish OS Microsoft CodeQL Lib Pack
shell: bash
run: |
# Download latest qlpack
gh codeql pack download "microsoft/$LANGUAGE-all"
PACK_DIR="$HOME/.codeql/packages/microsoft/$LANGUAGE-all"
VERSION_COUNT=$(ls -d "$PACK_DIR"/*/ | wc -l)
[[ "$VERSION_COUNT" -ne 1 ]] && { echo "Expected exactly one version in $PACK_DIR, but found $VERSION_COUNT. Exiting."; exit 1; }

# Increment version
CURRENT_VERSION=$(ls -v "$PACK_DIR" | tail -n 1)
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"

# Extract dependencies from the existing qlpack.yml before deleting
DEPENDENCIES=$(yq 'select(has("dependencies")) | .dependencies | {"dependencies": .}' "$LANGUAGE/ql/lib/qlpack.yml" 2>/dev/null)
DATAEXTENSIONS=$(yq 'select(has("dataExtensions")) | .dataExtensions | {"dataExtensions": .}' "$LANGUAGE/ql/lib/qlpack.yml" 2>/dev/null)
rm -f "$LANGUAGE/ql/lib/qlpack.yml" "$LANGUAGE/ql/lib/qlpack.lock"

# Create new qlpack.yml with modified content
cat <<EOF > "$LANGUAGE/ql/lib/qlpack.yml"
name: microsoft/$LANGUAGE-all
version: $NEXT_VERSION
extractor: $LANGUAGE
groups:
- $LANGUAGE
- microsoft-all
dbscheme: semmlecode.$LANGUAGE.dbscheme
extractor: $LANGUAGE
library: true
upgrades: upgrades
$DEPENDENCIES
$DATAEXTENSIONS
warnOnImplicitThis: true
EOF

# Publish pack
cat "$LANGUAGE/ql/lib/qlpack.yml"
gh codeql pack publish "$LANGUAGE/ql/lib"
env:
LANGUAGE: ${{ matrix.language }}
GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH }}
publish:
environment: secure-publish
needs: codeqlversion
runs-on: ubuntu-latest
strategy:
matrix:
language: ['csharp', 'cpp', 'java', 'javascript', 'python', 'ruby', 'go', 'rust', 'swift', 'powershell']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install CodeQL
shell: bash
run: |
gh extension install github/gh-codeql
gh codeql download "${{ needs.codeqlversion.outputs.codeql_version }}"
gh codeql set-version "${{ needs.codeqlversion.outputs.codeql_version }}"
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Publish OS Microsoft CodeQL Pack
shell: bash
run: |
# Download latest qlpack
gh codeql pack download "microsoft/$LANGUAGE-queries"
PACK_DIR="$HOME/.codeql/packages/microsoft/$LANGUAGE-queries"
VERSION_COUNT=$(ls -d "$PACK_DIR"/*/ | wc -l)
[[ "$VERSION_COUNT" -ne 1 ]] && { echo "Expected exactly one version in $PACK_DIR, but found $VERSION_COUNT. Exiting."; exit 1; }

# Increment version
CURRENT_VERSION=$(ls -v "$PACK_DIR" | tail -n 1)
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"

# Extract dependencies from the existing qlpack.yml before deleting
DEPENDENCIES=$(yq 'select(has("dependencies")) | .dependencies | {"dependencies": .}' "$LANGUAGE/ql/src/qlpack.yml" 2>/dev/null)
rm -f "$LANGUAGE/ql/src/qlpack.yml" "$LANGUAGE/ql/src/qlpack.lock"

# Create new qlpack.yml with modified content
cat <<EOF > "$LANGUAGE/ql/src/qlpack.yml"
name: microsoft/$LANGUAGE-queries
version: $NEXT_VERSION
extractor: $LANGUAGE
groups:
- $LANGUAGE
- queries
$DEPENDENCIES
EOF

# Publish pack
cat "$LANGUAGE/ql/src/qlpack.yml"
gh codeql pack publish "$LANGUAGE/ql/src"
env:
LANGUAGE: ${{ matrix.language }}
GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH }}

28 changes: 28 additions & 0 deletions .github/workflows/powershell-pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PowerShell PR Check

on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
powershell-pr-check:
name: powershell-pr-check
runs-on: ubuntu-latest
if: github.repository == 'microsoft/codeql'
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ github.token }}
- name: Setup CodeQL
uses: ./.github/actions/fetch-codeql
with:
channel: release
- name: Compile PowerShell Queries
run: |
codeql query compile --check-only --keep-going powershell/ql/src
28 changes: 28 additions & 0 deletions .github/workflows/sync-main-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Sync Main Tags

on:
pull_request:
types:
- closed
branches:
- main

jobs:
sync-main-tags:
name: Sync Main Tags
runs-on: ubuntu-latest
if: github.repository == 'microsoft/codeql' && github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'auto/sync-main-pr'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push Tags
run: |
git remote add upstream https://github.com/github/codeql.git
git fetch upstream --tags --force
git push --force origin --tags
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
88 changes: 88 additions & 0 deletions .github/workflows/sync-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Sync Main

on:
push:
branches:
- main
paths:
- .github/workflows/sync-main.yml
schedule:
- cron: '55 * * * *'

jobs:
sync-main:
name: Sync-main
runs-on: ubuntu-latest
if: github.repository == 'microsoft/codeql'
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Git config
shell: bash
run: |
git config user.name "dilanbhalla"
git config user.email "dilanbhalla@microsoft.com"
- name: Git checkout auto/sync-main-pr
shell: bash
run: |
git fetch origin
if git ls-remote --exit-code --heads origin auto/sync-main-pr > /dev/null; then
echo "Branch exists remotely. Checking it out."
git checkout -B auto/sync-main-pr origin/auto/sync-main-pr
else
echo "Branch does not exist remotely. Creating from main."
git checkout -B auto/sync-main-pr origin/main
git push -u origin auto/sync-main-pr
fi
- name: Sync origin/main
shell: bash
run: |
echo "::group::Sync with main branch"
git pull origin auto/sync-main-pr; exitCode=$?; if [ $exitCode -ne 0 ]; then exitCode=0; fi
git pull origin main --no-rebase
git push --force origin auto/sync-main-pr
echo "::endgroup::"
- name: Sync upstream/codeql-cli/latest
shell: bash
run: |
echo "::group::Set up remote"
git remote add upstream https://github.com/github/codeql.git
git fetch upstream --tags --force
echo "::endgroup::"
echo "::group::Merge codeql-cli/latest"
set -x
git merge codeql-cli/latest
set +x
echo "::endgroup::"
- name: Push sync branch
run: |
git push origin auto/sync-main-pr
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
- name: Create PR if it doesn't exist
shell: bash
run: |
pr_number=$(gh pr list --repo microsoft/codeql --head auto/sync-main-pr --base main --json number --jq '.[0].number')
if [ -n "$pr_number" ]; then
echo "PR from auto/sync-main-pr to main already exists (PR #$pr_number). Exiting gracefully."
else
if git fetch origin main auto/sync-main-pr && [ -n "$(git rev-list origin/main..origin/auto/sync-main-pr)" ]; then
echo "PR does not exist. Creating one..."
gh pr create --repo microsoft/codeql --fill -B main -H auto/sync-main-pr \
--label 'autogenerated' \
--title 'Sync Main (autogenerated)' \
--body "This PR syncs the latest changes from \`codeql-cli/latest\` into \`main\`." \
--reviewer 'MathiasVP' \
--reviewer 'ropwareJB'
else
echo "No changes to sync from auto/sync-main-pr to main. Exiting gracefully."
fi
fi
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ You can install the [CodeQL for Visual Studio Code](https://marketplace.visualst
### Tasks

The `.vscode/tasks.json` file defines custom tasks specific to working in this repository. To invoke one of these tasks, select the `Terminal | Run Task...` menu option, and then select the desired task from the dropdown. You can also invoke the `Tasks: Run Task` command from the command palette.


41 changes: 41 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.8 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).

If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: feature
---
* Added a new class `AdditionalCallTarget` for specifying additional call targets.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ private string normalizeFunctionName(Function f, string algType) {
(result.matches("RSA") implies not f.getName().toUpperCase().matches("%UNIVERSAL%")) and
//rsaz functions deemed to be too low level, and can be ignored
not f.getLocation().getFile().getBaseName().matches("rsaz_exp.c") and
// SHA false positives
(result.matches("SHA") implies not f.getName().toUpperCase().matches("%SHAKE%")) and
// CAST false positives
(result.matches("CAST") implies not f.getName().toUpperCase().matches(["%UPCAST%", "%DOWNCAST%"])) and
// General False positives
// Functions that 'get' do not set an algorithm, and therefore are considered ignorable
not f.getName().toLowerCase().matches("%get%")
Expand Down
Loading