Skip to content

Commit 56f1e0c

Browse files
authored
Merge branch 'main' into actions/dep-updates
2 parents f02c300 + 2b5b6ca commit 56f1e0c

27 files changed

+546
-106
lines changed

.codeqlversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.20.1

.github/actions/install-codeql/action.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
11
name: Setup CodeQL CLI
22
description: |
33
Install a CodeQL CLI or re-use an existing one from the cache and it to the path.
4-
inputs:
4+
5+
outputs:
56
codeql-cli-version:
6-
description: |
7-
The version of the CodeQL CLI to be downloaded.
7+
description: "The version of the CodeQL CLI that was installed or retrieved from cache"
8+
value: ${{ steps.codeql-version.outputs.codeql-cli-version }}
89

910
runs:
1011
using: composite
1112
steps:
13+
- name: "CodeQL Version"
14+
id: codeql-version
15+
shell: bash
16+
run: |
17+
echo "Reading CodeQL CLI version from .codeqlversion file."
18+
CODEQL_CLI_VERSION=$(cat ./.codeqlversion)
19+
echo "CODEQL_CLI_VERSION=${CODEQL_CLI_VERSION}" >> $GITHUB_ENV
20+
echo "codeql-cli-version=${CODEQL_CLI_VERSION}" >> $GITHUB_OUTPUT
21+
1222
- name: Cache CodeQL
1323
id: cache-codeql
1424
uses: actions/cache@v4
1525
with:
1626
# A list of files, directories, and wildcard patterns to cache and restore
1727
path: ${{github.workspace}}/codeql_home
1828
# An explicit key for restoring and saving the cache
19-
key: codeql-home-${{ inputs.codeql-cli-version }}
29+
key: codeql-home-${{ steps.codeql-version.outputs.codeql-cli-version }}
2030

2131
- name: Install CodeQL
32+
id: install-codeql
2233
if: steps.cache-codeql.outputs.cache-hit != 'true'
2334
shell: bash
2435
env:
2536
GITHUB_TOKEN: ${{ github.token }}
2637
CODEQL_HOME: ${{ github.workspace }}/codeql_home
27-
CODEQL_CLI_VERSION: ${{ inputs.codeql-cli-version }}
38+
CODEQL_CLI_VERSION: ${{ steps.codeql-version.outputs.codeql-cli-version }}
2839
run: |
40+
echo "Installing CodeQL CLI v${CODEQL_CLI_VERSION}."
41+
2942
mkdir -p $CODEQL_HOME
3043
echo "Change directory to $CODEQL_HOME"
3144
pushd $CODEQL_HOME
@@ -38,6 +51,7 @@ runs:
3851
3952
popd
4053
echo "Done."
54+
echo "codeql-cli-version=${CODEQL_CLI_VERSION}" >> $GITHUB_OUTPUT
4155
4256
- name: Add CodeQL to the PATH
4357
shell: bash

.github/workflows/ci.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
branches: [ main ]
66
workflow_dispatch:
77

8-
env:
9-
CODEQL_CLI_VERSION: 2.20.1
10-
118
jobs:
129
compile-and-test:
1310
runs-on: ubuntu-latest
@@ -31,15 +28,14 @@ jobs:
3128
3229
- name: Setup CodeQL
3330
if: steps.changes.outputs.src == 'true'
31+
id: install-codeql
3432
uses: ./.github/actions/install-codeql
35-
with:
36-
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}
3733

3834
- name: Install Packs
3935
if: steps.changes.outputs.src == 'true'
4036
env:
4137
GITHUB_TOKEN: ${{ github.token }}
42-
CODEQL_CLI_VERSION: ${{ env.CODEQL_CLI_VERSION }}
38+
CODEQL_CLI_VERSION: ${{ steps.install-codeql.outputs.codeql-cli-version }}
4339
run: |
4440
gh repo clone github/codeql -- -b codeql-cli-${CODEQL_CLI_VERSION} # to make stubs available for tests
4541
codeql pack install "${{ matrix.language }}/lib"
@@ -175,8 +171,6 @@ jobs:
175171
- name: Setup CodeQL
176172
if: steps.changes.outputs.src == 'true'
177173
uses: ./.github/actions/install-codeql
178-
with:
179-
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}
180174

181175
- name: Install Packs
182176
if: steps.changes.outputs.src == 'true'
@@ -210,8 +204,6 @@ jobs:
210204
- name: Setup CodeQL
211205
if: steps.changes.outputs.src == 'true'
212206
uses: ./.github/actions/install-codeql
213-
with:
214-
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}
215207

216208
- name: Install CodeQL
217209
if: steps.changes.outputs.src == 'true'
@@ -238,14 +230,10 @@ jobs:
238230
- name: Setup CodeQL
239231
if: steps.changes.outputs.src == 'true'
240232
uses: ./.github/actions/install-codeql
241-
with:
242-
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}
243233

244234
- name: "Check Configurations"
245235
if: steps.changes.outputs.src == 'true'
246236
env:
247237
GITHUB_TOKEN: ${{ github.token }}
248238
run: |
249239
./.github/scripts/pr-configs.sh "${{ github.event.number }}"
250-
251-

.github/workflows/publish.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
branches: [main]
66
workflow_dispatch:
77

8-
env:
9-
CODEQL_CLI_VERSION: 2.20.1
108

119
jobs:
1210
queries:
@@ -42,8 +40,6 @@ jobs:
4240
- name: Setup CodeQL
4341
if: steps.check_version.outputs.publish == 'true'
4442
uses: ./.github/actions/install-codeql
45-
with:
46-
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}
4743

4844
- name: Publish codeql-LANG-queries (src) pack.
4945
if: steps.check_version.outputs.publish == 'true'
@@ -87,8 +83,6 @@ jobs:
8783
- name: Setup CodeQL
8884
if: steps.check_version.outputs.publish == 'true'
8985
uses: ./.github/actions/install-codeql
90-
with:
91-
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}
9286

9387
- name: Publish codeql-LANG-libs (lib) pack
9488
if: steps.check_version.outputs.publish == 'true'
@@ -131,8 +125,6 @@ jobs:
131125
- name: Setup CodeQL
132126
if: steps.check_version.outputs.publish == 'true'
133127
uses: ./.github/actions/install-codeql
134-
with:
135-
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}
136128

137129
- name: Publish codeql-LANG-extensions (ext) pack
138130
if: steps.check_version.outputs.publish == 'true'
@@ -176,8 +168,6 @@ jobs:
176168
- name: Setup CodeQL
177169
if: steps.check_version.outputs.publish == 'true'
178170
uses: ./.github/actions/install-codeql
179-
with:
180-
codeql-cli-version: ${{ env.CODEQL_CLI_VERSION }}
181171

182172
- name: Publish codeql-LANG-library-sources (ext-library-sources) pack
183173
if: steps.check_version.outputs.publish == 'true'

.github/workflows/update-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
private-key: ${{ secrets.SECLABS_APP_KEY }}
3030

3131
- name: "Patch Release Me"
32-
uses: 42ByteLabs/patch-release-me@67fb9fab3595fd3fee1dfa539e080fef0488c909 # 0.5.4
32+
uses: 42ByteLabs/patch-release-me@63750b1c6fc917cdb605f13ad44c9e10e9d6ef5d # 0.6.0
3333
with:
3434
# Bump (patch)
3535
mode: ${{ inputs.mode }}

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ We welcome contributions to our CodeQL Community Packs libraries and queries. Go
44

55
There is lots of useful documentation to help you write queries, ranging from information about query file structure to tutorials for specific target languages. For more information on the documentation available, see [CodeQL queries](https://codeql.github.com/docs/writing-codeql-queries/codeql-queries) on [codeql.github.com](https://codeql.github.com).
66

7-
## Change notes
8-
9-
Any nontrivial user-visible change to a query pack or library pack should have a change note. For details on how to add a change note for your change, see [this guide](docs/change-notes.md).
10-
117
## Submitting a new query
128

139
If you have an idea for a query that you would like to share with other CodeQL users, please open a pull request to add it to this repository. New queries start out in a `<language>/ql/src/` directory, to which they can be merged when they meet the following requirements.

configs/synthetics.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ paths-ignore:
105105
- "vendor/**"
106106
- "examples/**"
107107
- "tests/**"
108+
- "test/**"
108109
- "site-packages/**"
109110

110111
# JavaScript

go/lib/codeql-pack.lock.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
lockVersion: 1.0.0
33
dependencies:
44
codeql/dataflow:
5-
version: 1.1.8
5+
version: 2.0.4
66
codeql/go-all:
7-
version: 3.0.1
7+
version: 4.2.2
88
codeql/mad:
9-
version: 1.0.14
9+
version: 1.0.20
1010
codeql/ssa:
11-
version: 1.0.14
11+
version: 1.0.20
1212
codeql/threat-models:
13-
version: 1.0.14
13+
version: 1.0.20
1414
codeql/tutorial:
15-
version: 1.0.14
15+
version: 1.0.20
1616
codeql/typetracking:
17-
version: 1.0.14
17+
version: 2.0.4
1818
codeql/util:
19-
version: 2.0.1
19+
version: 2.0.7
2020
compiled: false

go/lib/ghsl.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import go
2+
import ghsl.Utils
3+
import ghsl.LocalSources
4+
import ghsl.Sinks

go/lib/ghsl/Sinks.qll

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
private import go
2+
private import semmle.go.dataflow.DataFlow
3+
private import semmle.go.security.CommandInjectionCustomizations
4+
private import semmle.go.security.OpenUrlRedirectCustomizations
5+
private import semmle.go.security.ReflectedXssCustomizations
6+
private import semmle.go.security.RequestForgeryCustomizations
7+
private import semmle.go.security.SqlInjectionCustomizations
8+
private import semmle.go.security.UnsafeUnzipSymlinkCustomizations
9+
private import semmle.go.security.XPathInjectionCustomizations
10+
private import semmle.go.security.ZipSlipCustomizations
11+
12+
/**
13+
* List of all the sinks that we want to check.
14+
*/
15+
class AllSinks extends DataFlow::Node {
16+
private string sink;
17+
18+
AllSinks() {
19+
this instanceof CommandInjection::Sink and
20+
sink = "command-injection"
21+
or
22+
this instanceof OpenUrlRedirect::Sink and
23+
sink = "open-url-redirect"
24+
or
25+
this instanceof ReflectedXss::Sink and
26+
sink = "reflected-xss"
27+
or
28+
this instanceof RequestForgery::Sink and
29+
sink = "request-forgery"
30+
or
31+
this instanceof SqlInjection::Sink and
32+
sink = "sql-injection"
33+
or
34+
this instanceof UnsafeUnzipSymlink::EvalSymlinksSink and
35+
sink = "unsafe-unzip"
36+
or
37+
this instanceof XPathInjection::Sink and
38+
sink = "xpath-injection"
39+
or
40+
this instanceof ZipSlip::Sink and
41+
sink = "zip-slip"
42+
}
43+
44+
/**
45+
* Gets the sink sink type.
46+
*/
47+
string sinkType() { result = sink }
48+
}

0 commit comments

Comments
 (0)