Skip to content

Commit 882f78c

Browse files
committed
Merge remote-tracking branch 'origin/main' into ruby/weak-cryptographic-algorithm
2 parents 2b66dfa + f1ec2e3 commit 882f78c

File tree

1,329 files changed

+48849
-11766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,329 files changed

+48849
-11766
lines changed

.github/workflows/check-qldoc.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Check QLdoc coverage"
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "*/ql/lib/**"
7+
- .github/workflows/check-qldoc.yml
8+
branches:
9+
- main
10+
- "rc/*"
11+
12+
jobs:
13+
qldoc:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Install CodeQL
18+
run: |
19+
gh extension install github/gh-codeql
20+
gh codeql set-channel nightly
21+
gh codeql version
22+
env:
23+
GITHUB_TOKEN: ${{ github.token }}
24+
25+
- uses: actions/checkout@v2
26+
with:
27+
fetch-depth: 2
28+
29+
- name: Check QLdoc coverage
30+
shell: bash
31+
run: |
32+
EXIT_CODE=0
33+
changed_lib_packs="$(git diff --name-only --diff-filter=ACMRT HEAD^ HEAD | { grep -o '^[a-z]*/ql/lib' || true; } | sort -u)"
34+
for pack_dir in ${changed_lib_packs}; do
35+
lang="${pack_dir%/ql/lib}"
36+
gh codeql generate library-doc-coverage --output="${RUNNER_TEMP}/${lang}-current.txt" --dir="${pack_dir}"
37+
done
38+
git checkout HEAD^
39+
for pack_dir in ${changed_lib_packs}; do
40+
# When we add a new language, pack_dir would not exist in HEAD^.
41+
# In this case the right thing to do is to skip the check.
42+
[[ ! -d "${pack_dir}" ]] && continue
43+
lang="${pack_dir%/ql/lib}"
44+
gh codeql generate library-doc-coverage --output="${RUNNER_TEMP}/${lang}-baseline.txt" --dir="${pack_dir}"
45+
awk -F, '{gsub(/"/,""); if ($4==0 && $6=="public") print "\""$3"\"" }' "${RUNNER_TEMP}/${lang}-current.txt" | sort -u > "${RUNNER_TEMP}/current-undocumented.txt"
46+
awk -F, '{gsub(/"/,""); if ($4==0 && $6=="public") print "\""$3"\"" }' "${RUNNER_TEMP}/${lang}-baseline.txt" | sort -u > "${RUNNER_TEMP}/baseline-undocumented.txt"
47+
UNDOCUMENTED="$(grep -f <(comm -13 "${RUNNER_TEMP}/baseline-undocumented.txt" "${RUNNER_TEMP}/current-undocumented.txt") "${RUNNER_TEMP}/${lang}-current.txt" || true)"
48+
if [ -n "$UNDOCUMENTED" ]; then
49+
echo "$UNDOCUMENTED" | awk -F, '{gsub(/"/,""); print "::warning file='"${pack_dir}"'/"$1",line="$2"::Missing QLdoc for "$5, $3 }'
50+
EXIT_CODE=1
51+
fi
52+
done
53+
exit "${EXIT_CODE}"

.github/workflows/ql-for-ql-build.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ jobs:
1616
- uses: actions/checkout@v2
1717
- name: Find codeql
1818
id: find-codeql
19-
uses: github/codeql-action/init@erik-krogh/ql
19+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
2020
with:
2121
languages: javascript # does not matter
22+
tools: latest
2223
- name: Get CodeQL version
2324
id: get-codeql-version
2425
run: |
@@ -159,7 +160,7 @@ jobs:
159160
PACK: ${{ runner.temp }}/pack
160161
- name: Hack codeql-action options
161162
run: |
162-
JSON=$(jq -nc --arg pack "${PACK}" '.resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
163+
JSON=$(jq -nc --arg pack "${PACK}" '.database."run-queries"=["--search-path", $pack] | .resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
163164
echo "CODEQL_ACTION_EXTRA_OPTIONS=${JSON}" >> ${GITHUB_ENV}
164165
env:
165166
PACK: ${{ runner.temp }}/pack
@@ -171,22 +172,25 @@ jobs:
171172
echo "paths:" > ${CONF}
172173
echo " - ${FOLDER}" >> ${CONF}
173174
echo "paths-ignore:" >> ${CONF}
174-
echo " - ql/ql/test" >> ${CONF}
175+
echo " - ql/ql/test" >> ${CONF}
176+
echo "disable-default-queries: true" >> ${CONF}
177+
echo "packs:" >> ${CONF}
178+
echo " - codeql/ql" >> ${CONF}
175179
echo "Config file: "
176180
cat ${CONF}
177181
env:
178182
CONF: ./ql-for-ql-config.yml
179183
FOLDER: ${{ matrix.folder }}
180-
181184
- name: Initialize CodeQL
182-
uses: github/codeql-action/init@erik-krogh/ql
185+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
183186
with:
184187
languages: ql
185188
db-location: ${{ runner.temp }}/db
186189
config-file: ./ql-for-ql-config.yml
190+
tools: latest
187191

188192
- name: Perform CodeQL Analysis
189-
uses: github/codeql-action/analyze@erik-krogh/ql
193+
uses: github/codeql-action/analyze@aa93aea877e5fb8841bcb1193f672abf6e9f2980
190194
with:
191195
category: "ql-for-ql-${{ matrix.folder }}"
192196
- name: Copy sarif file to CWD

.github/workflows/ql-for-ql-dataset_measure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Find codeql
2828
id: find-codeql
29-
uses: github/codeql-action/init@erik-krogh/ql
29+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
3030
with:
3131
languages: javascript # does not matter
3232
- uses: actions/cache@v2

.github/workflows/ql-for-ql-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v2
2121
- name: Find codeql
2222
id: find-codeql
23-
uses: github/codeql-action/init@erik-krogh/ql
23+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
2424
with:
2525
languages: javascript # does not matter
2626
- uses: actions/cache@v2

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ If you have an idea for a query that you would like to share with other CodeQL u
3636

3737
For details, see the [guide on query metadata](docs/query-metadata-style-guide.md).
3838

39-
Make sure the `select` statement is compatible with the query `@kind`. See [About CodeQL queries](https://help.semmle.com/QL/learn-ql/writing-queries/introduction-to-queries.html#select-clause) on help.semmle.com.
39+
Make sure the `select` statement is compatible with the query `@kind`. See [About CodeQL queries](https://codeql.github.com/docs/writing-codeql-queries/about-codeql-queries/#select-clause) on codeql.github.com.
4040

4141
3. **Formatting**
4242

config/identical-files.json

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl3.qll",
2828
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl4.qll",
2929
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl.qll",
30-
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll"
30+
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll",
31+
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForLibraries.qll"
3132
],
3233
"DataFlow Java/C++/C#/Python Common": [
3334
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll",
@@ -54,7 +55,8 @@
5455
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking2/TaintTrackingImpl.qll",
5556
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking3/TaintTrackingImpl.qll",
5657
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking4/TaintTrackingImpl.qll",
57-
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
58+
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
59+
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttrackingforlibraries/TaintTrackingImpl.qll"
5860
],
5961
"DataFlow Java/C++/C#/Python Consistency checks": [
6062
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll",
@@ -73,6 +75,10 @@
7375
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SsaReadPositionCommon.qll",
7476
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionCommon.qll"
7577
],
78+
"Model as Data Generation Java/C# - CaptureModels": [
79+
"java/ql/src/utils/model-generator/internal/CaptureModels.qll",
80+
"csharp/ql/src/utils/model-generator/internal/CaptureModels.qll"
81+
],
7682
"Sign Java/C#": [
7783
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll",
7884
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/Sign.qll"
@@ -472,11 +478,12 @@
472478
"python/ql/lib/semmle/python/security/performance/ReDoSUtil.qll",
473479
"ruby/ql/lib/codeql/ruby/security/performance/ReDoSUtil.qll"
474480
],
475-
"ReDoS Exponential Python/JS": [
481+
"ReDoS Exponential Python/JS/Ruby": [
476482
"javascript/ql/lib/semmle/javascript/security/performance/ExponentialBackTracking.qll",
477-
"python/ql/lib/semmle/python/security/performance/ExponentialBackTracking.qll"
483+
"python/ql/lib/semmle/python/security/performance/ExponentialBackTracking.qll",
484+
"ruby/ql/lib/codeql/ruby/security/performance/ExponentialBackTracking.qll"
478485
],
479-
"ReDoS Polynomial Python/JS": [
486+
"ReDoS Polynomial Python/JS/Ruby": [
480487
"javascript/ql/lib/semmle/javascript/security/performance/SuperlinearBackTracking.qll",
481488
"python/ql/lib/semmle/python/security/performance/SuperlinearBackTracking.qll",
482489
"ruby/ql/lib/codeql/ruby/security/performance/SuperlinearBackTracking.qll"
@@ -507,5 +514,39 @@
507514
"java/ql/lib/semmle/code/java/dataflow/internal/AccessPathSyntax.qll",
508515
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/AccessPathSyntax.qll",
509516
"ruby/ql/lib/codeql/ruby/dataflow/internal/AccessPathSyntax.qll"
517+
],
518+
"IncompleteUrlSubstringSanitization": [
519+
"javascript/ql/src/Security/CWE-020/IncompleteUrlSubstringSanitization.qll",
520+
"ruby/ql/src/queries/security/cwe-020/IncompleteUrlSubstringSanitization.qll"
521+
],
522+
"Concepts Python/Ruby/JS": [
523+
"python/ql/lib/semmle/python/internal/ConceptsShared.qll",
524+
"ruby/ql/lib/codeql/ruby/internal/ConceptsShared.qll",
525+
"javascript/ql/lib/semmle/javascript/internal/ConceptsShared.qll"
526+
],
527+
"Hostname Regexp queries": [
528+
"javascript/ql/src/Security/CWE-020/HostnameRegexpShared.qll",
529+
"python/ql/src/Security/CWE-020/HostnameRegexpShared.qll",
530+
"ruby/ql/src/queries/security/cwe-020/HostnameRegexpShared.qll"
531+
],
532+
"ApiGraphModels": [
533+
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll",
534+
"ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll"
535+
],
536+
"TaintedFormatStringQuery Ruby/JS": [
537+
"javascript/ql/lib/semmle/javascript/security/dataflow/TaintedFormatStringQuery.qll",
538+
"ruby/ql/lib/codeql/ruby/security/TaintedFormatStringQuery.qll"
539+
],
540+
"TaintedFormatStringCustomizations Ruby/JS": [
541+
"javascript/ql/lib/semmle/javascript/security/dataflow/TaintedFormatStringCustomizations.qll",
542+
"ruby/ql/lib/codeql/ruby/security/TaintedFormatStringCustomizations.qll"
543+
],
544+
"HttpToFileAccessQuery JS/Ruby": [
545+
"javascript/ql/lib/semmle/javascript/security/dataflow/HttpToFileAccessQuery.qll",
546+
"ruby/ql/lib/codeql/ruby/security/HttpToFileAccessQuery.qll"
547+
],
548+
"HttpToFileAccessCustomizations JS/Ruby": [
549+
"javascript/ql/lib/semmle/javascript/security/dataflow/HttpToFileAccessCustomizations.qll",
550+
"ruby/ql/lib/codeql/ruby/security/HttpToFileAccessCustomizations.qll"
510551
]
511-
}
552+
}

cpp/ql/lib/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.0.11
2+
3+
### Minor Analysis Improvements
4+
5+
* Many queries now support structured bindings, as structured bindings are now handled in the IR translation.
6+
17
## 0.0.10
28

39
### New Features
@@ -6,6 +12,7 @@
612

713
## 0.0.9
814

15+
916
## 0.0.8
1017

1118
### Deprecated APIs

cpp/ql/lib/DefaultOptions.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ class Options extends string {
5454
*
5555
* By default, this holds for `exit`, `_exit`, `abort`, `__assert_fail`,
5656
* `longjmp`, `__builtin_unreachable` and any function with a
57-
* `noreturn` attribute.
57+
* `noreturn` attribute or specifier.
5858
*/
5959
predicate exits(Function f) {
6060
f.getAnAttribute().hasName("noreturn")
6161
or
62+
f.getASpecifier().hasName("noreturn")
63+
or
6264
f.hasGlobalOrStdName([
6365
"exit", "_exit", "abort", "__assert_fail", "longjmp", "__builtin_unreachable"
6466
])

cpp/ql/lib/Options.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CustomOptions extends Options {
3939
*
4040
* By default, this holds for `exit`, `_exit`, `abort`, `__assert_fail`,
4141
* `longjmp`, `error`, `__builtin_unreachable` and any function with a
42-
* `noreturn` attribute.
42+
* `noreturn` attribute or specifier.
4343
*/
4444
override predicate exits(Function f) { Options.super.exits(f) }
4545

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
category: deprecated
3+
---
4+
* Many classes/predicates/modules that had upper-case acronyms have been renamed to follow our style-guide.
5+
The old name still exists as a deprecated alias.

0 commit comments

Comments
 (0)