mirror of
https://github.com/github/codeql-action.git
synced 2026-05-09 23:30:28 +00:00
Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 68bde559de | |||
| 9739ad2d18 | |||
| 803d9e8c3c | |||
| 0fd9c7d135 | |||
| 922d6fb888 | |||
| df77e87896 | |||
| 6e3f985e4f | |||
| e7a347dfb1 | |||
| 17eabb2500 | |||
| aaef09c48d | |||
| ae1b9155d3 | |||
| 9f82f88f07 | |||
| bc0b696b41 | |||
| f9bb0e001c | |||
| 4b7faf0b3d | |||
| 09a1d9ec2a | |||
| f64a4491cf | |||
| 7fc86e0c37 | |||
| 5997e25ad9 | |||
| 7587714d0a | |||
| a723e99345 | |||
| fbba1e03be | |||
| 933238e8d5 | |||
| e46ed2cbd0 | |||
| b73d1d1634 | |||
| 24e0bb00a9 | |||
| ec298daba7 | |||
| 8c6e48dbe0 | |||
| 719098349e | |||
| 2bb209555a | |||
| 7851e55dc3 | |||
| 262a15f6cf | |||
| a6109b1c07 | |||
| 022ff3c73f | |||
| 0a4d574ac4 | |||
| d1edf2e4de | |||
| facd53f789 | |||
| b77983290b | |||
| fcf29e3d86 | |||
| 1fed3e9ba8 | |||
| 549683cee5 | |||
| 7a6ed56219 | |||
| 91fbc51606 | |||
| 35715ef8fe | |||
| bac7fdaf42 | |||
| 1517969c90 | |||
| f073360456 | |||
| 5145c112e7 | |||
| 7108503ac6 | |||
| 4fe9b1e243 | |||
| 56733fb5ae | |||
| 0a636086c9 | |||
| 97be3af35a | |||
| de303a9db5 | |||
| 7a818e6977 | |||
| 30e0f4391d | |||
| 7c5585e5cf | |||
| 245f6828c4 | |||
| c109008fac | |||
| e73c940c9b | |||
| cdb655d6d4 | |||
| 6153577cab | |||
| 8f02cfa11d | |||
| 0ed734b61b | |||
| efdcb31f11 | |||
| 4d2c7c6e10 | |||
| 70b2658d23 | |||
| 530fcb3bbf | |||
| 2acf81942b | |||
| d2a54a4507 | |||
| bc4097bbe1 | |||
| c8e26e209a | |||
| 0752451507 | |||
| 243c274daf | |||
| 19b3a84f58 | |||
| 858a6149c1 | |||
| c60c75576d | |||
| 59aede2113 | |||
| 6c35f8607b | |||
| c486cacf49 | |||
| 365478cc5b | |||
| f0e6490756 | |||
| 860353f245 | |||
| 4fb8483ef0 | |||
| c2574efbee | |||
| 4cbe7bef85 | |||
| f6a5638305 | |||
| 1279e8d41c | |||
| af1f613989 | |||
| 5026833be5 | |||
| 201ddc275d | |||
| 1dcdb940d5 | |||
| 0b7b740d4c | |||
| 0ac85966ba | |||
| 5019ed041c | |||
| d64d81d41f | |||
| 6777c894e9 | |||
| 79f9c0517c | |||
| 3b3a77544b | |||
| 9f95de42d6 | |||
| e2d518d895 | |||
| 9df9e9176e | |||
| 6847a42aa8 | |||
| f820c80d4d | |||
| ca7d6d3b79 | |||
| 8d9c36a0ce | |||
| 95e58e9a2c | |||
| 6f31bfe060 | |||
| d2e135a73a | |||
| 60abb65df0 | |||
| 5a0a562209 | |||
| f8b62132ab | |||
| 90d7616015 | |||
| 1aef4ed505 | |||
| cb52ba6486 | |||
| 7c9e131894 | |||
| 130ab2d721 | |||
| 8cf2dc52f9 | |||
| 97bcdd8c1e | |||
| e6c21da23c | |||
| bad0a744dd | |||
| 4ea3a4b4af |
@@ -1,5 +1,5 @@
|
|||||||
name: "CodeQL config"
|
name: "CodeQL config"
|
||||||
queries:
|
queries:
|
||||||
- name: Run custom queries
|
- name: Run custom queries
|
||||||
uses: ./queries
|
uses: ./queries
|
||||||
# Run all extra query suites, both because we want to
|
# Run all extra query suites, both because we want to
|
||||||
@@ -13,3 +13,5 @@ queries:
|
|||||||
paths-ignore:
|
paths-ignore:
|
||||||
- lib
|
- lib
|
||||||
- tests
|
- tests
|
||||||
|
- "**/*.test.ts"
|
||||||
|
- "**/testing-util.ts"
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ jobs:
|
|||||||
use-all-platform-bundle: 'false'
|
use-all-platform-bundle: 'false'
|
||||||
setup-kotlin: 'true'
|
setup-kotlin: 'true'
|
||||||
- name: Set up Ruby
|
- name: Set up Ruby
|
||||||
uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
|
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
|
||||||
with:
|
with:
|
||||||
ruby-version: 2.6
|
ruby-version: 2.6
|
||||||
- name: Install Code Scanning integration
|
- name: Install Code Scanning integration
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
# Workflow runs on main, on a release branch, and that were triggered as part of a merge group have
|
||||||
|
# already passed CI before being merged. Therefore if they fail, we should make sure that there
|
||||||
|
# wasn't a transient failure by rerunning the failed jobs once before investigating further.
|
||||||
|
name: Deflake
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
types: [completed]
|
||||||
|
# Exclude workflows that have significant side effects, like publishing releases. It's OK to
|
||||||
|
# retry CodeQL analysis.
|
||||||
|
workflows:
|
||||||
|
- Check Expected Release Files
|
||||||
|
- Code-Scanning config CLI tests
|
||||||
|
- CodeQL action
|
||||||
|
- Manual Check - go
|
||||||
|
- "PR Check - All-platform bundle"
|
||||||
|
- "PR Check - Analysis kinds"
|
||||||
|
- "PR Check - Analyze: 'ref' and 'sha' from inputs"
|
||||||
|
- "PR Check - autobuild-action"
|
||||||
|
- "PR Check - Autobuild direct tracing (custom working directory)"
|
||||||
|
- "PR Check - Autobuild working directory"
|
||||||
|
- "PR Check - Build mode autobuild"
|
||||||
|
- "PR Check - Build mode manual"
|
||||||
|
- "PR Check - Build mode none"
|
||||||
|
- "PR Check - Build mode rollback"
|
||||||
|
- "PR Check - Bundle: Caching checks"
|
||||||
|
- "PR Check - Bundle: From nightly"
|
||||||
|
- "PR Check - Bundle: From toolcache"
|
||||||
|
- "PR Check - Bundle: Zstandard checks"
|
||||||
|
- "PR Check - C/C\\+\\+: autoinstalling dependencies (Linux)"
|
||||||
|
- "PR Check - C/C\\+\\+: autoinstalling dependencies is skipped (macOS)"
|
||||||
|
- "PR Check - C/C\\+\\+: disabling autoinstalling dependencies (Linux)"
|
||||||
|
- "PR Check - Clean up database cluster directory"
|
||||||
|
- "PR Check - CodeQL Bundle All"
|
||||||
|
- "PR Check - Config export"
|
||||||
|
- "PR Check - Config input"
|
||||||
|
- "PR Check - Custom source root"
|
||||||
|
- "PR Check - Debug artifact upload"
|
||||||
|
- "PR Check - Debug artifacts after failure"
|
||||||
|
- "PR Check - Diagnostic export"
|
||||||
|
- "PR Check - Export file baseline information"
|
||||||
|
- "PR Check - Extractor ram and threads options test"
|
||||||
|
- "PR Check - Go: Custom queries"
|
||||||
|
- "PR Check - Go: diagnostic when Go is changed after init step"
|
||||||
|
- "PR Check - Go: diagnostic when `file` is not installed"
|
||||||
|
- "PR Check - Go: tracing with autobuilder step"
|
||||||
|
- "PR Check - Go: tracing with custom build steps"
|
||||||
|
- "PR Check - Go: tracing with legacy workflow"
|
||||||
|
- "PR Check - Go: workaround for indirect tracing"
|
||||||
|
- "PR Check - Job run UUID added to SARIF"
|
||||||
|
- "PR Check - Language aliases"
|
||||||
|
- "PR Check - Local CodeQL bundle"
|
||||||
|
- "PR Check - Multi-language repository"
|
||||||
|
- "PR Check - Overlay database init fallback"
|
||||||
|
- "PR Check - Packaging: Action input"
|
||||||
|
- "PR Check - Packaging: Config and input"
|
||||||
|
- "PR Check - Packaging: Config and input passed to the CLI"
|
||||||
|
- "PR Check - Packaging: Config file"
|
||||||
|
- "PR Check - Packaging: Download using registries"
|
||||||
|
- "PR Check - Proxy test"
|
||||||
|
- "PR Check - Remote config file"
|
||||||
|
- "PR Check - Resolve environment"
|
||||||
|
- "PR Check - RuboCop multi-language"
|
||||||
|
- "PR Check - Ruby analysis"
|
||||||
|
- "PR Check - Rust analysis"
|
||||||
|
- "PR Check - Split workflow"
|
||||||
|
- "PR Check - Start proxy"
|
||||||
|
- "PR Check - Submit SARIF after failure"
|
||||||
|
- "PR Check - Swift analysis using a custom build command"
|
||||||
|
- "PR Check - Swift analysis using autobuild"
|
||||||
|
- "PR Check - Test different uses of `upload-sarif`"
|
||||||
|
- "PR Check - Test unsetting environment variables"
|
||||||
|
- "PR Check - Upload-sarif: ref and sha from inputs"
|
||||||
|
- "PR Check - Use a custom `checkout_path`"
|
||||||
|
- PR Checks
|
||||||
|
- Query filters tests
|
||||||
|
- Test that the workaround for python 3.12 on windows works
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rerun-on-failure:
|
||||||
|
name: Rerun failed jobs
|
||||||
|
if: >-
|
||||||
|
github.event.workflow_run.conclusion == 'failure' &&
|
||||||
|
github.event.workflow_run.run_attempt == 1 &&
|
||||||
|
(
|
||||||
|
github.event.workflow_run.head_branch == 'main' ||
|
||||||
|
startsWith(github.event.workflow_run.head_branch, 'releases/') ||
|
||||||
|
github.event.workflow_run.event == 'merge_group'
|
||||||
|
)
|
||||||
|
runs-on: ubuntu-slim
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
steps:
|
||||||
|
- name: Rerun failed jobs in ${{ github.event.workflow_run.name }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||||
|
RUN_NAME: ${{ github.event.workflow_run.name }}
|
||||||
|
RUN_URL: ${{ github.event.workflow_run.html_url }}
|
||||||
|
run: |
|
||||||
|
echo "Rerunning failed jobs for workflow run ${RUN_ID}"
|
||||||
|
gh run rerun "${RUN_ID}" --failed
|
||||||
|
echo "### Reran failed jobs :recycle:" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
echo "" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
echo "Workflow: [${RUN_NAME}](${RUN_URL})" >> "$GITHUB_STEP_SUMMARY"
|
||||||
@@ -63,13 +63,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tools: https://github.com/github/codeql-action/releases/download/${{ github.event.release.tag_name }}/codeql-bundle-linux64.tar.gz
|
tools: https://github.com/github/codeql-action/releases/download/${{ github.event.release.tag_name }}/codeql-bundle-linux64.tar.gz
|
||||||
|
|
||||||
- name: Update language aliases
|
- name: Update built-in languages
|
||||||
|
run: npx tsx pr-checks/update-builtin-languages.ts "$CODEQL_PATH"
|
||||||
env:
|
env:
|
||||||
CODEQL_PATH: ${{ steps.setup-codeql.outputs.codeql-path }}
|
CODEQL_PATH: ${{ steps.setup-codeql.outputs.codeql-path }}
|
||||||
run: |
|
|
||||||
"$CODEQL_PATH" resolve languages --format=betterjson --extractor-include-aliases \
|
|
||||||
| jq -S '.aliases // {}' \
|
|
||||||
> src/known-language-aliases.json
|
|
||||||
|
|
||||||
- name: Bump Action minor version if new CodeQL minor version series
|
- name: Bump Action minor version if new CodeQL minor version series
|
||||||
id: bump-action-version
|
id: bump-action-version
|
||||||
|
|||||||
Vendored
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
"scope": "javascript, typescript",
|
"scope": "javascript, typescript",
|
||||||
"prefix": "testMacro",
|
"prefix": "testMacro",
|
||||||
"body": [
|
"body": [
|
||||||
"const ${1:nameMacro} = test.macro({",
|
"const ${1:nameMacro} = makeMacro({",
|
||||||
" exec: async (t: ExecutionContext<unknown>) => {},",
|
" exec: async (t: ExecutionContext<unknown>) => {},",
|
||||||
"",
|
"",
|
||||||
" title: (providedTitle = \"\") => `${2:common title} - \\${providedTitle}`,",
|
" title: (providedTitle = \"\") => `${2:common title} - \\${providedTitle}`,",
|
||||||
|
|||||||
+14
-1
@@ -2,12 +2,25 @@
|
|||||||
|
|
||||||
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
||||||
|
|
||||||
## [UNRELEASED]
|
## 4.35.4 - 07 May 2026
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to [2.25.4](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.4). [#3881](https://github.com/github/codeql-action/pull/3881)
|
||||||
|
|
||||||
|
## 4.35.3 - 01 May 2026
|
||||||
|
|
||||||
|
- _Upcoming breaking change_: Add a deprecation warning for customers using CodeQL version 2.19.3 and earlier. These versions of CodeQL were discontinued on 9 April 2026 alongside GitHub Enterprise Server 3.15, and will be unsupported by the next minor release of the CodeQL Action. [#3837](https://github.com/github/codeql-action/pull/3837)
|
||||||
|
- Configurations for private registries that use Cloudsmith or GCP OIDC are now accepted. [#3850](https://github.com/github/codeql-action/pull/3850)
|
||||||
|
- Best-effort connection tests for private registries now use `GET` requests instead of `HEAD` for better compatibility with various registry implementations. For NuGet feeds, the test is now always performed against the service index. [#3853](https://github.com/github/codeql-action/pull/3853)
|
||||||
|
- Fixed a bug where two diagnostics produced within the same millisecond could overwrite each other on disk, causing one of them to be lost. [#3852](https://github.com/github/codeql-action/pull/3852)
|
||||||
|
- Update default CodeQL bundle version to [2.25.3](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.3). [#3865](https://github.com/github/codeql-action/pull/3865)
|
||||||
|
|
||||||
|
## 4.35.2 - 15 Apr 2026
|
||||||
|
|
||||||
- The undocumented TRAP cache cleanup feature that could be enabled using the `CODEQL_ACTION_CLEANUP_TRAP_CACHES` environment variable is deprecated and will be removed in May 2026. If you are affected by this, we recommend disabling TRAP caching by passing the `trap-caching: false` input to the `init` Action. [#3795](https://github.com/github/codeql-action/pull/3795)
|
- The undocumented TRAP cache cleanup feature that could be enabled using the `CODEQL_ACTION_CLEANUP_TRAP_CACHES` environment variable is deprecated and will be removed in May 2026. If you are affected by this, we recommend disabling TRAP caching by passing the `trap-caching: false` input to the `init` Action. [#3795](https://github.com/github/codeql-action/pull/3795)
|
||||||
- The Git version 2.36.0 requirement for improved incremental analysis now only applies to repositories that contain submodules. [#3789](https://github.com/github/codeql-action/pull/3789)
|
- The Git version 2.36.0 requirement for improved incremental analysis now only applies to repositories that contain submodules. [#3789](https://github.com/github/codeql-action/pull/3789)
|
||||||
- Python analysis on GHES no longer extracts the standard library, relying instead on models of the standard library. This should result in significantly faster extraction and analysis times, while the effect on alerts should be minimal. [#3794](https://github.com/github/codeql-action/pull/3794)
|
- Python analysis on GHES no longer extracts the standard library, relying instead on models of the standard library. This should result in significantly faster extraction and analysis times, while the effect on alerts should be minimal. [#3794](https://github.com/github/codeql-action/pull/3794)
|
||||||
- Fixed a bug in the validation of OIDC configurations for private registries that was added in CodeQL Action 4.33.0 / 3.33.0. [#3807](https://github.com/github/codeql-action/pull/3807)
|
- Fixed a bug in the validation of OIDC configurations for private registries that was added in CodeQL Action 4.33.0 / 3.33.0. [#3807](https://github.com/github/codeql-action/pull/3807)
|
||||||
|
- Update default CodeQL bundle version to [2.25.2](https://github.com/github/codeql-action/releases/tag/codeql-bundle-v2.25.2). [#3823](https://github.com/github/codeql-action/pull/3823)
|
||||||
|
|
||||||
## 4.35.1 - 27 Mar 2026
|
## 4.35.1 - 27 Mar 2026
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ We typically release new minor versions of the CodeQL Action and Bundle when a n
|
|||||||
|
|
||||||
| Minimum CodeQL Action | Minimum CodeQL Bundle Version | GitHub Environment | Notes |
|
| Minimum CodeQL Action | Minimum CodeQL Bundle Version | GitHub Environment | Notes |
|
||||||
|-----------------------|-------------------------------|--------------------|-------|
|
|-----------------------|-------------------------------|--------------------|-------|
|
||||||
|
| `v4.33.0` | `2.24.3` | Enterprise Server 3.21 | |
|
||||||
| `v4.31.10` | `2.23.9` | Enterprise Server 3.20 | |
|
| `v4.31.10` | `2.23.9` | Enterprise Server 3.20 | |
|
||||||
| `v3.29.11` | `2.22.4` | Enterprise Server 3.19 | |
|
| `v3.29.11` | `2.22.4` | Enterprise Server 3.19 | |
|
||||||
| `v3.28.21` | `2.21.3` | Enterprise Server 3.18 | |
|
| `v3.28.21` | `2.21.3` | Enterprise Server 3.18 | |
|
||||||
|
|||||||
Generated
+1443
-36099
File diff suppressed because one or more lines are too long
Generated
+1409
-19312
File diff suppressed because one or more lines are too long
Generated
+1334
-19231
File diff suppressed because one or more lines are too long
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-v2.25.1",
|
"bundleVersion": "codeql-bundle-v2.25.4",
|
||||||
"cliVersion": "2.25.1",
|
"cliVersion": "2.25.4",
|
||||||
"priorBundleVersion": "codeql-bundle-v2.24.3",
|
"priorBundleVersion": "codeql-bundle-v2.25.3",
|
||||||
"priorCliVersion": "2.24.3"
|
"priorCliVersion": "2.25.3"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+1467
-36128
File diff suppressed because one or more lines are too long
Generated
+1431
-19326
File diff suppressed because one or more lines are too long
Generated
+1332
-19229
File diff suppressed because one or more lines are too long
Generated
+1354
-19256
File diff suppressed because one or more lines are too long
Generated
+1440
-36096
File diff suppressed because one or more lines are too long
Generated
+2671
-20536
File diff suppressed because one or more lines are too long
Generated
+1353
-19255
File diff suppressed because one or more lines are too long
Generated
+1440
-36096
File diff suppressed because one or more lines are too long
Generated
+1353
-19255
File diff suppressed because one or more lines are too long
Generated
+174
-214
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "4.35.2",
|
"version": "4.35.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "4.35.2",
|
"version": "4.35.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"pr-checks"
|
"pr-checks"
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"@octokit/plugin-retry": "^8.1.0",
|
"@octokit/plugin-retry": "^8.1.0",
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"follow-redirects": "^1.15.11",
|
"follow-redirects": "^1.16.0",
|
||||||
"get-folder-size": "^5.0.0",
|
"get-folder-size": "^5.0.0",
|
||||||
"https-proxy-agent": "^7.0.6",
|
"https-proxy-agent": "^7.0.6",
|
||||||
"js-yaml": "^4.1.1",
|
"js-yaml": "^4.1.1",
|
||||||
@@ -33,11 +33,11 @@
|
|||||||
"long": "^5.3.2",
|
"long": "^5.3.2",
|
||||||
"node-forge": "^1.4.0",
|
"node-forge": "^1.4.0",
|
||||||
"semver": "^7.7.4",
|
"semver": "^7.7.4",
|
||||||
"uuid": "^13.0.0"
|
"uuid": "^14.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ava/typescript": "6.0.0",
|
"@ava/typescript": "7.0.0",
|
||||||
"@eslint/compat": "^2.0.4",
|
"@eslint/compat": "^2.0.5",
|
||||||
"@microsoft/eslint-formatter-sarif": "^3.1.0",
|
"@microsoft/eslint-formatter-sarif": "^3.1.0",
|
||||||
"@octokit/types": "^16.0.0",
|
"@octokit/types": "^16.0.0",
|
||||||
"@types/archiver": "^7.0.0",
|
"@types/archiver": "^7.0.0",
|
||||||
@@ -51,17 +51,17 @@
|
|||||||
"ava": "^7.0.0",
|
"ava": "^7.0.0",
|
||||||
"esbuild": "^0.28.0",
|
"esbuild": "^0.28.0",
|
||||||
"eslint": "^9.39.2",
|
"eslint": "^9.39.2",
|
||||||
"eslint-import-resolver-typescript": "^3.8.7",
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
"eslint-plugin-github": "^6.0.0",
|
"eslint-plugin-github": "^6.0.0",
|
||||||
"eslint-plugin-import-x": "^4.16.2",
|
"eslint-plugin-import-x": "^4.16.2",
|
||||||
"eslint-plugin-jsdoc": "^62.9.0",
|
"eslint-plugin-jsdoc": "^62.9.0",
|
||||||
"eslint-plugin-no-async-foreach": "^0.1.1",
|
"eslint-plugin-no-async-foreach": "^0.1.1",
|
||||||
"glob": "^11.1.0",
|
"glob": "^11.1.0",
|
||||||
"globals": "^17.4.0",
|
"globals": "^17.5.0",
|
||||||
"nock": "^14.0.12",
|
"nock": "^14.0.12",
|
||||||
"sinon": "^21.0.3",
|
"sinon": "^21.1.2",
|
||||||
"typescript": "^6.0.2",
|
"typescript": "^6.0.2",
|
||||||
"typescript-eslint": "^8.58.0"
|
"typescript-eslint": "^8.58.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
@@ -410,15 +410,6 @@
|
|||||||
"undici": "^6.23.0"
|
"undici": "^6.23.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/github/node_modules/undici": {
|
|
||||||
"version": "6.23.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
|
|
||||||
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18.17"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@actions/glob": {
|
"node_modules/@actions/glob": {
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.1.tgz",
|
||||||
@@ -439,15 +430,6 @@
|
|||||||
"undici": "^6.23.0"
|
"undici": "^6.23.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/http-client/node_modules/undici": {
|
|
||||||
"version": "6.23.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
|
|
||||||
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18.17"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@actions/io": {
|
"node_modules/@actions/io": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/io/-/io-2.0.0.tgz",
|
||||||
@@ -468,16 +450,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ava/typescript": {
|
"node_modules/@ava/typescript": {
|
||||||
"version": "6.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-7.0.0.tgz",
|
||||||
"integrity": "sha512-+8oDYc4J5cCaWZh1VUbyc+cegGplJO9FqHpqR4LVAVx8fRLVRaYlC4yyA6cqHJ1vWP23Ff/ECS5U68Zz6OLZlg==",
|
"integrity": "sha512-0ktzq4/9ya2QoAuVWzl3McpLV9W//Tj+oMonQ4ucgm5l6tQ46aaju/rJL9kzeY5MkG6wzXvFt/MmaLqf9uNC9w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"escape-string-regexp": "^5.0.0",
|
"escape-string-regexp": "^5.0.0",
|
||||||
"execa": "^9.6.0"
|
"execa": "^9.6.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^20.8 || ^22 || >=24"
|
"node": "^22.20 || ^24.12 || >=25"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ava/typescript/node_modules/escape-string-regexp": {
|
"node_modules/@ava/typescript/node_modules/escape-string-regexp": {
|
||||||
@@ -1333,13 +1316,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/compat": {
|
"node_modules/@eslint/compat": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-2.0.5.tgz",
|
||||||
"integrity": "sha512-o598tCGstJv9Kk4XapwP+oDij9HD9Qr3V37ABzTfdzVvbFciV+sfg9zSW6olj6G/IXj7p89SwSzPnZ+JUEPIPg==",
|
"integrity": "sha512-IbHDbHJfkVNv6xjlET8AIVo/K1NQt7YT4Rp6ok/clyBGcpRx1l6gv0Rq3vBvYfPJIZt6ODf66Zq08FJNDpnzgg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint/core": "^1.2.0"
|
"@eslint/core": "^1.2.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^20.19.0 || ^22.13.0 || >=24"
|
"node": "^20.19.0 || ^22.13.0 || >=24"
|
||||||
@@ -1493,14 +1476,6 @@
|
|||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@fastify/busboy": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@github/browserslist-config": {
|
"node_modules/@github/browserslist-config": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@@ -1988,6 +1963,18 @@
|
|||||||
"@tybys/wasm-util": "^0.10.0"
|
"@tybys/wasm-util": "^0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@nodable/entities": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/nodable"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@nodelib/fs.scandir": {
|
"node_modules/@nodelib/fs.scandir": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.5",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@@ -2020,15 +2007,6 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@nolyfill/is-core-module": {
|
|
||||||
"version": "1.0.39",
|
|
||||||
"resolved": "https://registry.npmjs.org/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz",
|
|
||||||
"integrity": "sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/auth-token": {
|
"node_modules/@octokit/auth-token": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
|
||||||
@@ -2362,7 +2340,8 @@
|
|||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz",
|
||||||
"integrity": "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==",
|
"integrity": "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@sindresorhus/base62": {
|
"node_modules/@sindresorhus/base62": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@@ -2400,9 +2379,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@sinonjs/fake-timers": {
|
"node_modules/@sinonjs/fake-timers": {
|
||||||
"version": "15.1.1",
|
"version": "15.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-15.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-15.3.2.tgz",
|
||||||
"integrity": "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw==",
|
"integrity": "sha512-mrn35Jl2pCpns+mE3HaZa1yPN5EYCRgiMI+135COjr2hr8Cls9DXqIZ57vZe2cz7y2XVSq92tcs6kGQcT1J8Rw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2410,9 +2389,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@sinonjs/samsam": {
|
"node_modules/@sinonjs/samsam": {
|
||||||
"version": "9.0.3",
|
"version": "10.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-9.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-10.0.2.tgz",
|
||||||
"integrity": "sha512-ZgYY7Dc2RW+OUdnZ1DEHg00lhRt+9BjymPKHog4PRFzr1U3MbK57+djmscWyKxzO1qfunHqs4N45WWyKIFKpiQ==",
|
"integrity": "sha512-8lVwD1Df1BmzoaOLhMcGGcz/Jyr5QY2KSB75/YK1QgKzoabTeLdIVyhXNZK9ojfSKSdirbXqdbsXXqP9/Ve8+A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2549,17 +2528,17 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.58.2.tgz",
|
||||||
"integrity": "sha512-RLkVSiNuUP1C2ROIWfqX+YcUfLaSnxGE/8M+Y57lopVwg9VTYYfhuz15Yf1IzCKgZj6/rIbYTmJCUSqr76r0Wg==",
|
"integrity": "sha512-aC2qc5thQahutKjP+cl8cgN9DWe3ZUqVko30CMSZHnFEHyhOYoZSzkGtAI2mcwZ38xeImDucI4dnqsHiOYuuCw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.12.2",
|
"@eslint-community/regexpp": "^4.12.2",
|
||||||
"@typescript-eslint/scope-manager": "8.58.0",
|
"@typescript-eslint/scope-manager": "8.58.2",
|
||||||
"@typescript-eslint/type-utils": "8.58.0",
|
"@typescript-eslint/type-utils": "8.58.2",
|
||||||
"@typescript-eslint/utils": "8.58.0",
|
"@typescript-eslint/utils": "8.58.2",
|
||||||
"@typescript-eslint/visitor-keys": "8.58.0",
|
"@typescript-eslint/visitor-keys": "8.58.2",
|
||||||
"ignore": "^7.0.5",
|
"ignore": "^7.0.5",
|
||||||
"natural-compare": "^1.4.0",
|
"natural-compare": "^1.4.0",
|
||||||
"ts-api-utils": "^2.5.0"
|
"ts-api-utils": "^2.5.0"
|
||||||
@@ -2572,7 +2551,7 @@
|
|||||||
"url": "https://opencollective.com/typescript-eslint"
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@typescript-eslint/parser": "^8.58.0",
|
"@typescript-eslint/parser": "^8.58.2",
|
||||||
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
||||||
"typescript": ">=4.8.4 <6.1.0"
|
"typescript": ">=4.8.4 <6.1.0"
|
||||||
}
|
}
|
||||||
@@ -2588,16 +2567,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.58.2.tgz",
|
||||||
"integrity": "sha512-rLoGZIf9afaRBYsPUMtvkDWykwXwUPL60HebR4JgTI8mxfFe2cQTu3AGitANp4b9B2QlVru6WzjgB2IzJKiCSA==",
|
"integrity": "sha512-/Zb/xaIDfxeJnvishjGdcR4jmr7S+bda8PKNhRGdljDM+elXhlvN0FyPSsMnLmJUrVG9aPO6dof80wjMawsASg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "8.58.0",
|
"@typescript-eslint/scope-manager": "8.58.2",
|
||||||
"@typescript-eslint/types": "8.58.0",
|
"@typescript-eslint/types": "8.58.2",
|
||||||
"@typescript-eslint/typescript-estree": "8.58.0",
|
"@typescript-eslint/typescript-estree": "8.58.2",
|
||||||
"@typescript-eslint/visitor-keys": "8.58.0",
|
"@typescript-eslint/visitor-keys": "8.58.2",
|
||||||
"debug": "^4.4.3"
|
"debug": "^4.4.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -2631,14 +2610,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/project-service": {
|
"node_modules/@typescript-eslint/project-service": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.58.2.tgz",
|
||||||
"integrity": "sha512-8Q/wBPWLQP1j16NxoPNIKpDZFMaxl7yWIoqXWYeWO+Bbd2mjgvoF0dxP2jKZg5+x49rgKdf7Ck473M8PC3V9lg==",
|
"integrity": "sha512-Cq6UfpZZk15+r87BkIh5rDpi38W4b+Sjnb8wQCPPDDweS/LRCFjCyViEbzHk5Ck3f2QDfgmlxqSa7S7clDtlfg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/tsconfig-utils": "^8.58.0",
|
"@typescript-eslint/tsconfig-utils": "^8.58.2",
|
||||||
"@typescript-eslint/types": "^8.58.0",
|
"@typescript-eslint/types": "^8.58.2",
|
||||||
"debug": "^4.4.3"
|
"debug": "^4.4.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -2671,14 +2650,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.58.2.tgz",
|
||||||
"integrity": "sha512-W1Lur1oF50FxSnNdGp3Vs6P+yBRSmZiw4IIjEeYxd8UQJwhUF0gDgDD/W/Tgmh73mxgEU3qX0Bzdl/NGuSPEpQ==",
|
"integrity": "sha512-SgmyvDPexWETQek+qzZnrG6844IaO02UVyOLhI4wpo82dpZJY9+6YZCKAMFzXb7qhx37mFK1QcPQ18tud+vo6Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "8.58.0",
|
"@typescript-eslint/types": "8.58.2",
|
||||||
"@typescript-eslint/visitor-keys": "8.58.0"
|
"@typescript-eslint/visitor-keys": "8.58.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@@ -2689,9 +2668,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/tsconfig-utils": {
|
"node_modules/@typescript-eslint/tsconfig-utils": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.58.2.tgz",
|
||||||
"integrity": "sha512-doNSZEVJsWEu4htiVC+PR6NpM+pa+a4ClH9INRWOWCUzMst/VA9c4gXq92F8GUD1rwhNvRLkgjfYtFXegXQF7A==",
|
"integrity": "sha512-3SR+RukipDvkkKp/d0jP0dyzuls3DbGmwDpVEc5wqk5f38KFThakqAAO0XMirWAE+kT00oTauTbzMFGPoAzB0A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -2706,15 +2685,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/type-utils": {
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.58.2.tgz",
|
||||||
"integrity": "sha512-aGsCQImkDIqMyx1u4PrVlbi/krmDsQUs4zAcCV6M7yPcPev+RqVlndsJy9kJ8TLihW9TZ0kbDAzctpLn5o+lOg==",
|
"integrity": "sha512-Z7EloNR/B389FvabdGeTo2XMs4W9TjtPiO9DAsmT0yom0bwlPyRjkJ1uCdW1DvrrrYP50AJZ9Xc3sByZA9+dcg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "8.58.0",
|
"@typescript-eslint/types": "8.58.2",
|
||||||
"@typescript-eslint/typescript-estree": "8.58.0",
|
"@typescript-eslint/typescript-estree": "8.58.2",
|
||||||
"@typescript-eslint/utils": "8.58.0",
|
"@typescript-eslint/utils": "8.58.2",
|
||||||
"debug": "^4.4.3",
|
"debug": "^4.4.3",
|
||||||
"ts-api-utils": "^2.5.0"
|
"ts-api-utils": "^2.5.0"
|
||||||
},
|
},
|
||||||
@@ -2749,9 +2728,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/types": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.58.2.tgz",
|
||||||
"integrity": "sha512-O9CjxypDT89fbHxRfETNoAnHj/i6IpRK0CvbVN3qibxlLdo5p5hcLmUuCCrHMpxiWSwKyI8mCP7qRNYuOJ0Uww==",
|
"integrity": "sha512-9TukXyATBQf/Jq9AMQXfvurk+G5R2MwfqQGDR2GzGz28HvY/lXNKGhkY+6IOubwcquikWk5cjlgPvD2uAA7htQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -2763,16 +2742,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.58.2.tgz",
|
||||||
"integrity": "sha512-7vv5UWbHqew/dvs+D3e1RvLv1v2eeZ9txRHPnEEBUgSNLx5ghdzjHa0sgLWYVKssH+lYmV0JaWdoubo0ncGYLA==",
|
"integrity": "sha512-ELGuoofuhhoCvNbQjFFiobFcGgcDCEm0ThWdmO4Z0UzLqPXS3KFvnEZ+SHewwOYHjM09tkzOWXNTv9u6Gqtyuw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/project-service": "8.58.0",
|
"@typescript-eslint/project-service": "8.58.2",
|
||||||
"@typescript-eslint/tsconfig-utils": "8.58.0",
|
"@typescript-eslint/tsconfig-utils": "8.58.2",
|
||||||
"@typescript-eslint/types": "8.58.0",
|
"@typescript-eslint/types": "8.58.2",
|
||||||
"@typescript-eslint/visitor-keys": "8.58.0",
|
"@typescript-eslint/visitor-keys": "8.58.2",
|
||||||
"debug": "^4.4.3",
|
"debug": "^4.4.3",
|
||||||
"minimatch": "^10.2.2",
|
"minimatch": "^10.2.2",
|
||||||
"semver": "^7.7.3",
|
"semver": "^7.7.3",
|
||||||
@@ -2848,16 +2827,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/utils": {
|
"node_modules/@typescript-eslint/utils": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.58.2.tgz",
|
||||||
"integrity": "sha512-RfeSqcFeHMHlAWzt4TBjWOAtoW9lnsAGiP3GbaX9uVgTYYrMbVnGONEfUCiSss+xMHFl+eHZiipmA8WkQ7FuNA==",
|
"integrity": "sha512-QZfjHNEzPY8+l0+fIXMvuQ2sJlplB4zgDZvA+NmvZsZv3EQwOcc1DuIU1VJUTWZ/RKouBMhDyNaBMx4sWvrzRA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.9.1",
|
"@eslint-community/eslint-utils": "^4.9.1",
|
||||||
"@typescript-eslint/scope-manager": "8.58.0",
|
"@typescript-eslint/scope-manager": "8.58.2",
|
||||||
"@typescript-eslint/types": "8.58.0",
|
"@typescript-eslint/types": "8.58.2",
|
||||||
"@typescript-eslint/typescript-estree": "8.58.0"
|
"@typescript-eslint/typescript-estree": "8.58.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@@ -2872,13 +2851,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.58.2.tgz",
|
||||||
"integrity": "sha512-XJ9UD9+bbDo4a4epraTwG3TsNPeiB9aShrUneAVXy8q4LuwowN+qu89/6ByLMINqvIMeI9H9hOHQtg/ijrYXzQ==",
|
"integrity": "sha512-f1WO2Lx8a9t8DARmcWAUPJbu0G20bJlj8L4z72K00TMeJAoyLr/tHhI/pzYBLrR4dXWkcxO1cWYZEOX8DKHTqA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "8.58.0",
|
"@typescript-eslint/types": "8.58.2",
|
||||||
"eslint-visitor-keys": "^5.0.0"
|
"eslint-visitor-keys": "^5.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -4477,9 +4456,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/diff": {
|
"node_modules/diff": {
|
||||||
"version": "8.0.3",
|
"version": "8.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz",
|
||||||
"integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==",
|
"integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -4540,19 +4519,6 @@
|
|||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/enhanced-resolve": {
|
|
||||||
"version": "5.17.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz",
|
|
||||||
"integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"graceful-fs": "^4.2.4",
|
|
||||||
"tapable": "^2.2.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.13.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/es-abstract": {
|
"node_modules/es-abstract": {
|
||||||
"version": "1.24.1",
|
"version": "1.24.1",
|
||||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.1.tgz",
|
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.1.tgz",
|
||||||
@@ -4873,24 +4839,25 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-import-resolver-typescript": {
|
"node_modules/eslint-import-resolver-typescript": {
|
||||||
"version": "3.8.7",
|
"version": "4.4.4",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.8.7.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.4.4.tgz",
|
||||||
"integrity": "sha512-U7k84gOzrfl09c33qrIbD3TkWTWu3nt3dK5sDajHSekfoLlYGusIwSdPlPzVeA6TFpi0Wpj+ZdBD8hX4hxPoww==",
|
"integrity": "sha512-1iM2zeBvrYmUNTj2vSC/90JTHDth+dfOfiNKkxApWRsTJYNrc8rOdxxIf5vazX+BiAXTeOT0UvWpGI/7qIWQOw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nolyfill/is-core-module": "1.0.39",
|
"debug": "^4.4.1",
|
||||||
"debug": "^4.3.7",
|
"eslint-import-context": "^0.1.8",
|
||||||
"enhanced-resolve": "^5.15.0",
|
"get-tsconfig": "^4.10.1",
|
||||||
"get-tsconfig": "^4.10.0",
|
"is-bun-module": "^2.0.0",
|
||||||
"is-bun-module": "^1.0.2",
|
"stable-hash-x": "^0.2.0",
|
||||||
"stable-hash": "^0.0.4",
|
"tinyglobby": "^0.2.14",
|
||||||
"tinyglobby": "^0.2.12"
|
"unrs-resolver": "^1.7.11"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.18.0 || >=16.0.0"
|
"node": "^16.17.0 || >=18.6.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts"
|
"url": "https://opencollective.com/eslint-import-resolver-typescript"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"eslint": "*",
|
"eslint": "*",
|
||||||
@@ -5616,10 +5583,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/execa": {
|
"node_modules/execa": {
|
||||||
"version": "9.6.0",
|
"version": "9.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/execa/-/execa-9.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/execa/-/execa-9.6.1.tgz",
|
||||||
"integrity": "sha512-jpWzZ1ZhwUmeWRhS7Qv3mhpOhLfwI+uAX4e5fOcXqwMR7EcJ0pj2kV1CVzHVMX/LphnKWD3LObjZCoJ71lKpHw==",
|
"integrity": "sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sindresorhus/merge-streams": "^4.0.0",
|
"@sindresorhus/merge-streams": "^4.0.0",
|
||||||
"cross-spawn": "^7.0.6",
|
"cross-spawn": "^7.0.6",
|
||||||
@@ -5700,9 +5668,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-builder": {
|
"node_modules/fast-xml-builder": {
|
||||||
"version": "1.1.4",
|
"version": "1.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.5.tgz",
|
||||||
"integrity": "sha512-f2jhpN4Eccy0/Uz9csxh3Nu6q4ErKxf0XIsasomfOihuSUa3/xw6w8dnOtCDgEItQFJG8KyXPzQXzcODDrrbOg==",
|
"integrity": "sha512-4TJn/8FKLeslLAH3dnohXqE3QSoxkhvaMzepOIZytwJXZO69Bfz0HBdDHzOTOon6G59Zrk6VQ2bEiv1t61rfkA==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -5715,9 +5683,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fast-xml-parser": {
|
"node_modules/fast-xml-parser": {
|
||||||
"version": "5.5.7",
|
"version": "5.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.7.tgz",
|
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.7.1.tgz",
|
||||||
"integrity": "sha512-LteOsISQ2GEiDHZch6L9hB0+MLoYVLToR7xotrzU0opCICBkxOPgHAy1HxAvtxfJNXDJpgAsQN30mkrfpO2Prg==",
|
"integrity": "sha512-8Cc3f8GUGUULg34pBch/KGyPLglS+OFs05deyOlY7fL2MTagYPKrVQNmR1fLF/yJ9PH5ZSTd3YDF6pnmeZU+zA==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -5726,9 +5694,10 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-xml-builder": "^1.1.4",
|
"@nodable/entities": "^2.1.0",
|
||||||
"path-expression-matcher": "^1.1.3",
|
"fast-xml-builder": "^1.1.5",
|
||||||
"strnum": "^2.2.0"
|
"path-expression-matcher": "^1.5.0",
|
||||||
|
"strnum": "^2.2.3"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"fxparser": "src/cli/cli.js"
|
"fxparser": "src/cli/cli.js"
|
||||||
@@ -5841,9 +5810,9 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/follow-redirects": {
|
"node_modules/follow-redirects": {
|
||||||
"version": "1.15.11",
|
"version": "1.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
|
||||||
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
|
"integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
@@ -6033,6 +6002,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz",
|
||||||
"integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==",
|
"integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sec-ant/readable-stream": "^0.4.1",
|
"@sec-ant/readable-stream": "^0.4.1",
|
||||||
"is-stream": "^4.0.1"
|
"is-stream": "^4.0.1"
|
||||||
@@ -6148,9 +6118,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/globals": {
|
"node_modules/globals": {
|
||||||
"version": "17.4.0",
|
"version": "17.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/globals/-/globals-17.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/globals/-/globals-17.5.0.tgz",
|
||||||
"integrity": "sha512-hjrNztw/VajQwOLsMNT1cbJiH2muO3OROCHnbehc8eY5JyD2gqz4AcMHPqgaOR59DjgUjYAYLeH699g/eWi2jw==",
|
"integrity": "sha512-qoV+HK2yFl/366t2/Cb3+xxPUo5BuMynomoDmiaZBIdbs+0pYbjfZU+twLhGKp4uCZ/+NbtpVepH5bGCxRyy2g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -6393,6 +6363,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-8.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-8.0.1.tgz",
|
||||||
"integrity": "sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ==",
|
"integrity": "sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.18.0"
|
"node": ">=18.18.0"
|
||||||
}
|
}
|
||||||
@@ -6581,12 +6552,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/is-bun-module": {
|
"node_modules/is-bun-module": {
|
||||||
"version": "1.1.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz",
|
||||||
"integrity": "sha512-4mTAVPlrXpaN3jtF0lsnPCMGnq4+qZjVIKq0HCpfcqf8OC1SM5oATCIAPM5V5FN05qp2NNnFndphmdZS9CV3hA==",
|
"integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"semver": "^7.6.3"
|
"semver": "^7.7.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/is-callable": {
|
"node_modules/is-callable": {
|
||||||
@@ -6789,6 +6761,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz",
|
||||||
"integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==",
|
"integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -6863,6 +6836,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz",
|
||||||
"integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==",
|
"integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
@@ -7571,6 +7545,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-6.0.0.tgz",
|
||||||
"integrity": "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA==",
|
"integrity": "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"path-key": "^4.0.0",
|
"path-key": "^4.0.0",
|
||||||
"unicorn-magic": "^0.3.0"
|
"unicorn-magic": "^0.3.0"
|
||||||
@@ -7587,6 +7562,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
|
||||||
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
|
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -7860,9 +7836,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/path-expression-matcher": {
|
"node_modules/path-expression-matcher": {
|
||||||
"version": "1.1.3",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz",
|
||||||
"integrity": "sha512-qdVgY8KXmVdJZRSS1JdEPOKPdTiEK/pi0RkcT2sw1RhXxohdujUlJFPuS1TSkevZ9vzd3ZlL7ULl1MHGTApKzQ==",
|
"integrity": "sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -8532,17 +8508,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sinon": {
|
"node_modules/sinon": {
|
||||||
"version": "21.0.3",
|
"version": "21.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-21.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/sinon/-/sinon-21.1.2.tgz",
|
||||||
"integrity": "sha512-0x8TQFr8EjADhSME01u1ZK31yv2+bd6Z5NrBCHVM+n4qL1wFqbxftmeyi3bwlr49FbbzRfrqSFOpyHCOh/YmYA==",
|
"integrity": "sha512-FS6mN+/bx7e2ajpXkEmOcWB6xBzWiuNoAQT18/+a20SS4U7FSYl8Ms7N6VTUxN/1JAjkx7aXp+THMC8xdpp0gA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sinonjs/commons": "^3.0.1",
|
"@sinonjs/commons": "^3.0.1",
|
||||||
"@sinonjs/fake-timers": "^15.1.1",
|
"@sinonjs/fake-timers": "^15.3.2",
|
||||||
"@sinonjs/samsam": "^9.0.3",
|
"@sinonjs/samsam": "^10.0.2",
|
||||||
"diff": "^8.0.3",
|
"diff": "^8.0.4"
|
||||||
"supports-color": "^7.2.0"
|
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
@@ -8626,13 +8601,6 @@
|
|||||||
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
|
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/stable-hash": {
|
|
||||||
"version": "0.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.4.tgz",
|
|
||||||
"integrity": "sha512-LjdcbuBeLcdETCrPn9i8AYAZ1eCtu4ECAWtP7UleOiZ9LzVxRzzUZEoZ8zB24nhkQnDWyET0I+3sWokSDS3E7g==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/stable-hash-x": {
|
"node_modules/stable-hash-x": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/stable-hash-x/-/stable-hash-x-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/stable-hash-x/-/stable-hash-x-0.2.0.tgz",
|
||||||
@@ -8844,6 +8812,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-4.0.0.tgz",
|
||||||
"integrity": "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==",
|
"integrity": "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
@@ -8863,9 +8832,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/strnum": {
|
"node_modules/strnum": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.3.tgz",
|
||||||
"integrity": "sha512-BwRvNd5/QoAtyW1na1y1LsJGQNvRlkde6Q/ipqqEaivoMdV+B1OMOTVdwR+N/cwVUcIt9PYyHmV8HyexCZSupg==",
|
"integrity": "sha512-oKx6RUCuHfT3oyVjtnrmn19H1SiCqgJSg+54XqURKp5aCMbrXrhLjRN9TjuwMjiYstZ0MzDrHqkGZ5dFTKd+zg==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -8988,15 +8957,6 @@
|
|||||||
"url": "https://opencollective.com/unts"
|
"url": "https://opencollective.com/unts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tapable": {
|
|
||||||
"version": "2.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
|
|
||||||
"integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "7.5.11",
|
"version": "7.5.11",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.11.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.11.tgz",
|
||||||
@@ -9825,16 +9785,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript-eslint": {
|
"node_modules/typescript-eslint": {
|
||||||
"version": "8.58.0",
|
"version": "8.58.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.58.0.tgz",
|
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.58.2.tgz",
|
||||||
"integrity": "sha512-e2TQzKfaI85fO+F3QywtX+tCTsu/D3WW5LVU6nz8hTFKFZ8yBJ6mSYRpXqdR3mFjPWmO0eWsTa5f+UpAOe/FMA==",
|
"integrity": "sha512-V8iSng9mRbdZjl54VJ9NKr6ZB+dW0J3TzRXRGcSbLIej9jV86ZRtlYeTKDR/QLxXykocJ5icNzbsl2+5TzIvcQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "8.58.0",
|
"@typescript-eslint/eslint-plugin": "8.58.2",
|
||||||
"@typescript-eslint/parser": "8.58.0",
|
"@typescript-eslint/parser": "8.58.2",
|
||||||
"@typescript-eslint/typescript-estree": "8.58.0",
|
"@typescript-eslint/typescript-estree": "8.58.2",
|
||||||
"@typescript-eslint/utils": "8.58.0"
|
"@typescript-eslint/utils": "8.58.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@@ -9868,14 +9828,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "5.29.0",
|
"version": "6.24.1",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-6.24.1.tgz",
|
||||||
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
|
"integrity": "sha512-sC+b0tB1whOCzbtlx20fx3WgCXwkW627p4EA9uM+/tNNPkSS+eSEld6pAs9nDv7WbY1UUljBMYPtu9BCOrCWKA==",
|
||||||
"dependencies": {
|
"license": "MIT",
|
||||||
"@fastify/busboy": "^2.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0"
|
"node": ">=18.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
@@ -9890,6 +9848,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz",
|
||||||
"integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==",
|
"integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
@@ -9999,9 +9958,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/uuid": {
|
"node_modules/uuid": {
|
||||||
"version": "13.0.0",
|
"version": "14.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.0.tgz",
|
||||||
"integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==",
|
"integrity": "sha512-Qo+uWgilfSmAhXCMav1uYFynlQO7fMFiMVZsQqZRMIXp0O7rR7qjkj+cPvBHLgBqi960QCoo/PH2/6ZtVqKvrg==",
|
||||||
"funding": [
|
"funding": [
|
||||||
"https://github.com/sponsors/broofa",
|
"https://github.com/sponsors/broofa",
|
||||||
"https://github.com/sponsors/ctavan"
|
"https://github.com/sponsors/ctavan"
|
||||||
@@ -10393,10 +10352,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/yoctocolors": {
|
"node_modules/yoctocolors": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.2.tgz",
|
||||||
"integrity": "sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==",
|
"integrity": "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
|
|||||||
+12
-11
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "4.35.2",
|
"version": "4.35.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "CodeQL action",
|
"description": "CodeQL action",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"ava": "npm run transpile && ava --verbose",
|
"ava": "npm run transpile && ava --verbose",
|
||||||
"test": "npm run ava -- src/",
|
"test": "npm run ava -- src/",
|
||||||
"test-debug": "npm run test -- --timeout=20m",
|
"test-debug": "npm run test -- --timeout=20m",
|
||||||
"transpile": "tsc --build --verbose"
|
"transpile": "tsc --build --verbose tsconfig.json"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"@octokit/plugin-retry": "^8.1.0",
|
"@octokit/plugin-retry": "^8.1.0",
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"follow-redirects": "^1.15.11",
|
"follow-redirects": "^1.16.0",
|
||||||
"get-folder-size": "^5.0.0",
|
"get-folder-size": "^5.0.0",
|
||||||
"https-proxy-agent": "^7.0.6",
|
"https-proxy-agent": "^7.0.6",
|
||||||
"js-yaml": "^4.1.1",
|
"js-yaml": "^4.1.1",
|
||||||
@@ -40,11 +40,11 @@
|
|||||||
"long": "^5.3.2",
|
"long": "^5.3.2",
|
||||||
"node-forge": "^1.4.0",
|
"node-forge": "^1.4.0",
|
||||||
"semver": "^7.7.4",
|
"semver": "^7.7.4",
|
||||||
"uuid": "^13.0.0"
|
"uuid": "^14.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ava/typescript": "6.0.0",
|
"@ava/typescript": "7.0.0",
|
||||||
"@eslint/compat": "^2.0.4",
|
"@eslint/compat": "^2.0.5",
|
||||||
"@microsoft/eslint-formatter-sarif": "^3.1.0",
|
"@microsoft/eslint-formatter-sarif": "^3.1.0",
|
||||||
"@octokit/types": "^16.0.0",
|
"@octokit/types": "^16.0.0",
|
||||||
"@types/archiver": "^7.0.0",
|
"@types/archiver": "^7.0.0",
|
||||||
@@ -58,17 +58,17 @@
|
|||||||
"ava": "^7.0.0",
|
"ava": "^7.0.0",
|
||||||
"esbuild": "^0.28.0",
|
"esbuild": "^0.28.0",
|
||||||
"eslint": "^9.39.2",
|
"eslint": "^9.39.2",
|
||||||
"eslint-import-resolver-typescript": "^3.8.7",
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
"eslint-plugin-github": "^6.0.0",
|
"eslint-plugin-github": "^6.0.0",
|
||||||
"eslint-plugin-import-x": "^4.16.2",
|
"eslint-plugin-import-x": "^4.16.2",
|
||||||
"eslint-plugin-jsdoc": "^62.9.0",
|
"eslint-plugin-jsdoc": "^62.9.0",
|
||||||
"eslint-plugin-no-async-foreach": "^0.1.1",
|
"eslint-plugin-no-async-foreach": "^0.1.1",
|
||||||
"glob": "^11.1.0",
|
"glob": "^11.1.0",
|
||||||
"globals": "^17.4.0",
|
"globals": "^17.5.0",
|
||||||
"nock": "^14.0.12",
|
"nock": "^14.0.12",
|
||||||
"sinon": "^21.0.3",
|
"sinon": "^21.1.2",
|
||||||
"typescript": "^6.0.2",
|
"typescript": "^6.0.2",
|
||||||
"typescript-eslint": "^8.58.0"
|
"typescript-eslint": "^8.58.2"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@actions/tool-cache": {
|
"@actions/tool-cache": {
|
||||||
@@ -90,6 +90,7 @@
|
|||||||
"semver": ">=6.3.1"
|
"semver": ">=6.3.1"
|
||||||
},
|
},
|
||||||
"brace-expansion@2.0.1": "2.0.2",
|
"brace-expansion@2.0.1": "2.0.2",
|
||||||
"glob": "^11.1.0"
|
"glob": "^11.1.0",
|
||||||
|
"undici": "^6.24.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ versions:
|
|||||||
- default
|
- default
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Ruby
|
- name: Set up Ruby
|
||||||
uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
|
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
|
||||||
with:
|
with:
|
||||||
ruby-version: 2.6
|
ruby-version: 2.6
|
||||||
- name: Install Code Scanning integration
|
- name: Install Code Scanning integration
|
||||||
|
|||||||
@@ -11,3 +11,13 @@ export const PR_CHECK_EXCLUDED_FILE = path.join(PR_CHECKS_DIR, "excluded.yml");
|
|||||||
|
|
||||||
/** The path to the esbuild metadata file. */
|
/** The path to the esbuild metadata file. */
|
||||||
export const BUNDLE_METADATA_FILE = path.join(PR_CHECKS_DIR, "..", "meta.json");
|
export const BUNDLE_METADATA_FILE = path.join(PR_CHECKS_DIR, "..", "meta.json");
|
||||||
|
|
||||||
|
/** The `src` directory. */
|
||||||
|
const SOURCE_ROOT = path.join(PR_CHECKS_DIR, "..", "src");
|
||||||
|
|
||||||
|
/** The path to the built-in languages file. */
|
||||||
|
export const BUILTIN_LANGUAGES_FILE = path.join(
|
||||||
|
SOURCE_ROOT,
|
||||||
|
"languages",
|
||||||
|
"builtin.json",
|
||||||
|
);
|
||||||
|
|||||||
+5
-5
@@ -5,7 +5,7 @@ import * as path from "path";
|
|||||||
|
|
||||||
import * as yaml from "yaml";
|
import * as yaml from "yaml";
|
||||||
|
|
||||||
import { KnownLanguage } from "../src/languages";
|
import { BuiltInLanguage } from "../src/languages";
|
||||||
|
|
||||||
/** Known workflow input names. */
|
/** Known workflow input names. */
|
||||||
enum KnownInputName {
|
enum KnownInputName {
|
||||||
@@ -91,8 +91,8 @@ interface LanguageSetup {
|
|||||||
steps: Step[];
|
steps: Step[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Describes partial mappings from known languages to their specific setup information. */
|
/** Describes partial mappings from built-in languages to their specific setup information. */
|
||||||
type LanguageSetups = Partial<Record<KnownLanguage, LanguageSetup>>;
|
type LanguageSetups = Partial<Record<BuiltInLanguage, LanguageSetup>>;
|
||||||
|
|
||||||
// The default set of CodeQL Bundle versions to use for the PR checks.
|
// The default set of CodeQL Bundle versions to use for the PR checks.
|
||||||
const defaultTestVersions = [
|
const defaultTestVersions = [
|
||||||
@@ -125,7 +125,7 @@ const defaultLanguageVersions = {
|
|||||||
java: "17",
|
java: "17",
|
||||||
python: "3.13",
|
python: "3.13",
|
||||||
csharp: "9.x",
|
csharp: "9.x",
|
||||||
} as const satisfies Partial<Record<KnownLanguage, string>>;
|
} as const satisfies Partial<Record<BuiltInLanguage, string>>;
|
||||||
|
|
||||||
/** A mapping from known input names to their specifications. */
|
/** A mapping from known input names to their specifications. */
|
||||||
const inputSpecs: WorkflowInputs = {
|
const inputSpecs: WorkflowInputs = {
|
||||||
@@ -364,7 +364,7 @@ function getSetupSteps(checkSpecification: JobSpecification): {
|
|||||||
const inputs: Array<Set<KnownInputName>> = [];
|
const inputs: Array<Set<KnownInputName>> = [];
|
||||||
const steps: Step[] = [];
|
const steps: Step[] = [];
|
||||||
|
|
||||||
for (const language of Object.values(KnownLanguage).sort()) {
|
for (const language of Object.values(BuiltInLanguage).sort()) {
|
||||||
const setupSpec = languageSetups[language];
|
const setupSpec = languageSetups[language];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -0,0 +1,131 @@
|
|||||||
|
#!/usr/bin/env npx tsx
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Updates src/languages/builtin.json by querying the CodeQL CLI for:
|
||||||
|
* - Languages that have default queries (via codeql-extractor.yml)
|
||||||
|
* - Language aliases (via `codeql resolve languages --format=betterjson --extractor-include-aliases`)
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* npx tsx pr-checks/update-builtin-languages.ts [path-to-codeql]
|
||||||
|
*
|
||||||
|
* If no path is given, falls back to "codeql".
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { execFileSync } from "node:child_process";
|
||||||
|
import * as fs from "node:fs";
|
||||||
|
import * as path from "node:path";
|
||||||
|
|
||||||
|
import * as yaml from "yaml";
|
||||||
|
|
||||||
|
import { EnvVar } from "../src/environment";
|
||||||
|
|
||||||
|
import { BUILTIN_LANGUAGES_FILE } from "./config";
|
||||||
|
|
||||||
|
/** Resolve all known language extractor directories. */
|
||||||
|
function resolveLanguages(codeqlPath: string): Record<string, string[]> {
|
||||||
|
return JSON.parse(
|
||||||
|
execFileSync(codeqlPath, ["resolve", "languages", "--format=json"], {
|
||||||
|
encoding: "utf8",
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
[EnvVar.EXPERIMENTAL_FEATURES]: "true", // include experimental languages
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
) as Record<string, string[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the sorted list of languages whose extractors ship default queries.
|
||||||
|
*
|
||||||
|
* @param extractorDirs - Map from language to list of extractor directories
|
||||||
|
*/
|
||||||
|
function findLanguagesWithDefaultQueries(
|
||||||
|
extractorDirs: Record<string, string[]>,
|
||||||
|
): string[] {
|
||||||
|
const languages: string[] = [];
|
||||||
|
|
||||||
|
for (const [language, dirs] of Object.entries(extractorDirs)) {
|
||||||
|
if (dirs.length !== 1) {
|
||||||
|
throw new Error(
|
||||||
|
`Expected exactly one extractor directory for language '${language}', but found ${dirs.length}: ${dirs.join(
|
||||||
|
", ",
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const extractorYmlPath = path.join(dirs[0], "codeql-extractor.yml");
|
||||||
|
|
||||||
|
if (!fs.existsSync(extractorYmlPath)) {
|
||||||
|
throw new Error(
|
||||||
|
`Extractor YAML not found for language '${language}' at expected path: ${extractorYmlPath}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const extractorYml = yaml.parse(fs.readFileSync(extractorYmlPath, "utf8"));
|
||||||
|
const defaultQueries: unknown[] | undefined = extractorYml.default_queries;
|
||||||
|
|
||||||
|
if (Array.isArray(defaultQueries) && defaultQueries.length > 0) {
|
||||||
|
console.log(
|
||||||
|
` ✅ ${language}: included (default queries: ${JSON.stringify(defaultQueries)})`,
|
||||||
|
);
|
||||||
|
languages.push(language);
|
||||||
|
} else {
|
||||||
|
console.log(` ❌ ${language}: excluded (no default queries)`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return languages.sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve language aliases from the CodeQL CLI, keeping only those whose
|
||||||
|
* target is in the given set of included languages.
|
||||||
|
*/
|
||||||
|
function resolveAliases(
|
||||||
|
codeqlPath: string,
|
||||||
|
includedLanguages: Set<string>,
|
||||||
|
): Record<string, string> {
|
||||||
|
const betterjsonOutput = JSON.parse(
|
||||||
|
execFileSync(
|
||||||
|
codeqlPath,
|
||||||
|
[
|
||||||
|
"resolve",
|
||||||
|
"languages",
|
||||||
|
"--format=betterjson",
|
||||||
|
"--extractor-include-aliases",
|
||||||
|
],
|
||||||
|
{ encoding: "utf8" },
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries((betterjsonOutput.aliases ?? {}) as Record<string, string>)
|
||||||
|
.filter(([, target]) => includedLanguages.has(target))
|
||||||
|
.sort(([a], [b]) => a.localeCompare(b)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Write the built-in languages data to disk. */
|
||||||
|
function writeBuiltinLanguages(
|
||||||
|
languages: string[],
|
||||||
|
aliases: Record<string, string>,
|
||||||
|
): void {
|
||||||
|
const content = `${JSON.stringify({ languages, aliases }, null, 2)}\n`;
|
||||||
|
fs.mkdirSync(path.dirname(BUILTIN_LANGUAGES_FILE), { recursive: true });
|
||||||
|
fs.writeFileSync(BUILTIN_LANGUAGES_FILE, content);
|
||||||
|
|
||||||
|
console.log(`\nWrote ${BUILTIN_LANGUAGES_FILE}`);
|
||||||
|
console.log(` Languages: ${languages.join(", ")}`);
|
||||||
|
console.log(` Aliases: ${Object.keys(aliases).join(", ")}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function main(): void {
|
||||||
|
const codeqlPath = process.argv[2] || "codeql";
|
||||||
|
|
||||||
|
const extractorDirs = resolveLanguages(codeqlPath);
|
||||||
|
const languages = findLanguagesWithDefaultQueries(extractorDirs);
|
||||||
|
const aliases = resolveAliases(codeqlPath, new Set(languages));
|
||||||
|
writeBuiltinLanguages(languages, aliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
+10
-6
@@ -30,7 +30,7 @@ import {
|
|||||||
} from "./dependency-caching";
|
} from "./dependency-caching";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { initFeatures } from "./feature-flags";
|
import { initFeatures } from "./feature-flags";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { getActionsLogger, Logger } from "./logging";
|
import { getActionsLogger, Logger } from "./logging";
|
||||||
import { cleanupAndUploadOverlayBaseDatabaseToCache } from "./overlay/caching";
|
import { cleanupAndUploadOverlayBaseDatabaseToCache } from "./overlay/caching";
|
||||||
import { getRepositoryNwo } from "./repository";
|
import { getRepositoryNwo } from "./repository";
|
||||||
@@ -135,9 +135,13 @@ function hasBadExpectErrorInput(): boolean {
|
|||||||
function doesGoExtractionOutputExist(config: Config): boolean {
|
function doesGoExtractionOutputExist(config: Config): boolean {
|
||||||
const golangDbDirectory = util.getCodeQLDatabasePath(
|
const golangDbDirectory = util.getCodeQLDatabasePath(
|
||||||
config,
|
config,
|
||||||
KnownLanguage.go,
|
BuiltInLanguage.go,
|
||||||
|
);
|
||||||
|
const trapDirectory = path.join(
|
||||||
|
golangDbDirectory,
|
||||||
|
"trap",
|
||||||
|
BuiltInLanguage.go,
|
||||||
);
|
);
|
||||||
const trapDirectory = path.join(golangDbDirectory, "trap", KnownLanguage.go);
|
|
||||||
return (
|
return (
|
||||||
fs.existsSync(trapDirectory) &&
|
fs.existsSync(trapDirectory) &&
|
||||||
fs
|
fs
|
||||||
@@ -169,7 +173,7 @@ function doesGoExtractionOutputExist(config: Config): boolean {
|
|||||||
* whether any extraction output already exists for Go.
|
* whether any extraction output already exists for Go.
|
||||||
*/
|
*/
|
||||||
async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
|
async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
|
||||||
if (!config.languages.includes(KnownLanguage.go)) {
|
if (!config.languages.includes(BuiltInLanguage.go)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (config.buildMode) {
|
if (config.buildMode) {
|
||||||
@@ -182,7 +186,7 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
|
|||||||
logger.debug("Won't run Go autobuild since it has already been run.");
|
logger.debug("Won't run Go autobuild since it has already been run.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dbIsFinalized(config, KnownLanguage.go, logger)) {
|
if (dbIsFinalized(config, BuiltInLanguage.go, logger)) {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Won't run Go autobuild since there is already a finalized database for Go.",
|
"Won't run Go autobuild since there is already a finalized database for Go.",
|
||||||
);
|
);
|
||||||
@@ -205,7 +209,7 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
"Running Go autobuild because extraction output (TRAP files) for Go code has not been found.",
|
"Running Go autobuild because extraction output (TRAP files) for Go code has not been found.",
|
||||||
);
|
);
|
||||||
await runAutobuild(config, KnownLanguage.go, logger);
|
await runAutobuild(config, BuiltInLanguage.go, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function run(startedAt: Date) {
|
async function run(startedAt: Date) {
|
||||||
|
|||||||
+6
-6
@@ -14,7 +14,7 @@ import {
|
|||||||
} from "./analyze";
|
} from "./analyze";
|
||||||
import { createStubCodeQL } from "./codeql";
|
import { createStubCodeQL } from "./codeql";
|
||||||
import { Feature } from "./feature-flags";
|
import { Feature } from "./feature-flags";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import {
|
import {
|
||||||
setupTests,
|
setupTests,
|
||||||
@@ -41,7 +41,7 @@ test.serial("status report fields", async (t) => {
|
|||||||
const threadsFlag = "";
|
const threadsFlag = "";
|
||||||
sinon.stub(uploadLib, "validateSarifFileSchema");
|
sinon.stub(uploadLib, "validateSarifFileSchema");
|
||||||
|
|
||||||
for (const language of Object.values(KnownLanguage)) {
|
for (const language of Object.values(BuiltInLanguage)) {
|
||||||
const codeql = createStubCodeQL({
|
const codeql = createStubCodeQL({
|
||||||
databaseRunQueries: async () => {},
|
databaseRunQueries: async () => {},
|
||||||
databaseInterpretResults: async (
|
databaseInterpretResults: async (
|
||||||
@@ -130,13 +130,13 @@ test.serial("status report fields", async (t) => {
|
|||||||
test("resolveQuerySuiteAlias", (t) => {
|
test("resolveQuerySuiteAlias", (t) => {
|
||||||
// default query suite names should resolve to something language-specific ending in `.qls`.
|
// default query suite names should resolve to something language-specific ending in `.qls`.
|
||||||
for (const suite of defaultSuites) {
|
for (const suite of defaultSuites) {
|
||||||
const resolved = resolveQuerySuiteAlias(KnownLanguage.go, suite);
|
const resolved = resolveQuerySuiteAlias(BuiltInLanguage.go, suite);
|
||||||
t.assert(
|
t.assert(
|
||||||
path.extname(resolved) === ".qls",
|
path.extname(resolved) === ".qls",
|
||||||
"Resolved default suite doesn't end in .qls",
|
"Resolved default suite doesn't end in .qls",
|
||||||
);
|
);
|
||||||
t.assert(
|
t.assert(
|
||||||
resolved.indexOf(KnownLanguage.go) >= 0,
|
resolved.indexOf(BuiltInLanguage.go) >= 0,
|
||||||
"Resolved default suite doesn't contain language name",
|
"Resolved default suite doesn't contain language name",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -145,12 +145,12 @@ test("resolveQuerySuiteAlias", (t) => {
|
|||||||
const names = ["foo", "bar", "codeql/go-queries@1.0"];
|
const names = ["foo", "bar", "codeql/go-queries@1.0"];
|
||||||
|
|
||||||
for (const name of names) {
|
for (const name of names) {
|
||||||
t.deepEqual(resolveQuerySuiteAlias(KnownLanguage.go, name), name);
|
t.deepEqual(resolveQuerySuiteAlias(BuiltInLanguage.go, name), name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("addSarifExtension", (t) => {
|
test("addSarifExtension", (t) => {
|
||||||
for (const language of Object.values(KnownLanguage)) {
|
for (const language of Object.values(BuiltInLanguage)) {
|
||||||
t.deepEqual(addSarifExtension(CodeScanning, language), `${language}.sarif`);
|
t.deepEqual(addSarifExtension(CodeScanning, language), `${language}.sarif`);
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
addSarifExtension(CodeQuality, language),
|
addSarifExtension(CodeQuality, language),
|
||||||
|
|||||||
+15
-27
@@ -21,7 +21,7 @@ import {
|
|||||||
} from "./diff-informed-analysis-utils";
|
} from "./diff-informed-analysis-utils";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { FeatureEnablement, Feature } from "./feature-flags";
|
import { FeatureEnablement, Feature } from "./feature-flags";
|
||||||
import { KnownLanguage, Language } from "./languages";
|
import { BuiltInLanguage, Language } from "./languages";
|
||||||
import { Logger, withGroupAsync } from "./logging";
|
import { Logger, withGroupAsync } from "./logging";
|
||||||
import { OverlayDatabaseMode } from "./overlay/overlay-database-mode";
|
import { OverlayDatabaseMode } from "./overlay/overlay-database-mode";
|
||||||
import type * as sarif from "./sarif";
|
import type * as sarif from "./sarif";
|
||||||
@@ -41,7 +41,7 @@ export class CodeQLAnalysisError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type KnownLanguageKey = keyof typeof KnownLanguage;
|
type BuiltInLanguageKey = keyof typeof BuiltInLanguage;
|
||||||
|
|
||||||
type RunQueriesDurationStatusReport = {
|
type RunQueriesDurationStatusReport = {
|
||||||
/**
|
/**
|
||||||
@@ -50,12 +50,12 @@ type RunQueriesDurationStatusReport = {
|
|||||||
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
|
* The "builtin" designation is now outdated with the move to CLI config parsing: this is the time
|
||||||
* taken to run _all_ the queries.
|
* taken to run _all_ the queries.
|
||||||
*/
|
*/
|
||||||
[L in KnownLanguageKey as `analyze_builtin_queries_${L}_duration_ms`]?: number;
|
[L in BuiltInLanguageKey as `analyze_builtin_queries_${L}_duration_ms`]?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type InterpretResultsDurationStatusReport = {
|
type InterpretResultsDurationStatusReport = {
|
||||||
/** Time taken in ms to interpret results for the language (or undefined if this language was not analyzed). */
|
/** Time taken in ms to interpret results for the language (or undefined if this language was not analyzed). */
|
||||||
[L in KnownLanguageKey as `interpret_results_${L}_duration_ms`]?: number;
|
[L in BuiltInLanguageKey as `interpret_results_${L}_duration_ms`]?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface QueriesStatusReport
|
export interface QueriesStatusReport
|
||||||
@@ -115,12 +115,12 @@ export async function runExtraction(
|
|||||||
|
|
||||||
if (await shouldExtractLanguage(codeql, config, language)) {
|
if (await shouldExtractLanguage(codeql, config, language)) {
|
||||||
logger.startGroup(`Extracting ${language}`);
|
logger.startGroup(`Extracting ${language}`);
|
||||||
if (language === KnownLanguage.python) {
|
if (language === BuiltInLanguage.python) {
|
||||||
await setupPythonExtractor(logger);
|
await setupPythonExtractor(logger);
|
||||||
}
|
}
|
||||||
if (config.buildMode) {
|
if (config.buildMode) {
|
||||||
if (
|
if (
|
||||||
language === KnownLanguage.cpp &&
|
language === BuiltInLanguage.cpp &&
|
||||||
config.buildMode === BuildMode.Autobuild
|
config.buildMode === BuildMode.Autobuild
|
||||||
) {
|
) {
|
||||||
await setupCppAutobuild(codeql, logger);
|
await setupCppAutobuild(codeql, logger);
|
||||||
@@ -131,14 +131,14 @@ export async function runExtraction(
|
|||||||
// a stable path that caches can be restored into and that we can cache at the
|
// a stable path that caches can be restored into and that we can cache at the
|
||||||
// end of the workflow (i.e. that does not get removed when the scratch directory is).
|
// end of the workflow (i.e. that does not get removed when the scratch directory is).
|
||||||
if (
|
if (
|
||||||
language === KnownLanguage.java &&
|
language === BuiltInLanguage.java &&
|
||||||
config.buildMode === BuildMode.None
|
config.buildMode === BuildMode.None
|
||||||
) {
|
) {
|
||||||
process.env["CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS_DEPENDENCY_DIR"] =
|
process.env["CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS_DEPENDENCY_DIR"] =
|
||||||
getJavaTempDependencyDir();
|
getJavaTempDependencyDir();
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
language === KnownLanguage.csharp &&
|
language === BuiltInLanguage.csharp &&
|
||||||
config.buildMode === BuildMode.None &&
|
config.buildMode === BuildMode.None &&
|
||||||
(await features.getValue(Feature.CsharpCacheBuildModeNone))
|
(await features.getValue(Feature.CsharpCacheBuildModeNone))
|
||||||
) {
|
) {
|
||||||
@@ -251,16 +251,9 @@ export async function setupDiffInformedQueryRun(
|
|||||||
diffRanges,
|
diffRanges,
|
||||||
checkoutPath,
|
checkoutPath,
|
||||||
);
|
);
|
||||||
if (packDir === undefined) {
|
logger.info(
|
||||||
logger.warning(
|
`Successfully created diff range extension pack at ${packDir}.`,
|
||||||
"Cannot create diff range extension pack for diff-informed queries; " +
|
);
|
||||||
"reverting to performing full analysis.",
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
logger.info(
|
|
||||||
`Successfully created diff range extension pack at ${packDir}.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return packDir;
|
return packDir;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -314,18 +307,13 @@ extensions:
|
|||||||
* @param ranges The file line ranges, as returned by
|
* @param ranges The file line ranges, as returned by
|
||||||
* `getPullRequestEditedDiffRanges`.
|
* `getPullRequestEditedDiffRanges`.
|
||||||
* @param checkoutPath The path at which the repository was checked out.
|
* @param checkoutPath The path at which the repository was checked out.
|
||||||
* @returns The absolute path of the directory containing the extension pack, or
|
* @returns The absolute path of the directory containing the extension pack.
|
||||||
* `undefined` if no extension pack was created.
|
|
||||||
*/
|
*/
|
||||||
function writeDiffRangeDataExtensionPack(
|
function writeDiffRangeDataExtensionPack(
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
ranges: DiffThunkRange[] | undefined,
|
ranges: DiffThunkRange[],
|
||||||
checkoutPath: string,
|
checkoutPath: string,
|
||||||
): string | undefined {
|
): string {
|
||||||
if (ranges === undefined) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ranges.length === 0) {
|
if (ranges.length === 0) {
|
||||||
// An empty diff range means that there are no added or modified lines in
|
// An empty diff range means that there are no added or modified lines in
|
||||||
// the pull request. But the `restrictAlertsTo` extensible predicate
|
// the pull request. But the `restrictAlertsTo` extensible predicate
|
||||||
@@ -698,7 +686,7 @@ export async function warnIfGoInstalledAfterInit(
|
|||||||
|
|
||||||
addDiagnostic(
|
addDiagnostic(
|
||||||
config,
|
config,
|
||||||
KnownLanguage.go,
|
BuiltInLanguage.go,
|
||||||
makeDiagnostic(
|
makeDiagnostic(
|
||||||
"go/workflow/go-installed-after-codeql-init",
|
"go/workflow/go-installed-after-codeql-init",
|
||||||
"Go was installed after the `codeql-action/init` Action was run",
|
"Go was installed after the `codeql-action/init` Action was run",
|
||||||
|
|||||||
+22
-5
@@ -128,6 +128,8 @@ export async function getGitHubVersionFromApi(
|
|||||||
|
|
||||||
// Doesn't strictly have to be the meta endpoint as we're only
|
// Doesn't strictly have to be the meta endpoint as we're only
|
||||||
// using the response headers which are available on every request.
|
// using the response headers which are available on every request.
|
||||||
|
//
|
||||||
|
// See https://docs.github.com/en/rest/meta/meta#get-github-meta-information.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
const response = await apiClient.rest.meta.get();
|
const response = await apiClient.rest.meta.get();
|
||||||
|
|
||||||
@@ -164,6 +166,9 @@ export async function getGitHubVersion(): Promise<GitHubVersion> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path of the currently executing workflow relative to the repository root.
|
* Get the path of the currently executing workflow relative to the repository root.
|
||||||
|
*
|
||||||
|
* See https://docs.github.com/en/rest/actions/workflow-runs#get-a-workflow-run
|
||||||
|
* and https://docs.github.com/en/rest/actions/workflows#get-a-workflow.
|
||||||
*/
|
*/
|
||||||
export async function getWorkflowRelativePath(): Promise<string> {
|
export async function getWorkflowRelativePath(): Promise<string> {
|
||||||
const repo_nwo = getRepositoryNwo();
|
const repo_nwo = getRepositoryNwo();
|
||||||
@@ -252,9 +257,13 @@ export interface ActionsCacheItem {
|
|||||||
size_in_bytes?: number;
|
size_in_bytes?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** List all Actions cache entries matching the provided key and ref. */
|
/**
|
||||||
|
* List all Actions cache entries starting with the provided key prefix and matching the provided ref.
|
||||||
|
*
|
||||||
|
* See https://docs.github.com/en/rest/actions/cache#list-github-actions-caches-for-a-repository.
|
||||||
|
*/
|
||||||
export async function listActionsCaches(
|
export async function listActionsCaches(
|
||||||
key: string,
|
keyPrefix: string,
|
||||||
ref?: string,
|
ref?: string,
|
||||||
): Promise<ActionsCacheItem[]> {
|
): Promise<ActionsCacheItem[]> {
|
||||||
const repositoryNwo = getRepositoryNwo();
|
const repositoryNwo = getRepositoryNwo();
|
||||||
@@ -264,13 +273,17 @@ export async function listActionsCaches(
|
|||||||
{
|
{
|
||||||
owner: repositoryNwo.owner,
|
owner: repositoryNwo.owner,
|
||||||
repo: repositoryNwo.repo,
|
repo: repositoryNwo.repo,
|
||||||
key,
|
key: keyPrefix,
|
||||||
ref,
|
ref,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Delete an Actions cache item by its ID. */
|
/**
|
||||||
|
* Delete an Actions cache item by its ID.
|
||||||
|
*
|
||||||
|
* See https://docs.github.com/en/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id.
|
||||||
|
*/
|
||||||
export async function deleteActionsCache(id: number) {
|
export async function deleteActionsCache(id: number) {
|
||||||
const repositoryNwo = getRepositoryNwo();
|
const repositoryNwo = getRepositoryNwo();
|
||||||
|
|
||||||
@@ -281,7 +294,11 @@ export async function deleteActionsCache(id: number) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Retrieve all custom repository properties. */
|
/**
|
||||||
|
* Retrieve all custom repository properties.
|
||||||
|
*
|
||||||
|
* See https://docs.github.com/en/rest/repos/custom-properties#get-all-custom-property-values-for-a-repository.
|
||||||
|
*/
|
||||||
export async function getRepositoryProperties(repositoryNwo: RepositoryNwo) {
|
export async function getRepositoryProperties(repositoryNwo: RepositoryNwo) {
|
||||||
return getApiClient().request("GET /repos/:owner/:repo/properties/values", {
|
return getApiClient().request("GET /repos/:owner/:repo/properties/values", {
|
||||||
owner: repositoryNwo.owner,
|
owner: repositoryNwo.owner,
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"maximumVersion": "3.21", "minimumVersion": "3.14"}
|
{"maximumVersion": "3.21", "minimumVersion": "3.16"}
|
||||||
|
|||||||
+5
-5
@@ -7,7 +7,7 @@ import * as configUtils from "./config-utils";
|
|||||||
import { DocUrl } from "./doc-url";
|
import { DocUrl } from "./doc-url";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { Feature, featureConfig, initFeatures } from "./feature-flags";
|
import { Feature, featureConfig, initFeatures } from "./feature-flags";
|
||||||
import { KnownLanguage, Language } from "./languages";
|
import { BuiltInLanguage, Language } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import { getRepositoryNwo } from "./repository";
|
import { getRepositoryNwo } from "./repository";
|
||||||
import { asyncFilter, BuildMode } from "./util";
|
import { asyncFilter, BuildMode } from "./util";
|
||||||
@@ -72,7 +72,7 @@ export async function determineAutobuildLanguages(
|
|||||||
* version of the CodeQL Action.
|
* version of the CodeQL Action.
|
||||||
*/
|
*/
|
||||||
const autobuildLanguagesWithoutGo = autobuildLanguages.filter(
|
const autobuildLanguagesWithoutGo = autobuildLanguages.filter(
|
||||||
(l) => l !== KnownLanguage.go,
|
(l) => l !== BuiltInLanguage.go,
|
||||||
);
|
);
|
||||||
|
|
||||||
const languages: Language[] = [];
|
const languages: Language[] = [];
|
||||||
@@ -84,7 +84,7 @@ export async function determineAutobuildLanguages(
|
|||||||
// If Go is requested, run the Go autobuilder last to ensure it doesn't
|
// If Go is requested, run the Go autobuilder last to ensure it doesn't
|
||||||
// interfere with the other autobuilder.
|
// interfere with the other autobuilder.
|
||||||
if (autobuildLanguages.length !== autobuildLanguagesWithoutGo.length) {
|
if (autobuildLanguages.length !== autobuildLanguagesWithoutGo.length) {
|
||||||
languages.push(KnownLanguage.go);
|
languages.push(BuiltInLanguage.go);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(`Will autobuild ${languages.join(" and ")}.`);
|
logger.debug(`Will autobuild ${languages.join(" and ")}.`);
|
||||||
@@ -156,7 +156,7 @@ export async function runAutobuild(
|
|||||||
) {
|
) {
|
||||||
logger.startGroup(`Attempting to automatically build ${language} code`);
|
logger.startGroup(`Attempting to automatically build ${language} code`);
|
||||||
const codeQL = await getCodeQL(config.codeQLCmd);
|
const codeQL = await getCodeQL(config.codeQLCmd);
|
||||||
if (language === KnownLanguage.cpp) {
|
if (language === BuiltInLanguage.cpp) {
|
||||||
await setupCppAutobuild(codeQL, logger);
|
await setupCppAutobuild(codeQL, logger);
|
||||||
}
|
}
|
||||||
if (config.buildMode) {
|
if (config.buildMode) {
|
||||||
@@ -164,7 +164,7 @@ export async function runAutobuild(
|
|||||||
} else {
|
} else {
|
||||||
await codeQL.runAutobuild(config, language);
|
await codeQL.runAutobuild(config, language);
|
||||||
}
|
}
|
||||||
if (language === KnownLanguage.go) {
|
if (language === BuiltInLanguage.go) {
|
||||||
core.exportVariable(EnvVar.DID_AUTOBUILD_GOLANG, "true");
|
core.exportVariable(EnvVar.DID_AUTOBUILD_GOLANG, "true");
|
||||||
}
|
}
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
|
|||||||
+21
-30
@@ -21,7 +21,7 @@ import {
|
|||||||
import type { Config } from "./config-utils";
|
import type { Config } from "./config-utils";
|
||||||
import * as defaults from "./defaults.json";
|
import * as defaults from "./defaults.json";
|
||||||
import { DocUrl } from "./doc-url";
|
import { DocUrl } from "./doc-url";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import { ToolsSource } from "./setup-codeql";
|
import { ToolsSource } from "./setup-codeql";
|
||||||
import {
|
import {
|
||||||
@@ -33,6 +33,7 @@ import {
|
|||||||
mockBundleDownloadApi,
|
mockBundleDownloadApi,
|
||||||
makeVersionInfo,
|
makeVersionInfo,
|
||||||
createTestConfig,
|
createTestConfig,
|
||||||
|
makeMacro,
|
||||||
} from "./testing-utils";
|
} from "./testing-utils";
|
||||||
import { ToolsDownloadStatusReport } from "./tools-download";
|
import { ToolsDownloadStatusReport } from "./tools-download";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
@@ -46,7 +47,7 @@ test.beforeEach(() => {
|
|||||||
initializeEnvironment("1.2.3");
|
initializeEnvironment("1.2.3");
|
||||||
|
|
||||||
stubConfig = createTestConfig({
|
stubConfig = createTestConfig({
|
||||||
languages: [KnownLanguage.cpp],
|
languages: [BuiltInLanguage.cpp],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ async function stubCodeql(): Promise<codeql.CodeQL> {
|
|||||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.17.6"));
|
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.17.6"));
|
||||||
sinon
|
sinon
|
||||||
.stub(codeqlObject, "isTracedLanguage")
|
.stub(codeqlObject, "isTracedLanguage")
|
||||||
.withArgs(KnownLanguage.cpp)
|
.withArgs(BuiltInLanguage.cpp)
|
||||||
.resolves(true);
|
.resolves(true);
|
||||||
return codeqlObject;
|
return codeqlObject;
|
||||||
}
|
}
|
||||||
@@ -540,7 +541,7 @@ test.serial("getExtraOptions throws for bad content", (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Test macro for ensuring different variants of injected augmented configurations
|
// Test macro for ensuring different variants of injected augmented configurations
|
||||||
const injectedConfigMacro = test.macro({
|
const injectedConfigMacro = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
augmentationProperties: AugmentationProperties,
|
augmentationProperties: AugmentationProperties,
|
||||||
@@ -590,9 +591,8 @@ const injectedConfigMacro = test.macro({
|
|||||||
`databaseInitCluster() injected config: ${providedTitle}`,
|
`databaseInitCluster() injected config: ${providedTitle}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"basic",
|
"basic",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
},
|
},
|
||||||
@@ -600,9 +600,8 @@ test.serial(
|
|||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"injected packs from input",
|
"injected packs from input",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
packsInput: ["xxx", "yyy"],
|
packsInput: ["xxx", "yyy"],
|
||||||
@@ -613,9 +612,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"injected packs from input with existing packs combines",
|
"injected packs from input with existing packs combines",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
packsInputCombines: true,
|
packsInputCombines: true,
|
||||||
@@ -635,9 +633,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"injected packs from input with existing packs overrides",
|
"injected packs from input with existing packs overrides",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
packsInput: ["xxx", "yyy"],
|
packsInput: ["xxx", "yyy"],
|
||||||
@@ -655,9 +652,8 @@ test.serial(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// similar, but with queries
|
// similar, but with queries
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"injected queries from input",
|
"injected queries from input",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||||
@@ -675,9 +671,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"injected queries from input overrides",
|
"injected queries from input overrides",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||||
@@ -699,9 +694,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"injected queries from input combines",
|
"injected queries from input combines",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
@@ -727,9 +721,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"injected queries from input combines 2",
|
"injected queries from input combines 2",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
@@ -749,9 +742,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"injected queries and packs, but empty",
|
"injected queries and packs, but empty",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
@@ -768,9 +760,8 @@ test.serial(
|
|||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"repo property queries have the highest precedence",
|
"repo property queries have the highest precedence",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
@@ -790,9 +781,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"repo property queries combines with queries input",
|
"repo property queries combines with queries input",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
@@ -817,9 +807,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
injectedConfigMacro.serial(
|
||||||
"repo property queries combines everything else",
|
"repo property queries combines everything else",
|
||||||
injectedConfigMacro,
|
|
||||||
{
|
{
|
||||||
...defaultAugmentationProperties,
|
...defaultAugmentationProperties,
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
@@ -956,7 +945,8 @@ test.serial("runTool summarizes autobuilder errors", async (t) => {
|
|||||||
sinon.stub(io, "which").resolves("");
|
sinon.stub(io, "which").resolves("");
|
||||||
|
|
||||||
await t.throwsAsync(
|
await t.throwsAsync(
|
||||||
async () => await codeqlObject.runAutobuild(stubConfig, KnownLanguage.java),
|
async () =>
|
||||||
|
await codeqlObject.runAutobuild(stubConfig, BuiltInLanguage.java),
|
||||||
{
|
{
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message:
|
message:
|
||||||
@@ -982,7 +972,8 @@ test.serial("runTool truncates long autobuilder errors", async (t) => {
|
|||||||
sinon.stub(io, "which").resolves("");
|
sinon.stub(io, "which").resolves("");
|
||||||
|
|
||||||
await t.throwsAsync(
|
await t.throwsAsync(
|
||||||
async () => await codeqlObject.runAutobuild(stubConfig, KnownLanguage.java),
|
async () =>
|
||||||
|
await codeqlObject.runAutobuild(stubConfig, BuiltInLanguage.java),
|
||||||
{
|
{
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message:
|
message:
|
||||||
|
|||||||
+3
-3
@@ -282,17 +282,17 @@ const CODEQL_MINIMUM_VERSION = "2.17.6";
|
|||||||
/**
|
/**
|
||||||
* This version will shortly become the oldest version of CodeQL that the Action will run with.
|
* This version will shortly become the oldest version of CodeQL that the Action will run with.
|
||||||
*/
|
*/
|
||||||
const CODEQL_NEXT_MINIMUM_VERSION = "2.17.6";
|
const CODEQL_NEXT_MINIMUM_VERSION = "2.19.4";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the version of GHES that was most recently deprecated.
|
* This is the version of GHES that was most recently deprecated.
|
||||||
*/
|
*/
|
||||||
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.13";
|
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.15";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the deprecation date for the version of GHES that was most recently deprecated.
|
* This is the deprecation date for the version of GHES that was most recently deprecated.
|
||||||
*/
|
*/
|
||||||
const GHES_MOST_RECENT_DEPRECATION_DATE = "2025-06-19";
|
const GHES_MOST_RECENT_DEPRECATION_DATE = "2026-04-09";
|
||||||
|
|
||||||
/** The CLI verbosity level to use for extraction in debug mode. */
|
/** The CLI verbosity level to use for extraction in debug mode. */
|
||||||
const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
|
||||||
|
|||||||
+118
-175
@@ -18,7 +18,7 @@ import { Feature } from "./feature-flags";
|
|||||||
import { RepositoryProperties } from "./feature-flags/properties";
|
import { RepositoryProperties } from "./feature-flags/properties";
|
||||||
import * as gitUtils from "./git-utils";
|
import * as gitUtils from "./git-utils";
|
||||||
import { GitVersionInfo } from "./git-utils";
|
import { GitVersionInfo } from "./git-utils";
|
||||||
import { KnownLanguage, Language } from "./languages";
|
import { BuiltInLanguage, Language } from "./languages";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import { CODEQL_OVERLAY_MINIMUM_VERSION } from "./overlay";
|
import { CODEQL_OVERLAY_MINIMUM_VERSION } from "./overlay";
|
||||||
import { OverlayDisabledReason } from "./overlay/diagnostics";
|
import { OverlayDisabledReason } from "./overlay/diagnostics";
|
||||||
@@ -34,6 +34,7 @@ import {
|
|||||||
LoggedMessage,
|
LoggedMessage,
|
||||||
mockCodeQLVersion,
|
mockCodeQLVersion,
|
||||||
createTestConfig,
|
createTestConfig,
|
||||||
|
makeMacro,
|
||||||
} from "./testing-utils";
|
} from "./testing-utils";
|
||||||
import {
|
import {
|
||||||
GitHubVariant,
|
GitHubVariant,
|
||||||
@@ -215,7 +216,7 @@ test.serial("load code quality config", async (t) => {
|
|||||||
// And the config we expect it to result in
|
// And the config we expect it to result in
|
||||||
const expectedConfig = createTestConfig({
|
const expectedConfig = createTestConfig({
|
||||||
analysisKinds: [AnalysisKind.CodeQuality],
|
analysisKinds: [AnalysisKind.CodeQuality],
|
||||||
languages: [KnownLanguage.actions],
|
languages: [BuiltInLanguage.actions],
|
||||||
// This gets set because we only have `AnalysisKind.CodeQuality`
|
// This gets set because we only have `AnalysisKind.CodeQuality`
|
||||||
computedConfig: {
|
computedConfig: {
|
||||||
"disable-default-queries": true,
|
"disable-default-queries": true,
|
||||||
@@ -268,7 +269,7 @@ test.serial(
|
|||||||
|
|
||||||
const expectedConfig = createTestConfig({
|
const expectedConfig = createTestConfig({
|
||||||
analysisKinds: [AnalysisKind.CodeQuality],
|
analysisKinds: [AnalysisKind.CodeQuality],
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
codeQLCmd: codeql.getPath(),
|
codeQLCmd: codeql.getPath(),
|
||||||
computedConfig,
|
computedConfig,
|
||||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
@@ -518,7 +519,7 @@ test.serial("load non-empty input", async (t) => {
|
|||||||
|
|
||||||
// And the config we expect it to parse to
|
// And the config we expect it to parse to
|
||||||
const expectedConfig = createTestConfig({
|
const expectedConfig = createTestConfig({
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
buildMode: BuildMode.None,
|
buildMode: BuildMode.None,
|
||||||
originalUserInput: userConfig,
|
originalUserInput: userConfig,
|
||||||
computedConfig: userConfig,
|
computedConfig: userConfig,
|
||||||
@@ -892,10 +893,10 @@ const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
|||||||
betterResolveLanguages: (options) =>
|
betterResolveLanguages: (options) =>
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
aliases: {
|
aliases: {
|
||||||
"c#": KnownLanguage.csharp,
|
"c#": BuiltInLanguage.csharp,
|
||||||
c: KnownLanguage.cpp,
|
c: BuiltInLanguage.cpp,
|
||||||
kotlin: KnownLanguage.java,
|
kotlin: BuiltInLanguage.java,
|
||||||
typescript: KnownLanguage.javascript,
|
typescript: BuiltInLanguage.javascript,
|
||||||
},
|
},
|
||||||
extractors: {
|
extractors: {
|
||||||
cpp: [stubExtractorEntry],
|
cpp: [stubExtractorEntry],
|
||||||
@@ -944,12 +945,12 @@ const mockRepositoryNwo = parseRepositoryNwo("owner/repo");
|
|||||||
for (const { displayName, language, feature } of [
|
for (const { displayName, language, feature } of [
|
||||||
{
|
{
|
||||||
displayName: "Java",
|
displayName: "Java",
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
feature: Feature.DisableJavaBuildlessEnabled,
|
feature: Feature.DisableJavaBuildlessEnabled,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: "C#",
|
displayName: "C#",
|
||||||
language: KnownLanguage.csharp,
|
language: BuiltInLanguage.csharp,
|
||||||
feature: Feature.DisableCsharpBuildless,
|
feature: Feature.DisableCsharpBuildless,
|
||||||
},
|
},
|
||||||
]) {
|
]) {
|
||||||
@@ -969,7 +970,7 @@ for (const { displayName, language, feature } of [
|
|||||||
const messages: LoggedMessage[] = [];
|
const messages: LoggedMessage[] = [];
|
||||||
const buildMode = await configUtils.parseBuildModeInput(
|
const buildMode = await configUtils.parseBuildModeInput(
|
||||||
"none",
|
"none",
|
||||||
[KnownLanguage.python],
|
[BuiltInLanguage.python],
|
||||||
createFeatures([feature]),
|
createFeatures([feature]),
|
||||||
getRecordingLogger(messages),
|
getRecordingLogger(messages),
|
||||||
);
|
);
|
||||||
@@ -1019,7 +1020,7 @@ const defaultOverlayDatabaseModeTestSetup: OverlayDatabaseModeTestSetup = {
|
|||||||
isPullRequest: false,
|
isPullRequest: false,
|
||||||
isDefaultBranch: false,
|
isDefaultBranch: false,
|
||||||
buildMode: BuildMode.None,
|
buildMode: BuildMode.None,
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
codeqlVersion: CODEQL_OVERLAY_MINIMUM_VERSION,
|
codeqlVersion: CODEQL_OVERLAY_MINIMUM_VERSION,
|
||||||
gitRoot: "/some/git/root",
|
gitRoot: "/some/git/root",
|
||||||
gitVersion: new GitVersionInfo("2.39.0", "2.39.0"),
|
gitVersion: new GitVersionInfo("2.39.0", "2.39.0"),
|
||||||
@@ -1034,10 +1035,9 @@ const defaultOverlayDatabaseModeTestSetup: OverlayDatabaseModeTestSetup = {
|
|||||||
repositoryProperties: {},
|
repositoryProperties: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkOverlayEnablementMacro = test.macro({
|
const checkOverlayEnablementMacro = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext,
|
t: ExecutionContext,
|
||||||
_title: string,
|
|
||||||
setupOverrides: Partial<OverlayDatabaseModeTestSetup>,
|
setupOverrides: Partial<OverlayDatabaseModeTestSetup>,
|
||||||
expected:
|
expected:
|
||||||
| {
|
| {
|
||||||
@@ -1091,7 +1091,7 @@ const checkOverlayEnablementMacro = test.macro({
|
|||||||
sinon
|
sinon
|
||||||
.stub(codeql, "isTracedLanguage")
|
.stub(codeql, "isTracedLanguage")
|
||||||
.callsFake(async (lang: Language) => {
|
.callsFake(async (lang: Language) => {
|
||||||
return [KnownLanguage.java].includes(lang as KnownLanguage);
|
return lang === BuiltInLanguage.java;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mock git root detection
|
// Mock git root detection
|
||||||
@@ -1131,11 +1131,10 @@ const checkOverlayEnablementMacro = test.macro({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: (_, title) => `checkOverlayEnablement: ${title}`,
|
title: (title) => `checkOverlayEnablement: ${title}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Environment variable override - Overlay",
|
"Environment variable override - Overlay",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -1146,8 +1145,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Environment variable override - OverlayBase",
|
"Environment variable override - OverlayBase",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay-base",
|
overlayDatabaseEnvVar: "overlay-base",
|
||||||
@@ -1158,8 +1156,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Environment variable override - None",
|
"Environment variable override - None",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "none",
|
overlayDatabaseEnvVar: "none",
|
||||||
@@ -1169,8 +1166,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Ignore invalid environment variable",
|
"Ignore invalid environment variable",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "invalid-mode",
|
overlayDatabaseEnvVar: "invalid-mode",
|
||||||
@@ -1180,11 +1176,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Ignore feature flag when analyzing non-default branch",
|
"Ignore feature flag when analyzing non-default branch",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1192,11 +1187,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay-base database on default branch when feature enabled",
|
"Overlay-base database on default branch when feature enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
||||||
isDefaultBranch: true,
|
isDefaultBranch: true,
|
||||||
},
|
},
|
||||||
@@ -1206,11 +1200,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay-base database on default branch when feature enabled with custom analysis",
|
"Overlay-base database on default branch when feature enabled with custom analysis",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
||||||
codeScanningConfig: {
|
codeScanningConfig: {
|
||||||
packs: ["some-custom-pack@1.0.0"],
|
packs: ["some-custom-pack@1.0.0"],
|
||||||
@@ -1223,11 +1216,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay-base database on default branch when code-scanning feature enabled",
|
"Overlay-base database on default branch when code-scanning feature enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1240,11 +1232,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch if runner disk space is too low",
|
"No overlay-base database on default branch if runner disk space is too low",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1260,11 +1251,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch if we can't determine runner disk space",
|
"No overlay-base database on default branch if we can't determine runner disk space",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1277,11 +1267,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay-base database on default branch if runner disk space is too low and skip resource checks flag is enabled",
|
"Overlay-base database on default branch if runner disk space is too low and skip resource checks flag is enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1299,11 +1288,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch if runner disk space is below v2 limit and v2 resource checks enabled",
|
"No overlay-base database on default branch if runner disk space is below v2 limit and v2 resource checks enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1320,11 +1308,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay-base database on default branch if runner disk space is between v2 and v1 limits and v2 resource checks enabled",
|
"Overlay-base database on default branch if runner disk space is between v2 and v1 limits and v2 resource checks enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1342,11 +1329,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch if runner disk space is between v2 and v1 limits and v2 resource checks not enabled",
|
"No overlay-base database on default branch if runner disk space is between v2 and v1 limits and v2 resource checks not enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1362,11 +1348,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch if memory flag is too low",
|
"No overlay-base database on default branch if memory flag is too low",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1379,11 +1364,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay-base database on default branch if memory flag is too low but CodeQL >= 2.24.3",
|
"Overlay-base database on default branch if memory flag is too low but CodeQL >= 2.24.3",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1398,11 +1382,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay-base database on default branch if memory flag is too low and skip resource checks flag is enabled",
|
"Overlay-base database on default branch if memory flag is too low and skip resource checks flag is enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1417,11 +1400,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch when cached status indicates previous failure",
|
"No overlay-base database on default branch when cached status indicates previous failure",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisJavascript,
|
Feature.OverlayAnalysisJavascript,
|
||||||
@@ -1435,11 +1417,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR when cached status indicates previous failure",
|
"No overlay analysis on PR when cached status indicates previous failure",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisJavascript,
|
Feature.OverlayAnalysisJavascript,
|
||||||
@@ -1453,11 +1434,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch when code-scanning feature enabled with disable-default-queries",
|
"No overlay-base database on default branch when code-scanning feature enabled with disable-default-queries",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1472,11 +1452,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch when code-scanning feature enabled with packs",
|
"No overlay-base database on default branch when code-scanning feature enabled with packs",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1491,11 +1470,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch when code-scanning feature enabled with queries",
|
"No overlay-base database on default branch when code-scanning feature enabled with queries",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1510,11 +1488,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch when code-scanning feature enabled with query-filters",
|
"No overlay-base database on default branch when code-scanning feature enabled with query-filters",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1529,11 +1506,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch when only language-specific feature enabled",
|
"No overlay-base database on default branch when only language-specific feature enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysisJavascript],
|
||||||
isDefaultBranch: true,
|
isDefaultBranch: true,
|
||||||
},
|
},
|
||||||
@@ -1542,11 +1518,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch when only code-scanning feature enabled",
|
"No overlay-base database on default branch when only code-scanning feature enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysisCodeScanningJavascript],
|
features: [Feature.OverlayAnalysisCodeScanningJavascript],
|
||||||
isDefaultBranch: true,
|
isDefaultBranch: true,
|
||||||
},
|
},
|
||||||
@@ -1555,11 +1530,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay-base database on default branch when language-specific feature disabled",
|
"No overlay-base database on default branch when language-specific feature disabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis],
|
features: [Feature.OverlayAnalysis],
|
||||||
isDefaultBranch: true,
|
isDefaultBranch: true,
|
||||||
},
|
},
|
||||||
@@ -1568,11 +1542,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay analysis on PR when feature enabled",
|
"Overlay analysis on PR when feature enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
||||||
isPullRequest: true,
|
isPullRequest: true,
|
||||||
},
|
},
|
||||||
@@ -1582,11 +1555,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay analysis on PR when feature enabled with custom analysis",
|
"Overlay analysis on PR when feature enabled with custom analysis",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
||||||
codeScanningConfig: {
|
codeScanningConfig: {
|
||||||
packs: ["some-custom-pack@1.0.0"],
|
packs: ["some-custom-pack@1.0.0"],
|
||||||
@@ -1599,11 +1571,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay analysis on PR when code-scanning feature enabled",
|
"Overlay analysis on PR when code-scanning feature enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1616,11 +1587,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR if runner disk space is too low",
|
"No overlay analysis on PR if runner disk space is too low",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1636,11 +1606,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay analysis on PR if runner disk space is too low and skip resource checks flag is enabled",
|
"Overlay analysis on PR if runner disk space is too low and skip resource checks flag is enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1658,11 +1627,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR if we can't determine runner disk space",
|
"No overlay analysis on PR if we can't determine runner disk space",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1675,11 +1643,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR if memory flag is too low",
|
"No overlay analysis on PR if memory flag is too low",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1692,11 +1659,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay analysis on PR if memory flag is too low but CodeQL >= 2.24.3",
|
"Overlay analysis on PR if memory flag is too low but CodeQL >= 2.24.3",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1711,11 +1677,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay analysis on PR if memory flag is too low and skip resource checks flag is enabled",
|
"Overlay analysis on PR if memory flag is too low and skip resource checks flag is enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1730,11 +1695,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR when code-scanning feature enabled with disable-default-queries",
|
"No overlay analysis on PR when code-scanning feature enabled with disable-default-queries",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1749,11 +1713,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR when code-scanning feature enabled with packs",
|
"No overlay analysis on PR when code-scanning feature enabled with packs",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1768,11 +1731,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR when code-scanning feature enabled with queries",
|
"No overlay analysis on PR when code-scanning feature enabled with queries",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1787,11 +1749,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR when code-scanning feature enabled with query-filters",
|
"No overlay analysis on PR when code-scanning feature enabled with query-filters",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [
|
features: [
|
||||||
Feature.OverlayAnalysis,
|
Feature.OverlayAnalysis,
|
||||||
Feature.OverlayAnalysisCodeScanningJavascript,
|
Feature.OverlayAnalysisCodeScanningJavascript,
|
||||||
@@ -1806,11 +1767,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR when only language-specific feature enabled",
|
"No overlay analysis on PR when only language-specific feature enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysisJavascript],
|
||||||
isPullRequest: true,
|
isPullRequest: true,
|
||||||
},
|
},
|
||||||
@@ -1819,11 +1779,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR when only code-scanning feature enabled",
|
"No overlay analysis on PR when only code-scanning feature enabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysisCodeScanningJavascript],
|
features: [Feature.OverlayAnalysisCodeScanningJavascript],
|
||||||
isPullRequest: true,
|
isPullRequest: true,
|
||||||
},
|
},
|
||||||
@@ -1832,11 +1791,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis on PR when language-specific feature disabled",
|
"No overlay analysis on PR when language-specific feature disabled",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis],
|
features: [Feature.OverlayAnalysis],
|
||||||
isPullRequest: true,
|
isPullRequest: true,
|
||||||
},
|
},
|
||||||
@@ -1845,8 +1803,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay PR analysis by env",
|
"Overlay PR analysis by env",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -1857,8 +1814,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay PR analysis by env on a runner with low disk space",
|
"Overlay PR analysis by env on a runner with low disk space",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -1870,11 +1826,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay PR analysis by feature flag",
|
"Overlay PR analysis by feature flag",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
||||||
isPullRequest: true,
|
isPullRequest: true,
|
||||||
},
|
},
|
||||||
@@ -1884,34 +1839,31 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Fallback due to autobuild with traced language",
|
"Fallback due to autobuild with traced language",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
buildMode: BuildMode.Autobuild,
|
buildMode: BuildMode.Autobuild,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
disabledReason: OverlayDisabledReason.IncompatibleBuildMode,
|
disabledReason: OverlayDisabledReason.IncompatibleBuildMode,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Fallback due to no build mode with traced language",
|
"Fallback due to no build mode with traced language",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
buildMode: undefined,
|
buildMode: undefined,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
disabledReason: OverlayDisabledReason.IncompatibleBuildMode,
|
disabledReason: OverlayDisabledReason.IncompatibleBuildMode,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Fallback due to old CodeQL version",
|
"Fallback due to old CodeQL version",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -1922,8 +1874,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Fallback due to missing git root",
|
"Fallback due to missing git root",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -1934,8 +1885,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Fallback due to old git version with submodules",
|
"Fallback due to old git version with submodules",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -1947,8 +1897,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Fallback when git version cannot be determined and repo has submodules",
|
"Fallback when git version cannot be determined and repo has submodules",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -1960,8 +1909,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay enabled when git version cannot be determined and repo has no submodules",
|
"Overlay enabled when git version cannot be determined and repo has no submodules",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -1974,11 +1922,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay when disabled via repository property",
|
"No overlay when disabled via repository property",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
||||||
isPullRequest: true,
|
isPullRequest: true,
|
||||||
repositoryProperties: {
|
repositoryProperties: {
|
||||||
@@ -1990,11 +1937,10 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Overlay not disabled when repository property is false",
|
"Overlay not disabled when repository property is false",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
|
||||||
isPullRequest: true,
|
isPullRequest: true,
|
||||||
repositoryProperties: {
|
repositoryProperties: {
|
||||||
@@ -2007,8 +1953,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"Environment variable override takes precedence over repository property",
|
"Environment variable override takes precedence over repository property",
|
||||||
{
|
{
|
||||||
overlayDatabaseEnvVar: "overlay",
|
overlayDatabaseEnvVar: "overlay",
|
||||||
@@ -2023,9 +1968,8 @@ test.serial(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Exercise language-specific overlay analysis features code paths
|
// Exercise language-specific overlay analysis features code paths
|
||||||
for (const language in KnownLanguage) {
|
for (const language in BuiltInLanguage) {
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
`Check default overlay analysis feature for ${language}`,
|
`Check default overlay analysis feature for ${language}`,
|
||||||
{
|
{
|
||||||
languages: [language],
|
languages: [language],
|
||||||
@@ -2042,11 +1986,10 @@ for (const language in KnownLanguage) {
|
|||||||
// overlay analysis enabled, even when the base overlay feature flag is on.
|
// overlay analysis enabled, even when the base overlay feature flag is on.
|
||||||
// Using swift here as it doesn't currently have overlay support — update this if
|
// Using swift here as it doesn't currently have overlay support — update this if
|
||||||
// swift gains overlay support.
|
// swift gains overlay support.
|
||||||
test.serial(
|
checkOverlayEnablementMacro.serial(
|
||||||
checkOverlayEnablementMacro,
|
|
||||||
"No overlay analysis for language without per-language overlay feature flag",
|
"No overlay analysis for language without per-language overlay feature flag",
|
||||||
{
|
{
|
||||||
languages: [KnownLanguage.swift],
|
languages: [BuiltInLanguage.swift],
|
||||||
features: [Feature.OverlayAnalysis],
|
features: [Feature.OverlayAnalysis],
|
||||||
isPullRequest: true,
|
isPullRequest: true,
|
||||||
},
|
},
|
||||||
|
|||||||
+8
-8
@@ -48,7 +48,7 @@ import {
|
|||||||
hasSubmodules,
|
hasSubmodules,
|
||||||
isAnalyzingDefaultBranch,
|
isAnalyzingDefaultBranch,
|
||||||
} from "./git-utils";
|
} from "./git-utils";
|
||||||
import { KnownLanguage, Language } from "./languages";
|
import { BuiltInLanguage, Language } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import { CODEQL_OVERLAY_MINIMUM_VERSION } from "./overlay";
|
import { CODEQL_OVERLAY_MINIMUM_VERSION } from "./overlay";
|
||||||
import {
|
import {
|
||||||
@@ -274,10 +274,10 @@ async function getSupportedLanguageMap(
|
|||||||
for (const extractor of Object.keys(resolveResult.extractors)) {
|
for (const extractor of Object.keys(resolveResult.extractors)) {
|
||||||
// If the CLI supports resolving languages with default queries, use these
|
// If the CLI supports resolving languages with default queries, use these
|
||||||
// as the set of supported languages. Otherwise, require the language to be
|
// as the set of supported languages. Otherwise, require the language to be
|
||||||
// a known language.
|
// a built-in language.
|
||||||
if (
|
if (
|
||||||
resolveSupportedLanguagesUsingCli ||
|
resolveSupportedLanguagesUsingCli ||
|
||||||
KnownLanguage[extractor] !== undefined
|
BuiltInLanguage[extractor] !== undefined
|
||||||
) {
|
) {
|
||||||
supportedLanguages[extractor] = extractor;
|
supportedLanguages[extractor] = extractor;
|
||||||
}
|
}
|
||||||
@@ -947,7 +947,7 @@ async function validateOverlayDatabaseMode(
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
languages.map(
|
languages.map(
|
||||||
async (l) =>
|
async (l) =>
|
||||||
l !== KnownLanguage.go && // Workaround to allow overlay analysis for Go with any build
|
l !== BuiltInLanguage.go && // Workaround to allow overlay analysis for Go with any build
|
||||||
// mode, since it does not yet support BMN. The Go autobuilder and/or extractor will
|
// mode, since it does not yet support BMN. The Go autobuilder and/or extractor will
|
||||||
// ensure that overlay-base databases are only created for supported Go build setups,
|
// ensure that overlay-base databases are only created for supported Go build setups,
|
||||||
// and that we'll fall back to full databases in other cases.
|
// and that we'll fall back to full databases in other cases.
|
||||||
@@ -1036,13 +1036,13 @@ async function setCppTrapCachingEnvironmentVariables(
|
|||||||
config: Config,
|
config: Config,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (config.languages.includes(KnownLanguage.cpp)) {
|
if (config.languages.includes(BuiltInLanguage.cpp)) {
|
||||||
const envVar = "CODEQL_EXTRACTOR_CPP_TRAP_CACHING";
|
const envVar = "CODEQL_EXTRACTOR_CPP_TRAP_CACHING";
|
||||||
if (process.env[envVar]) {
|
if (process.env[envVar]) {
|
||||||
logger.info(
|
logger.info(
|
||||||
`Environment variable ${envVar} already set, leaving it unchanged.`,
|
`Environment variable ${envVar} already set, leaving it unchanged.`,
|
||||||
);
|
);
|
||||||
} else if (config.trapCaches[KnownLanguage.cpp]) {
|
} else if (config.trapCaches[BuiltInLanguage.cpp]) {
|
||||||
logger.info("Enabling TRAP caching for C/C++.");
|
logger.info("Enabling TRAP caching for C/C++.");
|
||||||
core.exportVariable(envVar, "true");
|
core.exportVariable(envVar, "true");
|
||||||
} else {
|
} else {
|
||||||
@@ -1539,7 +1539,7 @@ export async function parseBuildModeInput(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
languages.includes(KnownLanguage.csharp) &&
|
languages.includes(BuiltInLanguage.csharp) &&
|
||||||
(await features.getValue(Feature.DisableCsharpBuildless))
|
(await features.getValue(Feature.DisableCsharpBuildless))
|
||||||
) {
|
) {
|
||||||
logger.warning(
|
logger.warning(
|
||||||
@@ -1549,7 +1549,7 @@ export async function parseBuildModeInput(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
languages.includes(KnownLanguage.java) &&
|
languages.includes(BuiltInLanguage.java) &&
|
||||||
(await features.getValue(Feature.DisableJavaBuildlessEnabled))
|
(await features.getValue(Feature.DisableJavaBuildlessEnabled))
|
||||||
) {
|
) {
|
||||||
logger.warning(
|
logger.warning(
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import test, { ExecutionContext } from "ava";
|
import test, { ExecutionContext } from "ava";
|
||||||
|
|
||||||
import { RepositoryProperties } from "../feature-flags/properties";
|
import { RepositoryProperties } from "../feature-flags/properties";
|
||||||
import { KnownLanguage, Language } from "../languages";
|
import { BuiltInLanguage, Language } from "../languages";
|
||||||
import { getRunnerLogger } from "../logging";
|
import { getRunnerLogger } from "../logging";
|
||||||
import {
|
import {
|
||||||
checkExpectedLogMessages,
|
checkExpectedLogMessages,
|
||||||
getRecordingLogger,
|
getRecordingLogger,
|
||||||
LoggedMessage,
|
LoggedMessage,
|
||||||
|
makeMacro,
|
||||||
} from "../testing-utils";
|
} from "../testing-utils";
|
||||||
import { ConfigurationError, prettyPrintPack } from "../util";
|
import { ConfigurationError, prettyPrintPack } from "../util";
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ import * as dbConfig from "./db-config";
|
|||||||
/**
|
/**
|
||||||
* Test macro for ensuring the packs block is valid
|
* Test macro for ensuring the packs block is valid
|
||||||
*/
|
*/
|
||||||
const parsePacksMacro = test.macro({
|
const parsePacksMacro = makeMacro({
|
||||||
exec: (
|
exec: (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
packsInput: string,
|
packsInput: string,
|
||||||
@@ -33,7 +34,7 @@ const parsePacksMacro = test.macro({
|
|||||||
/**
|
/**
|
||||||
* Test macro for testing when the packs block is invalid
|
* Test macro for testing when the packs block is invalid
|
||||||
*/
|
*/
|
||||||
const parsePacksErrorMacro = test.macro({
|
const parsePacksErrorMacro = makeMacro({
|
||||||
exec: (
|
exec: (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
packsInput: string,
|
packsInput: string,
|
||||||
@@ -49,45 +50,42 @@ const parsePacksErrorMacro = test.macro({
|
|||||||
/**
|
/**
|
||||||
* Test macro for testing when the packs block is invalid
|
* Test macro for testing when the packs block is invalid
|
||||||
*/
|
*/
|
||||||
const invalidPackNameMacro = test.macro({
|
const invalidPackNameMacro = makeMacro({
|
||||||
exec: (t: ExecutionContext, name: string) =>
|
exec: (t: ExecutionContext, arg: string) =>
|
||||||
parsePacksErrorMacro.exec(
|
parsePacksErrorMacro.fn(
|
||||||
t,
|
t,
|
||||||
name,
|
arg,
|
||||||
[KnownLanguage.cpp],
|
[BuiltInLanguage.cpp],
|
||||||
new RegExp(`^"${name}" is not a valid pack$`),
|
new RegExp(`^"${arg}" is not a valid pack$`),
|
||||||
),
|
),
|
||||||
title: (_providedTitle: string | undefined, arg: string | undefined) =>
|
title: (_providedTitle: string | undefined, arg: string | undefined) =>
|
||||||
`Invalid pack string: ${arg}`,
|
`Invalid pack string: ${arg}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test("no packs", parsePacksMacro, "", [], undefined);
|
parsePacksMacro("no packs", "", [], undefined);
|
||||||
test("two packs", parsePacksMacro, "a/b,c/d@1.2.3", [KnownLanguage.cpp], {
|
parsePacksMacro("two packs", "a/b,c/d@1.2.3", [BuiltInLanguage.cpp], {
|
||||||
[KnownLanguage.cpp]: ["a/b", "c/d@1.2.3"],
|
[BuiltInLanguage.cpp]: ["a/b", "c/d@1.2.3"],
|
||||||
});
|
});
|
||||||
test(
|
parsePacksMacro(
|
||||||
"two packs with spaces",
|
"two packs with spaces",
|
||||||
parsePacksMacro,
|
|
||||||
" a/b , c/d@1.2.3 ",
|
" a/b , c/d@1.2.3 ",
|
||||||
[KnownLanguage.cpp],
|
[BuiltInLanguage.cpp],
|
||||||
{
|
{
|
||||||
[KnownLanguage.cpp]: ["a/b", "c/d@1.2.3"],
|
[BuiltInLanguage.cpp]: ["a/b", "c/d@1.2.3"],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
test(
|
parsePacksErrorMacro(
|
||||||
"two packs with language",
|
"two packs with language",
|
||||||
parsePacksErrorMacro,
|
|
||||||
"a/b,c/d@1.2.3",
|
"a/b,c/d@1.2.3",
|
||||||
[KnownLanguage.cpp, KnownLanguage.java],
|
[BuiltInLanguage.cpp, BuiltInLanguage.java],
|
||||||
new RegExp(
|
new RegExp(
|
||||||
"Cannot specify a 'packs' input in a multi-language analysis. " +
|
"Cannot specify a 'packs' input in a multi-language analysis. " +
|
||||||
"Use a codeql-config.yml file instead and specify packs by language.",
|
"Use a codeql-config.yml file instead and specify packs by language.",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
parsePacksMacro(
|
||||||
"packs with other valid names",
|
"packs with other valid names",
|
||||||
parsePacksMacro,
|
|
||||||
[
|
[
|
||||||
// ranges are ok
|
// ranges are ok
|
||||||
"c/d@1.0",
|
"c/d@1.0",
|
||||||
@@ -106,9 +104,9 @@ test(
|
|||||||
// (globbing is not done)
|
// (globbing is not done)
|
||||||
"c/d@1.2.3:+*)_(",
|
"c/d@1.2.3:+*)_(",
|
||||||
].join(","),
|
].join(","),
|
||||||
[KnownLanguage.cpp],
|
[BuiltInLanguage.cpp],
|
||||||
{
|
{
|
||||||
[KnownLanguage.cpp]: [
|
[BuiltInLanguage.cpp]: [
|
||||||
"c/d@1.0",
|
"c/d@1.0",
|
||||||
"c/d@~1.0.0",
|
"c/d@~1.0.0",
|
||||||
"c/d@~1.0.0:a/b",
|
"c/d@~1.0.0:a/b",
|
||||||
@@ -123,23 +121,23 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(invalidPackNameMacro, "c"); // all packs require at least a scope and a name
|
invalidPackNameMacro.test("c"); // all packs require at least a scope and a name
|
||||||
test(invalidPackNameMacro, "c-/d");
|
invalidPackNameMacro.test("c-/d");
|
||||||
test(invalidPackNameMacro, "-c/d");
|
invalidPackNameMacro.test("-c/d");
|
||||||
test(invalidPackNameMacro, "c/d_d");
|
invalidPackNameMacro.test("c/d_d");
|
||||||
test(invalidPackNameMacro, "c/d@@");
|
invalidPackNameMacro.test("c/d@@");
|
||||||
test(invalidPackNameMacro, "c/d@1.0.0:");
|
invalidPackNameMacro.test("c/d@1.0.0:");
|
||||||
test(invalidPackNameMacro, "c/d:");
|
invalidPackNameMacro.test("c/d:");
|
||||||
test(invalidPackNameMacro, "c/d:/a");
|
invalidPackNameMacro.test("c/d:/a");
|
||||||
test(invalidPackNameMacro, "@1.0.0:a");
|
invalidPackNameMacro.test("@1.0.0:a");
|
||||||
test(invalidPackNameMacro, "c/d@../a");
|
invalidPackNameMacro.test("c/d@../a");
|
||||||
test(invalidPackNameMacro, "c/d@b/../a");
|
invalidPackNameMacro.test("c/d@b/../a");
|
||||||
test(invalidPackNameMacro, "c/d:z@1");
|
invalidPackNameMacro.test("c/d:z@1");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test macro for pretty printing pack specs
|
* Test macro for pretty printing pack specs
|
||||||
*/
|
*/
|
||||||
const packSpecPrettyPrintingMacro = test.macro({
|
const packSpecPrettyPrintingMacro = makeMacro({
|
||||||
exec: (t: ExecutionContext, packStr: string, packObj: dbConfig.Pack) => {
|
exec: (t: ExecutionContext, packStr: string, packObj: dbConfig.Pack) => {
|
||||||
const parsed = dbConfig.parsePacksSpecification(packStr);
|
const parsed = dbConfig.parsePacksSpecification(packStr);
|
||||||
t.deepEqual(parsed, packObj, "parsed pack spec is correct");
|
t.deepEqual(parsed, packObj, "parsed pack spec is correct");
|
||||||
@@ -163,36 +161,35 @@ const packSpecPrettyPrintingMacro = test.macro({
|
|||||||
) => `Prettyprint pack spec: '${packStr}'`,
|
) => `Prettyprint pack spec: '${packStr}'`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test(packSpecPrettyPrintingMacro, "a/b", {
|
packSpecPrettyPrintingMacro.test("a/b", {
|
||||||
name: "a/b",
|
name: "a/b",
|
||||||
version: undefined,
|
version: undefined,
|
||||||
path: undefined,
|
path: undefined,
|
||||||
});
|
});
|
||||||
test(packSpecPrettyPrintingMacro, "a/b@~1.2.3", {
|
packSpecPrettyPrintingMacro.test("a/b@~1.2.3", {
|
||||||
name: "a/b",
|
name: "a/b",
|
||||||
version: "~1.2.3",
|
version: "~1.2.3",
|
||||||
path: undefined,
|
path: undefined,
|
||||||
});
|
});
|
||||||
test(packSpecPrettyPrintingMacro, "a/b@~1.2.3:abc/def", {
|
packSpecPrettyPrintingMacro.test("a/b@~1.2.3:abc/def", {
|
||||||
name: "a/b",
|
name: "a/b",
|
||||||
version: "~1.2.3",
|
version: "~1.2.3",
|
||||||
path: "abc/def",
|
path: "abc/def",
|
||||||
});
|
});
|
||||||
test(packSpecPrettyPrintingMacro, "a/b:abc/def", {
|
packSpecPrettyPrintingMacro.test("a/b:abc/def", {
|
||||||
name: "a/b",
|
name: "a/b",
|
||||||
version: undefined,
|
version: undefined,
|
||||||
path: "abc/def",
|
path: "abc/def",
|
||||||
});
|
});
|
||||||
test(packSpecPrettyPrintingMacro, " a/b:abc/def ", {
|
packSpecPrettyPrintingMacro.test(" a/b:abc/def ", {
|
||||||
name: "a/b",
|
name: "a/b",
|
||||||
version: undefined,
|
version: undefined,
|
||||||
path: "abc/def",
|
path: "abc/def",
|
||||||
});
|
});
|
||||||
|
|
||||||
const calculateAugmentationMacro = test.macro({
|
const calculateAugmentationMacro = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext,
|
t: ExecutionContext,
|
||||||
_title: string,
|
|
||||||
rawPacksInput: string | undefined,
|
rawPacksInput: string | undefined,
|
||||||
rawQueriesInput: string | undefined,
|
rawQueriesInput: string | undefined,
|
||||||
languages: Language[],
|
languages: Language[],
|
||||||
@@ -207,27 +204,25 @@ const calculateAugmentationMacro = test.macro({
|
|||||||
);
|
);
|
||||||
t.deepEqual(actualAugmentationProperties, expectedAugmentationProperties);
|
t.deepEqual(actualAugmentationProperties, expectedAugmentationProperties);
|
||||||
},
|
},
|
||||||
title: (_, title) => `Calculate Augmentation: ${title}`,
|
title: (title) => `Calculate Augmentation: ${title}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test(
|
calculateAugmentationMacro(
|
||||||
calculateAugmentationMacro,
|
|
||||||
"All empty",
|
"All empty",
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
...dbConfig.defaultAugmentationProperties,
|
...dbConfig.defaultAugmentationProperties,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationMacro(
|
||||||
calculateAugmentationMacro,
|
|
||||||
"With queries",
|
"With queries",
|
||||||
undefined,
|
undefined,
|
||||||
" a, b , c, d",
|
" a, b , c, d",
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
...dbConfig.defaultAugmentationProperties,
|
...dbConfig.defaultAugmentationProperties,
|
||||||
@@ -235,12 +230,11 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationMacro(
|
||||||
calculateAugmentationMacro,
|
|
||||||
"With queries combining",
|
"With queries combining",
|
||||||
undefined,
|
undefined,
|
||||||
" + a, b , c, d ",
|
" + a, b , c, d ",
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
...dbConfig.defaultAugmentationProperties,
|
...dbConfig.defaultAugmentationProperties,
|
||||||
@@ -249,12 +243,11 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationMacro(
|
||||||
calculateAugmentationMacro,
|
|
||||||
"With packs",
|
"With packs",
|
||||||
" codeql/a , codeql/b , codeql/c , codeql/d ",
|
" codeql/a , codeql/b , codeql/c , codeql/d ",
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
...dbConfig.defaultAugmentationProperties,
|
...dbConfig.defaultAugmentationProperties,
|
||||||
@@ -262,12 +255,11 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationMacro(
|
||||||
calculateAugmentationMacro,
|
|
||||||
"With packs combining",
|
"With packs combining",
|
||||||
" + codeql/a, codeql/b, codeql/c, codeql/d",
|
" + codeql/a, codeql/b, codeql/c, codeql/d",
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
...dbConfig.defaultAugmentationProperties,
|
...dbConfig.defaultAugmentationProperties,
|
||||||
@@ -276,12 +268,11 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationMacro(
|
||||||
calculateAugmentationMacro,
|
|
||||||
"With repo property queries",
|
"With repo property queries",
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{
|
{
|
||||||
"github-codeql-extra-queries": "a, b, c, d",
|
"github-codeql-extra-queries": "a, b, c, d",
|
||||||
},
|
},
|
||||||
@@ -294,12 +285,11 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationMacro(
|
||||||
calculateAugmentationMacro,
|
|
||||||
"With repo property queries combining",
|
"With repo property queries combining",
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{
|
{
|
||||||
"github-codeql-extra-queries": "+ a, b, c, d",
|
"github-codeql-extra-queries": "+ a, b, c, d",
|
||||||
},
|
},
|
||||||
@@ -312,10 +302,9 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const calculateAugmentationErrorMacro = test.macro({
|
const calculateAugmentationErrorMacro = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext,
|
t: ExecutionContext,
|
||||||
_title: string,
|
|
||||||
rawPacksInput: string | undefined,
|
rawPacksInput: string | undefined,
|
||||||
rawQueriesInput: string | undefined,
|
rawQueriesInput: string | undefined,
|
||||||
languages: Language[],
|
languages: Language[],
|
||||||
@@ -333,53 +322,48 @@ const calculateAugmentationErrorMacro = test.macro({
|
|||||||
{ message: expectedError },
|
{ message: expectedError },
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
title: (_, title) => `Calculate Augmentation Error: ${title}`,
|
title: (title) => `Calculate Augmentation Error: ${title}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test(
|
calculateAugmentationErrorMacro(
|
||||||
calculateAugmentationErrorMacro,
|
|
||||||
"Plus (+) with nothing else (queries)",
|
"Plus (+) with nothing else (queries)",
|
||||||
undefined,
|
undefined,
|
||||||
" + ",
|
" + ",
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{},
|
{},
|
||||||
/The workflow property "queries" is invalid/,
|
/The workflow property "queries" is invalid/,
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationErrorMacro(
|
||||||
calculateAugmentationErrorMacro,
|
|
||||||
"Plus (+) with nothing else (packs)",
|
"Plus (+) with nothing else (packs)",
|
||||||
" + ",
|
" + ",
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{},
|
{},
|
||||||
/The workflow property "packs" is invalid/,
|
/The workflow property "packs" is invalid/,
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationErrorMacro(
|
||||||
calculateAugmentationErrorMacro,
|
|
||||||
"Plus (+) with nothing else (repo property queries)",
|
"Plus (+) with nothing else (repo property queries)",
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{
|
{
|
||||||
"github-codeql-extra-queries": " + ",
|
"github-codeql-extra-queries": " + ",
|
||||||
},
|
},
|
||||||
/The repository property "github-codeql-extra-queries" is invalid/,
|
/The repository property "github-codeql-extra-queries" is invalid/,
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationErrorMacro(
|
||||||
calculateAugmentationErrorMacro,
|
|
||||||
"Packs input with multiple languages",
|
"Packs input with multiple languages",
|
||||||
" + a/b, c/d ",
|
" + a/b, c/d ",
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript, KnownLanguage.java],
|
[BuiltInLanguage.javascript, BuiltInLanguage.java],
|
||||||
{},
|
{},
|
||||||
/Cannot specify a 'packs' input in a multi-language analysis/,
|
/Cannot specify a 'packs' input in a multi-language analysis/,
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationErrorMacro(
|
||||||
calculateAugmentationErrorMacro,
|
|
||||||
"Packs input with no languages",
|
"Packs input with no languages",
|
||||||
" + a/b, c/d ",
|
" + a/b, c/d ",
|
||||||
undefined,
|
undefined,
|
||||||
@@ -388,12 +372,11 @@ test(
|
|||||||
/No languages specified/,
|
/No languages specified/,
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
calculateAugmentationErrorMacro(
|
||||||
calculateAugmentationErrorMacro,
|
|
||||||
"Invalid packs",
|
"Invalid packs",
|
||||||
" a-pack-without-a-scope ",
|
" a-pack-without-a-scope ",
|
||||||
undefined,
|
undefined,
|
||||||
[KnownLanguage.javascript],
|
[BuiltInLanguage.javascript],
|
||||||
{},
|
{},
|
||||||
/"a-pack-without-a-scope" is not a valid pack/,
|
/"a-pack-without-a-scope" is not a valid pack/,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { createStubCodeQL } from "./codeql";
|
|||||||
import { Config } from "./config-utils";
|
import { Config } from "./config-utils";
|
||||||
import { cleanupAndUploadDatabases } from "./database-upload";
|
import { cleanupAndUploadDatabases } from "./database-upload";
|
||||||
import * as gitUtils from "./git-utils";
|
import * as gitUtils from "./git-utils";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { RepositoryNwo } from "./repository";
|
import { RepositoryNwo } from "./repository";
|
||||||
import {
|
import {
|
||||||
checkExpectedLogMessages,
|
checkExpectedLogMessages,
|
||||||
@@ -45,7 +45,7 @@ const testApiDetails: GitHubApiDetails = {
|
|||||||
|
|
||||||
function getTestConfig(tmpDir: string): Config {
|
function getTestConfig(tmpDir: string): Config {
|
||||||
return createTestConfig({
|
return createTestConfig({
|
||||||
languages: [KnownLanguage.javascript],
|
languages: [BuiltInLanguage.javascript],
|
||||||
dbLocation: tmpDir,
|
dbLocation: tmpDir,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-v2.25.1",
|
"bundleVersion": "codeql-bundle-v2.25.4",
|
||||||
"cliVersion": "2.25.1",
|
"cliVersion": "2.25.4",
|
||||||
"priorBundleVersion": "codeql-bundle-v2.24.3",
|
"priorBundleVersion": "codeql-bundle-v2.25.3",
|
||||||
"priorCliVersion": "2.24.3"
|
"priorCliVersion": "2.25.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import {
|
|||||||
CacheStoreResult,
|
CacheStoreResult,
|
||||||
} from "./dependency-caching";
|
} from "./dependency-caching";
|
||||||
import { Feature } from "./feature-flags";
|
import { Feature } from "./feature-flags";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import {
|
import {
|
||||||
setupTests,
|
setupTests,
|
||||||
createFeatures,
|
createFeatures,
|
||||||
@@ -179,7 +179,7 @@ test("checkHashPatterns - logs when no patterns match", async (t) => {
|
|||||||
const result = await checkHashPatterns(
|
const result = await checkHashPatterns(
|
||||||
codeql,
|
codeql,
|
||||||
features,
|
features,
|
||||||
KnownLanguage.csharp,
|
BuiltInLanguage.csharp,
|
||||||
config,
|
config,
|
||||||
"download",
|
"download",
|
||||||
getRecordingLogger(messages),
|
getRecordingLogger(messages),
|
||||||
@@ -208,7 +208,7 @@ test("checkHashPatterns - returns patterns when patterns match", async (t) => {
|
|||||||
const result = await checkHashPatterns(
|
const result = await checkHashPatterns(
|
||||||
codeql,
|
codeql,
|
||||||
features,
|
features,
|
||||||
KnownLanguage.csharp,
|
BuiltInLanguage.csharp,
|
||||||
config,
|
config,
|
||||||
"upload",
|
"upload",
|
||||||
getRecordingLogger(messages),
|
getRecordingLogger(messages),
|
||||||
@@ -270,7 +270,7 @@ test.serial(
|
|||||||
const keyWithFeature = await cacheKey(
|
const keyWithFeature = await cacheKey(
|
||||||
codeql,
|
codeql,
|
||||||
createFeatures([Feature.CsharpNewCacheKey]),
|
createFeatures([Feature.CsharpNewCacheKey]),
|
||||||
KnownLanguage.csharp,
|
BuiltInLanguage.csharp,
|
||||||
// Patterns don't matter here because we have stubbed `hashFiles` to always return a specific hash above.
|
// Patterns don't matter here because we have stubbed `hashFiles` to always return a specific hash above.
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@@ -288,12 +288,12 @@ test.serial(
|
|||||||
const result = await downloadDependencyCaches(
|
const result = await downloadDependencyCaches(
|
||||||
codeql,
|
codeql,
|
||||||
createFeatures([]),
|
createFeatures([]),
|
||||||
[KnownLanguage.csharp],
|
[BuiltInLanguage.csharp],
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
const statusReport = result.statusReport;
|
const statusReport = result.statusReport;
|
||||||
t.is(statusReport.length, 1);
|
t.is(statusReport.length, 1);
|
||||||
t.is(statusReport[0].language, KnownLanguage.csharp);
|
t.is(statusReport[0].language, BuiltInLanguage.csharp);
|
||||||
t.is(statusReport[0].hit_kind, CacheHitKind.Miss);
|
t.is(statusReport[0].hit_kind, CacheHitKind.Miss);
|
||||||
t.deepEqual(result.restoredKeys, []);
|
t.deepEqual(result.restoredKeys, []);
|
||||||
t.assert(restoreCacheStub.calledOnce);
|
t.assert(restoreCacheStub.calledOnce);
|
||||||
@@ -316,7 +316,7 @@ test.serial(
|
|||||||
const keyWithFeature = await cacheKey(
|
const keyWithFeature = await cacheKey(
|
||||||
codeql,
|
codeql,
|
||||||
features,
|
features,
|
||||||
KnownLanguage.csharp,
|
BuiltInLanguage.csharp,
|
||||||
// Patterns don't matter here because we have stubbed `hashFiles` to always return a specific hash above.
|
// Patterns don't matter here because we have stubbed `hashFiles` to always return a specific hash above.
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@@ -334,14 +334,14 @@ test.serial(
|
|||||||
const result = await downloadDependencyCaches(
|
const result = await downloadDependencyCaches(
|
||||||
codeql,
|
codeql,
|
||||||
features,
|
features,
|
||||||
[KnownLanguage.csharp],
|
[BuiltInLanguage.csharp],
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check that the status report for telemetry indicates that one cache was restored with an exact match.
|
// Check that the status report for telemetry indicates that one cache was restored with an exact match.
|
||||||
const statusReport = result.statusReport;
|
const statusReport = result.statusReport;
|
||||||
t.is(statusReport.length, 1);
|
t.is(statusReport.length, 1);
|
||||||
t.is(statusReport[0].language, KnownLanguage.csharp);
|
t.is(statusReport[0].language, BuiltInLanguage.csharp);
|
||||||
t.is(statusReport[0].hit_kind, CacheHitKind.Exact);
|
t.is(statusReport[0].hit_kind, CacheHitKind.Exact);
|
||||||
|
|
||||||
// Check that the restored key has been returned.
|
// Check that the restored key has been returned.
|
||||||
@@ -380,7 +380,7 @@ test.serial(
|
|||||||
const keyWithFeature = await cacheKey(
|
const keyWithFeature = await cacheKey(
|
||||||
codeql,
|
codeql,
|
||||||
features,
|
features,
|
||||||
KnownLanguage.csharp,
|
BuiltInLanguage.csharp,
|
||||||
// Patterns don't matter here because we have stubbed `hashFiles` to always return a specific hash above.
|
// Patterns don't matter here because we have stubbed `hashFiles` to always return a specific hash above.
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@@ -398,14 +398,14 @@ test.serial(
|
|||||||
const result = await downloadDependencyCaches(
|
const result = await downloadDependencyCaches(
|
||||||
codeql,
|
codeql,
|
||||||
features,
|
features,
|
||||||
[KnownLanguage.csharp],
|
[BuiltInLanguage.csharp],
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check that the status report for telemetry indicates that one cache was restored with a partial match.
|
// Check that the status report for telemetry indicates that one cache was restored with a partial match.
|
||||||
const statusReport = result.statusReport;
|
const statusReport = result.statusReport;
|
||||||
t.is(statusReport.length, 1);
|
t.is(statusReport.length, 1);
|
||||||
t.is(statusReport[0].language, KnownLanguage.csharp);
|
t.is(statusReport[0].language, BuiltInLanguage.csharp);
|
||||||
t.is(statusReport[0].hit_kind, CacheHitKind.Partial);
|
t.is(statusReport[0].hit_kind, CacheHitKind.Partial);
|
||||||
|
|
||||||
// Check that the restored key has been returned.
|
// Check that the restored key has been returned.
|
||||||
@@ -426,7 +426,7 @@ test("uploadDependencyCaches - skips upload for a language with no cache config"
|
|||||||
const logger = getRecordingLogger(messages);
|
const logger = getRecordingLogger(messages);
|
||||||
const features = createFeatures([]);
|
const features = createFeatures([]);
|
||||||
const config = createTestConfig({
|
const config = createTestConfig({
|
||||||
languages: [KnownLanguage.actions],
|
languages: [BuiltInLanguage.actions],
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await uploadDependencyCaches(codeql, features, config, logger);
|
const result = await uploadDependencyCaches(codeql, features, config, logger);
|
||||||
@@ -444,7 +444,7 @@ test.serial(
|
|||||||
const logger = getRecordingLogger(messages);
|
const logger = getRecordingLogger(messages);
|
||||||
const features = createFeatures([]);
|
const features = createFeatures([]);
|
||||||
const config = createTestConfig({
|
const config = createTestConfig({
|
||||||
languages: [KnownLanguage.go],
|
languages: [BuiltInLanguage.go],
|
||||||
});
|
});
|
||||||
|
|
||||||
const makePatternCheckStub = sinon.stub(internal, "makePatternCheck");
|
const makePatternCheckStub = sinon.stub(internal, "makePatternCheck");
|
||||||
@@ -457,7 +457,7 @@ test.serial(
|
|||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
t.is(result.length, 1);
|
t.is(result.length, 1);
|
||||||
t.is(result[0].language, KnownLanguage.go);
|
t.is(result[0].language, BuiltInLanguage.go);
|
||||||
t.is(result[0].result, CacheStoreResult.NoHash);
|
t.is(result[0].result, CacheStoreResult.NoHash);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -483,12 +483,12 @@ test.serial(
|
|||||||
const primaryCacheKey = await cacheKey(
|
const primaryCacheKey = await cacheKey(
|
||||||
codeql,
|
codeql,
|
||||||
features,
|
features,
|
||||||
KnownLanguage.csharp,
|
BuiltInLanguage.csharp,
|
||||||
CSHARP_BASE_PATTERNS,
|
CSHARP_BASE_PATTERNS,
|
||||||
);
|
);
|
||||||
|
|
||||||
const config = createTestConfig({
|
const config = createTestConfig({
|
||||||
languages: [KnownLanguage.csharp],
|
languages: [BuiltInLanguage.csharp],
|
||||||
dependencyCachingRestoredKeys: [primaryCacheKey],
|
dependencyCachingRestoredKeys: [primaryCacheKey],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -499,7 +499,7 @@ test.serial(
|
|||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
t.is(result.length, 1);
|
t.is(result.length, 1);
|
||||||
t.is(result[0].language, KnownLanguage.csharp);
|
t.is(result[0].language, BuiltInLanguage.csharp);
|
||||||
t.is(result[0].result, CacheStoreResult.Duplicate);
|
t.is(result[0].result, CacheStoreResult.Duplicate);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -525,7 +525,7 @@ test.serial(
|
|||||||
sinon.stub(cachingUtils, "getTotalCacheSize").resolves(0);
|
sinon.stub(cachingUtils, "getTotalCacheSize").resolves(0);
|
||||||
|
|
||||||
const config = createTestConfig({
|
const config = createTestConfig({
|
||||||
languages: [KnownLanguage.csharp],
|
languages: [BuiltInLanguage.csharp],
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await uploadDependencyCaches(
|
const result = await uploadDependencyCaches(
|
||||||
@@ -535,7 +535,7 @@ test.serial(
|
|||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
t.is(result.length, 1);
|
t.is(result.length, 1);
|
||||||
t.is(result[0].language, KnownLanguage.csharp);
|
t.is(result[0].language, BuiltInLanguage.csharp);
|
||||||
t.is(result[0].result, CacheStoreResult.Empty);
|
t.is(result[0].result, CacheStoreResult.Empty);
|
||||||
|
|
||||||
checkExpectedLogMessages(t, messages, [
|
checkExpectedLogMessages(t, messages, [
|
||||||
@@ -566,7 +566,7 @@ test.serial(
|
|||||||
sinon.stub(actionsCache, "saveCache").resolves();
|
sinon.stub(actionsCache, "saveCache").resolves();
|
||||||
|
|
||||||
const config = createTestConfig({
|
const config = createTestConfig({
|
||||||
languages: [KnownLanguage.csharp],
|
languages: [BuiltInLanguage.csharp],
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await uploadDependencyCaches(
|
const result = await uploadDependencyCaches(
|
||||||
@@ -576,7 +576,7 @@ test.serial(
|
|||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
t.is(result.length, 1);
|
t.is(result.length, 1);
|
||||||
t.is(result[0].language, KnownLanguage.csharp);
|
t.is(result[0].language, BuiltInLanguage.csharp);
|
||||||
t.is(result[0].result, CacheStoreResult.Stored);
|
t.is(result[0].result, CacheStoreResult.Stored);
|
||||||
t.is(result[0].upload_size_bytes, 1024);
|
t.is(result[0].upload_size_bytes, 1024);
|
||||||
|
|
||||||
@@ -608,7 +608,7 @@ test.serial(
|
|||||||
.throws(new actionsCache.ReserveCacheError("Already in use"));
|
.throws(new actionsCache.ReserveCacheError("Already in use"));
|
||||||
|
|
||||||
const config = createTestConfig({
|
const config = createTestConfig({
|
||||||
languages: [KnownLanguage.csharp],
|
languages: [BuiltInLanguage.csharp],
|
||||||
});
|
});
|
||||||
|
|
||||||
await t.notThrowsAsync(async () => {
|
await t.notThrowsAsync(async () => {
|
||||||
@@ -619,7 +619,7 @@ test.serial(
|
|||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
t.is(result.length, 1);
|
t.is(result.length, 1);
|
||||||
t.is(result[0].language, KnownLanguage.csharp);
|
t.is(result[0].language, BuiltInLanguage.csharp);
|
||||||
t.is(result[0].result, CacheStoreResult.Duplicate);
|
t.is(result[0].result, CacheStoreResult.Duplicate);
|
||||||
|
|
||||||
checkExpectedLogMessages(t, messages, ["Not uploading cache for"]);
|
checkExpectedLogMessages(t, messages, ["Not uploading cache for"]);
|
||||||
@@ -647,7 +647,7 @@ test.serial("uploadDependencyCaches - throws other exceptions", async (t) => {
|
|||||||
sinon.stub(actionsCache, "saveCache").throws();
|
sinon.stub(actionsCache, "saveCache").throws();
|
||||||
|
|
||||||
const config = createTestConfig({
|
const config = createTestConfig({
|
||||||
languages: [KnownLanguage.csharp],
|
languages: [BuiltInLanguage.csharp],
|
||||||
});
|
});
|
||||||
|
|
||||||
await t.throwsAsync(async () => {
|
await t.throwsAsync(async () => {
|
||||||
@@ -659,7 +659,7 @@ test("getFeaturePrefix - returns empty string if no features are enabled", async
|
|||||||
const codeql = createStubCodeQL({});
|
const codeql = createStubCodeQL({});
|
||||||
const features = createFeatures([]);
|
const features = createFeatures([]);
|
||||||
|
|
||||||
for (const knownLanguage of Object.values(KnownLanguage)) {
|
for (const knownLanguage of Object.values(BuiltInLanguage)) {
|
||||||
const result = await getFeaturePrefix(codeql, features, knownLanguage);
|
const result = await getFeaturePrefix(codeql, features, knownLanguage);
|
||||||
t.deepEqual(result, "", `Expected no feature prefix for ${knownLanguage}`);
|
t.deepEqual(result, "", `Expected no feature prefix for ${knownLanguage}`);
|
||||||
}
|
}
|
||||||
@@ -669,7 +669,11 @@ test("getFeaturePrefix - C# - returns prefix if CsharpNewCacheKey is enabled", a
|
|||||||
const codeql = createStubCodeQL({});
|
const codeql = createStubCodeQL({});
|
||||||
const features = createFeatures([Feature.CsharpNewCacheKey]);
|
const features = createFeatures([Feature.CsharpNewCacheKey]);
|
||||||
|
|
||||||
const result = await getFeaturePrefix(codeql, features, KnownLanguage.csharp);
|
const result = await getFeaturePrefix(
|
||||||
|
codeql,
|
||||||
|
features,
|
||||||
|
BuiltInLanguage.csharp,
|
||||||
|
);
|
||||||
t.notDeepEqual(result, "");
|
t.notDeepEqual(result, "");
|
||||||
t.assert(result.endsWith("-"));
|
t.assert(result.endsWith("-"));
|
||||||
// Check the length of the prefix, which should correspond to `cacheKeyHashLength` + 1 for the trailing `-`.
|
// Check the length of the prefix, which should correspond to `cacheKeyHashLength` + 1 for the trailing `-`.
|
||||||
@@ -680,9 +684,9 @@ test("getFeaturePrefix - non-C# - returns '' if CsharpNewCacheKey is enabled", a
|
|||||||
const codeql = createStubCodeQL({});
|
const codeql = createStubCodeQL({});
|
||||||
const features = createFeatures([Feature.CsharpNewCacheKey]);
|
const features = createFeatures([Feature.CsharpNewCacheKey]);
|
||||||
|
|
||||||
for (const knownLanguage of Object.values(KnownLanguage)) {
|
for (const knownLanguage of Object.values(BuiltInLanguage)) {
|
||||||
// Skip C# since we expect a result for it, which is tested in the previous test.
|
// Skip C# since we expect a result for it, which is tested in the previous test.
|
||||||
if (knownLanguage === KnownLanguage.csharp) {
|
if (knownLanguage === BuiltInLanguage.csharp) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const result = await getFeaturePrefix(codeql, features, knownLanguage);
|
const result = await getFeaturePrefix(codeql, features, knownLanguage);
|
||||||
@@ -694,7 +698,11 @@ test("getFeaturePrefix - C# - returns prefix if CsharpCacheBuildModeNone is enab
|
|||||||
const codeql = createStubCodeQL({});
|
const codeql = createStubCodeQL({});
|
||||||
const features = createFeatures([Feature.CsharpCacheBuildModeNone]);
|
const features = createFeatures([Feature.CsharpCacheBuildModeNone]);
|
||||||
|
|
||||||
const result = await getFeaturePrefix(codeql, features, KnownLanguage.csharp);
|
const result = await getFeaturePrefix(
|
||||||
|
codeql,
|
||||||
|
features,
|
||||||
|
BuiltInLanguage.csharp,
|
||||||
|
);
|
||||||
t.notDeepEqual(result, "");
|
t.notDeepEqual(result, "");
|
||||||
t.assert(result.endsWith("-"));
|
t.assert(result.endsWith("-"));
|
||||||
// Check the length of the prefix, which should correspond to `cacheKeyHashLength` + 1 for the trailing `-`.
|
// Check the length of the prefix, which should correspond to `cacheKeyHashLength` + 1 for the trailing `-`.
|
||||||
@@ -705,9 +713,9 @@ test("getFeaturePrefix - non-C# - returns '' if CsharpCacheBuildModeNone is enab
|
|||||||
const codeql = createStubCodeQL({});
|
const codeql = createStubCodeQL({});
|
||||||
const features = createFeatures([Feature.CsharpCacheBuildModeNone]);
|
const features = createFeatures([Feature.CsharpCacheBuildModeNone]);
|
||||||
|
|
||||||
for (const knownLanguage of Object.values(KnownLanguage)) {
|
for (const knownLanguage of Object.values(BuiltInLanguage)) {
|
||||||
// Skip C# since we expect a result for it, which is tested in the previous test.
|
// Skip C# since we expect a result for it, which is tested in the previous test.
|
||||||
if (knownLanguage === KnownLanguage.csharp) {
|
if (knownLanguage === BuiltInLanguage.csharp) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const result = await getFeaturePrefix(codeql, features, knownLanguage);
|
const result = await getFeaturePrefix(codeql, features, knownLanguage);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { CodeQL } from "./codeql";
|
|||||||
import { Config } from "./config-utils";
|
import { Config } from "./config-utils";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { Feature, FeatureEnablement } from "./feature-flags";
|
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||||
import { KnownLanguage, Language } from "./languages";
|
import { BuiltInLanguage, Language } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import { getErrorMessage, getRequiredEnvParam } from "./util";
|
import { getErrorMessage, getRequiredEnvParam } from "./util";
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ export async function getFeaturePrefix(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (language === KnownLanguage.csharp) {
|
if (language === BuiltInLanguage.csharp) {
|
||||||
await addFeatureIfEnabled(Feature.CsharpNewCacheKey);
|
await addFeatureIfEnabled(Feature.CsharpNewCacheKey);
|
||||||
await addFeatureIfEnabled(Feature.CsharpCacheBuildModeNone);
|
await addFeatureIfEnabled(Feature.CsharpCacheBuildModeNone);
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-2
@@ -72,6 +72,13 @@ let unwrittenDiagnostics: UnwrittenDiagnostic[] = [];
|
|||||||
*/
|
*/
|
||||||
let unwrittenDefaultLanguageDiagnostics: DiagnosticMessage[] = [];
|
let unwrittenDefaultLanguageDiagnostics: DiagnosticMessage[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counter used to generate a unique suffix for each diagnostic filename, so that
|
||||||
|
* two diagnostics produced within the same millisecond do not overwrite each
|
||||||
|
* other on disk.
|
||||||
|
*/
|
||||||
|
let diagnosticCounter = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new diagnostic message with the specified id and name, as well as optional additional data.
|
* Constructs a new diagnostic message with the specified id and name, as well as optional additional data.
|
||||||
*
|
*
|
||||||
@@ -167,10 +174,18 @@ function writeDiagnostic(
|
|||||||
// Create the directory if it doesn't exist yet.
|
// Create the directory if it doesn't exist yet.
|
||||||
mkdirSync(diagnosticsPath, { recursive: true });
|
mkdirSync(diagnosticsPath, { recursive: true });
|
||||||
|
|
||||||
|
// Include a monotonically increasing suffix to avoid filename collisions
|
||||||
|
// between diagnostics produced within the same millisecond.
|
||||||
|
const uniqueSuffix = (diagnosticCounter++).toString();
|
||||||
|
// We should only need to remove colons, but to be defensive, only allow a restricted set of
|
||||||
|
// characters.
|
||||||
|
const sanitizedTimestamp = diagnostic.timestamp.replace(
|
||||||
|
/[^a-zA-Z0-9.-]/g,
|
||||||
|
"",
|
||||||
|
);
|
||||||
const jsonPath = path.resolve(
|
const jsonPath = path.resolve(
|
||||||
diagnosticsPath,
|
diagnosticsPath,
|
||||||
// Remove colons from the timestamp as these are not allowed in Windows filenames.
|
`codeql-action-${sanitizedTimestamp}-${uniqueSuffix}.json`,
|
||||||
`codeql-action-${diagnostic.timestamp.replaceAll(":", "")}.json`,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
writeFileSync(jsonPath, JSON.stringify(diagnostic));
|
writeFileSync(jsonPath, JSON.stringify(diagnostic));
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
mockCodeQLVersion,
|
mockCodeQLVersion,
|
||||||
mockFeatureFlagApiEndpoint,
|
mockFeatureFlagApiEndpoint,
|
||||||
setupActionsVars,
|
setupActionsVars,
|
||||||
|
makeMacro,
|
||||||
} from "./testing-utils";
|
} from "./testing-utils";
|
||||||
import { GitHubVariant, withTmpDir } from "./util";
|
import { GitHubVariant, withTmpDir } from "./util";
|
||||||
import type { GitHubVersion } from "./util";
|
import type { GitHubVersion } from "./util";
|
||||||
@@ -42,10 +43,9 @@ const defaultTestCase: DiffInformedAnalysisTestCase = {
|
|||||||
codeQLVersion: "2.21.0",
|
codeQLVersion: "2.21.0",
|
||||||
};
|
};
|
||||||
|
|
||||||
const testShouldPerformDiffInformedAnalysis = test.macro({
|
const testShouldPerformDiffInformedAnalysis = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext,
|
t: ExecutionContext,
|
||||||
_title: string,
|
|
||||||
partialTestCase: Partial<DiffInformedAnalysisTestCase>,
|
partialTestCase: Partial<DiffInformedAnalysisTestCase>,
|
||||||
expectedResult: boolean,
|
expectedResult: boolean,
|
||||||
) => {
|
) => {
|
||||||
@@ -94,18 +94,16 @@ const testShouldPerformDiffInformedAnalysis = test.macro({
|
|||||||
getPullRequestBranchesStub.restore();
|
getPullRequestBranchesStub.restore();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: (_, title) => `shouldPerformDiffInformedAnalysis: ${title}`,
|
title: (title) => `shouldPerformDiffInformedAnalysis: ${title}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns true in the default test case",
|
"returns true in the default test case",
|
||||||
{},
|
{},
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns false when feature flag is disabled from the API",
|
"returns false when feature flag is disabled from the API",
|
||||||
{
|
{
|
||||||
featureEnabled: false,
|
featureEnabled: false,
|
||||||
@@ -113,8 +111,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns false when CODEQL_ACTION_DIFF_INFORMED_QUERIES is set to false",
|
"returns false when CODEQL_ACTION_DIFF_INFORMED_QUERIES is set to false",
|
||||||
{
|
{
|
||||||
featureEnabled: true,
|
featureEnabled: true,
|
||||||
@@ -123,8 +120,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns true when CODEQL_ACTION_DIFF_INFORMED_QUERIES is set to true",
|
"returns true when CODEQL_ACTION_DIFF_INFORMED_QUERIES is set to true",
|
||||||
{
|
{
|
||||||
featureEnabled: false,
|
featureEnabled: false,
|
||||||
@@ -133,8 +129,7 @@ test.serial(
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns false for CodeQL version 2.20.0",
|
"returns false for CodeQL version 2.20.0",
|
||||||
{
|
{
|
||||||
codeQLVersion: "2.20.0",
|
codeQLVersion: "2.20.0",
|
||||||
@@ -142,8 +137,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns false for invalid GHES version",
|
"returns false for invalid GHES version",
|
||||||
{
|
{
|
||||||
gitHubVersion: {
|
gitHubVersion: {
|
||||||
@@ -154,8 +148,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns false for GHES version 3.18.5",
|
"returns false for GHES version 3.18.5",
|
||||||
{
|
{
|
||||||
gitHubVersion: {
|
gitHubVersion: {
|
||||||
@@ -166,8 +159,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns true for GHES version 3.19.0",
|
"returns true for GHES version 3.19.0",
|
||||||
{
|
{
|
||||||
gitHubVersion: {
|
gitHubVersion: {
|
||||||
@@ -178,8 +170,7 @@ test.serial(
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testShouldPerformDiffInformedAnalysis.serial(
|
||||||
testShouldPerformDiffInformedAnalysis,
|
|
||||||
"returns false when not a pull request",
|
"returns false when not a pull request",
|
||||||
{
|
{
|
||||||
pullRequestBranches: undefined,
|
pullRequestBranches: undefined,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export enum DocUrl {
|
|||||||
CODEQL_BUILD_MODES = "https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#codeql-build-modes",
|
CODEQL_BUILD_MODES = "https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#codeql-build-modes",
|
||||||
DEFINE_ENV_VARIABLES = "https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow",
|
DEFINE_ENV_VARIABLES = "https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow",
|
||||||
DELETE_ACTIONS_CACHE_ENTRIES = "https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manage-caches#deleting-cache-entries",
|
DELETE_ACTIONS_CACHE_ENTRIES = "https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manage-caches#deleting-cache-entries",
|
||||||
|
PRIVATE_REGISTRY_LOGS = "https://docs.github.com/en/code-security/reference/code-scanning/code-scanning-logs#diagnostic-information-for-private-package-registries",
|
||||||
SCANNING_ON_PUSH = "https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#scanning-on-push",
|
SCANNING_ON_PUSH = "https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#scanning-on-push",
|
||||||
SPECIFY_BUILD_STEPS_MANUALLY = "https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#about-specifying-build-steps-manually",
|
SPECIFY_BUILD_STEPS_MANUALLY = "https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#about-specifying-build-steps-manually",
|
||||||
SYSTEM_REQUIREMENTS = "https://codeql.github.com/docs/codeql-overview/system-requirements/",
|
SYSTEM_REQUIREMENTS = "https://codeql.github.com/docs/codeql-overview/system-requirements/",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
createFeatures,
|
createFeatures,
|
||||||
createTestConfig,
|
createTestConfig,
|
||||||
DEFAULT_ACTIONS_VARS,
|
DEFAULT_ACTIONS_VARS,
|
||||||
|
makeMacro,
|
||||||
makeVersionInfo,
|
makeVersionInfo,
|
||||||
RecordingLogger,
|
RecordingLogger,
|
||||||
setupActionsVars,
|
setupActionsVars,
|
||||||
@@ -796,7 +797,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const skippedUploadTest = test.macro({
|
const skippedUploadTest = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
config: Partial<configUtils.Config>,
|
config: Partial<configUtils.Config>,
|
||||||
@@ -823,9 +824,8 @@ const skippedUploadTest = test.macro({
|
|||||||
`tryUploadSarifIfRunFailed - skips upload ${providedTitle}`,
|
`tryUploadSarifIfRunFailed - skips upload ${providedTitle}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
skippedUploadTest.serial(
|
||||||
"without CodeQL command",
|
"without CodeQL command",
|
||||||
skippedUploadTest,
|
|
||||||
// No codeQLCmd
|
// No codeQLCmd
|
||||||
{
|
{
|
||||||
analysisKinds: [AnalysisKind.RiskAssessment],
|
analysisKinds: [AnalysisKind.RiskAssessment],
|
||||||
@@ -834,9 +834,8 @@ test.serial(
|
|||||||
"CodeQL command not found",
|
"CodeQL command not found",
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
skippedUploadTest.serial(
|
||||||
"if no language is configured",
|
"if no language is configured",
|
||||||
skippedUploadTest,
|
|
||||||
// No explicit language configuration
|
// No explicit language configuration
|
||||||
{
|
{
|
||||||
analysisKinds: [AnalysisKind.RiskAssessment],
|
analysisKinds: [AnalysisKind.RiskAssessment],
|
||||||
@@ -845,9 +844,8 @@ test.serial(
|
|||||||
"Unexpectedly, the configuration is not for a single language.",
|
"Unexpectedly, the configuration is not for a single language.",
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
skippedUploadTest.serial(
|
||||||
"if multiple languages is configured",
|
"if multiple languages is configured",
|
||||||
skippedUploadTest,
|
|
||||||
// Multiple explicit languages configured
|
// Multiple explicit languages configured
|
||||||
{
|
{
|
||||||
analysisKinds: [AnalysisKind.RiskAssessment],
|
analysisKinds: [AnalysisKind.RiskAssessment],
|
||||||
|
|||||||
+22
-17
@@ -58,7 +58,7 @@ import {
|
|||||||
initConfig,
|
initConfig,
|
||||||
runDatabaseInitCluster,
|
runDatabaseInitCluster,
|
||||||
} from "./init";
|
} from "./init";
|
||||||
import { JavaEnvVars, KnownLanguage } from "./languages";
|
import { JavaEnvVars, BuiltInLanguage } from "./languages";
|
||||||
import { getActionsLogger, Logger, withGroupAsync } from "./logging";
|
import { getActionsLogger, Logger, withGroupAsync } from "./logging";
|
||||||
import {
|
import {
|
||||||
downloadOverlayBaseDatabaseFromCache,
|
downloadOverlayBaseDatabaseFromCache,
|
||||||
@@ -330,7 +330,7 @@ async function run(startedAt: Date) {
|
|||||||
// requested rust - don't enable it via language autodetection.
|
// requested rust - don't enable it via language autodetection.
|
||||||
configUtils
|
configUtils
|
||||||
.getRawLanguagesNoAutodetect(getOptionalInput("languages"))
|
.getRawLanguagesNoAutodetect(getOptionalInput("languages"))
|
||||||
.includes(KnownLanguage.rust)
|
.includes(BuiltInLanguage.rust)
|
||||||
) {
|
) {
|
||||||
const experimental = "2.19.3";
|
const experimental = "2.19.3";
|
||||||
const publicPreview = "2.22.1";
|
const publicPreview = "2.22.1";
|
||||||
@@ -390,7 +390,7 @@ async function run(startedAt: Date) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
config.languages.includes(KnownLanguage.swift) &&
|
config.languages.includes(BuiltInLanguage.swift) &&
|
||||||
process.platform !== "darwin"
|
process.platform !== "darwin"
|
||||||
) {
|
) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
@@ -465,18 +465,23 @@ async function run(startedAt: Date) {
|
|||||||
// necessary preparations. So, in that mode, we would assume that
|
// necessary preparations. So, in that mode, we would assume that
|
||||||
// everything is in order and let the analysis fail if that turns out not
|
// everything is in order and let the analysis fail if that turns out not
|
||||||
// to be the case.
|
// to be the case.
|
||||||
overlayBaseDatabaseStats = await downloadOverlayBaseDatabaseFromCache(
|
await withGroupAsync(
|
||||||
codeql,
|
"Checking cache for overlay-base database",
|
||||||
config,
|
async () => {
|
||||||
logger,
|
overlayBaseDatabaseStats = await downloadOverlayBaseDatabaseFromCache(
|
||||||
|
codeql,
|
||||||
|
config,
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
if (!overlayBaseDatabaseStats) {
|
||||||
|
config.overlayDatabaseMode = OverlayDatabaseMode.None;
|
||||||
|
logger.info(
|
||||||
|
"No overlay-base database found in cache, " +
|
||||||
|
`reverting overlay database mode to ${OverlayDatabaseMode.None}.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
if (!overlayBaseDatabaseStats) {
|
|
||||||
config.overlayDatabaseMode = OverlayDatabaseMode.None;
|
|
||||||
logger.info(
|
|
||||||
"No overlay-base database found in cache, " +
|
|
||||||
`reverting overlay database mode to ${OverlayDatabaseMode.None}.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.overlayDatabaseMode !== OverlayDatabaseMode.Overlay) {
|
if (config.overlayDatabaseMode !== OverlayDatabaseMode.Overlay) {
|
||||||
@@ -509,7 +514,7 @@ async function run(startedAt: Date) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
config.languages.includes(KnownLanguage.go) &&
|
config.languages.includes(BuiltInLanguage.go) &&
|
||||||
process.platform === "linux"
|
process.platform === "linux"
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
@@ -567,7 +572,7 @@ async function run(startedAt: Date) {
|
|||||||
if (e instanceof FileCmdNotFoundError) {
|
if (e instanceof FileCmdNotFoundError) {
|
||||||
addDiagnostic(
|
addDiagnostic(
|
||||||
config,
|
config,
|
||||||
KnownLanguage.go,
|
BuiltInLanguage.go,
|
||||||
makeDiagnostic(
|
makeDiagnostic(
|
||||||
"go/workflow/file-program-unavailable",
|
"go/workflow/file-program-unavailable",
|
||||||
"The `file` program is required on Linux, but does not appear to be installed",
|
"The `file` program is required on Linux, but does not appear to be installed",
|
||||||
@@ -661,7 +666,7 @@ async function run(startedAt: Date) {
|
|||||||
(await codeQlVersionAtLeast(codeql, CODEQL_VERSION_JAR_MINIMIZATION)) &&
|
(await codeQlVersionAtLeast(codeql, CODEQL_VERSION_JAR_MINIMIZATION)) &&
|
||||||
config.dependencyCachingEnabled &&
|
config.dependencyCachingEnabled &&
|
||||||
config.buildMode === BuildMode.None &&
|
config.buildMode === BuildMode.None &&
|
||||||
config.languages.includes(KnownLanguage.java)
|
config.languages.includes(BuiltInLanguage.java)
|
||||||
) {
|
) {
|
||||||
core.exportVariable(
|
core.exportVariable(
|
||||||
EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS,
|
EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS,
|
||||||
|
|||||||
+49
-61
@@ -15,13 +15,14 @@ import {
|
|||||||
getFileCoverageInformationEnabled,
|
getFileCoverageInformationEnabled,
|
||||||
logFileCoverageOnPrsDeprecationWarning,
|
logFileCoverageOnPrsDeprecationWarning,
|
||||||
} from "./init";
|
} from "./init";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import {
|
import {
|
||||||
createFeatures,
|
createFeatures,
|
||||||
LoggedMessage,
|
LoggedMessage,
|
||||||
createTestConfig,
|
createTestConfig,
|
||||||
getRecordingLogger,
|
getRecordingLogger,
|
||||||
setupTests,
|
setupTests,
|
||||||
|
makeMacro,
|
||||||
} from "./testing-utils";
|
} from "./testing-utils";
|
||||||
import { ConfigurationError, withTmpDir } from "./util";
|
import { ConfigurationError, withTmpDir } from "./util";
|
||||||
|
|
||||||
@@ -152,16 +153,15 @@ test("cleanupDatabaseClusterDirectory can disable warning with options", async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
type PackInfo = {
|
type PackInfo = {
|
||||||
language: KnownLanguage;
|
language: BuiltInLanguage;
|
||||||
packinfoContents: string | undefined;
|
packinfoContents: string | undefined;
|
||||||
sourceOnlyPack?: boolean;
|
sourceOnlyPack?: boolean;
|
||||||
qlpackFileName?: string;
|
qlpackFileName?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const testCheckPacksForOverlayCompatibility = test.macro({
|
const testCheckPacksForOverlayCompatibility = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext,
|
t: ExecutionContext,
|
||||||
_title: string,
|
|
||||||
{
|
{
|
||||||
cliOverlayVersion,
|
cliOverlayVersion,
|
||||||
languages,
|
languages,
|
||||||
@@ -169,13 +169,13 @@ const testCheckPacksForOverlayCompatibility = test.macro({
|
|||||||
expectedResult,
|
expectedResult,
|
||||||
}: {
|
}: {
|
||||||
cliOverlayVersion: number | undefined;
|
cliOverlayVersion: number | undefined;
|
||||||
languages: KnownLanguage[];
|
languages: BuiltInLanguage[];
|
||||||
packs: Record<string, PackInfo>;
|
packs: Record<string, PackInfo>;
|
||||||
expectedResult: boolean;
|
expectedResult: boolean;
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
await withTmpDir(async (tmpDir) => {
|
await withTmpDir(async (tmpDir) => {
|
||||||
const packDirsByLanguage = new Map<KnownLanguage, string[]>();
|
const packDirsByLanguage = new Map<BuiltInLanguage, string[]>();
|
||||||
|
|
||||||
for (const [packName, packInfo] of Object.entries(packs)) {
|
for (const [packName, packInfo] of Object.entries(packs)) {
|
||||||
const packPath = path.join(tmpDir, packName);
|
const packPath = path.join(tmpDir, packName);
|
||||||
@@ -234,18 +234,17 @@ const testCheckPacksForOverlayCompatibility = test.macro({
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: (_, title) => `checkPacksForOverlayCompatibility: ${title}`,
|
title: (title) => `checkPacksForOverlayCompatibility: ${title}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns false when CLI does not support overlay",
|
"returns false when CLI does not support overlay",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: undefined,
|
cliOverlayVersion: undefined,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -253,26 +252,24 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns true when there are no query packs",
|
"returns true when there are no query packs",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {},
|
packs: {},
|
||||||
expectedResult: true,
|
expectedResult: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns true when query pack has not been compiled",
|
"returns true when query pack has not been compiled",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: undefined,
|
packinfoContents: undefined,
|
||||||
sourceOnlyPack: true,
|
sourceOnlyPack: true,
|
||||||
},
|
},
|
||||||
@@ -281,15 +278,14 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns true when query pack has expected overlay version",
|
"returns true when query pack has expected overlay version",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -297,19 +293,18 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns true when query packs for all languages to analyze are compatible",
|
"returns true when query packs for all languages to analyze are compatible",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.cpp, KnownLanguage.java],
|
languages: [BuiltInLanguage.cpp, BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/cpp-queries": {
|
"codeql/cpp-queries": {
|
||||||
language: KnownLanguage.cpp,
|
language: BuiltInLanguage.cpp,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -317,19 +312,18 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns true when query pack for a language not analyzed is incompatible",
|
"returns true when query pack for a language not analyzed is incompatible",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/cpp-queries": {
|
"codeql/cpp-queries": {
|
||||||
language: KnownLanguage.cpp,
|
language: BuiltInLanguage.cpp,
|
||||||
packinfoContents: undefined,
|
packinfoContents: undefined,
|
||||||
},
|
},
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -337,19 +331,18 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns false when query pack for a language to analyze is incompatible",
|
"returns false when query pack for a language to analyze is incompatible",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.cpp, KnownLanguage.java],
|
languages: [BuiltInLanguage.cpp, BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/cpp-queries": {
|
"codeql/cpp-queries": {
|
||||||
language: KnownLanguage.cpp,
|
language: BuiltInLanguage.cpp,
|
||||||
packinfoContents: '{"overlayVersion":1}',
|
packinfoContents: '{"overlayVersion":1}',
|
||||||
},
|
},
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -357,19 +350,18 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns false when query pack is missing .packinfo",
|
"returns false when query pack is missing .packinfo",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
"custom/queries": {
|
"custom/queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: undefined,
|
packinfoContents: undefined,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -377,19 +369,18 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns false when query pack has different overlay version",
|
"returns false when query pack has different overlay version",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
"custom/queries": {
|
"custom/queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":1}',
|
packinfoContents: '{"overlayVersion":1}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -397,19 +388,18 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns false when query pack is missing overlayVersion in .packinfo",
|
"returns false when query pack is missing overlayVersion in .packinfo",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
"custom/queries": {
|
"custom/queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: "{}",
|
packinfoContents: "{}",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -417,19 +407,18 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns false when .packinfo is not valid JSON",
|
"returns false when .packinfo is not valid JSON",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
},
|
},
|
||||||
"custom/queries": {
|
"custom/queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: "this_is_not_valid_json",
|
packinfoContents: "this_is_not_valid_json",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -437,15 +426,14 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
testCheckPacksForOverlayCompatibility(
|
||||||
testCheckPacksForOverlayCompatibility,
|
|
||||||
"returns true when query pack uses codeql-pack.yml filename",
|
"returns true when query pack uses codeql-pack.yml filename",
|
||||||
{
|
{
|
||||||
cliOverlayVersion: 2,
|
cliOverlayVersion: 2,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
packs: {
|
packs: {
|
||||||
"codeql/java-queries": {
|
"codeql/java-queries": {
|
||||||
language: KnownLanguage.java,
|
language: BuiltInLanguage.java,
|
||||||
packinfoContents: '{"overlayVersion":2}',
|
packinfoContents: '{"overlayVersion":2}',
|
||||||
qlpackFileName: "codeql-pack.yml",
|
qlpackFileName: "codeql-pack.yml",
|
||||||
},
|
},
|
||||||
|
|||||||
+2
-2
@@ -26,7 +26,7 @@ import {
|
|||||||
RepositoryProperties,
|
RepositoryProperties,
|
||||||
RepositoryPropertyName,
|
RepositoryPropertyName,
|
||||||
} from "./feature-flags/properties";
|
} from "./feature-flags/properties";
|
||||||
import { KnownLanguage, Language } from "./languages";
|
import { BuiltInLanguage, Language } from "./languages";
|
||||||
import { Logger, withGroupAsync } from "./logging";
|
import { Logger, withGroupAsync } from "./logging";
|
||||||
import { ToolsSource } from "./setup-codeql";
|
import { ToolsSource } from "./setup-codeql";
|
||||||
import { ZstdAvailability } from "./tar";
|
import { ZstdAvailability } from "./tar";
|
||||||
@@ -235,7 +235,7 @@ export async function checkInstallPython311(
|
|||||||
codeql: CodeQL,
|
codeql: CodeQL,
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
languages.includes(KnownLanguage.python) &&
|
languages.includes(BuiltInLanguage.python) &&
|
||||||
process.platform === "win32" &&
|
process.platform === "win32" &&
|
||||||
!(await codeql.getVersion()).features?.supportsPython312
|
!(await codeql.getVersion()).features?.supportsPython312
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import test from "ava";
|
||||||
|
|
||||||
|
import { setupTests } from "../testing-utils";
|
||||||
|
|
||||||
|
import * as json from ".";
|
||||||
|
|
||||||
|
setupTests(test);
|
||||||
|
|
||||||
|
const testSchema = {
|
||||||
|
requiredKey: json.string,
|
||||||
|
};
|
||||||
|
|
||||||
|
const optionalSchema = {
|
||||||
|
optionalKey: json.optional(json.string),
|
||||||
|
};
|
||||||
|
|
||||||
|
test("validateSchema - required properties are required", async (t) => {
|
||||||
|
t.false(json.validateSchema(testSchema, {}));
|
||||||
|
t.false(json.validateSchema(testSchema, { requiredKey: undefined }));
|
||||||
|
t.false(json.validateSchema(testSchema, { requiredKey: null }));
|
||||||
|
t.false(json.validateSchema(testSchema, { requiredKey: 0 }));
|
||||||
|
t.false(json.validateSchema(testSchema, { requiredKey: 123 }));
|
||||||
|
t.false(json.validateSchema(testSchema, { requiredKey: false }));
|
||||||
|
t.false(json.validateSchema(testSchema, { requiredKey: true }));
|
||||||
|
t.false(json.validateSchema(testSchema, { requiredKey: [] }));
|
||||||
|
t.false(json.validateSchema(testSchema, { requiredKey: {} }));
|
||||||
|
t.true(json.validateSchema(testSchema, { requiredKey: "" }));
|
||||||
|
t.true(json.validateSchema(testSchema, { requiredKey: "foo" }));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("validateSchema - optional properties are optional", async (t) => {
|
||||||
|
// Optional fields may be absent
|
||||||
|
t.true(json.validateSchema(optionalSchema, {}));
|
||||||
|
t.true(json.validateSchema(optionalSchema, { optionalKey: undefined }));
|
||||||
|
t.true(json.validateSchema(optionalSchema, { optionalKey: null }));
|
||||||
|
|
||||||
|
// But, if present, should have the expected type
|
||||||
|
t.false(json.validateSchema(optionalSchema, { optionalKey: 0 }));
|
||||||
|
t.false(json.validateSchema(optionalSchema, { optionalKey: 123 }));
|
||||||
|
t.false(json.validateSchema(optionalSchema, { optionalKey: false }));
|
||||||
|
t.false(json.validateSchema(optionalSchema, { optionalKey: true }));
|
||||||
|
t.false(json.validateSchema(optionalSchema, { optionalKey: [] }));
|
||||||
|
t.false(json.validateSchema(optionalSchema, { optionalKey: {} }));
|
||||||
|
t.true(json.validateSchema(optionalSchema, { optionalKey: "" }));
|
||||||
|
t.true(json.validateSchema(optionalSchema, { optionalKey: "foo" }));
|
||||||
|
});
|
||||||
@@ -36,3 +36,82 @@ export function isStringOrUndefined(
|
|||||||
): value is string | undefined {
|
): value is string | undefined {
|
||||||
return value === undefined || isString(value);
|
return value === undefined || isString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a field of type `T` in a schema.
|
||||||
|
* Carries a validation function and flag indicating whether the field is required or not.
|
||||||
|
*/
|
||||||
|
export type Validator<T> = {
|
||||||
|
validate: (val: unknown) => val is T;
|
||||||
|
required: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Extracts `T` from `Validator<T>`. */
|
||||||
|
export type UnwrapValidator<V> = V extends Validator<infer A> ? A : never;
|
||||||
|
|
||||||
|
/** A validator for string fields in schemas. */
|
||||||
|
export const string = {
|
||||||
|
validate: isString,
|
||||||
|
required: true,
|
||||||
|
} as const satisfies Validator<string>;
|
||||||
|
|
||||||
|
/** Transforms a validator to be optional. */
|
||||||
|
export function optional<T>(validator: Validator<T>) {
|
||||||
|
return {
|
||||||
|
validate: (val: unknown) => {
|
||||||
|
return val === undefined || val === null || validator.validate(val);
|
||||||
|
},
|
||||||
|
required: false,
|
||||||
|
} as const satisfies Validator<T | undefined | null>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Represents an arbitrary object schema. */
|
||||||
|
export type Schema = Record<string, Validator<any>>;
|
||||||
|
|
||||||
|
/** Extracts the required keys from `S`. */
|
||||||
|
export type RequiredKeys<S extends Schema> = {
|
||||||
|
[K in keyof S]: S[K]["required"] extends true ? K : never;
|
||||||
|
}[keyof S];
|
||||||
|
|
||||||
|
/** Extracts optional keys from `S`. */
|
||||||
|
export type OptionalKeys<S extends Schema> = {
|
||||||
|
[K in keyof S]: S[K]["required"] extends true ? never : K;
|
||||||
|
}[keyof S];
|
||||||
|
|
||||||
|
/** Constructs an object type corresponding to a schema. */
|
||||||
|
export type FromSchema<S extends Schema> = {
|
||||||
|
[K in RequiredKeys<S>]: UnwrapValidator<S[K]>;
|
||||||
|
} & { [K in OptionalKeys<S>]?: UnwrapValidator<S[K]> };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates that `obj` satisfies at least `schema`. Additional keys are accepted.
|
||||||
|
*
|
||||||
|
* @param schema The schema to validate against.
|
||||||
|
* @param obj The object to validate.
|
||||||
|
* @returns Asserts that `obj` is of the `schema`'s type if validation is successful.
|
||||||
|
*/
|
||||||
|
export function validateSchema<S extends Schema>(
|
||||||
|
schema: S,
|
||||||
|
obj: UnvalidatedObject<any>,
|
||||||
|
): obj is FromSchema<S> {
|
||||||
|
for (const [key, validator] of Object.entries(schema)) {
|
||||||
|
const hasKey = key in obj;
|
||||||
|
|
||||||
|
// If the property is required, but absent, fail.
|
||||||
|
if (validator.required && !hasKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the property is required, but undefined or null, fail.
|
||||||
|
if (validator.required && (obj[key] === undefined || obj[key] === null)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the property is present, validate it.
|
||||||
|
if (hasKey && !validator.validate(obj[key])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import { ExecutionContext } from "ava";
|
||||||
|
|
||||||
|
import * as json from ".";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an object based on `schema` for unit tests.
|
||||||
|
* Assumes that all keys in `schema` have string values.
|
||||||
|
*
|
||||||
|
* @param includeOptional Whether to include optional properties.
|
||||||
|
* @param schema The schema to base the object on.
|
||||||
|
* @returns An object that satisfies `schema`.
|
||||||
|
*/
|
||||||
|
export function makeFromSchema<S extends json.Schema>(
|
||||||
|
includeOptional: boolean,
|
||||||
|
schema: S,
|
||||||
|
): json.FromSchema<S> {
|
||||||
|
const result = {};
|
||||||
|
for (const [key, validator] of Object.entries(schema)) {
|
||||||
|
if (!validator.required && !includeOptional) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result[key] = `value-for-${key}`;
|
||||||
|
}
|
||||||
|
return result as json.FromSchema<S>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Options for `withSchemaMatrix`. */
|
||||||
|
export interface SchemaMatrixOptions {
|
||||||
|
/** Whether cases where the properties are entirely absent should be excluded. */
|
||||||
|
excludeAbsent?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a test matrix of possible objects for `schema`: all required properties
|
||||||
|
* plus all permutations of possible states for the optional properties.
|
||||||
|
*
|
||||||
|
* @param schema The schema to construct a test matrix for.
|
||||||
|
* @param body The test body to call with each value from the test matrix.
|
||||||
|
*/
|
||||||
|
export function withSchemaMatrix<S extends json.Schema>(
|
||||||
|
t: ExecutionContext<any>,
|
||||||
|
schema: S,
|
||||||
|
opts: SchemaMatrixOptions,
|
||||||
|
body: (value: json.FromSchema<S>) => void,
|
||||||
|
): void {
|
||||||
|
// Construct a base object that includes all required properties.
|
||||||
|
const required = makeFromSchema(false, schema);
|
||||||
|
|
||||||
|
// Identify optional properties.
|
||||||
|
const optionalKeys: Array<keyof S> = [];
|
||||||
|
|
||||||
|
for (const [key, validator] of Object.entries(schema)) {
|
||||||
|
if (!validator.required) {
|
||||||
|
optionalKeys.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const optionalValues = (key: keyof S) => [
|
||||||
|
null,
|
||||||
|
undefined,
|
||||||
|
`value-for-${String(key)}`,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Constructs an array of test objects, starting with `required` and combining it with all
|
||||||
|
// possible states of each optional property. For example, with default settings:
|
||||||
|
//
|
||||||
|
// For { requiredKey: string }, we get: `[{ requiredKey: "some-string-value" }]`
|
||||||
|
//
|
||||||
|
// For { requiredKey: string, optionalKey?: string }, we get:
|
||||||
|
// [ { requiredKey: "some-string-value" },
|
||||||
|
// { requiredKey: "some-string-value", optionalKey: undefined },
|
||||||
|
// { requiredKey: "some-string-value", optionalKey: null },
|
||||||
|
// { requiredKey: "some-string-value", optionalKey: "some-value" },
|
||||||
|
// ]
|
||||||
|
const permutations = (keys: Array<keyof S>) => {
|
||||||
|
if (keys.length === 0) return [required];
|
||||||
|
|
||||||
|
const bases = permutations(keys.slice(1));
|
||||||
|
const result: Array<json.FromSchema<S>> = [];
|
||||||
|
|
||||||
|
const optionalKey = keys[0];
|
||||||
|
for (const base of bases) {
|
||||||
|
if (!opts.excludeAbsent) {
|
||||||
|
// Optional keys can be absent entirely.
|
||||||
|
result.push(base);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or be present and have one of the `optionalValues`.
|
||||||
|
for (const optionalValue of optionalValues(optionalKey)) {
|
||||||
|
result.push({ ...base, [optionalKey]: optionalValue });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Call `body` for all test cases.
|
||||||
|
const testCases = permutations(optionalKeys);
|
||||||
|
for (const testCase of testCases) {
|
||||||
|
try {
|
||||||
|
body(testCase);
|
||||||
|
} catch (err) {
|
||||||
|
t.log(testCase);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"c": "cpp",
|
|
||||||
"c-c++": "cpp",
|
|
||||||
"c-cpp": "cpp",
|
|
||||||
"c#": "csharp",
|
|
||||||
"c++": "cpp",
|
|
||||||
"java-kotlin": "java",
|
|
||||||
"javascript-typescript": "javascript",
|
|
||||||
"kotlin": "java",
|
|
||||||
"typescript": "javascript"
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/** A language to analyze with CodeQL. */
|
|
||||||
export type Language = string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A language supported by CodeQL that is treated specially by the Action.
|
|
||||||
*
|
|
||||||
* This is not an exhaustive list of languages supported by CodeQL and new
|
|
||||||
* languages do not need to be added here.
|
|
||||||
*/
|
|
||||||
export enum KnownLanguage {
|
|
||||||
actions = "actions",
|
|
||||||
cpp = "cpp",
|
|
||||||
csharp = "csharp",
|
|
||||||
go = "go",
|
|
||||||
java = "java",
|
|
||||||
javascript = "javascript",
|
|
||||||
python = "python",
|
|
||||||
ruby = "ruby",
|
|
||||||
rust = "rust",
|
|
||||||
swift = "swift",
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Java-specific environment variable names that we may care about. */
|
|
||||||
export enum JavaEnvVars {
|
|
||||||
JAVA_HOME = "JAVA_HOME",
|
|
||||||
JAVA_TOOL_OPTIONS = "JAVA_TOOL_OPTIONS",
|
|
||||||
JDK_JAVA_OPTIONS = "JDK_JAVA_OPTIONS",
|
|
||||||
_JAVA_OPTIONS = "_JAVA_OPTIONS",
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"languages": [
|
||||||
|
"actions",
|
||||||
|
"cpp",
|
||||||
|
"csharp",
|
||||||
|
"go",
|
||||||
|
"java",
|
||||||
|
"javascript",
|
||||||
|
"python",
|
||||||
|
"ruby",
|
||||||
|
"rust",
|
||||||
|
"swift"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"c": "cpp",
|
||||||
|
"c-c++": "cpp",
|
||||||
|
"c-cpp": "cpp",
|
||||||
|
"c#": "csharp",
|
||||||
|
"c++": "cpp",
|
||||||
|
"java-kotlin": "java",
|
||||||
|
"javascript-typescript": "javascript",
|
||||||
|
"kotlin": "java",
|
||||||
|
"typescript": "javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import test from "ava";
|
||||||
|
|
||||||
|
import { setupTests } from "../testing-utils";
|
||||||
|
|
||||||
|
import knownLanguagesData from "./builtin.json";
|
||||||
|
|
||||||
|
import { isBuiltInLanguage, BuiltInLanguage, parseBuiltInLanguage } from ".";
|
||||||
|
|
||||||
|
setupTests(test);
|
||||||
|
|
||||||
|
test("parseBuiltInLanguage", (t) => {
|
||||||
|
// Exact matches
|
||||||
|
t.is(parseBuiltInLanguage("csharp"), BuiltInLanguage.csharp);
|
||||||
|
t.is(parseBuiltInLanguage("cpp"), BuiltInLanguage.cpp);
|
||||||
|
t.is(parseBuiltInLanguage("go"), BuiltInLanguage.go);
|
||||||
|
t.is(parseBuiltInLanguage("java"), BuiltInLanguage.java);
|
||||||
|
t.is(parseBuiltInLanguage("javascript"), BuiltInLanguage.javascript);
|
||||||
|
t.is(parseBuiltInLanguage("python"), BuiltInLanguage.python);
|
||||||
|
t.is(parseBuiltInLanguage("rust"), BuiltInLanguage.rust);
|
||||||
|
|
||||||
|
// Aliases
|
||||||
|
t.is(parseBuiltInLanguage(" \t\nCsHaRp\t\t"), BuiltInLanguage.csharp);
|
||||||
|
t.is(parseBuiltInLanguage("c"), BuiltInLanguage.cpp);
|
||||||
|
t.is(parseBuiltInLanguage("c++"), BuiltInLanguage.cpp);
|
||||||
|
t.is(parseBuiltInLanguage("kotlin"), BuiltInLanguage.java);
|
||||||
|
t.is(parseBuiltInLanguage("typescript"), BuiltInLanguage.javascript);
|
||||||
|
|
||||||
|
// spaces and case-insensitivity
|
||||||
|
t.is(parseBuiltInLanguage(" \t\nkOtLin\t\t"), BuiltInLanguage.java);
|
||||||
|
|
||||||
|
// Not matches
|
||||||
|
t.is(parseBuiltInLanguage(BuiltInLanguage.python), BuiltInLanguage.python);
|
||||||
|
t.is(parseBuiltInLanguage("foo"), undefined);
|
||||||
|
t.is(parseBuiltInLanguage(" "), undefined);
|
||||||
|
t.is(parseBuiltInLanguage(""), undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("isBuiltInLanguage matches the curated built-in language set", (t) => {
|
||||||
|
t.true(isBuiltInLanguage(BuiltInLanguage.actions));
|
||||||
|
t.true(isBuiltInLanguage(BuiltInLanguage.swift));
|
||||||
|
t.false(isBuiltInLanguage("typescript"));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("BuiltInLanguage enum matches builtin.json", (t) => {
|
||||||
|
t.deepEqual(Object.values(BuiltInLanguage), knownLanguagesData.languages);
|
||||||
|
});
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import knownLanguagesData from "./builtin.json";
|
||||||
|
|
||||||
|
/** A language to analyze with CodeQL. */
|
||||||
|
export type Language = string;
|
||||||
|
|
||||||
|
/** A language built into the `defaults.json` CodeQL distribution. */
|
||||||
|
export enum BuiltInLanguage {
|
||||||
|
actions = "actions",
|
||||||
|
cpp = "cpp",
|
||||||
|
csharp = "csharp",
|
||||||
|
go = "go",
|
||||||
|
java = "java",
|
||||||
|
javascript = "javascript",
|
||||||
|
python = "python",
|
||||||
|
ruby = "ruby",
|
||||||
|
rust = "rust",
|
||||||
|
swift = "swift",
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Java-specific environment variable names that we may care about. */
|
||||||
|
export enum JavaEnvVars {
|
||||||
|
JAVA_HOME = "JAVA_HOME",
|
||||||
|
JAVA_TOOL_OPTIONS = "JAVA_TOOL_OPTIONS",
|
||||||
|
JDK_JAVA_OPTIONS = "JDK_JAVA_OPTIONS",
|
||||||
|
_JAVA_OPTIONS = "_JAVA_OPTIONS",
|
||||||
|
}
|
||||||
|
|
||||||
|
const builtInLanguageSet = new Set<string>(knownLanguagesData.languages);
|
||||||
|
|
||||||
|
export function isBuiltInLanguage(
|
||||||
|
language: string,
|
||||||
|
): language is BuiltInLanguage {
|
||||||
|
return builtInLanguageSet.has(language);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse a language input corresponding to a built-in language into its canonical CodeQL language
|
||||||
|
* name.
|
||||||
|
*
|
||||||
|
* This uses the language aliases shipped with the Action and will not be able to resolve aliases
|
||||||
|
* added by third-party CodeQL language support or versions of the CodeQL CLI newer than the one
|
||||||
|
* mentioned in `defaults.json`. Therefore, this function should only be used when the CodeQL CLI is
|
||||||
|
* not available.
|
||||||
|
*/
|
||||||
|
export function parseBuiltInLanguage(
|
||||||
|
language: string,
|
||||||
|
): BuiltInLanguage | undefined {
|
||||||
|
language = language.trim().toLowerCase();
|
||||||
|
language =
|
||||||
|
knownLanguagesData.aliases[
|
||||||
|
language as keyof typeof knownLanguagesData.aliases
|
||||||
|
] ?? language;
|
||||||
|
if (isBuiltInLanguage(language)) {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
+149
-28
@@ -7,12 +7,13 @@ import * as sinon from "sinon";
|
|||||||
|
|
||||||
import * as actionsUtil from "../actions-util";
|
import * as actionsUtil from "../actions-util";
|
||||||
import * as apiClient from "../api-client";
|
import * as apiClient from "../api-client";
|
||||||
import { ResolveDatabaseOutput } from "../codeql";
|
import type { ResolveDatabaseOutput } from "../codeql";
|
||||||
import * as gitUtils from "../git-utils";
|
import * as gitUtils from "../git-utils";
|
||||||
import { KnownLanguage } from "../languages";
|
import { BuiltInLanguage } from "../languages";
|
||||||
import { getRunnerLogger } from "../logging";
|
import { getRunnerLogger } from "../logging";
|
||||||
import {
|
import {
|
||||||
createTestConfig,
|
createTestConfig,
|
||||||
|
makeMacro,
|
||||||
mockCodeQLVersion,
|
mockCodeQLVersion,
|
||||||
setupTests,
|
setupTests,
|
||||||
} from "../testing-utils";
|
} from "../testing-utils";
|
||||||
@@ -23,6 +24,7 @@ import {
|
|||||||
downloadOverlayBaseDatabaseFromCache,
|
downloadOverlayBaseDatabaseFromCache,
|
||||||
getCacheRestoreKeyPrefix,
|
getCacheRestoreKeyPrefix,
|
||||||
getCacheSaveKey,
|
getCacheSaveKey,
|
||||||
|
getCodeQlVersionsForOverlayBaseDatabases,
|
||||||
} from "./caching";
|
} from "./caching";
|
||||||
import { OverlayDatabaseMode } from "./overlay-database-mode";
|
import { OverlayDatabaseMode } from "./overlay-database-mode";
|
||||||
|
|
||||||
@@ -50,10 +52,9 @@ const defaultDownloadTestCase: DownloadOverlayBaseDatabaseTestCase = {
|
|||||||
resolveDatabaseOutput: { overlayBaseSpecifier: "20250626:XXX" },
|
resolveDatabaseOutput: { overlayBaseSpecifier: "20250626:XXX" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const testDownloadOverlayBaseDatabaseFromCache = test.macro({
|
const testDownloadOverlayBaseDatabaseFromCache = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t,
|
t,
|
||||||
_title: string,
|
|
||||||
partialTestCase: Partial<DownloadOverlayBaseDatabaseTestCase>,
|
partialTestCase: Partial<DownloadOverlayBaseDatabaseTestCase>,
|
||||||
expectDownloadSuccess: boolean,
|
expectDownloadSuccess: boolean,
|
||||||
) => {
|
) => {
|
||||||
@@ -65,7 +66,7 @@ const testDownloadOverlayBaseDatabaseFromCache = test.macro({
|
|||||||
const testCase = { ...defaultDownloadTestCase, ...partialTestCase };
|
const testCase = { ...defaultDownloadTestCase, ...partialTestCase };
|
||||||
const config = createTestConfig({
|
const config = createTestConfig({
|
||||||
dbLocation,
|
dbLocation,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
});
|
});
|
||||||
|
|
||||||
config.overlayDatabaseMode = testCase.overlayDatabaseMode;
|
config.overlayDatabaseMode = testCase.overlayDatabaseMode;
|
||||||
@@ -141,18 +142,16 @@ const testDownloadOverlayBaseDatabaseFromCache = test.macro({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: (_, title) => `downloadOverlayBaseDatabaseFromCache: ${title}`,
|
title: (title) => `downloadOverlayBaseDatabaseFromCache: ${title}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns stats when successful",
|
"returns stats when successful",
|
||||||
{},
|
{},
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when mode is OverlayDatabaseMode.OverlayBase",
|
"returns undefined when mode is OverlayDatabaseMode.OverlayBase",
|
||||||
{
|
{
|
||||||
overlayDatabaseMode: OverlayDatabaseMode.OverlayBase,
|
overlayDatabaseMode: OverlayDatabaseMode.OverlayBase,
|
||||||
@@ -160,8 +159,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when mode is OverlayDatabaseMode.None",
|
"returns undefined when mode is OverlayDatabaseMode.None",
|
||||||
{
|
{
|
||||||
overlayDatabaseMode: OverlayDatabaseMode.None,
|
overlayDatabaseMode: OverlayDatabaseMode.None,
|
||||||
@@ -169,8 +167,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when caching is disabled",
|
"returns undefined when caching is disabled",
|
||||||
{
|
{
|
||||||
useOverlayDatabaseCaching: false,
|
useOverlayDatabaseCaching: false,
|
||||||
@@ -178,8 +175,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined in test mode",
|
"returns undefined in test mode",
|
||||||
{
|
{
|
||||||
isInTestMode: true,
|
isInTestMode: true,
|
||||||
@@ -187,8 +183,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when cache miss",
|
"returns undefined when cache miss",
|
||||||
{
|
{
|
||||||
restoreCacheResult: undefined,
|
restoreCacheResult: undefined,
|
||||||
@@ -196,8 +191,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when download fails",
|
"returns undefined when download fails",
|
||||||
{
|
{
|
||||||
restoreCacheResult: new Error("Download failed"),
|
restoreCacheResult: new Error("Download failed"),
|
||||||
@@ -205,8 +199,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when downloaded database is invalid",
|
"returns undefined when downloaded database is invalid",
|
||||||
{
|
{
|
||||||
hasBaseDatabaseOidsFile: false,
|
hasBaseDatabaseOidsFile: false,
|
||||||
@@ -214,8 +207,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when downloaded database doesn't have an overlayBaseSpecifier",
|
"returns undefined when downloaded database doesn't have an overlayBaseSpecifier",
|
||||||
{
|
{
|
||||||
resolveDatabaseOutput: {},
|
resolveDatabaseOutput: {},
|
||||||
@@ -223,8 +215,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when resolving database metadata fails",
|
"returns undefined when resolving database metadata fails",
|
||||||
{
|
{
|
||||||
resolveDatabaseOutput: new Error("Failed to resolve database metadata"),
|
resolveDatabaseOutput: new Error("Failed to resolve database metadata"),
|
||||||
@@ -232,8 +223,7 @@ test.serial(
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testDownloadOverlayBaseDatabaseFromCache.serial(
|
||||||
testDownloadOverlayBaseDatabaseFromCache,
|
|
||||||
"returns undefined when filesystem error occurs",
|
"returns undefined when filesystem error occurs",
|
||||||
{
|
{
|
||||||
tryGetFolderBytesSucceeds: false,
|
tryGetFolderBytesSucceeds: false,
|
||||||
@@ -285,3 +275,134 @@ test.serial("overlay-base database cache keys remain stable", async (t) => {
|
|||||||
`Expected save key "${saveKey}" to start with restore key prefix "${restoreKeyPrefix}"`,
|
`Expected save key "${saveKey}" to start with restore key prefix "${restoreKeyPrefix}"`,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.serial(
|
||||||
|
"getCodeQlVersionsForOverlayBaseDatabases returns unique versions sorted latest first",
|
||||||
|
async (t) => {
|
||||||
|
const logger = getRunnerLogger(true);
|
||||||
|
|
||||||
|
sinon.stub(apiClient, "getAutomationID").resolves("test-automation-id/");
|
||||||
|
sinon.stub(apiClient, "listActionsCaches").resolves([
|
||||||
|
{
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-javascript_python-2.23.0-abc123-1-1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-javascript_python-2.24.1-def456-2-1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-javascript_python-2.23.0-ghi789-3-1",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const result = await getCodeQlVersionsForOverlayBaseDatabases(
|
||||||
|
["javascript", "python"],
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
t.deepEqual(result, ["2.24.1", "2.23.0"]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
test.serial(
|
||||||
|
"getCodeQlVersionsForOverlayBaseDatabases returns empty list when no caches exist",
|
||||||
|
async (t) => {
|
||||||
|
const logger = getRunnerLogger(true);
|
||||||
|
|
||||||
|
sinon.stub(apiClient, "getAutomationID").resolves("test-automation-id/");
|
||||||
|
sinon.stub(apiClient, "listActionsCaches").resolves([]);
|
||||||
|
|
||||||
|
const result = await getCodeQlVersionsForOverlayBaseDatabases(
|
||||||
|
["python"],
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
t.deepEqual(result, []);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
test.serial(
|
||||||
|
"getCodeQlVersionsForOverlayBaseDatabases returns empty list when cache keys are unparseable",
|
||||||
|
async (t) => {
|
||||||
|
const logger = getRunnerLogger(true);
|
||||||
|
|
||||||
|
sinon.stub(apiClient, "getAutomationID").resolves("test-automation-id/");
|
||||||
|
sinon.stub(apiClient, "listActionsCaches").resolves([
|
||||||
|
{
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-python-malformed",
|
||||||
|
},
|
||||||
|
{ key: undefined },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const result = await getCodeQlVersionsForOverlayBaseDatabases(
|
||||||
|
["python"],
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
t.deepEqual(result, []);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
test.serial(
|
||||||
|
"getCodeQlVersionsForOverlayBaseDatabases returns the single version when only one cache exists",
|
||||||
|
async (t) => {
|
||||||
|
const logger = getRunnerLogger(true);
|
||||||
|
|
||||||
|
sinon.stub(apiClient, "getAutomationID").resolves("test-automation-id/");
|
||||||
|
sinon.stub(apiClient, "listActionsCaches").resolves([
|
||||||
|
{
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-cpp-2.25.0-abc123-1-1",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const result = await getCodeQlVersionsForOverlayBaseDatabases(
|
||||||
|
["cpp"],
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
t.deepEqual(result, ["2.25.0"]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
test.serial(
|
||||||
|
"getCodeQlVersionsForOverlayBaseDatabases resolves language aliases",
|
||||||
|
async (t) => {
|
||||||
|
const logger = getRunnerLogger(true);
|
||||||
|
// The alias `c++` should be resolved to "cpp" and match cache entries keyed with "cpp"
|
||||||
|
|
||||||
|
sinon.stub(apiClient, "getAutomationID").resolves("test-automation-id/");
|
||||||
|
sinon.stub(apiClient, "listActionsCaches").resolves([
|
||||||
|
{
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-cpp-2.25.0-abc123-1-1",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const result = await getCodeQlVersionsForOverlayBaseDatabases(
|
||||||
|
["c++"],
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
t.deepEqual(result, ["2.25.0"]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
test.serial(
|
||||||
|
"getCodeQlVersionsForOverlayBaseDatabases ignores nightly versions with build metadata",
|
||||||
|
async (t) => {
|
||||||
|
const logger = getRunnerLogger(true);
|
||||||
|
|
||||||
|
sinon.stub(apiClient, "getAutomationID").resolves("test-automation-id/");
|
||||||
|
sinon.stub(apiClient, "listActionsCaches").resolves([
|
||||||
|
{
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-python-2.25.0-abc123-1-1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Nightly release with semver build metadata; should be ignored.
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-python-2.26.0+202604211234-def456-2-1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "codeql-overlay-base-database-1-c5666c509a2d9895-python-2.24.0-ghi789-3-1",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const result = await getCodeQlVersionsForOverlayBaseDatabases(
|
||||||
|
["python"],
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
t.deepEqual(result, ["2.25.0", "2.24.0"]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|||||||
+104
-12
@@ -1,18 +1,20 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
|
|
||||||
import * as actionsCache from "@actions/cache";
|
import * as actionsCache from "@actions/cache";
|
||||||
|
import * as semver from "semver";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getRequiredInput,
|
getRequiredInput,
|
||||||
getWorkflowRunAttempt,
|
getWorkflowRunAttempt,
|
||||||
getWorkflowRunID,
|
getWorkflowRunID,
|
||||||
} from "../actions-util";
|
} from "../actions-util";
|
||||||
import { getAutomationID } from "../api-client";
|
import { getAutomationID, listActionsCaches } from "../api-client";
|
||||||
import { createCacheKeyHash } from "../caching-utils";
|
import { createCacheKeyHash } from "../caching-utils";
|
||||||
import { type CodeQL } from "../codeql";
|
import { type CodeQL } from "../codeql";
|
||||||
import { type Config } from "../config-utils";
|
import { type Config } from "../config-utils";
|
||||||
import { getCommitOid } from "../git-utils";
|
import { getCommitOid } from "../git-utils";
|
||||||
import { Logger, withGroupAsync } from "../logging";
|
import { type Language, parseBuiltInLanguage } from "../languages";
|
||||||
|
import { type Logger, withGroupAsync } from "../logging";
|
||||||
import {
|
import {
|
||||||
CleanupLevel,
|
CleanupLevel,
|
||||||
getBaseDatabaseOidsFilePath,
|
getBaseDatabaseOidsFilePath,
|
||||||
@@ -404,7 +406,17 @@ export async function getCacheRestoreKeyPrefix(
|
|||||||
config: Config,
|
config: Config,
|
||||||
codeQlVersion: string,
|
codeQlVersion: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const languages = [...config.languages].sort().join("_");
|
return `${await getCacheKeyPrefixBase(config.languages)}${codeQlVersion}-`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the cache key prefix for overlay-base databases, excluding the
|
||||||
|
* CodeQL version.
|
||||||
|
*/
|
||||||
|
async function getCacheKeyPrefixBase(
|
||||||
|
parsedLanguages: Language[],
|
||||||
|
): Promise<string> {
|
||||||
|
const languagesComponent = [...parsedLanguages].sort().join("_");
|
||||||
|
|
||||||
const cacheKeyComponents = {
|
const cacheKeyComponents = {
|
||||||
automationID: await getAutomationID(),
|
automationID: await getAutomationID(),
|
||||||
@@ -412,17 +424,97 @@ export async function getCacheRestoreKeyPrefix(
|
|||||||
};
|
};
|
||||||
const componentsHash = createCacheKeyHash(cacheKeyComponents);
|
const componentsHash = createCacheKeyHash(cacheKeyComponents);
|
||||||
|
|
||||||
// For a cached overlay-base database to be considered compatible for overlay
|
|
||||||
// analysis, all components in the cache restore key must match:
|
|
||||||
//
|
|
||||||
// CACHE_PREFIX: distinguishes overlay-base databases from other cache objects
|
// CACHE_PREFIX: distinguishes overlay-base databases from other cache objects
|
||||||
// CACHE_VERSION: cache format version
|
// CACHE_VERSION: cache format version
|
||||||
// componentsHash: hash of additional components (see above for details)
|
// componentsHash: hash of additional components (see above for details)
|
||||||
// languages: the languages included in the overlay-base database
|
// languagesComponent: the languages included in the overlay-base database
|
||||||
// codeQlVersion: CodeQL bundle version
|
|
||||||
//
|
//
|
||||||
// Technically we can also include languages and codeQlVersion in the
|
// Technically we can also include languages in the componentsHash, but
|
||||||
// componentsHash, but including them explicitly in the cache key makes it
|
// including them explicitly in the cache key makes it easier to debug and
|
||||||
// easier to debug and understand the cache key structure.
|
// understand the cache key structure.
|
||||||
return `${CACHE_PREFIX}-${CACHE_VERSION}-${componentsHash}-${languages}-${codeQlVersion}-`;
|
return `${CACHE_PREFIX}-${CACHE_VERSION}-${componentsHash}-${languagesComponent}-`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches the GitHub Actions cache for overlay-base databases matching the given languages, and
|
||||||
|
* returns all stable CodeQL versions found across matching cache entries.
|
||||||
|
*
|
||||||
|
* Note that we do not guarantee that the cache entry for these versions of CodeQL will still be
|
||||||
|
* present by the time we attempt to restore the cache. We could achieve that with a download retry
|
||||||
|
* loop, but we expect that if there is sufficient Actions cache contention that an overlay-base
|
||||||
|
* cache entry for a particular CodeQL version is evicted before we can use it, then it is likely
|
||||||
|
* that the same thing will happen to other overlay-base cache entries, and therefore we will not be
|
||||||
|
* able to use overlay.
|
||||||
|
*
|
||||||
|
* @returns Unique stable CodeQL versions found in cached overlay-base databases, sorted from latest to
|
||||||
|
* earliest, or undefined if one of the languages is not a built-in language.
|
||||||
|
*/
|
||||||
|
export async function getCodeQlVersionsForOverlayBaseDatabases(
|
||||||
|
rawLanguages: string[],
|
||||||
|
logger: Logger,
|
||||||
|
): Promise<string[] | undefined> {
|
||||||
|
const languages = rawLanguages.map(parseBuiltInLanguage);
|
||||||
|
if (languages.includes(undefined)) {
|
||||||
|
logger.warning(
|
||||||
|
"One or more provided languages are not recognized as built-in languages. " +
|
||||||
|
"Skipping searching for overlay-base databases in cache.",
|
||||||
|
);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const cacheKeyPrefix = await getCacheKeyPrefixBase(
|
||||||
|
languages.filter((l) => l !== undefined),
|
||||||
|
);
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
`Searching for overlay-base databases in Actions cache with ` +
|
||||||
|
`prefix ${cacheKeyPrefix}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
const caches = await listActionsCaches(cacheKeyPrefix);
|
||||||
|
|
||||||
|
if (caches.length === 0) {
|
||||||
|
logger.info("No overlay-base databases found in Actions cache.");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
`Found ${caches.length} overlay-base ` +
|
||||||
|
`${caches.length === 1 ? "database" : "databases"} in the Actions cache.`,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Parse CodeQL versions from cache keys, matching only stable releases.
|
||||||
|
//
|
||||||
|
// After the prefix, the remaining key format starts with `${codeQlVersion}-`. Nightlies will have
|
||||||
|
// a suffix like `+202604201548` that will break the match.
|
||||||
|
//
|
||||||
|
// Caveat: this relies on the fact that we haven't released any CodeQL bundles with the
|
||||||
|
// `x.y.z-<pre-release>` semver format which does not interact well with the current overlay base
|
||||||
|
// DB cache key format.
|
||||||
|
const versionRegex = /^([\d.]+)-/;
|
||||||
|
const versionSet = new Set<string>();
|
||||||
|
|
||||||
|
for (const cache of caches) {
|
||||||
|
if (!cache.key) continue;
|
||||||
|
const suffix = cache.key.substring(cacheKeyPrefix.length);
|
||||||
|
const match = suffix.match(versionRegex);
|
||||||
|
if (match && semver.valid(match[1])) {
|
||||||
|
versionSet.add(match[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (versionSet.size === 0) {
|
||||||
|
logger.info(
|
||||||
|
"Could not parse any CodeQL versions from overlay-base database " +
|
||||||
|
"cache keys.",
|
||||||
|
);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const versions = [...versionSet].sort(semver.rcompare);
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
`Found overlay databases for the following CodeQL versions in the Actions cache: ${versions.join(", ")}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return versions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
createFeatures,
|
createFeatures,
|
||||||
getRecordingLogger,
|
getRecordingLogger,
|
||||||
initializeFeatures,
|
initializeFeatures,
|
||||||
|
makeMacro,
|
||||||
mockBundleDownloadApi,
|
mockBundleDownloadApi,
|
||||||
setupActionsVars,
|
setupActionsVars,
|
||||||
setupTests,
|
setupTests,
|
||||||
@@ -473,7 +474,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const toolcacheInputFallbackMacro = test.macro({
|
const toolcacheInputFallbackMacro = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
featureList: Feature[],
|
featureList: Feature[],
|
||||||
@@ -533,9 +534,8 @@ const toolcacheInputFallbackMacro = test.macro({
|
|||||||
`getCodeQLSource falls back to downloading the CLI if ${providedTitle}`,
|
`getCodeQLSource falls back to downloading the CLI if ${providedTitle}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
toolcacheInputFallbackMacro.serial(
|
||||||
"the toolcache doesn't have a CodeQL CLI when tools == toolcache",
|
"the toolcache doesn't have a CodeQL CLI when tools == toolcache",
|
||||||
toolcacheInputFallbackMacro,
|
|
||||||
[Feature.AllowToolcacheInput],
|
[Feature.AllowToolcacheInput],
|
||||||
{ GITHUB_EVENT_NAME: "dynamic" },
|
{ GITHUB_EVENT_NAME: "dynamic" },
|
||||||
[],
|
[],
|
||||||
@@ -545,9 +545,8 @@ test.serial(
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
toolcacheInputFallbackMacro.serial(
|
||||||
"the workflow trigger is not `dynamic`",
|
"the workflow trigger is not `dynamic`",
|
||||||
toolcacheInputFallbackMacro,
|
|
||||||
[Feature.AllowToolcacheInput],
|
[Feature.AllowToolcacheInput],
|
||||||
{ GITHUB_EVENT_NAME: "pull_request" },
|
{ GITHUB_EVENT_NAME: "pull_request" },
|
||||||
[],
|
[],
|
||||||
@@ -556,9 +555,8 @@ test.serial(
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
toolcacheInputFallbackMacro.serial(
|
||||||
"the feature flag is not enabled",
|
"the feature flag is not enabled",
|
||||||
toolcacheInputFallbackMacro,
|
|
||||||
[],
|
[],
|
||||||
{ GITHUB_EVENT_NAME: "dynamic" },
|
{ GITHUB_EVENT_NAME: "dynamic" },
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import * as core from "@actions/core";
|
|||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
import { getGitHubVersion } from "./api-client";
|
import { getGitHubVersion } from "./api-client";
|
||||||
import { Feature, FeatureEnablement, initFeatures } from "./feature-flags";
|
import { Feature, FeatureEnablement, initFeatures } from "./feature-flags";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage, parseBuiltInLanguage } from "./languages";
|
||||||
import { getActionsLogger, Logger } from "./logging";
|
import { getActionsLogger, Logger } from "./logging";
|
||||||
import { getRepositoryNwo } from "./repository";
|
import { getRepositoryNwo } from "./repository";
|
||||||
import {
|
import {
|
||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
getCredentials,
|
getCredentials,
|
||||||
getProxyBinaryPath,
|
getProxyBinaryPath,
|
||||||
getSafeErrorMessage,
|
getSafeErrorMessage,
|
||||||
parseLanguage,
|
|
||||||
ProxyInfo,
|
ProxyInfo,
|
||||||
sendFailedStatusReport,
|
sendFailedStatusReport,
|
||||||
sendSuccessStatusReport,
|
sendSuccessStatusReport,
|
||||||
@@ -33,7 +32,7 @@ async function run(startedAt: Date) {
|
|||||||
|
|
||||||
const logger = getActionsLogger();
|
const logger = getActionsLogger();
|
||||||
let features: FeatureEnablement | undefined;
|
let features: FeatureEnablement | undefined;
|
||||||
let language: KnownLanguage | undefined;
|
let language: BuiltInLanguage | undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Make inputs accessible in the `post` step.
|
// Make inputs accessible in the `post` step.
|
||||||
@@ -56,7 +55,7 @@ async function run(startedAt: Date) {
|
|||||||
|
|
||||||
// Get the language input.
|
// Get the language input.
|
||||||
const languageInput = actionsUtil.getOptionalInput("language");
|
const languageInput = actionsUtil.getOptionalInput("language");
|
||||||
language = languageInput ? parseLanguage(languageInput) : undefined;
|
language = languageInput ? parseBuiltInLanguage(languageInput) : undefined;
|
||||||
|
|
||||||
// Query the FF for whether we should use the reduced registry mapping.
|
// Query the FF for whether we should use the reduced registry mapping.
|
||||||
const skipUnusedRegistries = await features.getValue(
|
const skipUnusedRegistries = await features.getValue(
|
||||||
@@ -112,14 +111,14 @@ async function run(startedAt: Date) {
|
|||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check that the private registries are reachable.
|
// Perform best-effort checks that the private registries are reachable.
|
||||||
await checkConnections(logger, proxyInfo);
|
await checkConnections(logger, proxyInfo);
|
||||||
|
|
||||||
// Report success if we have reached this point.
|
// Report success if we have reached this point.
|
||||||
await sendSuccessStatusReport(
|
await sendSuccessStatusReport(
|
||||||
startedAt,
|
startedAt,
|
||||||
{
|
{
|
||||||
languages: language && [language],
|
languages: language === undefined ? undefined : [language],
|
||||||
},
|
},
|
||||||
proxyConfig.all_credentials.map((c) => c.type),
|
proxyConfig.all_credentials.map((c) => c.type),
|
||||||
logger,
|
logger,
|
||||||
@@ -199,6 +198,7 @@ async function startProxy(
|
|||||||
.map((credential) => ({
|
.map((credential) => ({
|
||||||
type: credential.type,
|
type: credential.type,
|
||||||
url: credential.url,
|
url: credential.url,
|
||||||
|
"replaces-base": credential["replaces-base"],
|
||||||
}));
|
}));
|
||||||
core.setOutput("proxy_urls", JSON.stringify(registry_urls));
|
core.setOutput("proxy_urls", JSON.stringify(registry_urls));
|
||||||
|
|
||||||
|
|||||||
+144
-186
@@ -8,15 +8,17 @@ import sinon from "sinon";
|
|||||||
import * as apiClient from "./api-client";
|
import * as apiClient from "./api-client";
|
||||||
import * as defaults from "./defaults.json";
|
import * as defaults from "./defaults.json";
|
||||||
import { setUpFeatureFlagTests } from "./feature-flags/testing-util";
|
import { setUpFeatureFlagTests } from "./feature-flags/testing-util";
|
||||||
import { KnownLanguage } from "./languages";
|
import { UnvalidatedObject, validateSchema } from "./json";
|
||||||
|
import { makeFromSchema } from "./json/testing-util";
|
||||||
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { getRunnerLogger, Logger } from "./logging";
|
import { getRunnerLogger, Logger } from "./logging";
|
||||||
import * as startProxyExports from "./start-proxy";
|
import * as startProxyExports from "./start-proxy";
|
||||||
import { parseLanguage } from "./start-proxy";
|
|
||||||
import * as statusReport from "./status-report";
|
import * as statusReport from "./status-report";
|
||||||
import {
|
import {
|
||||||
assertNotLogged,
|
assertNotLogged,
|
||||||
checkExpectedLogMessages,
|
checkExpectedLogMessages,
|
||||||
createFeatures,
|
createFeatures,
|
||||||
|
makeMacro,
|
||||||
makeTestToken,
|
makeTestToken,
|
||||||
RecordingLogger,
|
RecordingLogger,
|
||||||
setupTests,
|
setupTests,
|
||||||
@@ -31,7 +33,7 @@ import {
|
|||||||
|
|
||||||
setupTests(test);
|
setupTests(test);
|
||||||
|
|
||||||
const sendFailedStatusReportTest = test.macro({
|
const sendFailedStatusReportTest = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
err: Error,
|
err: Error,
|
||||||
@@ -87,16 +89,14 @@ const sendFailedStatusReportTest = test.macro({
|
|||||||
title: (providedTitle = "") => `sendFailedStatusReport - ${providedTitle}`,
|
title: (providedTitle = "") => `sendFailedStatusReport - ${providedTitle}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
sendFailedStatusReportTest.serial(
|
||||||
"reports generic error message for non-StartProxyError error",
|
"reports generic error message for non-StartProxyError error",
|
||||||
sendFailedStatusReportTest,
|
|
||||||
new Error("Something went wrong today"),
|
new Error("Something went wrong today"),
|
||||||
"Error from start-proxy Action omitted (Error).",
|
"Error from start-proxy Action omitted (Error).",
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
sendFailedStatusReportTest.serial(
|
||||||
"reports generic error message for non-StartProxyError error with safe error message",
|
"reports generic error message for non-StartProxyError error with safe error message",
|
||||||
sendFailedStatusReportTest,
|
|
||||||
new Error(
|
new Error(
|
||||||
startProxyExports.getStartProxyErrorMessage(
|
startProxyExports.getStartProxyErrorMessage(
|
||||||
startProxyExports.StartProxyErrorType.DownloadFailed,
|
startProxyExports.StartProxyErrorType.DownloadFailed,
|
||||||
@@ -105,9 +105,8 @@ test.serial(
|
|||||||
"Error from start-proxy Action omitted (Error).",
|
"Error from start-proxy Action omitted (Error).",
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
sendFailedStatusReportTest.serial(
|
||||||
"reports generic error message for ConfigurationError error",
|
"reports generic error message for ConfigurationError error",
|
||||||
sendFailedStatusReportTest,
|
|
||||||
new ConfigurationError("Something went wrong today"),
|
new ConfigurationError("Something went wrong today"),
|
||||||
"Error from start-proxy Action omitted (ConfigurationError).",
|
"Error from start-proxy Action omitted (ConfigurationError).",
|
||||||
"user-error",
|
"user-error",
|
||||||
@@ -232,7 +231,7 @@ test("getCredentials filters by language when specified", async (t) => {
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
toEncodedJSON(mixedCredentials),
|
toEncodedJSON(mixedCredentials),
|
||||||
KnownLanguage.java,
|
BuiltInLanguage.java,
|
||||||
);
|
);
|
||||||
t.is(credentials.length, 1);
|
t.is(credentials.length, 1);
|
||||||
t.is(credentials[0].type, "maven_repository");
|
t.is(credentials[0].type, "maven_repository");
|
||||||
@@ -243,7 +242,7 @@ test("getCredentials returns all for a language when specified", async (t) => {
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
toEncodedJSON(mixedCredentials),
|
toEncodedJSON(mixedCredentials),
|
||||||
KnownLanguage.go,
|
BuiltInLanguage.go,
|
||||||
);
|
);
|
||||||
t.is(credentials.length, 2);
|
t.is(credentials.length, 2);
|
||||||
|
|
||||||
@@ -263,7 +262,7 @@ test("getCredentials returns all goproxy_servers for Go when specified", async (
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
toEncodedJSON(multipleGoproxyServers),
|
toEncodedJSON(multipleGoproxyServers),
|
||||||
KnownLanguage.go,
|
BuiltInLanguage.go,
|
||||||
);
|
);
|
||||||
t.is(credentials.length, 3);
|
t.is(credentials.length, 3);
|
||||||
|
|
||||||
@@ -292,7 +291,7 @@ test("getCredentials returns all maven_repositories for Java when specified", as
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
toEncodedJSON(multipleMavenRepositories),
|
toEncodedJSON(multipleMavenRepositories),
|
||||||
KnownLanguage.java,
|
BuiltInLanguage.java,
|
||||||
);
|
);
|
||||||
t.is(credentials.length, 2);
|
t.is(credentials.length, 2);
|
||||||
|
|
||||||
@@ -350,147 +349,70 @@ test("getCredentials throws an error when non-printable characters are used", as
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const validAzureCredential: startProxyExports.AzureConfig = {
|
for (const oidcSchemaInfo of startProxyExports.oidcSchemas) {
|
||||||
"tenant-id": "12345678-1234-1234-1234-123456789012",
|
test(`getCredentials throws when non-printable characters are used (${oidcSchemaInfo.name} OIDC)`, (t) => {
|
||||||
"client-id": "abcdef01-2345-6789-abcd-ef0123456789",
|
const validCredential = makeFromSchema(true, oidcSchemaInfo.schema);
|
||||||
};
|
for (const key of Object.keys(validCredential)) {
|
||||||
|
const invalidAuthConfig = {
|
||||||
|
...validCredential,
|
||||||
|
[key]: "123\x00",
|
||||||
|
};
|
||||||
|
const invalidCredential: startProxyExports.RawCredential = {
|
||||||
|
type: "nuget_feed",
|
||||||
|
host: `${key}.nuget.pkg.github.com`,
|
||||||
|
...invalidAuthConfig,
|
||||||
|
};
|
||||||
|
const credentialsInput = toEncodedJSON([invalidCredential]);
|
||||||
|
|
||||||
const validAwsCredential: startProxyExports.AWSConfig = {
|
t.throws(
|
||||||
"aws-region": "us-east-1",
|
() =>
|
||||||
"account-id": "123456789012",
|
startProxyExports.getCredentials(
|
||||||
"role-name": "MY_ROLE",
|
getRunnerLogger(true),
|
||||||
domain: "MY_DOMAIN",
|
undefined,
|
||||||
"domain-owner": "987654321098",
|
credentialsInput,
|
||||||
audience: "custom-audience",
|
undefined,
|
||||||
};
|
),
|
||||||
|
{
|
||||||
const validJFrogCredential: startProxyExports.JFrogConfig = {
|
message:
|
||||||
"jfrog-oidc-provider-name": "MY_PROVIDER",
|
"Invalid credentials - fields must contain only printable characters",
|
||||||
audience: "jfrog-audience",
|
},
|
||||||
"identity-mapping-name": "my-mapping",
|
);
|
||||||
};
|
}
|
||||||
|
});
|
||||||
test("getCredentials throws an error when non-printable characters are used for Azure OIDC", (t) => {
|
}
|
||||||
for (const key of Object.keys(validAzureCredential)) {
|
|
||||||
const invalidAzureCredential = {
|
|
||||||
...validAzureCredential,
|
|
||||||
[key]: "123\x00",
|
|
||||||
};
|
|
||||||
const invalidCredential: startProxyExports.RawCredential = {
|
|
||||||
type: "nuget_feed",
|
|
||||||
host: `${key}.nuget.pkg.github.com`,
|
|
||||||
...invalidAzureCredential,
|
|
||||||
};
|
|
||||||
const credentialsInput = toEncodedJSON([invalidCredential]);
|
|
||||||
|
|
||||||
t.throws(
|
|
||||||
() =>
|
|
||||||
startProxyExports.getCredentials(
|
|
||||||
getRunnerLogger(true),
|
|
||||||
undefined,
|
|
||||||
credentialsInput,
|
|
||||||
undefined,
|
|
||||||
),
|
|
||||||
{
|
|
||||||
message:
|
|
||||||
"Invalid credentials - fields must contain only printable characters",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test("getCredentials throws an error when non-printable characters are used for AWS OIDC", (t) => {
|
|
||||||
for (const key of Object.keys(validAwsCredential)) {
|
|
||||||
const invalidAwsCredential = {
|
|
||||||
...validAwsCredential,
|
|
||||||
[key]: "123\x00",
|
|
||||||
};
|
|
||||||
const invalidCredential: startProxyExports.RawCredential = {
|
|
||||||
type: "nuget_feed",
|
|
||||||
host: `${key}.nuget.pkg.github.com`,
|
|
||||||
...invalidAwsCredential,
|
|
||||||
};
|
|
||||||
const credentialsInput = toEncodedJSON([invalidCredential]);
|
|
||||||
|
|
||||||
t.throws(
|
|
||||||
() =>
|
|
||||||
startProxyExports.getCredentials(
|
|
||||||
getRunnerLogger(true),
|
|
||||||
undefined,
|
|
||||||
credentialsInput,
|
|
||||||
undefined,
|
|
||||||
),
|
|
||||||
{
|
|
||||||
message:
|
|
||||||
"Invalid credentials - fields must contain only printable characters",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test("getCredentials throws an error when non-printable characters are used for JFrog OIDC", (t) => {
|
|
||||||
for (const key of Object.keys(validJFrogCredential)) {
|
|
||||||
const invalidJFrogCredential = {
|
|
||||||
...validJFrogCredential,
|
|
||||||
[key]: "123\x00",
|
|
||||||
};
|
|
||||||
const invalidCredential: startProxyExports.RawCredential = {
|
|
||||||
type: "nuget_feed",
|
|
||||||
host: `${key}.nuget.pkg.github.com`,
|
|
||||||
...invalidJFrogCredential,
|
|
||||||
};
|
|
||||||
const credentialsInput = toEncodedJSON([invalidCredential]);
|
|
||||||
|
|
||||||
t.throws(
|
|
||||||
() =>
|
|
||||||
startProxyExports.getCredentials(
|
|
||||||
getRunnerLogger(true),
|
|
||||||
undefined,
|
|
||||||
credentialsInput,
|
|
||||||
undefined,
|
|
||||||
),
|
|
||||||
{
|
|
||||||
message:
|
|
||||||
"Invalid credentials - fields must contain only printable characters",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test("getCredentials accepts OIDC configurations", (t) => {
|
test("getCredentials accepts OIDC configurations", (t) => {
|
||||||
const oidcConfigurations = [
|
const oidcConfigurations = startProxyExports.oidcSchemas.map(
|
||||||
{
|
(schemaInfo) => ({
|
||||||
type: "nuget_feed",
|
type: "nuget_feed",
|
||||||
host: "azure.pkg.github.com",
|
host: `${schemaInfo.name.toLowerCase()}.pkg.github.com`,
|
||||||
...validAzureCredential,
|
...makeFromSchema(true, schemaInfo.schema),
|
||||||
},
|
}),
|
||||||
{
|
);
|
||||||
type: "nuget_feed",
|
|
||||||
host: "aws.pkg.github.com",
|
|
||||||
...validAwsCredential,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "nuget_feed",
|
|
||||||
host: "jfrog.pkg.github.com",
|
|
||||||
...validJFrogCredential,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const credentials = startProxyExports.getCredentials(
|
const credentials = startProxyExports.getCredentials(
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
toEncodedJSON(oidcConfigurations),
|
toEncodedJSON(oidcConfigurations),
|
||||||
KnownLanguage.csharp,
|
BuiltInLanguage.csharp,
|
||||||
);
|
);
|
||||||
t.is(credentials.length, 3);
|
t.is(credentials.length, startProxyExports.oidcSchemas.length);
|
||||||
|
|
||||||
t.assert(credentials.every((c) => c.type === "nuget_feed"));
|
t.assert(credentials.every((c) => c.type === "nuget_feed"));
|
||||||
t.assert(credentials.some((c) => startProxyExports.isAzureConfig(c)));
|
|
||||||
t.assert(credentials.some((c) => startProxyExports.isAWSConfig(c)));
|
for (const oidcSchemaInfo of startProxyExports.oidcSchemas) {
|
||||||
t.assert(credentials.some((c) => startProxyExports.isJFrogConfig(c)));
|
t.assert(
|
||||||
|
credentials.some((c) =>
|
||||||
|
validateSchema(
|
||||||
|
oidcSchemaInfo.schema,
|
||||||
|
c as unknown as UnvalidatedObject<any>,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const getCredentialsMacro = test.macro({
|
const getCredentialsMacro = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
credentials: startProxyExports.RawCredential[],
|
credentials: startProxyExports.RawCredential[],
|
||||||
@@ -516,9 +438,8 @@ const getCredentialsMacro = test.macro({
|
|||||||
title: (providedTitle = "") => `getCredentials - ${providedTitle}`,
|
title: (providedTitle = "") => `getCredentials - ${providedTitle}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test(
|
getCredentialsMacro(
|
||||||
"warns for PAT-like password without a username",
|
"warns for PAT-like password without a username",
|
||||||
getCredentialsMacro,
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: "git_server",
|
type: "git_server",
|
||||||
@@ -533,7 +454,7 @@ test(
|
|||||||
t.is(results[0].type, "git_server");
|
t.is(results[0].type, "git_server");
|
||||||
t.is(results[0].host, "https://github.com/");
|
t.is(results[0].host, "https://github.com/");
|
||||||
|
|
||||||
if (startProxyExports.isUsernamePassword(results[0])) {
|
if (startProxyExports.hasUsernameAndPassword(results[0])) {
|
||||||
t.assert(results[0].password?.startsWith("ghp_"));
|
t.assert(results[0].password?.startsWith("ghp_"));
|
||||||
} else {
|
} else {
|
||||||
t.fail("Expected a `UsernamePassword`-based credential.");
|
t.fail("Expected a `UsernamePassword`-based credential.");
|
||||||
@@ -546,9 +467,8 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
getCredentialsMacro(
|
||||||
"no warning for PAT-like password with a username",
|
"no warning for PAT-like password with a username",
|
||||||
getCredentialsMacro,
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: "git_server",
|
type: "git_server",
|
||||||
@@ -564,7 +484,7 @@ test(
|
|||||||
t.is(results[0].type, "git_server");
|
t.is(results[0].type, "git_server");
|
||||||
t.is(results[0].host, "https://github.com/");
|
t.is(results[0].host, "https://github.com/");
|
||||||
|
|
||||||
if (startProxyExports.isUsernamePassword(results[0])) {
|
if (startProxyExports.hasUsernameAndPassword(results[0])) {
|
||||||
t.assert(results[0].password?.startsWith("ghp_"));
|
t.assert(results[0].password?.startsWith("ghp_"));
|
||||||
} else {
|
} else {
|
||||||
t.fail("Expected a `UsernamePassword`-based credential.");
|
t.fail("Expected a `UsernamePassword`-based credential.");
|
||||||
@@ -578,9 +498,8 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
getCredentialsMacro(
|
||||||
"warns for PAT-like token without a username",
|
"warns for PAT-like token without a username",
|
||||||
getCredentialsMacro,
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: "git_server",
|
type: "git_server",
|
||||||
@@ -608,9 +527,8 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
getCredentialsMacro(
|
||||||
"no warning for PAT-like token with a username",
|
"no warning for PAT-like token with a username",
|
||||||
getCredentialsMacro,
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: "git_server",
|
type: "git_server",
|
||||||
@@ -640,6 +558,76 @@ test(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test("getCredentials validates 'replaces-base' correctly", async (t) => {
|
||||||
|
// Valid cases.
|
||||||
|
const credentialsInput = toEncodedJSON([
|
||||||
|
{
|
||||||
|
type: "maven_repository",
|
||||||
|
host: "maven1.pkg.github.com",
|
||||||
|
token: "abc",
|
||||||
|
"replaces-base": false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "maven_repository",
|
||||||
|
host: "maven2.pkg.github.com",
|
||||||
|
token: "def",
|
||||||
|
"replaces-base": true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "maven_repository",
|
||||||
|
host: "maven3.pkg.github.com",
|
||||||
|
token: "ghi",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const credentials = startProxyExports.getCredentials(
|
||||||
|
getRunnerLogger(true),
|
||||||
|
undefined,
|
||||||
|
credentialsInput,
|
||||||
|
BuiltInLanguage.java,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
t.is(credentials.length, 3);
|
||||||
|
t.true(credentials.some((c) => c["replaces-base"] === true));
|
||||||
|
t.true(credentials.some((c) => c["replaces-base"] === false));
|
||||||
|
t.true(credentials.some((c) => c["replaces-base"] === undefined));
|
||||||
|
|
||||||
|
// Invalid cases.
|
||||||
|
const baseInvalid = {
|
||||||
|
type: "maven_repository",
|
||||||
|
host: "maven4.pkg.github.com",
|
||||||
|
token: "jkl",
|
||||||
|
};
|
||||||
|
t.throws(() =>
|
||||||
|
startProxyExports.getCredentials(
|
||||||
|
getRunnerLogger(true),
|
||||||
|
undefined,
|
||||||
|
toEncodedJSON([{ ...baseInvalid, "replaces-base": null }]),
|
||||||
|
BuiltInLanguage.actions,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
t.throws(() =>
|
||||||
|
startProxyExports.getCredentials(
|
||||||
|
getRunnerLogger(true),
|
||||||
|
undefined,
|
||||||
|
toEncodedJSON([{ ...baseInvalid, "replaces-base": 123 }]),
|
||||||
|
BuiltInLanguage.actions,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
t.throws(() =>
|
||||||
|
startProxyExports.getCredentials(
|
||||||
|
getRunnerLogger(true),
|
||||||
|
undefined,
|
||||||
|
toEncodedJSON([{ ...baseInvalid, "replaces-base": "true" }]),
|
||||||
|
BuiltInLanguage.actions,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_REGISTRY_TYPE", async (t) => {
|
test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_REGISTRY_TYPE", async (t) => {
|
||||||
const credentialsInput = toEncodedJSON(mixedCredentials);
|
const credentialsInput = toEncodedJSON(mixedCredentials);
|
||||||
|
|
||||||
@@ -647,7 +635,7 @@ test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
credentialsInput,
|
credentialsInput,
|
||||||
KnownLanguage.actions,
|
BuiltInLanguage.actions,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
t.is(credentials.length, mixedCredentials.length);
|
t.is(credentials.length, mixedCredentials.length);
|
||||||
@@ -660,39 +648,12 @@ test("getCredentials returns no credentials for Actions when using NEW_LANGUAGE_
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
credentialsInput,
|
credentialsInput,
|
||||||
KnownLanguage.actions,
|
BuiltInLanguage.actions,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
t.deepEqual(credentials, []);
|
t.deepEqual(credentials, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("parseLanguage", async (t) => {
|
|
||||||
// Exact matches
|
|
||||||
t.deepEqual(parseLanguage("csharp"), KnownLanguage.csharp);
|
|
||||||
t.deepEqual(parseLanguage("cpp"), KnownLanguage.cpp);
|
|
||||||
t.deepEqual(parseLanguage("go"), KnownLanguage.go);
|
|
||||||
t.deepEqual(parseLanguage("java"), KnownLanguage.java);
|
|
||||||
t.deepEqual(parseLanguage("javascript"), KnownLanguage.javascript);
|
|
||||||
t.deepEqual(parseLanguage("python"), KnownLanguage.python);
|
|
||||||
t.deepEqual(parseLanguage("rust"), KnownLanguage.rust);
|
|
||||||
|
|
||||||
// Aliases
|
|
||||||
t.deepEqual(parseLanguage("c"), KnownLanguage.cpp);
|
|
||||||
t.deepEqual(parseLanguage("c++"), KnownLanguage.cpp);
|
|
||||||
t.deepEqual(parseLanguage("c#"), KnownLanguage.csharp);
|
|
||||||
t.deepEqual(parseLanguage("kotlin"), KnownLanguage.java);
|
|
||||||
t.deepEqual(parseLanguage("typescript"), KnownLanguage.javascript);
|
|
||||||
|
|
||||||
// spaces and case-insensitivity
|
|
||||||
t.deepEqual(parseLanguage(" \t\nCsHaRp\t\t"), KnownLanguage.csharp);
|
|
||||||
t.deepEqual(parseLanguage(" \t\nkOtLin\t\t"), KnownLanguage.java);
|
|
||||||
|
|
||||||
// Not matches
|
|
||||||
t.deepEqual(parseLanguage("foo"), undefined);
|
|
||||||
t.deepEqual(parseLanguage(" "), undefined);
|
|
||||||
t.deepEqual(parseLanguage(""), undefined);
|
|
||||||
});
|
|
||||||
|
|
||||||
function mockGetApiClient(endpoints: any) {
|
function mockGetApiClient(endpoints: any) {
|
||||||
return (
|
return (
|
||||||
sinon
|
sinon
|
||||||
@@ -829,7 +790,7 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const wrapFailureTest = test.macro({
|
const wrapFailureTest = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
setup: () => void,
|
setup: () => void,
|
||||||
@@ -860,9 +821,8 @@ test.serial("downloadProxy - returns file path on success", async (t) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
wrapFailureTest.serial(
|
||||||
"downloadProxy",
|
"downloadProxy",
|
||||||
wrapFailureTest,
|
|
||||||
() => {
|
() => {
|
||||||
sinon.stub(toolcache, "downloadTool").throws();
|
sinon.stub(toolcache, "downloadTool").throws();
|
||||||
},
|
},
|
||||||
@@ -881,9 +841,8 @@ test.serial("extractProxy - returns file path on success", async (t) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
wrapFailureTest.serial(
|
||||||
"extractProxy",
|
"extractProxy",
|
||||||
wrapFailureTest,
|
|
||||||
() => {
|
() => {
|
||||||
sinon.stub(toolcache, "extractTar").throws();
|
sinon.stub(toolcache, "extractTar").throws();
|
||||||
},
|
},
|
||||||
@@ -907,9 +866,8 @@ test.serial("cacheProxy - returns file path on success", async (t) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
wrapFailureTest.serial(
|
||||||
"cacheProxy",
|
"cacheProxy",
|
||||||
wrapFailureTest,
|
|
||||||
() => {
|
() => {
|
||||||
sinon.stub(toolcache, "cacheDir").throws();
|
sinon.stub(toolcache, "cacheDir").throws();
|
||||||
},
|
},
|
||||||
|
|||||||
+28
-118
@@ -18,27 +18,18 @@ import {
|
|||||||
FeatureEnablement,
|
FeatureEnablement,
|
||||||
} from "./feature-flags";
|
} from "./feature-flags";
|
||||||
import * as json from "./json";
|
import * as json from "./json";
|
||||||
import * as knownLanguageAliases from "./known-language-aliases.json";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { KnownLanguage } from "./languages";
|
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import {
|
import {
|
||||||
Address,
|
Address,
|
||||||
Registry,
|
Registry,
|
||||||
Credential,
|
Credential,
|
||||||
AuthConfig,
|
hasToken,
|
||||||
isToken,
|
hasUsernameAndPassword,
|
||||||
isAzureConfig,
|
|
||||||
Token,
|
|
||||||
UsernamePassword,
|
|
||||||
AzureConfig,
|
|
||||||
isAWSConfig,
|
|
||||||
AWSConfig,
|
|
||||||
isJFrogConfig,
|
|
||||||
JFrogConfig,
|
|
||||||
isUsernamePassword,
|
|
||||||
hasUsername,
|
hasUsername,
|
||||||
RawCredential,
|
RawCredential,
|
||||||
} from "./start-proxy/types";
|
} from "./start-proxy/types";
|
||||||
|
import { getAuthConfig } from "./start-proxy/validation";
|
||||||
import {
|
import {
|
||||||
ActionName,
|
ActionName,
|
||||||
createStatusReportBase,
|
createStatusReportBase,
|
||||||
@@ -157,7 +148,7 @@ export function getSafeErrorMessage(error: Error): string {
|
|||||||
export async function sendFailedStatusReport(
|
export async function sendFailedStatusReport(
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
startedAt: Date,
|
startedAt: Date,
|
||||||
language: KnownLanguage | undefined,
|
language: BuiltInLanguage | undefined,
|
||||||
unwrappedError: unknown,
|
unwrappedError: unknown,
|
||||||
) {
|
) {
|
||||||
const error = util.wrapError(unwrappedError);
|
const error = util.wrapError(unwrappedError);
|
||||||
@@ -173,7 +164,7 @@ export async function sendFailedStatusReport(
|
|||||||
getActionsStatus(error),
|
getActionsStatus(error),
|
||||||
startedAt,
|
startedAt,
|
||||||
{
|
{
|
||||||
languages: language && [language],
|
languages: language === undefined ? undefined : [language],
|
||||||
},
|
},
|
||||||
await util.checkDiskUsage(logger),
|
await util.checkDiskUsage(logger),
|
||||||
logger,
|
logger,
|
||||||
@@ -189,35 +180,6 @@ export const UPDATEJOB_PROXY_VERSION = "v2.0.20250624110901";
|
|||||||
const UPDATEJOB_PROXY_URL_PREFIX =
|
const UPDATEJOB_PROXY_URL_PREFIX =
|
||||||
"https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.22.0/";
|
"https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.22.0/";
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the start-proxy language input into its canonical CodeQL language name.
|
|
||||||
*
|
|
||||||
* This uses the language aliases shipped with the Action and will not be able to resolve aliases
|
|
||||||
* added by versions of the CodeQL CLI newer than the one mentioned in `defaults.json`. However,
|
|
||||||
* this is sufficient for the start-proxy Action since we are already specifying proxy
|
|
||||||
* configurations on a per-language basis.
|
|
||||||
*/
|
|
||||||
export function parseLanguage(language: string): KnownLanguage | undefined {
|
|
||||||
// Normalize to lower case
|
|
||||||
language = language.trim().toLowerCase();
|
|
||||||
|
|
||||||
// See if it's an exact match
|
|
||||||
if (Object.hasOwn(KnownLanguage, language)) {
|
|
||||||
return language as KnownLanguage;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check language aliases
|
|
||||||
if (Object.hasOwn(knownLanguageAliases, language)) {
|
|
||||||
language =
|
|
||||||
knownLanguageAliases[language as keyof typeof knownLanguageAliases];
|
|
||||||
if (Object.hasOwn(KnownLanguage, language)) {
|
|
||||||
return language as KnownLanguage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isPAT(value: string) {
|
function isPAT(value: string) {
|
||||||
return artifactScanner.isAuthToken(value, [
|
return artifactScanner.isAuthToken(value, [
|
||||||
artifactScanner.GITHUB_PAT_CLASSIC_PATTERN,
|
artifactScanner.GITHUB_PAT_CLASSIC_PATTERN,
|
||||||
@@ -225,7 +187,7 @@ function isPAT(value: string) {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
type RegistryMapping = Partial<Record<KnownLanguage, string[]>>;
|
type RegistryMapping = Partial<Record<BuiltInLanguage, string[]>>;
|
||||||
|
|
||||||
const LANGUAGE_TO_REGISTRY_TYPE: RegistryMapping = {
|
const LANGUAGE_TO_REGISTRY_TYPE: RegistryMapping = {
|
||||||
java: ["maven_repository"],
|
java: ["maven_repository"],
|
||||||
@@ -281,75 +243,6 @@ function getRegistryAddress(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Extracts an `AuthConfig` value from `config`. */
|
|
||||||
export function getAuthConfig(
|
|
||||||
config: json.UnvalidatedObject<AuthConfig>,
|
|
||||||
): AuthConfig {
|
|
||||||
// Start by checking for the OIDC configurations, since they have required properties
|
|
||||||
// which we can use to identify them.
|
|
||||||
if (isAzureConfig(config)) {
|
|
||||||
return {
|
|
||||||
"tenant-id": config["tenant-id"],
|
|
||||||
"client-id": config["client-id"],
|
|
||||||
} satisfies AzureConfig;
|
|
||||||
} else if (isAWSConfig(config)) {
|
|
||||||
return {
|
|
||||||
"aws-region": config["aws-region"],
|
|
||||||
"account-id": config["account-id"],
|
|
||||||
"role-name": config["role-name"],
|
|
||||||
domain: config.domain,
|
|
||||||
"domain-owner": config["domain-owner"],
|
|
||||||
audience: config.audience,
|
|
||||||
} satisfies AWSConfig;
|
|
||||||
} else if (isJFrogConfig(config)) {
|
|
||||||
return {
|
|
||||||
"jfrog-oidc-provider-name": config["jfrog-oidc-provider-name"],
|
|
||||||
"identity-mapping-name": config["identity-mapping-name"],
|
|
||||||
audience: config.audience,
|
|
||||||
} satisfies JFrogConfig;
|
|
||||||
} else if (isToken(config)) {
|
|
||||||
// There are three scenarios for non-OIDC authentication based on the registry type:
|
|
||||||
//
|
|
||||||
// 1. `username`+`token`
|
|
||||||
// 2. A `token` that combines the username and actual token, separated by ':'.
|
|
||||||
// 3. `username`+`password`
|
|
||||||
//
|
|
||||||
// In all three cases, all fields are optional. If the `token` field is present,
|
|
||||||
// we accept the configuration as a `Token` typed configuration, with the `token`
|
|
||||||
// value and an optional `username`. Otherwise, we accept the configuration
|
|
||||||
// typed as `UsernamePassword` (in the `else` clause below) with optional
|
|
||||||
// username and password. I.e. a private registry type that uses 1. or 2.,
|
|
||||||
// but has no `token` configured, will get accepted as `UsernamePassword` here.
|
|
||||||
|
|
||||||
if (isDefined(config.token)) {
|
|
||||||
// Mask token to reduce chance of accidental leakage in logs, if we have one.
|
|
||||||
core.setSecret(config.token);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { username: config.username, token: config.token } satisfies Token;
|
|
||||||
} else {
|
|
||||||
let username: string | undefined = undefined;
|
|
||||||
let password: string | undefined = undefined;
|
|
||||||
|
|
||||||
// Both "username" and "password" are optional. If we have reached this point, we need
|
|
||||||
// to validate which of them are present and that they have the correct type if so.
|
|
||||||
if ("password" in config && json.isString(config.password)) {
|
|
||||||
// Mask password to reduce chance of accidental leakage in logs, if we have one.
|
|
||||||
core.setSecret(config.password);
|
|
||||||
password = config.password;
|
|
||||||
}
|
|
||||||
if ("username" in config && json.isString(config.username)) {
|
|
||||||
username = config.username;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the `UsernamePassword` object. Both username and password may be undefined.
|
|
||||||
return {
|
|
||||||
username,
|
|
||||||
password,
|
|
||||||
} satisfies UsernamePassword;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// getCredentials returns registry credentials from action inputs.
|
// getCredentials returns registry credentials from action inputs.
|
||||||
// It prefers `registries_credentials` over `registry_secrets`.
|
// It prefers `registries_credentials` over `registry_secrets`.
|
||||||
// If neither is set, it returns an empty array.
|
// If neither is set, it returns an empty array.
|
||||||
@@ -357,7 +250,7 @@ export function getCredentials(
|
|||||||
logger: Logger,
|
logger: Logger,
|
||||||
registrySecrets: string | undefined,
|
registrySecrets: string | undefined,
|
||||||
registriesCredentials: string | undefined,
|
registriesCredentials: string | undefined,
|
||||||
language: KnownLanguage | undefined,
|
language: BuiltInLanguage | undefined,
|
||||||
skipUnusedRegistries: boolean = false,
|
skipUnusedRegistries: boolean = false,
|
||||||
): Credential[] {
|
): Credential[] {
|
||||||
const registryMapping = skipUnusedRegistries
|
const registryMapping = skipUnusedRegistries
|
||||||
@@ -438,11 +331,11 @@ export function getCredentials(
|
|||||||
const noUsername =
|
const noUsername =
|
||||||
!hasUsername(authConfig) || !isDefined(authConfig.username);
|
!hasUsername(authConfig) || !isDefined(authConfig.username);
|
||||||
const passwordIsPAT =
|
const passwordIsPAT =
|
||||||
isUsernamePassword(authConfig) &&
|
hasUsernameAndPassword(authConfig) &&
|
||||||
isDefined(authConfig.password) &&
|
isDefined(authConfig.password) &&
|
||||||
isPAT(authConfig.password);
|
isPAT(authConfig.password);
|
||||||
const tokenIsPAT =
|
const tokenIsPAT =
|
||||||
isToken(authConfig) &&
|
hasToken(authConfig) &&
|
||||||
isDefined(authConfig.token) &&
|
isDefined(authConfig.token) &&
|
||||||
isPAT(authConfig.token);
|
isPAT(authConfig.token);
|
||||||
|
|
||||||
@@ -454,8 +347,25 @@ export function getCredentials(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Construct the base credential object.
|
||||||
|
const baseCredential: Omit<Registry, keyof Address> = { type: e.type };
|
||||||
|
|
||||||
|
// If "replaces-base" is present, it must be a boolean.
|
||||||
|
if ("replaces-base" in e) {
|
||||||
|
if (
|
||||||
|
isDefined(e["replaces-base"]) &&
|
||||||
|
typeof e["replaces-base"] === "boolean"
|
||||||
|
) {
|
||||||
|
baseCredential["replaces-base"] = e["replaces-base"];
|
||||||
|
} else {
|
||||||
|
throw new ConfigurationError(
|
||||||
|
"Invalid credentials - 'replaces-base' must be a boolean",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
out.push({
|
out.push({
|
||||||
type: e.type,
|
...baseCredential,
|
||||||
...authConfig,
|
...authConfig,
|
||||||
...address,
|
...address,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as io from "@actions/io";
|
|||||||
import test, { ExecutionContext } from "ava";
|
import test, { ExecutionContext } from "ava";
|
||||||
import sinon from "sinon";
|
import sinon from "sinon";
|
||||||
|
|
||||||
import { JavaEnvVars, KnownLanguage } from "../languages";
|
import { JavaEnvVars, BuiltInLanguage } from "../languages";
|
||||||
import {
|
import {
|
||||||
checkExpectedLogMessages,
|
checkExpectedLogMessages,
|
||||||
getRecordingLogger,
|
getRecordingLogger,
|
||||||
@@ -182,11 +182,11 @@ test.serial("checkProxyEnvVars - credentials are removed from URLs", (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
test.serial(
|
||||||
"checkProxyEnvironment - includes base checks for all known languages",
|
"checkProxyEnvironment - includes base checks for all built-in languages",
|
||||||
async (t) => {
|
async (t) => {
|
||||||
stubToolrunner();
|
stubToolrunner();
|
||||||
|
|
||||||
for (const language of Object.values(KnownLanguage)) {
|
for (const language of Object.values(BuiltInLanguage)) {
|
||||||
const messages: LoggedMessage[] = [];
|
const messages: LoggedMessage[] = [];
|
||||||
const logger = getRecordingLogger(messages);
|
const logger = getRecordingLogger(messages);
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ test.serial(
|
|||||||
|
|
||||||
stubToolrunner();
|
stubToolrunner();
|
||||||
|
|
||||||
await checkProxyEnvironment(logger, KnownLanguage.java);
|
await checkProxyEnvironment(logger, BuiltInLanguage.java);
|
||||||
assertEnvVarLogMessages(t, Object.keys(ProxyEnvVars), messages, false);
|
assertEnvVarLogMessages(t, Object.keys(ProxyEnvVars), messages, false);
|
||||||
assertEnvVarLogMessages(t, JAVA_PROXY_ENV_VARS, messages, false);
|
assertEnvVarLogMessages(t, JAVA_PROXY_ENV_VARS, messages, false);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as path from "path";
|
|||||||
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
||||||
import * as io from "@actions/io";
|
import * as io from "@actions/io";
|
||||||
|
|
||||||
import { JavaEnvVars, KnownLanguage, Language } from "../languages";
|
import { JavaEnvVars, BuiltInLanguage, Language } from "../languages";
|
||||||
import { Logger } from "../logging";
|
import { Logger } from "../logging";
|
||||||
import { getErrorMessage, isDefined } from "../util";
|
import { getErrorMessage, isDefined } from "../util";
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ export async function checkProxyEnvironment(
|
|||||||
|
|
||||||
// Check language-specific configurations. If we don't know the language,
|
// Check language-specific configurations. If we don't know the language,
|
||||||
// then we perform all checks.
|
// then we perform all checks.
|
||||||
if (language === undefined || language === KnownLanguage.java) {
|
if (language === undefined || language === BuiltInLanguage.java) {
|
||||||
checkJavaEnvVars(logger);
|
checkJavaEnvVars(logger);
|
||||||
|
|
||||||
await showJavaSettings(logger);
|
await showJavaSettings(logger);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from "./../testing-utils";
|
} from "./../testing-utils";
|
||||||
import {
|
import {
|
||||||
checkConnections,
|
checkConnections,
|
||||||
|
connectionTestConfig,
|
||||||
ReachabilityBackend,
|
ReachabilityBackend,
|
||||||
ReachabilityError,
|
ReachabilityError,
|
||||||
} from "./reachability";
|
} from "./reachability";
|
||||||
@@ -118,3 +119,34 @@ test("checkConnections - handles invalid URLs", async (t) => {
|
|||||||
`Finished testing connections`,
|
`Finished testing connections`,
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("checkConnections - appends extra paths", async (t) => {
|
||||||
|
const backend = new MockReachabilityBackend();
|
||||||
|
const checkConnection = sinon.stub(backend, "checkConnection").resolves(200);
|
||||||
|
|
||||||
|
const messages = await withRecordingLoggerAsync(async (logger) => {
|
||||||
|
await checkConnections(
|
||||||
|
logger,
|
||||||
|
{
|
||||||
|
...proxyInfo,
|
||||||
|
registries: [{ ...nugetFeed, url: "https://api.nuget.org/" }],
|
||||||
|
},
|
||||||
|
backend,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
checkExpectedLogMessages(t, messages, [
|
||||||
|
`Testing connection to https://api.nuget.org/`,
|
||||||
|
`Successfully tested connection to https://api.nuget.org/`,
|
||||||
|
`Finished testing connections`,
|
||||||
|
]);
|
||||||
|
|
||||||
|
t.true(
|
||||||
|
checkConnection.calledWith(
|
||||||
|
sinon.match(
|
||||||
|
new URL(
|
||||||
|
`https://api.nuget.org/${connectionTestConfig["nuget_feed"]?.path}`,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
@@ -2,11 +2,41 @@ import * as https from "https";
|
|||||||
|
|
||||||
import { HttpsProxyAgent } from "https-proxy-agent";
|
import { HttpsProxyAgent } from "https-proxy-agent";
|
||||||
|
|
||||||
|
import { DocUrl } from "../doc-url";
|
||||||
import { Logger } from "../logging";
|
import { Logger } from "../logging";
|
||||||
import { getErrorMessage } from "../util";
|
import { getErrorMessage } from "../util";
|
||||||
|
|
||||||
import { getAddressString, ProxyInfo, Registry } from "./types";
|
import { getAddressString, ProxyInfo, Registry } from "./types";
|
||||||
|
|
||||||
|
/** Represents registry-specific connection test configurations. */
|
||||||
|
export interface ConnectionTestConfig {
|
||||||
|
/** An optional path to append to the end of the base url. */
|
||||||
|
path?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A partial mapping of registry types to extra connection test configurations. */
|
||||||
|
export const connectionTestConfig: Partial<
|
||||||
|
Record<string, ConnectionTestConfig>
|
||||||
|
> = {
|
||||||
|
nuget_feed: { path: "v3/index.json" },
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies the registry-specific check configuration to the base URL, if any and applicable.
|
||||||
|
*/
|
||||||
|
export function makeTestUrl(
|
||||||
|
config: ConnectionTestConfig | undefined,
|
||||||
|
base: URL,
|
||||||
|
): URL {
|
||||||
|
if (config?.path === undefined) {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
if (base.pathname.endsWith(config.path)) {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
return new URL(config.path, base);
|
||||||
|
}
|
||||||
|
|
||||||
export class ReachabilityError extends Error {
|
export class ReachabilityError extends Error {
|
||||||
constructor(public readonly statusCode?: number | undefined) {
|
constructor(public readonly statusCode?: number | undefined) {
|
||||||
super();
|
super();
|
||||||
@@ -41,7 +71,7 @@ class NetworkReachabilityBackend implements ReachabilityBackend {
|
|||||||
url,
|
url,
|
||||||
{
|
{
|
||||||
agent: this.agent,
|
agent: this.agent,
|
||||||
method: "HEAD",
|
method: "GET",
|
||||||
ca: this.proxy.cert,
|
ca: this.proxy.cert,
|
||||||
timeout: 5 * 1000, // 5 seconds
|
timeout: 5 * 1000, // 5 seconds
|
||||||
},
|
},
|
||||||
@@ -85,6 +115,13 @@ export async function checkConnections(
|
|||||||
// Don't do anything if there are no registries.
|
// Don't do anything if there are no registries.
|
||||||
if (proxy.registries.length === 0) return result;
|
if (proxy.registries.length === 0) return result;
|
||||||
|
|
||||||
|
// Start a log group and print a message with a disclaimer with a link to the
|
||||||
|
// relevant documentation that these checks are a best-effort process.
|
||||||
|
logger.startGroup("Testing connections via the proxy");
|
||||||
|
logger.info(
|
||||||
|
`The connection tests performed here are best-effort only and failures here may not affect the subsequent analysis. See ${DocUrl.PRIVATE_REGISTRY_LOGS} for more information.`,
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Initialise a networking backend if no backend was provided.
|
// Initialise a networking backend if no backend was provided.
|
||||||
if (backend === undefined) {
|
if (backend === undefined) {
|
||||||
@@ -92,6 +129,7 @@ export async function checkConnections(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const registry of proxy.registries) {
|
for (const registry of proxy.registries) {
|
||||||
|
const config = connectionTestConfig[registry.type];
|
||||||
const address = getAddressString(registry);
|
const address = getAddressString(registry);
|
||||||
const url = URL.parse(address);
|
const url = URL.parse(address);
|
||||||
|
|
||||||
@@ -102,9 +140,11 @@ export async function checkConnections(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const testUrl = makeTestUrl(config, url);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.debug(`Testing connection to ${url}...`);
|
logger.debug(`Testing connection to ${url}...`);
|
||||||
const statusCode = await backend.checkConnection(url);
|
const statusCode = await backend.checkConnection(testUrl);
|
||||||
|
|
||||||
logger.info(`Successfully tested connection to ${url} (${statusCode})`);
|
logger.info(`Successfully tested connection to ${url} (${statusCode})`);
|
||||||
result.add(registry);
|
result.add(registry);
|
||||||
@@ -126,5 +166,6 @@ export async function checkConnections(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.endGroup();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import test from "ava";
|
import test from "ava";
|
||||||
|
|
||||||
|
import { makeFromSchema, withSchemaMatrix } from "../json/testing-util";
|
||||||
import { setupTests } from "../testing-utils";
|
import { setupTests } from "../testing-utils";
|
||||||
|
|
||||||
import * as types from "./types";
|
import * as types from "./types";
|
||||||
@@ -26,6 +27,38 @@ const validJFrogCredential: types.JFrogConfig = {
|
|||||||
"identity-mapping-name": "my-mapping",
|
"identity-mapping-name": "my-mapping",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
test("hasUsername", (t) => {
|
||||||
|
// Reject the case where `username` is missing.
|
||||||
|
t.false(types.hasUsername({}));
|
||||||
|
|
||||||
|
// Test all cases where `username` is present.
|
||||||
|
withSchemaMatrix(
|
||||||
|
t,
|
||||||
|
types.usernameSchema,
|
||||||
|
{ excludeAbsent: true },
|
||||||
|
(value) => {
|
||||||
|
t.true(types.hasUsername(value));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("hasUsernameAndPassword", (t) => {
|
||||||
|
// Reject cases where `username` or `password` are missing.
|
||||||
|
t.false(types.hasUsernameAndPassword({}));
|
||||||
|
t.false(types.hasUsernameAndPassword({ username: "foo" }));
|
||||||
|
t.false(types.hasUsernameAndPassword({ password: "foo" }));
|
||||||
|
|
||||||
|
// Test all cases where both `username` and `password` are present.
|
||||||
|
withSchemaMatrix(
|
||||||
|
t,
|
||||||
|
types.usernamePasswordSchema,
|
||||||
|
{ excludeAbsent: true },
|
||||||
|
(value) => {
|
||||||
|
t.true(types.hasUsernameAndPassword(value));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("credentialToStr - pretty-prints valid username+password configurations", (t) => {
|
test("credentialToStr - pretty-prints valid username+password configurations", (t) => {
|
||||||
const secret = "password123";
|
const secret = "password123";
|
||||||
const credential: types.Credential = {
|
const credential: types.Credential = {
|
||||||
@@ -107,13 +140,46 @@ test("credentialToStr - pretty-prints valid JFrog OIDC configurations", (t) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("credentialToStr - pretty-prints valid Cloudsmith OIDC configurations", (t) => {
|
||||||
|
const credential: types.Credential = {
|
||||||
|
type: "maven_credential",
|
||||||
|
url: "https://localhost",
|
||||||
|
...(makeFromSchema(
|
||||||
|
true,
|
||||||
|
types.cloudsmithConfigSchema,
|
||||||
|
) as types.CloudsmithConfig),
|
||||||
|
};
|
||||||
|
|
||||||
|
const str = types.credentialToStr(credential);
|
||||||
|
|
||||||
|
t.is(
|
||||||
|
"Type: maven_credential; Url: https://localhost; Cloudsmith Namespace: value-for-namespace; Cloudsmith Service Slug: value-for-service-slug; Cloudsmith API Host: value-for-api-host;",
|
||||||
|
str,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("credentialToStr - pretty-prints valid GCP OIDC configurations", (t) => {
|
||||||
|
const credential: types.Credential = {
|
||||||
|
type: "maven_credential",
|
||||||
|
url: "https://localhost",
|
||||||
|
...(makeFromSchema(true, types.gcpConfigSchema) as types.GCPConfig),
|
||||||
|
};
|
||||||
|
|
||||||
|
const str = types.credentialToStr(credential);
|
||||||
|
|
||||||
|
t.is(
|
||||||
|
"Type: maven_credential; Url: https://localhost; GCP Workload Identity Provider: value-for-workload-identity-provider; GCP Service Account: value-for-service-account; GCP Audience: value-for-audience;",
|
||||||
|
str,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("credentialToStr - hides passwords", (t) => {
|
test("credentialToStr - hides passwords", (t) => {
|
||||||
const secret = "password123";
|
const secret = "password123";
|
||||||
const credential = {
|
const credential = {
|
||||||
type: "maven_credential",
|
type: "maven_credential",
|
||||||
password: secret,
|
password: secret,
|
||||||
url: "https://localhost",
|
url: "https://localhost",
|
||||||
};
|
} satisfies types.Credential;
|
||||||
|
|
||||||
const str = types.credentialToStr(credential);
|
const str = types.credentialToStr(credential);
|
||||||
|
|
||||||
@@ -127,7 +193,7 @@ test("credentialToStr - hides tokens", (t) => {
|
|||||||
type: "maven_credential",
|
type: "maven_credential",
|
||||||
token: secret,
|
token: secret,
|
||||||
url: "https://localhost",
|
url: "https://localhost",
|
||||||
};
|
} satisfies types.Credential;
|
||||||
|
|
||||||
const str = types.credentialToStr(credential);
|
const str = types.credentialToStr(credential);
|
||||||
|
|
||||||
|
|||||||
+134
-88
@@ -9,144 +9,177 @@ import { isDefined } from "../util";
|
|||||||
*/
|
*/
|
||||||
export type RawCredential = UnvalidatedObject<Credential>;
|
export type RawCredential = UnvalidatedObject<Credential>;
|
||||||
|
|
||||||
/** Usernames may be present for both authentication with tokens or passwords. */
|
/** A schema for credential objects with a username. */
|
||||||
export type Username = {
|
export const usernameSchema = {
|
||||||
/** The username needed to authenticate to the package registry, if any. */
|
/** The username needed to authenticate to the package registry, if any. */
|
||||||
username?: string;
|
username: json.optional(json.string),
|
||||||
};
|
} as const satisfies json.Schema;
|
||||||
|
|
||||||
/** Decides whether `config` has a username. */
|
/** Usernames may be present for both authentication with tokens or passwords. */
|
||||||
|
export type Username = json.FromSchema<typeof usernameSchema>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Narrows `config` to `Username` if `config` has a `username` property.
|
||||||
|
* Not used for validation. Assumes that `config` is already a validated `AuthConfig`.
|
||||||
|
*/
|
||||||
export function hasUsername(config: AuthConfig): config is Username {
|
export function hasUsername(config: AuthConfig): config is Username {
|
||||||
return "username" in config;
|
return "username" in config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A schema for credential objects with a username and password. */
|
||||||
|
export const usernamePasswordSchema = {
|
||||||
|
/** The password needed to authenticate to the package registry, if any. */
|
||||||
|
password: json.optional(json.string),
|
||||||
|
...usernameSchema,
|
||||||
|
} as const satisfies json.Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fields expected for authentication based on a username and password.
|
* Fields expected for authentication based on a username and password.
|
||||||
* Both username and password are optional.
|
* Both username and password are optional.
|
||||||
*/
|
*/
|
||||||
export type UsernamePassword = {
|
export type UsernamePassword = json.FromSchema<typeof usernamePasswordSchema>;
|
||||||
/** The password needed to authenticate to the package registry, if any. */
|
|
||||||
password?: string;
|
|
||||||
} & Username;
|
|
||||||
|
|
||||||
/** Decides whether `config` is based on a username and password. */
|
/**
|
||||||
export function isUsernamePassword(
|
* Narrows `config` to `UsernamePassword` if it has a `username` and `password` property.
|
||||||
|
* Not used for validation. Assumes that `config` is already a validated `AuthConfig`.
|
||||||
|
*/
|
||||||
|
export function hasUsernameAndPassword(
|
||||||
config: AuthConfig,
|
config: AuthConfig,
|
||||||
): config is UsernamePassword {
|
): config is UsernamePassword {
|
||||||
return hasUsername(config) && "password" in config;
|
return hasUsername(config) && "password" in config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A schema for credential objects for token-based authentication. */
|
||||||
|
export const tokenSchema = {
|
||||||
|
/** The token needed to authenticate to the package registry, if any. */
|
||||||
|
token: json.optional(json.string),
|
||||||
|
...usernameSchema,
|
||||||
|
} as const satisfies json.Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fields expected for token-based authentication.
|
* Fields expected for token-based authentication.
|
||||||
* Both username and token are optional.
|
* Both username and token are optional.
|
||||||
*/
|
*/
|
||||||
export type Token = {
|
export type Token = json.FromSchema<typeof tokenSchema>;
|
||||||
/** The token needed to authenticate to the package registry, if any. */
|
|
||||||
token?: string;
|
/**
|
||||||
} & Username;
|
* Narrows `config` to `Token` if it has a `token` property.
|
||||||
|
* Not used for validation. Assumes that `config` is already a validated `AuthConfig`.
|
||||||
|
*/
|
||||||
|
export function hasToken(config: AuthConfig): config is Token {
|
||||||
|
return "token" in config;
|
||||||
|
}
|
||||||
|
|
||||||
/** Decides whether `config` is token-based. */
|
/** Decides whether `config` is token-based. */
|
||||||
export function isToken(
|
export function isToken(
|
||||||
config: UnvalidatedObject<AuthConfig>,
|
config: UnvalidatedObject<AuthConfig>,
|
||||||
): config is Token {
|
): config is Token {
|
||||||
// The "username" field is optional, but should be a string if present.
|
return "token" in config && json.validateSchema(tokenSchema, config);
|
||||||
if ("username" in config && !json.isStringOrUndefined(config.username)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The "token" field is required, and must be a string or undefined.
|
|
||||||
return "token" in config && json.isStringOrUndefined(config.token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A schema for Azure OIDC configurations. */
|
||||||
|
export const azureConfigSchema = {
|
||||||
|
"tenant-id": json.string,
|
||||||
|
"client-id": json.string,
|
||||||
|
} as const satisfies json.Schema;
|
||||||
|
|
||||||
/** Configuration for Azure OIDC. */
|
/** Configuration for Azure OIDC. */
|
||||||
export type AzureConfig = { "tenant-id": string; "client-id": string };
|
export type AzureConfig = json.FromSchema<typeof azureConfigSchema>;
|
||||||
|
|
||||||
/** Decides whether `config` is an Azure OIDC configuration. */
|
/** Decides whether `config` is an Azure OIDC configuration. */
|
||||||
export function isAzureConfig(
|
export function isAzureConfig(
|
||||||
config: UnvalidatedObject<AuthConfig>,
|
config: UnvalidatedObject<AuthConfig>,
|
||||||
): config is AzureConfig {
|
): config is AzureConfig {
|
||||||
return (
|
return json.validateSchema(azureConfigSchema, config);
|
||||||
"tenant-id" in config &&
|
|
||||||
"client-id" in config &&
|
|
||||||
isDefined(config["tenant-id"]) &&
|
|
||||||
isDefined(config["client-id"]) &&
|
|
||||||
json.isString(config["tenant-id"]) &&
|
|
||||||
json.isString(config["client-id"])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A schema for AWS OIDC configurations. */
|
||||||
|
export const awsConfigSchema = {
|
||||||
|
"aws-region": json.string,
|
||||||
|
"account-id": json.string,
|
||||||
|
"role-name": json.string,
|
||||||
|
domain: json.string,
|
||||||
|
"domain-owner": json.string,
|
||||||
|
audience: json.optional(json.string),
|
||||||
|
} as const satisfies json.Schema;
|
||||||
|
|
||||||
/** Configuration for AWS OIDC. */
|
/** Configuration for AWS OIDC. */
|
||||||
export type AWSConfig = {
|
export type AWSConfig = json.FromSchema<typeof awsConfigSchema>;
|
||||||
"aws-region": string;
|
|
||||||
"account-id": string;
|
|
||||||
"role-name": string;
|
|
||||||
domain: string;
|
|
||||||
"domain-owner": string;
|
|
||||||
audience?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Decides whether `config` is an AWS OIDC configuration. */
|
/** Decides whether `config` is an AWS OIDC configuration. */
|
||||||
export function isAWSConfig(
|
export function isAWSConfig(
|
||||||
config: UnvalidatedObject<AuthConfig>,
|
config: UnvalidatedObject<AuthConfig>,
|
||||||
): config is AWSConfig {
|
): config is AWSConfig {
|
||||||
// All of these properties are required.
|
return json.validateSchema(awsConfigSchema, config);
|
||||||
const requiredProperties = [
|
|
||||||
"aws-region",
|
|
||||||
"account-id",
|
|
||||||
"role-name",
|
|
||||||
"domain",
|
|
||||||
"domain-owner",
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const property of requiredProperties) {
|
|
||||||
if (
|
|
||||||
!(property in config) ||
|
|
||||||
!isDefined(config[property]) ||
|
|
||||||
!json.isString(config[property])
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The "audience" field is optional, but should be a string if present.
|
|
||||||
if ("audience" in config && !json.isStringOrUndefined(config.audience)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A schema for JFrog OIDC configurations. */
|
||||||
|
export const jfrogConfigSchema = {
|
||||||
|
"jfrog-oidc-provider-name": json.string,
|
||||||
|
audience: json.optional(json.string),
|
||||||
|
"identity-mapping-name": json.optional(json.string),
|
||||||
|
} as const satisfies json.Schema;
|
||||||
|
|
||||||
/** Configuration for JFrog OIDC. */
|
/** Configuration for JFrog OIDC. */
|
||||||
export type JFrogConfig = {
|
export type JFrogConfig = json.FromSchema<typeof jfrogConfigSchema>;
|
||||||
"jfrog-oidc-provider-name": string;
|
|
||||||
audience?: string;
|
|
||||||
"identity-mapping-name"?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Decides whether `config` is a JFrog OIDC configuration. */
|
/** Decides whether `config` is a JFrog OIDC configuration. */
|
||||||
export function isJFrogConfig(
|
export function isJFrogConfig(
|
||||||
config: UnvalidatedObject<AuthConfig>,
|
config: UnvalidatedObject<AuthConfig>,
|
||||||
): config is JFrogConfig {
|
): config is JFrogConfig {
|
||||||
// The "audience" and "identity-mapping-name" fields are optional, but should be strings if present.
|
return json.validateSchema(jfrogConfigSchema, config);
|
||||||
if ("audience" in config && !json.isStringOrUndefined(config.audience)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
"identity-mapping-name" in config &&
|
|
||||||
!json.isStringOrUndefined(config["identity-mapping-name"])
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
"jfrog-oidc-provider-name" in config &&
|
|
||||||
isDefined(config["jfrog-oidc-provider-name"]) &&
|
|
||||||
json.isString(config["jfrog-oidc-provider-name"])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A schema for Cloudsmith OIDC configurations. */
|
||||||
|
export const cloudsmithConfigSchema = {
|
||||||
|
namespace: json.string,
|
||||||
|
"service-slug": json.string,
|
||||||
|
"api-host": json.string,
|
||||||
|
} as const satisfies json.Schema;
|
||||||
|
|
||||||
|
/** Configuration for Cloudsmith OIDC. */
|
||||||
|
export type CloudsmithConfig = json.FromSchema<typeof cloudsmithConfigSchema>;
|
||||||
|
|
||||||
|
/** Decides whether `config` is a Cloudsmith OIDC configuration. */
|
||||||
|
export function isCloudsmithConfig(
|
||||||
|
config: UnvalidatedObject<AuthConfig>,
|
||||||
|
): config is CloudsmithConfig {
|
||||||
|
return json.validateSchema(cloudsmithConfigSchema, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A schema for GCP OIDC configurations. */
|
||||||
|
export const gcpConfigSchema = {
|
||||||
|
"workload-identity-provider": json.string,
|
||||||
|
"service-account": json.optional(json.string),
|
||||||
|
audience: json.optional(json.string),
|
||||||
|
} as const satisfies json.Schema;
|
||||||
|
|
||||||
|
/** Configuration for GCP OIDC. */
|
||||||
|
export type GCPConfig = json.FromSchema<typeof gcpConfigSchema>;
|
||||||
|
|
||||||
|
/** Decides whether `config` is a GCP OIDC configuration. */
|
||||||
|
export function isGCPConfig(
|
||||||
|
config: UnvalidatedObject<AuthConfig>,
|
||||||
|
): config is GCPConfig {
|
||||||
|
return json.validateSchema(gcpConfigSchema, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** An array of all OIDC configuration schemas along with output-friendly names. */
|
||||||
|
export const oidcSchemas = [
|
||||||
|
{ schema: azureConfigSchema, name: "Azure" },
|
||||||
|
{ schema: awsConfigSchema, name: "AWS" },
|
||||||
|
{ schema: jfrogConfigSchema, name: "JFrog" },
|
||||||
|
{ schema: cloudsmithConfigSchema, name: "Cloudsmith" },
|
||||||
|
{ schema: gcpConfigSchema, name: "GCP" },
|
||||||
|
];
|
||||||
|
|
||||||
/** Represents all supported OIDC configurations. */
|
/** Represents all supported OIDC configurations. */
|
||||||
export type OIDC = AzureConfig | AWSConfig | JFrogConfig;
|
export type OIDC =
|
||||||
|
| AzureConfig
|
||||||
|
| AWSConfig
|
||||||
|
| JFrogConfig
|
||||||
|
| CloudsmithConfig
|
||||||
|
| GCPConfig;
|
||||||
|
|
||||||
/** All authentication-related fields. */
|
/** All authentication-related fields. */
|
||||||
export type AuthConfig = UsernamePassword | Token | OIDC;
|
export type AuthConfig = UsernamePassword | Token | OIDC;
|
||||||
@@ -165,7 +198,7 @@ export type Credential = AuthConfig & Registry;
|
|||||||
export function credentialToStr(credential: Credential): string {
|
export function credentialToStr(credential: Credential): string {
|
||||||
let result: string = `Type: ${credential.type};`;
|
let result: string = `Type: ${credential.type};`;
|
||||||
|
|
||||||
const appendIfDefined = (name: string, val: string | undefined) => {
|
const appendIfDefined = (name: string, val: string | undefined | null) => {
|
||||||
if (isDefined(val)) {
|
if (isDefined(val)) {
|
||||||
result += ` ${name}: ${val};`;
|
result += ` ${name}: ${val};`;
|
||||||
}
|
}
|
||||||
@@ -184,7 +217,7 @@ export function credentialToStr(credential: Credential): string {
|
|||||||
isDefined(credential.password) ? "***" : undefined,
|
isDefined(credential.password) ? "***" : undefined,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isToken(credential)) {
|
if (hasToken(credential)) {
|
||||||
appendIfDefined("Token", isDefined(credential.token) ? "***" : undefined);
|
appendIfDefined("Token", isDefined(credential.token) ? "***" : undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +238,17 @@ export function credentialToStr(credential: Credential): string {
|
|||||||
credential["identity-mapping-name"],
|
credential["identity-mapping-name"],
|
||||||
);
|
);
|
||||||
appendIfDefined("JFrog Audience", credential.audience);
|
appendIfDefined("JFrog Audience", credential.audience);
|
||||||
|
} else if (isCloudsmithConfig(credential)) {
|
||||||
|
appendIfDefined("Cloudsmith Namespace", credential.namespace);
|
||||||
|
appendIfDefined("Cloudsmith Service Slug", credential["service-slug"]);
|
||||||
|
appendIfDefined("Cloudsmith API Host", credential["api-host"]);
|
||||||
|
} else if (isGCPConfig(credential)) {
|
||||||
|
appendIfDefined(
|
||||||
|
"GCP Workload Identity Provider",
|
||||||
|
credential["workload-identity-provider"],
|
||||||
|
);
|
||||||
|
appendIfDefined("GCP Service Account", credential["service-account"]);
|
||||||
|
appendIfDefined("GCP Audience", credential.audience);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -214,6 +258,8 @@ export function credentialToStr(credential: Credential): string {
|
|||||||
export type Registry = {
|
export type Registry = {
|
||||||
/** The type of the package registry. */
|
/** The type of the package registry. */
|
||||||
type: string;
|
type: string;
|
||||||
|
/** Whether the registry replaces the base registry for the ecosystem. */
|
||||||
|
"replaces-base"?: boolean;
|
||||||
} & Address;
|
} & Address;
|
||||||
|
|
||||||
// If a registry has an `url`, then that takes precedence over the `host` which may or may
|
// If a registry has an `url`, then that takes precedence over the `host` which may or may
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import test from "ava";
|
||||||
|
|
||||||
|
import * as json from "../json";
|
||||||
|
import { makeFromSchema } from "../json/testing-util";
|
||||||
|
import { setupTests } from "../testing-utils";
|
||||||
|
|
||||||
|
import * as types from "./types";
|
||||||
|
import { getAuthConfig } from "./validation";
|
||||||
|
|
||||||
|
setupTests(test);
|
||||||
|
|
||||||
|
for (const schemaTest of types.oidcSchemas) {
|
||||||
|
for (const includeOptional of [true, false]) {
|
||||||
|
const minimalName = includeOptional ? "full" : "minimal";
|
||||||
|
|
||||||
|
test(`getAuthConfig - ${schemaTest.name} - ${minimalName}`, async (t) => {
|
||||||
|
const config = makeFromSchema(includeOptional, schemaTest.schema);
|
||||||
|
|
||||||
|
t.deepEqual(
|
||||||
|
getAuthConfig({
|
||||||
|
...config,
|
||||||
|
unexpected: "unexpected-value",
|
||||||
|
} as unknown as json.UnvalidatedObject<types.AuthConfig>),
|
||||||
|
config,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("getAuthConfig - token", async (t) => {
|
||||||
|
const config = makeFromSchema(true, types.tokenSchema);
|
||||||
|
|
||||||
|
t.deepEqual(
|
||||||
|
getAuthConfig({
|
||||||
|
...config,
|
||||||
|
unexpected: "unexpected-value",
|
||||||
|
} as json.UnvalidatedObject<types.AuthConfig>),
|
||||||
|
config,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("getAuthConfig - username and password", async (t) => {
|
||||||
|
const config = makeFromSchema(true, types.usernamePasswordSchema);
|
||||||
|
|
||||||
|
t.deepEqual(
|
||||||
|
getAuthConfig({
|
||||||
|
...config,
|
||||||
|
unexpected: "unexpected-value",
|
||||||
|
} as json.UnvalidatedObject<types.AuthConfig>),
|
||||||
|
config,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("getAuthConfig - empty", async (t) => {
|
||||||
|
const config = makeFromSchema(false, types.usernamePasswordSchema);
|
||||||
|
|
||||||
|
// Since the purpose of constructing the `AuthConfig` values is for
|
||||||
|
// serialisation to JSON so that they can be passed to the proxy as configuration,
|
||||||
|
// we only care that the stringified JSON representations are the same.
|
||||||
|
t.deepEqual(
|
||||||
|
JSON.stringify(
|
||||||
|
getAuthConfig({
|
||||||
|
...config,
|
||||||
|
unexpected: "unexpected-value",
|
||||||
|
} as json.UnvalidatedObject<types.AuthConfig>),
|
||||||
|
),
|
||||||
|
JSON.stringify({}),
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
|
import * as json from "../json";
|
||||||
|
import { isDefined } from "../util";
|
||||||
|
|
||||||
|
import type { AuthConfig, UsernamePassword } from "./types";
|
||||||
|
import * as types from "./types";
|
||||||
|
|
||||||
|
/** Constructs a new object from `obj` with only keys that exist in `schema`. */
|
||||||
|
export function cloneCredential<S extends json.Schema>(
|
||||||
|
schema: S,
|
||||||
|
obj: json.FromSchema<S>,
|
||||||
|
): json.FromSchema<S> {
|
||||||
|
const result = {};
|
||||||
|
|
||||||
|
for (const key of Object.keys(schema)) {
|
||||||
|
// Skip keys that don't exist or don't have a value.
|
||||||
|
if (!isDefined(obj[key])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result[key] = obj[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result as json.FromSchema<S>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Extracts an `AuthConfig` value from `config`. */
|
||||||
|
export function getAuthConfig(
|
||||||
|
config: json.UnvalidatedObject<AuthConfig>,
|
||||||
|
): AuthConfig {
|
||||||
|
// Start by checking for the OIDC configurations, since they have required properties
|
||||||
|
// which we can use to identify them.
|
||||||
|
for (const oidcSchema of types.oidcSchemas) {
|
||||||
|
if (json.validateSchema(oidcSchema.schema, config)) {
|
||||||
|
return cloneCredential(oidcSchema.schema, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, try the basic configuration types.
|
||||||
|
if (types.isToken(config)) {
|
||||||
|
// There are three scenarios for non-OIDC authentication based on the registry type:
|
||||||
|
//
|
||||||
|
// 1. `username`+`token`
|
||||||
|
// 2. A `token` that combines the username and actual token, separated by ':'.
|
||||||
|
// 3. `username`+`password`
|
||||||
|
//
|
||||||
|
// In all three cases, all fields are optional. If the `token` field is present,
|
||||||
|
// we accept the configuration as a `Token` typed configuration, with the `token`
|
||||||
|
// value and an optional `username`. Otherwise, we accept the configuration
|
||||||
|
// typed as `UsernamePassword` (in the `else` clause below) with optional
|
||||||
|
// username and password. I.e. a private registry type that uses 1. or 2.,
|
||||||
|
// but has no `token` configured, will get accepted as `UsernamePassword` here.
|
||||||
|
|
||||||
|
if (isDefined(config.token)) {
|
||||||
|
// Mask token to reduce chance of accidental leakage in logs, if we have one.
|
||||||
|
core.setSecret(config.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cloneCredential(types.tokenSchema, config);
|
||||||
|
} else {
|
||||||
|
let username: string | undefined = undefined;
|
||||||
|
let password: string | undefined = undefined;
|
||||||
|
|
||||||
|
// Both "username" and "password" are optional. If we have reached this point, we need
|
||||||
|
// to validate which of them are present and that they have the correct type if so.
|
||||||
|
if ("password" in config && json.isString(config.password)) {
|
||||||
|
// Mask password to reduce chance of accidental leakage in logs, if we have one.
|
||||||
|
core.setSecret(config.password);
|
||||||
|
password = config.password;
|
||||||
|
}
|
||||||
|
if ("username" in config && json.isString(config.username)) {
|
||||||
|
username = config.username;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the `UsernamePassword` object. Both username and password may be undefined.
|
||||||
|
return {
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
} satisfies UsernamePassword;
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-14
@@ -4,7 +4,7 @@ import * as sinon from "sinon";
|
|||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
import { Config } from "./config-utils";
|
import { Config } from "./config-utils";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import { ToolsSource } from "./setup-codeql";
|
import { ToolsSource } from "./setup-codeql";
|
||||||
import {
|
import {
|
||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
setupTests,
|
setupTests,
|
||||||
setupActionsVars,
|
setupActionsVars,
|
||||||
createTestConfig,
|
createTestConfig,
|
||||||
|
makeMacro,
|
||||||
} from "./testing-utils";
|
} from "./testing-utils";
|
||||||
import { BuildMode, ConfigurationError, withTmpDir, wrapError } from "./util";
|
import { BuildMode, ConfigurationError, withTmpDir, wrapError } from "./util";
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ test.serial("createStatusReportBase", async (t) => {
|
|||||||
new Date("May 19, 2023 05:19:00"),
|
new Date("May 19, 2023 05:19:00"),
|
||||||
createTestConfig({
|
createTestConfig({
|
||||||
buildMode: BuildMode.None,
|
buildMode: BuildMode.None,
|
||||||
languages: [KnownLanguage.java, KnownLanguage.swift],
|
languages: [BuiltInLanguage.java, BuiltInLanguage.swift],
|
||||||
}),
|
}),
|
||||||
{ numAvailableBytes: 100, numTotalBytes: 500 },
|
{ numAvailableBytes: 100, numTotalBytes: 500 },
|
||||||
getRunnerLogger(false),
|
getRunnerLogger(false),
|
||||||
@@ -291,10 +292,9 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const testCreateInitWithConfigStatusReport = test.macro({
|
const testCreateInitWithConfigStatusReport = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t,
|
t,
|
||||||
_title: string,
|
|
||||||
config: Config,
|
config: Config,
|
||||||
expectedReportProperties: Partial<InitWithConfigStatusReport>,
|
expectedReportProperties: Partial<InitWithConfigStatusReport>,
|
||||||
) => {
|
) => {
|
||||||
@@ -337,15 +337,14 @@ const testCreateInitWithConfigStatusReport = test.macro({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: (_, title) => `createInitWithConfigStatusReport: ${title}`,
|
title: (title) => `createInitWithConfigStatusReport: ${title}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
testCreateInitWithConfigStatusReport.serial(
|
||||||
testCreateInitWithConfigStatusReport,
|
|
||||||
"returns a value",
|
"returns a value",
|
||||||
createTestConfig({
|
createTestConfig({
|
||||||
buildMode: BuildMode.None,
|
buildMode: BuildMode.None,
|
||||||
languages: [KnownLanguage.java, KnownLanguage.swift],
|
languages: [BuiltInLanguage.java, BuiltInLanguage.swift],
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
trap_cache_download_size_bytes: 1024,
|
trap_cache_download_size_bytes: 1024,
|
||||||
@@ -355,12 +354,11 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testCreateInitWithConfigStatusReport.serial(
|
||||||
testCreateInitWithConfigStatusReport,
|
|
||||||
"includes packs for a single language",
|
"includes packs for a single language",
|
||||||
createTestConfig({
|
createTestConfig({
|
||||||
buildMode: BuildMode.None,
|
buildMode: BuildMode.None,
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
computedConfig: {
|
computedConfig: {
|
||||||
packs: ["foo", "bar"],
|
packs: ["foo", "bar"],
|
||||||
},
|
},
|
||||||
@@ -372,12 +370,11 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
testCreateInitWithConfigStatusReport.serial(
|
||||||
testCreateInitWithConfigStatusReport,
|
|
||||||
"includes packs for multiple languages",
|
"includes packs for multiple languages",
|
||||||
createTestConfig({
|
createTestConfig({
|
||||||
buildMode: BuildMode.None,
|
buildMode: BuildMode.None,
|
||||||
languages: [KnownLanguage.java, KnownLanguage.swift],
|
languages: [BuiltInLanguage.java, BuiltInLanguage.swift],
|
||||||
computedConfig: {
|
computedConfig: {
|
||||||
packs: { java: ["java-foo", "java-bar"], swift: ["swift-bar"] },
|
packs: { java: ["java-foo", "java-bar"], swift: ["swift-bar"] },
|
||||||
},
|
},
|
||||||
|
|||||||
+27
-3
@@ -2,7 +2,11 @@ import { TextDecoder } from "node:util";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
import * as github from "@actions/github";
|
import * as github from "@actions/github";
|
||||||
import { ExecutionContext, TestFn } from "ava";
|
import test, {
|
||||||
|
type ExecutionContext,
|
||||||
|
type MacroDeclarationOptions,
|
||||||
|
type TestFn,
|
||||||
|
} from "ava";
|
||||||
import nock from "nock";
|
import nock from "nock";
|
||||||
import * as sinon from "sinon";
|
import * as sinon from "sinon";
|
||||||
|
|
||||||
@@ -85,8 +89,8 @@ function wrapOutput(context: TestContext) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setupTests(test: TestFn<any>) {
|
export function setupTests(testFn: TestFn<any>) {
|
||||||
const typedTest = test as TestFn<TestContext>;
|
const typedTest = testFn as TestFn<TestContext>;
|
||||||
|
|
||||||
typedTest.beforeEach((t) => {
|
typedTest.beforeEach((t) => {
|
||||||
// Set an empty CodeQL object so that all method calls will fail
|
// Set an empty CodeQL object so that all method calls will fail
|
||||||
@@ -139,6 +143,26 @@ export function setupTests(test: TestFn<any>) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Declare a reusable test implementation, with better type safety than `test.macro`.
|
||||||
|
*/
|
||||||
|
export function makeMacro<Args extends unknown[]>(
|
||||||
|
decl: MacroDeclarationOptions<Args, unknown>,
|
||||||
|
) {
|
||||||
|
const m = test.macro<Args>(decl);
|
||||||
|
|
||||||
|
const wrapper = (name: string, ...args: Args) => test(name, m, ...args);
|
||||||
|
wrapper.test = (...args: Args) => test(m, ...args);
|
||||||
|
wrapper.serial = (name: string, ...args: Args) =>
|
||||||
|
test.serial(name, m, ...args);
|
||||||
|
// Make the implementation available as `fn`. We don't call it `exec` so
|
||||||
|
// that results from this function are not valid arguments to `test`
|
||||||
|
// or `test.serial`.
|
||||||
|
wrapper.fn = decl.exec;
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default values for environment variables typically set in an Actions
|
* Default values for environment variables typically set in an Actions
|
||||||
* environment. Tests can override individual variables by passing them in the
|
* environment. Tests can override individual variables by passing them in the
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import * as sinon from "sinon";
|
|||||||
|
|
||||||
import { CodeQL, getCodeQLForTesting } from "./codeql";
|
import { CodeQL, getCodeQLForTesting } from "./codeql";
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { createTestConfig, makeVersionInfo, setupTests } from "./testing-utils";
|
import { createTestConfig, makeVersionInfo, setupTests } from "./testing-utils";
|
||||||
import { ToolsFeature } from "./tools-features";
|
import { ToolsFeature } from "./tools-features";
|
||||||
import { getCombinedTracerConfig } from "./tracer-config";
|
import { getCombinedTracerConfig } from "./tracer-config";
|
||||||
@@ -16,7 +16,7 @@ setupTests(test);
|
|||||||
|
|
||||||
function getTestConfig(tempDir: string): configUtils.Config {
|
function getTestConfig(tempDir: string): configUtils.Config {
|
||||||
return createTestConfig({
|
return createTestConfig({
|
||||||
languages: [KnownLanguage.java],
|
languages: [BuiltInLanguage.java],
|
||||||
tempDir,
|
tempDir,
|
||||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
});
|
});
|
||||||
@@ -36,7 +36,7 @@ async function stubCodeql(
|
|||||||
);
|
);
|
||||||
sinon
|
sinon
|
||||||
.stub(codeqlObject, "isTracedLanguage")
|
.stub(codeqlObject, "isTracedLanguage")
|
||||||
.withArgs(KnownLanguage.java)
|
.withArgs(BuiltInLanguage.java)
|
||||||
.resolves(true);
|
.resolves(true);
|
||||||
return codeqlObject;
|
return codeqlObject;
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ test("getCombinedTracerConfig - return undefined when no languages are traced la
|
|||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
const config = getTestConfig(tmpDir);
|
const config = getTestConfig(tmpDir);
|
||||||
// No traced languages
|
// No traced languages
|
||||||
config.languages = [KnownLanguage.javascript, KnownLanguage.python];
|
config.languages = [BuiltInLanguage.javascript, BuiltInLanguage.python];
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
await getCombinedTracerConfig(await stubCodeql(), config),
|
await getCombinedTracerConfig(await stubCodeql(), config),
|
||||||
undefined,
|
undefined,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { Feature } from "./feature-flags";
|
import { Feature } from "./feature-flags";
|
||||||
import * as gitUtils from "./git-utils";
|
import * as gitUtils from "./git-utils";
|
||||||
import { KnownLanguage } from "./languages";
|
import { BuiltInLanguage } from "./languages";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import {
|
import {
|
||||||
createFeatures,
|
createFeatures,
|
||||||
@@ -41,7 +41,7 @@ const stubCodeql = createStubCodeQL({
|
|||||||
async betterResolveLanguages() {
|
async betterResolveLanguages() {
|
||||||
return {
|
return {
|
||||||
extractors: {
|
extractors: {
|
||||||
[KnownLanguage.javascript]: [
|
[BuiltInLanguage.javascript]: [
|
||||||
{
|
{
|
||||||
extractor_root: "some_root",
|
extractor_root: "some_root",
|
||||||
extractor_options: {
|
extractor_options: {
|
||||||
@@ -65,7 +65,7 @@ const stubCodeql = createStubCodeQL({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[KnownLanguage.cpp]: [
|
[BuiltInLanguage.cpp]: [
|
||||||
{
|
{
|
||||||
extractor_root: "other_root",
|
extractor_root: "other_root",
|
||||||
},
|
},
|
||||||
@@ -76,7 +76,7 @@ const stubCodeql = createStubCodeQL({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const testConfigWithoutTmpDir = createTestConfig({
|
const testConfigWithoutTmpDir = createTestConfig({
|
||||||
languages: [KnownLanguage.javascript, KnownLanguage.cpp],
|
languages: [BuiltInLanguage.javascript, BuiltInLanguage.cpp],
|
||||||
trapCaches: {
|
trapCaches: {
|
||||||
javascript: "/some/cache/dir",
|
javascript: "/some/cache/dir",
|
||||||
},
|
},
|
||||||
@@ -84,7 +84,7 @@ const testConfigWithoutTmpDir = createTestConfig({
|
|||||||
|
|
||||||
function getTestConfigWithTempDir(tempDir: string): configUtils.Config {
|
function getTestConfigWithTempDir(tempDir: string): configUtils.Config {
|
||||||
return createTestConfig({
|
return createTestConfig({
|
||||||
languages: [KnownLanguage.javascript, KnownLanguage.ruby],
|
languages: [BuiltInLanguage.javascript, BuiltInLanguage.ruby],
|
||||||
tempDir,
|
tempDir,
|
||||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
trapCaches: {
|
trapCaches: {
|
||||||
@@ -100,7 +100,7 @@ test.serial("check flags for JS, analyzing default branch", async (t) => {
|
|||||||
sinon.stub(gitUtils, "isAnalyzingDefaultBranch").resolves(true);
|
sinon.stub(gitUtils, "isAnalyzingDefaultBranch").resolves(true);
|
||||||
const result = await getTrapCachingExtractorConfigArgsForLang(
|
const result = await getTrapCachingExtractorConfigArgsForLang(
|
||||||
config,
|
config,
|
||||||
KnownLanguage.javascript,
|
BuiltInLanguage.javascript,
|
||||||
);
|
);
|
||||||
t.deepEqual(result, [
|
t.deepEqual(result, [
|
||||||
`-O=javascript.trap.cache.dir=${path.resolve(tmpDir, "jsCache")}`,
|
`-O=javascript.trap.cache.dir=${path.resolve(tmpDir, "jsCache")}`,
|
||||||
@@ -131,10 +131,10 @@ test("get languages that support TRAP caching", async (t) => {
|
|||||||
const logger = getRecordingLogger(loggedMessages);
|
const logger = getRecordingLogger(loggedMessages);
|
||||||
const languagesSupportingCaching = await getLanguagesSupportingCaching(
|
const languagesSupportingCaching = await getLanguagesSupportingCaching(
|
||||||
stubCodeql,
|
stubCodeql,
|
||||||
[KnownLanguage.javascript, KnownLanguage.cpp],
|
[BuiltInLanguage.javascript, BuiltInLanguage.cpp],
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
t.deepEqual(languagesSupportingCaching, [KnownLanguage.javascript]);
|
t.deepEqual(languagesSupportingCaching, [BuiltInLanguage.javascript]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial("upload cache key contains right fields", async (t) => {
|
test.serial("upload cache key contains right fields", async (t) => {
|
||||||
@@ -180,7 +180,7 @@ test.serial(
|
|||||||
);
|
);
|
||||||
await downloadTrapCaches(
|
await downloadTrapCaches(
|
||||||
stubCodeql,
|
stubCodeql,
|
||||||
[KnownLanguage.javascript, KnownLanguage.cpp],
|
[BuiltInLanguage.javascript, BuiltInLanguage.cpp],
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
t.assert(
|
t.assert(
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import * as sinon from "sinon";
|
|||||||
|
|
||||||
import { AnalysisKind, getAnalysisConfig } from "./analyses";
|
import { AnalysisKind, getAnalysisConfig } from "./analyses";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import { createFeatures, setupTests } from "./testing-utils";
|
import { createFeatures, makeMacro, setupTests } from "./testing-utils";
|
||||||
import { UploadResult } from "./upload-lib";
|
import { UploadResult } from "./upload-lib";
|
||||||
import * as uploadLib from "./upload-lib";
|
import * as uploadLib from "./upload-lib";
|
||||||
import { postProcessAndUploadSarif } from "./upload-sarif";
|
import { postProcessAndUploadSarif } from "./upload-sarif";
|
||||||
@@ -43,7 +43,7 @@ function mockPostProcessSarifFiles() {
|
|||||||
return postProcessSarifFiles;
|
return postProcessSarifFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
const postProcessAndUploadSarifMacro = test.macro({
|
const postProcessAndUploadSarifMacro = makeMacro({
|
||||||
exec: async (
|
exec: async (
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
sarifFiles: string[],
|
sarifFiles: string[],
|
||||||
@@ -123,9 +123,8 @@ const postProcessAndUploadSarifMacro = test.macro({
|
|||||||
title: (providedTitle = "") => `processAndUploadSarif - ${providedTitle}`,
|
title: (providedTitle = "") => `processAndUploadSarif - ${providedTitle}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial(
|
postProcessAndUploadSarifMacro.serial(
|
||||||
"SARIF file",
|
"SARIF file",
|
||||||
postProcessAndUploadSarifMacro,
|
|
||||||
["test.sarif"],
|
["test.sarif"],
|
||||||
(tempDir) => path.join(tempDir, "test.sarif"),
|
(tempDir) => path.join(tempDir, "test.sarif"),
|
||||||
{
|
{
|
||||||
@@ -138,9 +137,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
postProcessAndUploadSarifMacro.serial(
|
||||||
"JSON file",
|
"JSON file",
|
||||||
postProcessAndUploadSarifMacro,
|
|
||||||
["test.json"],
|
["test.json"],
|
||||||
(tempDir) => path.join(tempDir, "test.json"),
|
(tempDir) => path.join(tempDir, "test.json"),
|
||||||
{
|
{
|
||||||
@@ -153,9 +151,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
postProcessAndUploadSarifMacro.serial(
|
||||||
"Code Scanning files",
|
"Code Scanning files",
|
||||||
postProcessAndUploadSarifMacro,
|
|
||||||
["test.json", "test.sarif"],
|
["test.json", "test.sarif"],
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
@@ -169,9 +166,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
postProcessAndUploadSarifMacro.serial(
|
||||||
"Code Quality file",
|
"Code Quality file",
|
||||||
postProcessAndUploadSarifMacro,
|
|
||||||
["test.quality.sarif"],
|
["test.quality.sarif"],
|
||||||
(tempDir) => path.join(tempDir, "test.quality.sarif"),
|
(tempDir) => path.join(tempDir, "test.quality.sarif"),
|
||||||
{
|
{
|
||||||
@@ -184,9 +180,8 @@ test.serial(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test.serial(
|
postProcessAndUploadSarifMacro.serial(
|
||||||
"Mixed files",
|
"Mixed files",
|
||||||
postProcessAndUploadSarifMacro,
|
|
||||||
["test.sarif", "test.quality.sarif"],
|
["test.sarif", "test.quality.sarif"],
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ packs:
|
|||||||
- codeql-testing/codeql-pack3:other-query.ql
|
- codeql-testing/codeql-pack3:other-query.ql
|
||||||
|
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- tests
|
|
||||||
- lib
|
- lib
|
||||||
|
- pr-checks
|
||||||
|
- tests
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ name: Pack testing in the CodeQL Action
|
|||||||
|
|
||||||
disable-default-queries: true
|
disable-default-queries: true
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- tests
|
|
||||||
- lib
|
- lib
|
||||||
|
- pr-checks
|
||||||
|
- tests
|
||||||
|
|||||||
@@ -6,5 +6,6 @@ packs:
|
|||||||
- codeql-testing/codeql-pack2
|
- codeql-testing/codeql-pack2
|
||||||
- codeql-testing/codeql-pack3:other-query.ql
|
- codeql-testing/codeql-pack3:other-query.ql
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- tests
|
|
||||||
- lib
|
- lib
|
||||||
|
- pr-checks
|
||||||
|
- tests
|
||||||
|
|||||||
Reference in New Issue
Block a user