Compare commits

...

606 Commits

Author SHA1 Message Date
Henry Mercer
0116bc2df5 Merge pull request #1947 from github/update-v2.22.3-82ba90b1d
Merge main into releases/v2
2023-10-13 14:01:05 +01:00
github-actions[bot]
f5a984b113 Update changelog for v2.22.3 2023-10-13 12:31:28 +00:00
Henry Mercer
82ba90b1d9 Merge pull request #1945 from github/henrymercer/authenticate-api-url
Authenticate when downloading CodeQL Bundle from GHES API
2023-10-12 19:02:05 +01:00
Henry Mercer
34f97d7a16 Merge pull request #1944 from github/henrymercer/sublanguage-file-coverage-fixes
Enable sub-language file coverage during interpretation and update PR check
2023-10-12 19:01:47 +01:00
Henry Mercer
74442e0a95 Add changelog note 2023-10-12 17:26:51 +01:00
Henry Mercer
bd32fab74f Provide token when downloading from GHES API 2023-10-12 17:26:42 +01:00
Nora
b584cf8321 Merge pull request #1922 from github/nora/add-commit-sha-to-database-upload
Add commit sha to database upload
2023-10-12 17:50:48 +02:00
Henry Mercer
761255a4a3 Merge pull request #1943 from github/mergeback/v2.22.2-to-main-d90b8d79
Mergeback v2.22.2 refs/heads/releases/v2 into main
2023-10-12 12:12:03 +01:00
Henry Mercer
346d5c4b07 Test sub-language file coverage in file baseline information check
We can do this now that the nightly has a version number starting with
2.15.0.
2023-10-12 11:58:09 +01:00
Henry Mercer
5950d13564 Enable sub-language file coverage in interpret-results too 2023-10-12 11:57:23 +01:00
github-actions[bot]
c1a0ad9a04 Update checked-in dependencies 2023-10-12 10:44:16 +00:00
github-actions[bot]
76a9f5c431 Update changelog and version after v2.22.2 2023-10-12 10:38:34 +00:00
Henry Mercer
d90b8d79de Merge pull request #1942 from github/update-v2.22.2-8a2cbabd4
Merge main into releases/v2
2023-10-12 11:36:04 +01:00
github-actions[bot]
175f696a4d Update changelog for v2.22.2 2023-10-12 10:09:51 +00:00
Henry Mercer
8a2cbabd43 Merge pull request #1938 from github/update-bundle/codeql-bundle-v2.15.0
Update default bundle to 2.15.0
2023-10-11 13:14:25 +01:00
Henry Mercer
a5cf70c3f1 Merge branch 'main' into update-bundle/codeql-bundle-v2.15.0 2023-10-11 12:23:42 +01:00
Henry Mercer
a67b110795 Merge pull request #1937 from github/henrymercer/new-analysis-summary-bump
Bump CLI version for new analysis summaries to v2.15.0
2023-10-10 18:32:33 +01:00
Henry Mercer
0eb279015c Merge branch 'main' into update-bundle/codeql-bundle-v2.15.0 2023-10-10 17:20:48 +01:00
github-actions[bot]
275f994944 Add changelog note 2023-10-10 16:18:35 +00:00
github-actions[bot]
d5d445b7af Update default bundle to codeql-bundle-v2.15.0 2023-10-10 16:18:31 +00:00
Henry Mercer
2a7218bdef Bump CLI version for new analysis summaries to v2.15.0
Earlier versions support new analysis summaries, but v2.15.0 improves
the quality of the summary messages.
2023-10-10 16:42:34 +01:00
Henry Mercer
78bfd29301 Merge pull request #1935 from github/henrymercer/ref-sha-input-reduce-ci-load
Remove 42 CI jobs by only running `ref` and `sha` input checks against a single CLI version
2023-10-10 16:32:56 +01:00
Henry Mercer
dfb913f660 Merge pull request #1936 from github/dependabot/npm_and_yarn/npm-07540147dc
Bump the npm group with 5 updates
2023-10-10 14:42:19 +01:00
Nora
e62d946796 Add new param to test 2023-10-10 08:48:53 +00:00
github-actions[bot]
026e833827 Update checked-in dependencies 2023-10-09 17:38:29 +00:00
dependabot[bot]
5d6442e87d Bump the npm group with 5 updates
Bumps the npm group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/uuid) | `9.0.4` | `9.0.5` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `6.7.3` | `6.7.5` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `6.7.3` | `6.7.5` |
| [eslint](https://github.com/eslint/eslint) | `8.50.0` | `8.51.0` |
| [sinon](https://github.com/sinonjs/sinon) | `16.0.0` | `16.1.0` |


Updates `@types/uuid` from 9.0.4 to 9.0.5
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/uuid)

Updates `@typescript-eslint/eslint-plugin` from 6.7.3 to 6.7.5
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.5/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.7.3 to 6.7.5
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.5/packages/parser)

Updates `eslint` from 8.50.0 to 8.51.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.50.0...v8.51.0)

Updates `sinon` from 16.0.0 to 16.1.0
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v16.0.0...v16.1.0)

---
updated-dependencies:
- dependency-name: "@types/uuid"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-09 17:35:49 +00:00
Henry Mercer
4ab92370dd Merge pull request #1927 from github/henrymercer/reduce-log-duplication
Reduce duplication in the logs when errors occur in CLI commands
2023-10-09 13:30:24 +01:00
Henry Mercer
83d1db3366 Merge branch 'main' into henrymercer/reduce-log-duplication 2023-10-09 12:53:58 +01:00
Henry Mercer
2125352e3e Merge pull request #1934 from github/mergeback/v2.22.1-to-main-fdcae64e
Mergeback v2.22.1 refs/heads/releases/v2 into main
2023-10-09 12:37:17 +01:00
Henry Mercer
d52a751f8f Only run ref and sha input checks against a single CLI version
These checks aren't affected by the CLI version, so just run them with
the default CLI.
2023-10-09 12:09:21 +01:00
github-actions[bot]
947b43a6b6 Update checked-in dependencies 2023-10-09 11:06:11 +00:00
github-actions[bot]
788783aba5 Update changelog and version after v2.22.1 2023-10-09 11:04:27 +00:00
Henry Mercer
fdcae64e14 Merge pull request #1932 from github/update-v2.22.1-18e6c398c
Merge main into releases/v2
2023-10-09 12:02:20 +01:00
github-actions[bot]
8554648f41 Update changelog for v2.22.1 2023-10-09 09:46:39 +00:00
Henry Mercer
18e6c398ce Merge pull request #1930 from github/aeisenberg-patch-1
Update CHANGELOG.md
2023-10-09 10:30:49 +01:00
Henry Mercer
5e34d08d9e Link PR and fix case of Python 2023-10-09 09:55:04 +01:00
Michael B. Gale
faf91ca6bd Merge pull request #1926 from github/mbg/suppress-go-workaround-warning
Suppress Go workaround warning if autobuilder ran
2023-10-09 09:42:25 +01:00
Nora
8193a92e41 Await commitOid 2023-10-09 07:43:35 +00:00
Michael B. Gale
ffaea6c837 Merge branch 'main' into mbg/suppress-go-workaround-warning 2023-10-08 18:07:40 +01:00
Andrew Eisenberg
0a0988c4b2 Update CHANGELOG.md
Add missing work and make it clear that failure only applies when trying to downgrade to 3.11.
2023-10-07 09:30:52 -07:00
Andrew Eisenberg
0d5c2e0228 Merge pull request #1928 from github/aeisenberg/fix-python312
Add a fix for python 3.12
2023-10-06 16:42:31 -07:00
Andrew Eisenberg
94b6970619 Update CHANGELOG.md 2023-10-06 14:49:04 -07:00
Andrew Eisenberg
669c61022c Add a feature flag to turn this off for newer versions of codeql 2023-10-06 14:17:01 -07:00
Andrew Eisenberg
028bacb8e9 Add integration test
Also:

- Update changelog
- Fix comments in check_python script
2023-10-06 13:52:34 -07:00
Andrew Eisenberg
d0916526cd Add a fix for python 3.12
The python extractor does not yet support 3.12. Check for this and
instead make sure we run python 3.11. Only need to check on windows
since we are extremely unlikely to be running 3.12 on linux or macos.
2023-10-06 13:05:18 -07:00
Henry Mercer
102a12bba4 Add changelog note 2023-10-06 16:00:36 +01:00
Henry Mercer
8295705640 Reduce duplication in the logs when errors occur in CLI commands 2023-10-06 15:53:22 +01:00
Michael B. Gale
4eccc6dac4 Suppress Go workaround warning if autobuilder ran 2023-10-06 15:11:31 +01:00
Nora
aed2e7f47f Add commit id to params 2023-10-06 13:16:13 +00:00
Henry Mercer
a2dc5ffaff Merge pull request #1925 from github/mergeback/v2.22.0-to-main-2cb752a8
Mergeback v2.22.0 refs/heads/releases/v2 into main
2023-10-06 12:36:34 +01:00
github-actions[bot]
b6ea09e3e4 Update checked-in dependencies 2023-10-06 11:12:35 +00:00
github-actions[bot]
fd3d78671c Update changelog and version after v2.22.0 2023-10-06 10:47:42 +00:00
Henry Mercer
2cb752a87e Merge pull request #1924 from github/update-v2.22.0-3f7850a17
Merge main into releases/v2
2023-10-06 11:45:52 +01:00
Henry Mercer
e50f53baa1 Add changelog note for tracing Go 1.21 2023-10-06 11:20:43 +01:00
github-actions[bot]
0a65c007f6 Update changelog for v2.22.0 2023-10-06 09:45:48 +00:00
hoshino tsuyoshi
3f7850a179 Improve downloading log message (#1920)
Previously, a trailing `.` character was recognized as part of the URL in GitHub Actions log output. We add an additional space before it to distinguish.
2023-10-05 21:21:52 +00:00
Henry Mercer
27235304e0 Merge pull request #1923 from github/henrymercer/fix-resolve-environment-aliases
Fix using the `resolve-environment` Action with language aliases
2023-10-05 18:48:18 +01:00
Henry Mercer
8f0e8b0890 Tweak language parsing to improve clarity 2023-10-05 16:26:47 +01:00
Henry Mercer
f243294ab7 Extend PR check to test resolve-environment works with language alias 2023-10-05 15:57:53 +01:00
Nora
075eb6aaea Use getCommitOid to get the id 2023-10-05 14:47:51 +00:00
Michael B. Gale
1ea6a10947 Merge pull request #1909 from github/mbg/go-1.21-workaround 2023-10-05 15:31:48 +01:00
Henry Mercer
e26ed57a22 Defer language aliasing to CLI when appropriate 2023-10-05 15:27:51 +01:00
Henry Mercer
0ac7669167 Fix using resolve-environment Action with language aliases
This impacted default setup configurations that analyzed Go alongside at
least one of the following languages:
- C/C++
- Java/Kotlin
- JavaScript/TypeScript
2023-10-05 14:54:24 +01:00
Michael B. Gale
235bdca565 Use markdownMessage 2023-10-05 14:27:34 +01:00
Michael B. Gale
94f3e9b563 Apply suggestions from code review
Co-authored-by: Henry Mercer <henry.mercer@me.com>
2023-10-05 14:27:09 +01:00
Michael B. Gale
3b2fee487e Include mkdirSync in try/catch 2023-10-05 13:48:56 +01:00
Michael B. Gale
a144bf5d7f Store diagnostics in language-specific database 2023-10-05 13:39:58 +01:00
Michael B. Gale
4154eb799b Fix: workflow name and description 2023-10-05 13:29:18 +01:00
Michael B. Gale
7f4a9481a7 Fix: create codeql-action diagnostics directory 2023-10-05 13:20:34 +01:00
Michael B. Gale
faf7528b44 Add integration test for Go workaround diagnostic 2023-10-05 13:11:37 +01:00
Michael B. Gale
2b193c5ab5 Store diagnostics in a codeql-action directory 2023-10-05 13:05:46 +01:00
Michael B. Gale
eb71a60380 Emit diagnostic when Go was changed after init 2023-10-05 12:52:06 +01:00
Michael B. Gale
36777d2236 Add utilities to produce diagnostics 2023-10-05 12:50:19 +01:00
Nora
1727de39fe Add commit sha to database upload 2023-10-05 09:49:13 +00:00
Michael B. Gale
c8dd2bc90f Add integration test for workaround 2023-10-05 10:46:10 +01:00
Michael B. Gale
db9f2c5968 Add test for isSupportedToolsFeature 2023-10-05 10:33:33 +01:00
Michael B. Gale
738030674f Trim file output 2023-10-05 10:25:31 +01:00
Michael B. Gale
68d0b65ee5 Add another level to tempBinPath 2023-10-04 20:03:32 +01:00
Igwe Kalu
517782a2a0 Improve description of codeql-action/init languages input (#1919) 2023-10-04 12:01:23 -07:00
Michael B. Gale
bb70bab648 Add comment explaining workaround 2023-10-04 19:57:11 +01:00
Michael B. Gale
41a13ec084 Fix comment in analyse Action 2023-10-04 19:53:23 +01:00
Michael B. Gale
9a5a628613 Improve getFileType
- Change parameter name
- Add more documentation
2023-10-04 19:50:02 +01:00
Michael B. Gale
8ac187720c Allow other patch versions of Go in workflows 2023-10-04 19:46:36 +01:00
Michael B. Gale
f6d9b6bcfa Improve/add log messages 2023-10-04 19:45:09 +01:00
Michael B. Gale
7b0b42afec Remove FeaturesInVersionResult 2023-10-04 19:45:08 +01:00
Michael B. Gale
abb71f14cf Add CLI feature flag to disable Go workaround 2023-10-04 19:45:08 +01:00
Michael B. Gale
604448043e Add which go output in warning 2023-10-04 19:45:08 +01:00
Michael B. Gale
4cee553ea6 Output stdout upon error in getFileType 2023-10-04 19:45:08 +01:00
Michael B. Gale
df098abd11 Set DID_AUTOBUILD_GOLANG in runAutobuild 2023-10-04 19:45:08 +01:00
Michael B. Gale
4611ff9b23 Cross-check Go binary in analyze Action 2023-10-04 19:45:04 +01:00
Michael B. Gale
2bd75f528c Install Go wrapper script if necessary 2023-10-04 17:23:52 +01:00
Michael B. Gale
3c15d2383b Add utility function to run file command 2023-10-04 17:23:52 +01:00
Michael B. Gale
c08086a26a Add new environment variable for Go binary path 2023-10-04 17:23:52 +01:00
Michael B. Gale
d718153f0a Use Go 1.21 for Go tracing checks 2023-10-04 17:23:51 +01:00
Michael B. Gale
3fb6719bea Merge pull request #1918 from github/mbg/support-version-features
Support `features` key in `version` JSON output
2023-10-04 17:23:13 +01:00
Michael B. Gale
bcbb900532 Rename VersionOutput to VersionInfo 2023-10-04 15:54:34 +01:00
Michael B. Gale
49b94f1a2d Remove unused properties from VersionOutput 2023-10-04 15:51:26 +01:00
Michael B. Gale
bb67eddd77 Wrap JSON parsing in try/catch 2023-10-04 15:49:25 +01:00
Michael B. Gale
e827ad5b71 Move makeVersionOutput to testing-utils.js 2023-10-04 15:49:04 +01:00
Michael B. Gale
a402be8739 Fix linter error 2023-10-04 11:43:14 +01:00
Michael B. Gale
74b46628c3 Support features key in version JSON output 2023-10-04 11:28:28 +01:00
dependabot[bot]
3dd4ad872b Bump the actions-setup-swift group (#1912)
Bumps the actions-setup-swift group in /.github/actions/setup-swift with 1 update: [swift-actions/setup-swift](https://github.com/swift-actions/setup-swift).

- [Release notes](https://github.com/swift-actions/setup-swift/releases)
- [Commits](cdcbe8e35d...f51889efb5)

---
updated-dependencies:
- dependency-name: swift-actions/setup-swift
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-setup-swift
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Angela P Wen <angelapwen@github.com>
2023-10-03 15:21:00 -07:00
dependabot[bot]
b686e07c2b Bump urllib3 in /python-setup/tests/pipenv/python-3.8 (#1917)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.0.4...2.0.6)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 17:49:02 +00:00
dependabot[bot]
7de46310d9 Bump urllib3 in /python-setup/tests/poetry/python-3.8 (#1916)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.7 to 1.26.17.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.7...1.26.17)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 10:25:36 -07:00
dependabot[bot]
896a68d162 Bump urllib3 in /python-setup/tests/poetry/requests-3 (#1915)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.7 to 1.26.17.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.7...1.26.17)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 10:25:17 -07:00
dependabot[bot]
5f88bb1ffa Bump urllib3 in /python-setup/tests/pipenv/requests-3 (#1914)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.0.4...2.0.6)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 10:24:54 -07:00
dependabot[bot]
90f8ed12cc Bump the npm group with 3 updates (#1911)
* Bump the npm group with 3 updates

Bumps the npm group with 3 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [eslint-plugin-github](https://github.com/github/eslint-plugin-github).


Updates `@typescript-eslint/eslint-plugin` from 6.7.2 to 6.7.3
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.3/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.7.2 to 6.7.3
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.3/packages/parser)

Updates `eslint-plugin-github` from 4.10.0 to 4.10.1
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.10.0...v4.10.1)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Angela P Wen <angelapwen@github.com>
2023-10-02 16:31:08 -07:00
Aditya Sharad
ed2a90b161 Merge pull request #1910 from github/henrymercer/remove-ml-powered-queries
Remove ML-powered queries
2023-10-02 14:40:55 -07:00
Henry Mercer
7b16c0dad0 Improve method name for addQueriesFromWorkflow. 2023-10-02 17:35:03 +01:00
Henry Mercer
37a2d1fe3c Remove ML-powered queries PR checks 2023-10-02 17:29:54 +01:00
Henry Mercer
5dac60ecef Add changelog note 2023-10-02 17:20:58 +01:00
Henry Mercer
ebbadee09e Remove ML-powered queries 2023-10-02 17:20:50 +01:00
Aditya Sharad
a370ce344f Merge pull request #1898 from Panquesito7/checkout_v4
Use `actions/checkout@v4` in test helper
2023-09-28 15:59:34 -07:00
David Leal
66572c69b0 Merge branch 'main' into checkout_v4 2023-09-28 14:31:04 -06:00
David Leal
e0103eab17 Use actions/checkout@v4 2023-09-28 20:30:31 +00:00
Henry Mercer
e7a6fa9589 Merge pull request #1907 from github/henrymercer/deprecate-codeql-2.9
Bump minimum CodeQL version to 2.10.5
2023-09-27 21:36:22 +01:00
Henry Mercer
f59bf3c458 Fix expected artifact directory name for semver versions 2023-09-27 19:44:41 +01:00
Henry Mercer
6e3f5b0184 Prompt maintainers to start process when GHES version deprecated 2023-09-27 19:40:26 +01:00
Henry Mercer
1d70a98580 Document CodeQL deprecation process 2023-09-27 19:10:31 +01:00
Henry Mercer
e4ef094279 Merge branch 'main' into henrymercer/deprecate-codeql-2.9 2023-09-27 17:18:42 +01:00
Henry Mercer
2cc1651ead Merge pull request #1906 from github/mergeback/v2.21.9-to-main-ddccb873
Mergeback v2.21.9 refs/heads/releases/v2 into main
2023-09-27 17:14:03 +01:00
Henry Mercer
a6484fa0f6 Merge pull request #1896 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2023-09-27 16:44:20 +01:00
Henry Mercer
9ef3267030 Merge pull request #1904 from github/henrymercer/tweak-cgroup-ram-logging
Don't log invalid cgroup memory limits
2023-09-27 16:43:26 +01:00
Henry Mercer
219066c343 Fix error in generated workflow 2023-09-27 16:41:29 +01:00
Henry Mercer
a9a0f3b4c0 Add changelog note 2023-09-27 16:23:10 +01:00
Henry Mercer
467bfa1cff Update CodeQL versions tested in PR checks 2023-09-27 16:21:16 +01:00
Henry Mercer
1d5eed8d40 Remove deprecated functionality 2023-09-27 16:16:13 +01:00
Henry Mercer
96fa24c6ba Bump minimum CodeQL version to 2.10.5 2023-09-27 16:08:27 +01:00
Henry Mercer
f1752b0b55 Bump minor version 2023-09-27 16:07:45 +01:00
github-actions[bot]
7efe1c9625 Update checked-in dependencies 2023-09-27 15:01:27 +00:00
github-actions[bot]
0dd2eafff0 Update changelog and version after v2.21.9 2023-09-27 14:58:13 +00:00
Alexander Eyers-Taylor
ddccb87388 Merge pull request #1905 from github/update-v2.21.9-27cb1e1de
Merge main into releases/v2
2023-09-27 15:56:30 +01:00
github-actions[bot]
d8cb5a2a0f Update changelog for v2.21.9 2023-09-27 14:21:29 +00:00
Henry Mercer
378bbcd274 Don't log invalid cgroup memory limits 2023-09-27 13:56:20 +01:00
dependabot[bot]
27cb1e1de5 Bump the npm group with 6 updates (#1902)
* Bump the npm group with 6 updates

Bumps the npm group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [@octokit/types](https://github.com/octokit/types.ts) | `11.1.0` | `12.0.0` |
| [@types/adm-zip](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/adm-zip) | `0.5.1` | `0.5.2` |
| [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.5.2` | `7.5.3` |
| [@types/sinon](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/sinon) | `10.0.16` | `10.0.17` |
| [eslint](https://github.com/eslint/eslint) | `8.49.0` | `8.50.0` |
| [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) | `3.6.0` | `3.6.1` |


Updates `@octokit/types` from 11.1.0 to 12.0.0
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v11.1.0...v12.0.0)

Updates `@types/adm-zip` from 0.5.1 to 0.5.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/adm-zip)

Updates `@types/semver` from 7.5.2 to 7.5.3
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Updates `@types/sinon` from 10.0.16 to 10.0.17
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/sinon)

Updates `eslint` from 8.49.0 to 8.50.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.49.0...v8.50.0)

Updates `eslint-import-resolver-typescript` from 3.6.0 to 3.6.1
- [Release notes](https://github.com/import-js/eslint-import-resolver-typescript/releases)
- [Changelog](https://github.com/import-js/eslint-import-resolver-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-import-resolver-typescript/compare/v3.6.0...v3.6.1)

---
updated-dependencies:
- dependency-name: "@octokit/types"
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: "@types/adm-zip"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/semver"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/sinon"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-import-resolver-typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-26 10:34:03 -07:00
Henry Mercer
4818fdd8ec Merge pull request #1903 from github/henrymercer/sublanguage-file-coverage
Enable sub-language file coverage behind a feature flag
2023-09-26 17:30:08 +01:00
Alexander Eyers-Taylor
e548601be3 Merge pull request #1897 from github/update-bundle/codeql-bundle-v2.14.6
Update default bundle to 2.14.6
2023-09-26 14:03:58 +01:00
Alexander Eyers-Taylor
cc6542087a Merge branch 'main' into update-bundle/codeql-bundle-v2.14.6 2023-09-26 13:37:33 +01:00
Henry Mercer
c95737bb43 Add changelog note 2023-09-26 11:38:39 +01:00
Henry Mercer
41d2ffad87 Enable sub-language file coverage behind a ff 2023-09-26 11:38:39 +01:00
Henry Mercer
650a85ef6d Merge pull request #1901 from github/henrymercer/check-for-duplicated-languages
Warn when workflow analyzes the same language twice
2023-09-25 14:25:34 +01:00
Henry Mercer
0de36d4594 Merge branch 'main' into henrymercer/check-for-duplicated-languages 2023-09-22 19:14:37 +01:00
Henry Mercer
0dfaf4ef65 Add a changelog note 2023-09-22 19:13:56 +01:00
Henry Mercer
d1a917f445 Test that workflow with two different languages doesn't produce an error 2023-09-22 19:08:38 +01:00
Henry Mercer
431174f620 Factor out groupLanguagesByExtractor 2023-09-22 18:55:52 +01:00
Nick Rolfe
3078f51bf0 Merge pull request #1900 from github/nickrolfe/fine-grained-version
Bump min. version for evaluator parallelism feature flag
2023-09-22 17:44:44 +01:00
Henry Mercer
d0c18ba23e Warn when workflow analyzes the same language twice 2023-09-22 14:54:03 +01:00
Nick Rolfe
724d64319a Bump min. version for evaluator parallelism feature flag
Since we suspect fine-grained parallelism may make the OOM issues worse,
we don't want to enable it on 2.14.0-2.14.5, even though they support
it.
2023-09-22 14:43:03 +01:00
Paolo Tranquilli
49aaa9a420 Merge pull request #1889 from github/redsun82/cpp-autoinstall-dependencies
C++: introduce automatic installation of dependencies in the autobuilder
2023-09-21 16:49:24 +02:00
Paolo Tranquilli
c21e1dd0da Lint and build 2023-09-21 16:23:27 +02:00
Paolo Tranquilli
53bed11e0b Apply suggestions from code review
Co-authored-by: Henry Mercer <henry.mercer@me.com>
2023-09-21 16:11:21 +02:00
Paolo Tranquilli
ab8159054c Add changelog entry 2023-09-20 16:33:46 +02:00
Paolo Tranquilli
765807bee7 Add RUNNER_ENVIRONMENT to the list of known default setup variables 2023-09-20 14:08:00 +02:00
Paolo Tranquilli
bf2187592f C++: simplify CppDependencyInstallation interface 2023-09-20 14:05:12 +02:00
Paolo Tranquilli
c4c06786f2 C++: introduce automatic installation of dependencies in the autobuilder
This introduces the possibility to automatically install dependencies
when running the C++ autobuilder on an Ubuntu runner, that will be
available with upcoming version 2.15.0.

An experimental `cpp-autoinstall-dependencies` input is added to the
`autobuild` action. When not set, the default is driven by a feature
flag.
2023-09-20 14:05:12 +02:00
github-actions[bot]
59aaff8718 Add changelog note 2023-09-20 10:53:17 +00:00
github-actions[bot]
5897cf73c4 Update default bundle to codeql-bundle-v2.14.6 2023-09-20 10:53:12 +00:00
github-actions[bot]
d467036438 Update supported GitHub Enterprise Server versions 2023-09-20 00:10:40 +00:00
Angela P Wen
8e0b1c74b1 Add continueOnError: true for debug artifact upload (#1895) 2023-09-19 15:10:13 -07:00
Henry Mercer
01b8760f90 Merge pull request #1894 from github/mergeback/v2.21.8-to-main-6a28655e
Mergeback v2.21.8 refs/heads/releases/v2 into main
2023-09-19 12:07:52 +01:00
github-actions[bot]
74e25cdac8 Update checked-in dependencies 2023-09-19 10:40:42 +00:00
github-actions[bot]
eac8f8cd93 Update changelog and version after v2.21.8 2023-09-19 10:19:21 +00:00
Henry Mercer
6a28655e3d Merge pull request #1893 from github/update-v2.21.8-dd1128f4f
Merge main into releases/v2
2023-09-19 11:17:36 +01:00
github-actions[bot]
2ca983a793 Update changelog for v2.21.8 2023-09-19 09:31:44 +00:00
dependabot[bot]
dd1128f4f1 Bump the npm group with 11 updates (#1892)
* Bump the npm group with 11 updates

Bumps the npm group with 11 updates:

| Package | From | To |
| --- | --- | --- |
| [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact) | `1.1.1` | `1.1.2` |
| [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) | `1.10.0` | `1.10.1` |
| [uuid](https://github.com/uuidjs/uuid) | `9.0.0` | `9.0.1` |
| [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/uuid) | `9.0.3` | `9.0.4` |
| [@types/adm-zip](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/adm-zip) | `0.5.0` | `0.5.1` |
| [@types/js-yaml](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/js-yaml) | `4.0.5` | `4.0.6` |
| [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.5.1` | `7.5.2` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `6.5.0` | `6.7.2` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `6.6.0` | `6.7.2` |
| [eslint](https://github.com/eslint/eslint) | `8.48.0` | `8.49.0` |
| [sinon](https://github.com/sinonjs/sinon) | `15.2.0` | `16.0.0` |


Updates `@actions/artifact` from 1.1.1 to 1.1.2
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/artifact)

Updates `@actions/core` from 1.10.0 to 1.10.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Updates `uuid` from 9.0.0 to 9.0.1
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1)

Updates `@types/uuid` from 9.0.3 to 9.0.4
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/uuid)

Updates `@types/adm-zip` from 0.5.0 to 0.5.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/adm-zip)

Updates `@types/js-yaml` from 4.0.5 to 4.0.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/js-yaml)

Updates `@types/semver` from 7.5.1 to 7.5.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Updates `@typescript-eslint/eslint-plugin` from 6.5.0 to 6.7.2
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.2/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.6.0 to 6.7.2
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.2/packages/parser)

Updates `eslint` from 8.48.0 to 8.49.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.48.0...v8.49.0)

Updates `sinon` from 15.2.0 to 16.0.0
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v15.2.0...v16.0.0)

---
updated-dependencies:
- dependency-name: "@actions/artifact"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/uuid"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/adm-zip"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/js-yaml"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/semver"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-18 20:01:16 +00:00
Henry Mercer
f3a128e0fe Merge pull request #1891 from github/henrymercer/fix-cgroup-limits
Fix reading `cgroup` limits on `ubuntu-20.04`
2023-09-18 17:25:00 +01:00
Henry Mercer
6846be007d Address review comments 2023-09-18 16:00:59 +01:00
Henry Mercer
0e74cd1660 Handle cgroup file containing MAX_INT on ubuntu-20.04 2023-09-18 13:44:02 +01:00
Henry Mercer
379f89dc53 Log cgroup RAM limits 2023-09-18 13:05:29 +01:00
Henry Mercer
253d9cf358 Matrix CodeQL CI job over all runner images 2023-09-18 12:56:35 +01:00
Henry Mercer
4254f3a4c1 Merge pull request #1888 from github/henrymercer/constrained-ram
Respect RAM constraints imposed by Linux cgroups
2023-09-18 10:40:41 +01:00
Henry Mercer
9bfb9ba527 Handle files that exist but whose contents are not integers 2023-09-15 18:23:25 +01:00
Henry Mercer
d4c26876d3 Improve docs 2023-09-15 18:17:13 +01:00
Henry Mercer
d6f9faae0d Respect RAM constraints imposed by Linux cgroups 2023-09-15 18:09:37 +01:00
Henry Mercer
c459726691 Merge pull request #1884 from github/henrymercer/deprecation-warning-for-codeql-2.10.x
Add a deprecation warning for CodeQL 2.10.*
2023-09-15 17:47:36 +01:00
Henry Mercer
a087b01cdd Merge branch 'main' into henrymercer/deprecation-warning-for-codeql-2.10.x 2023-09-15 12:04:01 +01:00
Henry Mercer
f3051ed54e Merge pull request #1883 from github/henrymercer/language-aliasing
Add support for aliasing languages like C/C++, Java/Kotlin, and JS/TS
2023-09-15 12:00:12 +01:00
Henry Mercer
860e98cc4a Update changelog note 2023-09-15 11:16:37 +01:00
Henry Mercer
3ffd6c071a Update PR check description 2023-09-15 11:12:41 +01:00
Henry Mercer
2d646a3990 Merge pull request #1887 from github/henrymercer/add-token-to-update-dependencies
Add GitHub token to update dependencies workflow
2023-09-15 10:23:49 +01:00
Henry Mercer
a9313c9016 Merge pull request #1881 from github/henrymercer/fix-update-ghes-versions
Update ignored version number in GHES versions automation
2023-09-15 10:21:57 +01:00
Chuan-kai Lin
5f18c9ab80 Merge pull request #1886 from github/mergeback/v2.21.7-to-main-04daf014
Mergeback v2.21.7 refs/heads/releases/v2 into main
2023-09-14 10:37:27 -07:00
Henry Mercer
2c22b37a68 Add GitHub token to update dependencies workflow 2023-09-14 18:14:24 +01:00
github-actions[bot]
c07fd68e12 Update checked-in dependencies 2023-09-14 17:03:42 +00:00
github-actions[bot]
c33f0b4fc7 Update changelog and version after v2.21.7 2023-09-14 16:58:59 +00:00
Chuan-kai Lin
04daf014b5 Merge pull request #1885 from github/update-v2.21.7-e982de4fb
Merge main into releases/v2
2023-09-14 09:56:54 -07:00
github-actions[bot]
bb3bc25861 Update changelog for v2.21.7 2023-09-14 16:10:20 +00:00
Henry Mercer
ac4145f467 Add a deprecation warning for CodeQL 2.10.* 2023-09-14 16:34:07 +01:00
Henry Mercer
87a64c9c4c Add changelog note 2023-09-14 16:11:20 +01:00
Henry Mercer
897ddf2662 Add PR check 2023-09-14 16:11:20 +01:00
Henry Mercer
74714a34ca Implement support for language aliasing 2023-09-14 16:11:20 +01:00
Chuan-kai Lin
e982de4fb4 Merge pull request #1882 from github/update-bundle/codeql-bundle-v2.14.5
Update default bundle to 2.14.5
2023-09-14 08:04:05 -07:00
github-actions[bot]
19c02a4d16 Add changelog note 2023-09-14 14:29:33 +00:00
github-actions[bot]
71c7e82837 Update default bundle to codeql-bundle-v2.14.5 2023-09-14 14:29:25 +00:00
Henry Mercer
8b733e71a6 Update ignored version number in GHES versions automation 2023-09-14 12:27:25 +01:00
Chuan-kai Lin
c6c77c8c2d Merge pull request #1877 from cklin/update-dependencies
Remove --pr in update-dependencies.yml
2023-09-13 11:46:02 -07:00
Chuan-kai Lin
8efd40b126 Merge pull request #1876 from github/mergeback/v2.21.6-to-main-701f152f
Mergeback v2.21.6 refs/heads/releases/v2 into main
2023-09-13 10:20:39 -07:00
Chuan-kai Lin
77a54b68d4 Remove --pr in update-dependencies.yml 2023-09-13 09:49:02 -07:00
github-actions[bot]
f664957aa4 Update checked-in dependencies 2023-09-13 16:41:51 +00:00
github-actions[bot]
70c4c0fc21 Update changelog and version after v2.21.6 2023-09-13 16:39:21 +00:00
Chuan-kai Lin
701f152f28 Merge pull request #1875 from github/update-v2.21.6-6a6a82470
Merge main into releases/v2
2023-09-13 09:36:35 -07:00
Chuan-kai Lin
1b6299040a Fix misplaced changelog entry 2023-09-13 08:43:19 -07:00
github-actions[bot]
5462f69153 Update changelog for v2.21.6 2023-09-13 14:39:25 +00:00
Chuan-kai Lin
6a6a824702 Merge pull request #1873 from github/update-bundle/codeql-bundle-v2.14.4
Update default bundle to 2.14.4
2023-09-12 07:18:14 -07:00
github-actions[bot]
88c7a5c4cc Add changelog note 2023-09-08 22:29:07 +00:00
github-actions[bot]
da65035498 Update default bundle to codeql-bundle-v2.14.4 2023-09-08 22:29:04 +00:00
Henry Mercer
43750fe4fc Merge pull request #1872 from github/henrymercer/user-errors-for-upload-sarif
Mark invalid SARIF errors as user errors in the `upload-sarif` Action
2023-09-07 22:46:29 +01:00
Henry Mercer
a7c12a5225 Address PR comments 2023-09-07 20:44:15 +01:00
Henry Mercer
7218de5369 Merge branch 'main' into henrymercer/user-errors-for-upload-sarif 2023-09-07 19:40:15 +01:00
Henry Mercer
4764dce02f Merge pull request #1866 from github/henrymercer/enable-scaling-reserved-ram-ghes
Enable scaling reserved RAM on GHES
2023-09-07 19:38:36 +01:00
Henry Mercer
077672fa88 Merge branch 'main' into henrymercer/enable-scaling-reserved-ram-ghes 2023-09-06 18:16:42 +01:00
Henry Mercer
583a1019cc Mark invalid SARIF errors as user errors in the upload-sarif Action 2023-09-06 18:14:30 +01:00
Henry Mercer
45d66afb31 Merge pull request #1870 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2023-09-06 17:57:07 +01:00
github-actions[bot]
f4683e88f3 Update supported GitHub Enterprise Server versions 2023-09-06 00:10:35 +00:00
Henry Mercer
798e74c57d Merge pull request #1867 from github/henrymercer/remove-language-baseline-ff
Enable language-specific baseline configuration on GHES
2023-09-05 18:25:33 +01:00
Henry Mercer
37d8d03606 Merge pull request #1868 from github/henrymercer/improve-dependency-update
Improve usability of update dependencies workflow
2023-09-05 16:38:52 +01:00
Tom Bolton
7bffcb42ec Merge pull request #1864 from github/dependabot/npm_and_yarn/npm-18a1c3fa4c
Bump the npm group with 3 updates
2023-09-05 16:22:51 +01:00
Tom Bolton
94293438d4 Merge pull request #1865 from github/dependabot/github_actions/actions-8a9da2b879
Bump the actions group with 1 update
2023-09-05 16:04:22 +01:00
Henry Mercer
e6cb4feff9 Improve usability of update dependencies workflow 2023-09-05 16:36:41 +02:00
tombolton
85cd5ad8b4 update checkout version in pr-checks/checks 2023-09-05 15:16:58 +01:00
tombolton
d5d81f40c6 bump checkout to v4 in sync.py 2023-09-05 13:54:16 +01:00
Henry Mercer
bec071acb9 Add changelog note 2023-09-05 14:48:21 +02:00
Henry Mercer
5150b5c6ab Add changelog note 2023-09-05 14:45:00 +02:00
Henry Mercer
270788d6fd Remove language-specific baseline configuration flag 2023-09-05 14:36:51 +02:00
Henry Mercer
10389f671b Remove scaling reserved RAM feature flag 2023-09-05 14:30:56 +02:00
Henry Mercer
574dbbc517 Allow customizing the scaling threshold with an environment variable 2023-09-05 13:14:55 +02:00
Henry Mercer
466ed42568 Enable scaling reserved RAM on GHES 2023-09-05 12:50:34 +02:00
dependabot[bot]
321d3e057d Bump the actions group with 1 update
Bumps the actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).

- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 18:00:31 +00:00
github-actions[bot]
3115e0f9c4 Update checked-in dependencies 2023-09-04 17:19:10 +00:00
dependabot[bot]
7aafc67ccf Bump the npm group with 3 updates
Bumps the npm group with 3 updates: [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/uuid), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [eslint-plugin-github](https://github.com/github/eslint-plugin-github).


Updates `@types/uuid` from 9.0.2 to 9.0.3
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/uuid)

Updates `@typescript-eslint/parser` from 6.5.0 to 6.6.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.6.0/packages/parser)

Updates `eslint-plugin-github` from 4.9.2 to 4.10.0
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.9.2...v4.10.0)

---
updated-dependencies:
- dependency-name: "@types/uuid"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 17:15:55 +00:00
Angela P Wen
07d42ec34e Improve logging for Go autobuild when invoked in analyze step (#1862) 2023-08-31 11:39:07 +00:00
Andrew Eisenberg
c5acfe3b0d Merge pull request #1860 from github/aeisenberg/better-error-messages
Add better error messages when determining merge-base
2023-08-29 13:51:10 -07:00
Andrew Eisenberg
469786860d Address more comments from PR 2023-08-29 13:20:55 -07:00
Andrew Eisenberg
e603106d1a Add change note 2023-08-29 13:11:48 -07:00
Andrew Eisenberg
09940b4bb9 Address comments from PR 2023-08-29 12:11:32 -07:00
dependabot[bot]
8ecc33d259 Bump the npm group with 5 updates (#1856)
* Bump the npm group with 5 updates

Bumps the npm group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.5.0` | `7.5.1` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `6.4.1` | `6.5.0` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `6.4.1` | `6.5.0` |
| [eslint](https://github.com/eslint/eslint) | `8.47.0` | `8.48.0` |
| [typescript](https://github.com/Microsoft/TypeScript) | `5.1.6` | `5.2.2` |


Updates `@types/semver` from 7.5.0 to 7.5.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Updates `@typescript-eslint/eslint-plugin` from 6.4.1 to 6.5.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.5.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.4.1 to 6.5.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.5.0/packages/parser)

Updates `eslint` from 8.47.0 to 8.48.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.47.0...v8.48.0)

Updates `typescript` from 5.1.6 to 5.2.2
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.1.6...v5.2.2)

---
updated-dependencies:
- dependency-name: "@types/semver"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-08-29 04:47:41 -07:00
Andrew Eisenberg
d721f69753 Add better error messages when determining merge-base
Avoid printing scary error messages to console when the current
directory is not a git repo. Instead provide a better reason for the git
failure and continue on.
2023-08-28 15:50:30 -07:00
Dave Bartolomeo
b88b5503aa Merge pull request #1859 from github/mergeback/v2.21.5-to-main-00e563ea
Mergeback v2.21.5 refs/heads/releases/v2 into main
2023-08-28 15:18:47 -04:00
github-actions[bot]
f644ffe4b2 Update checked-in dependencies 2023-08-28 18:54:38 +00:00
github-actions[bot]
7cd044345e Update changelog and version after v2.21.5 2023-08-28 18:37:27 +00:00
Dave Bartolomeo
00e563ead9 Merge pull request #1858 from github/update-v2.21.5-100912429
Merge main into releases/v2
2023-08-28 14:35:05 -04:00
github-actions[bot]
7323c2ac6b Update changelog for v2.21.5 2023-08-28 17:51:24 +00:00
Dave Bartolomeo
100912429f Merge pull request #1845 from github/update-bundle/codeql-bundle-v2.14.3
Update default bundle to 2.14.3
2023-08-25 11:40:49 -04:00
Dave Bartolomeo
a2d14d32b8 Merge branch 'main' into update-bundle/codeql-bundle-v2.14.3 2023-08-25 10:54:01 -04:00
Ian Lynagh
ff9cb435df Merge pull request #1853 from github/igfoo/kot1.9.10
Kotlin: CodeQL >= 2.13.4 supports 1.9.10.
2023-08-24 19:10:19 +01:00
Ian Lynagh
2f913c1249 npm run build 2023-08-24 17:57:40 +01:00
Ian Lynagh
7dab60079b Put upper limit on the CodeQL versions for which we override the Kotlin limit
Otherwise it'll be lower than the default at some point in the future.
2023-08-24 17:56:31 +01:00
Ian Lynagh
862b2cf102 Add a changelog entry for the Kotlin 1.9.10 support 2023-08-24 17:49:56 +01:00
Ian Lynagh
070dd05edd npm run build 2023-08-24 15:15:12 +01:00
Ian Lynagh
ff95d147d6 Kotlin: Fix lint 2023-08-24 15:14:49 +01:00
Ian Lynagh
30fe0c4907 npm run build 2023-08-24 14:57:53 +01:00
Ian Lynagh
e5813484cd Kotlin: CodeQL >= 2.13.4 supports 1.9.10. 2023-08-24 14:57:05 +01:00
Henry Mercer
9a53fd0577 Merge pull request #1848 from sabrowning1/main
Update docs links in the README
2023-08-23 15:47:06 +01:00
Sam Browning
dfb560cac1 Merge branch 'github:main' into main 2023-08-23 08:13:29 -04:00
Sam Browning
5c8be669de Merge pull request #1 from sabrowning1/sabrowning1/update-README-links
Update docs links in the README
2023-08-23 08:13:16 -04:00
Henry Mercer
14877a1345 Merge pull request #1847 from github/dependabot/npm_and_yarn/npm-522ac6628f
Bump the npm group with 4 updates
2023-08-21 19:21:24 +01:00
Henry Mercer
bc08098689 Merge pull request #1846 from github/dependabot/github_actions/dot-github/actions/setup-swift/actions-setup-swift-487d23c2d8
Bump the actions-setup-swift group in /.github/actions/setup-swift with 1 update
2023-08-21 19:00:04 +01:00
github-actions[bot]
02c45745e3 Update checked-in dependencies 2023-08-21 17:52:18 +00:00
dependabot[bot]
67f7ac2add Bump the npm group with 4 updates
Bumps the npm group with 4 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser), [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) and [nock](https://github.com/nock/nock).


Updates `@typescript-eslint/eslint-plugin` from 6.4.0 to 6.4.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.4.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.4.0 to 6.4.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.4.1/packages/parser)

Updates `eslint-plugin-import` from 2.28.0 to 2.28.1
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.28.0...v2.28.1)

Updates `nock` from 13.3.2 to 13.3.3
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v13.3.2...v13.3.3)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 17:48:12 +00:00
dependabot[bot]
fbb8195699 Bump the actions-setup-swift group
Bumps the actions-setup-swift group in /.github/actions/setup-swift with 1 update: [swift-actions/setup-swift](https://github.com/swift-actions/setup-swift).

- [Release notes](https://github.com/swift-actions/setup-swift/releases)
- [Commits](65540b95f5...cdcbe8e35d)

---
updated-dependencies:
- dependency-name: swift-actions/setup-swift
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-setup-swift
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 17:39:22 +00:00
Sam Browning
66572f0900 Update README.md 2023-08-21 11:37:17 -04:00
github-actions[bot]
e755a052f0 Add changelog note 2023-08-18 23:37:40 +00:00
github-actions[bot]
37628e79a4 Update default bundle to codeql-bundle-v2.14.3 2023-08-18 23:37:35 +00:00
Ian Lynagh
e4262713b5 Merge pull request #1844 from github/igfoo/lombok_no_overwrite
Lombok: Don't set env var if it's already set
2023-08-18 19:57:50 +01:00
Ian Lynagh
ddf2bd2495 Tweak CHANGELOG.md
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2023-08-18 19:04:05 +01:00
Ian Lynagh
c34b59d32f Add a changenote for the Lombok change 2023-08-18 12:31:32 +01:00
Ian Lynagh
b557ee7090 npm run build 2023-08-18 12:31:32 +01:00
Ian Lynagh
d5b5e18245 Lombok: Don't set env var if it's already set
If the user has manually configured it, then we let their setting stand.
2023-08-18 12:31:12 +01:00
Henry Mercer
e683046da1 Merge pull request #1840 from github/dependabot/npm_and_yarn/npm-4335ac1f11
Bump the npm group with 5 updates
2023-08-14 20:42:14 +01:00
Henry Mercer
af18655ef9 Merge branch 'main' into dependabot/npm_and_yarn/npm-4335ac1f11 2023-08-14 20:05:13 +01:00
Henry Mercer
314b271ce0 Merge pull request #1841 from github/henrymercer/remove-actions-cache-overrides
Update `@actions/cache` and remove overrides
2023-08-14 19:56:39 +01:00
Henry Mercer
4db827f313 Update @actions/cache and remove overrides
Now that `@actions/cache` has been updated, we can remove our manual
overrides for vulnerable dependencies.
2023-08-14 18:59:06 +01:00
github-actions[bot]
6a54608e14 Update checked-in dependencies 2023-08-14 17:46:13 +00:00
dependabot[bot]
3f55ff1327 Bump the npm group with 5 updates
Bumps the npm group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache) | `3.2.1` | `3.2.2` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `6.2.1` | `6.4.0` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `6.2.1` | `6.4.0` |
| [eslint](https://github.com/eslint/eslint) | `8.46.0` | `8.47.0` |
| [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) | `3.5.5` | `3.6.0` |


Updates `@actions/cache` from 3.2.1 to 3.2.2
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/cache@3.2.2/packages/cache)

Updates `@typescript-eslint/eslint-plugin` from 6.2.1 to 6.4.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.4.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.2.1 to 6.4.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.4.0/packages/parser)

Updates `eslint` from 8.46.0 to 8.47.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.46.0...v8.47.0)

Updates `eslint-import-resolver-typescript` from 3.5.5 to 3.6.0
- [Release notes](https://github.com/import-js/eslint-import-resolver-typescript/releases)
- [Changelog](https://github.com/import-js/eslint-import-resolver-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-import-resolver-typescript/compare/v3.5.5...v3.6.0)

---
updated-dependencies:
- dependency-name: "@actions/cache"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-import-resolver-typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 17:43:22 +00:00
Henry Mercer
3ecf990cd2 Merge pull request #1839 from github/mergeback/v2.21.4-to-main-a09933a1
Mergeback v2.21.4 refs/heads/releases/v2 into main
2023-08-14 16:04:17 +01:00
github-actions[bot]
96f00f2adf Update checked-in dependencies 2023-08-14 14:37:28 +00:00
github-actions[bot]
2760c3e6c4 Update changelog and version after v2.21.4 2023-08-14 14:09:37 +00:00
Henry Mercer
a09933a12a Merge pull request #1838 from github/update-v2.21.4-492a68c32
Merge main into releases/v2
2023-08-14 15:06:52 +01:00
Henry Mercer
37116fb629 Fix positioning of bundle update changelog note 2023-08-14 14:16:49 +01:00
github-actions[bot]
c613917766 Update changelog for v2.21.4 2023-08-14 13:13:56 +00:00
Henry Mercer
492a68c323 Merge pull request #1836 from github/henrymercer/analysis-summary-v2-ff
Enable language specific baselines via feature flag
2023-08-14 12:57:51 +01:00
Henry Mercer
ac49314877 Merge pull request #1834 from github/henrymercer/analysis-summary-v2-ff
Rename new analysis summary feature flag
2023-08-14 10:57:25 +01:00
Henry Mercer
ac35d7a02d Merge pull request #1835 from github/henrymercer/language-baseline-config
Enable language specific baselines via feature flag
2023-08-14 10:57:22 +01:00
Henry Mercer
d03c744ad6 Don't pass --no- flag as it doesn't exist yet 2023-08-11 17:31:20 +01:00
Henry Mercer
a0407a8c60 Add changelog note for rollout 2023-08-11 17:20:49 +01:00
Henry Mercer
8a7b2e9c9b Enable language specific baselines via feature flag 2023-08-11 17:20:42 +01:00
Henry Mercer
9a510d9b07 Rename new analysis summary feature flag 2023-08-11 15:51:44 +01:00
Henry Mercer
2160dd3b55 Merge pull request #1831 from github/update-bundle/codeql-bundle-v2.14.2
Update default bundle to 2.14.2
2023-08-11 12:08:16 +01:00
Henry Mercer
1e14fd9e7a Merge branch 'main' into update-bundle/codeql-bundle-v2.14.2 2023-08-11 11:15:43 +01:00
Henry Mercer
2ec74e3c0e Merge pull request #1833 from github/henrymercer/print-commands
Log commands manually before executing them
2023-08-10 16:26:15 +01:00
Henry Mercer
25a42462f9 Add changelog note 2023-08-10 15:35:54 +01:00
Henry Mercer
f5920c85ab Log commands manually before executing them 2023-08-10 15:35:54 +01:00
Henry Mercer
6ed1ccdc9a Merge pull request #1832 from github/henrymercer/nicer-toolcache-version-numbers
Simplify toolcache version number for semantically versioned bundles
2023-08-10 15:32:53 +01:00
Henry Mercer
ceb4b69c73 Add changelog note 2023-08-10 14:40:20 +01:00
Henry Mercer
76584bd0a0 Simplify toolcache version number for semantically versioned bundles 2023-08-10 14:36:04 +01:00
github-actions[bot]
fba32955a0 Add changelog note 2023-08-10 10:18:25 +00:00
github-actions[bot]
f4eba74c80 Update default bundle to codeql-bundle-v2.14.2 2023-08-10 10:18:20 +00:00
Henry Mercer
9e4932e291 Merge pull request #1825 from github/henrymercer/disk-telemetry
Add runner disk info and image version to status report
2023-08-09 16:05:09 +01:00
Henry Mercer
bd20e2b607 Add changelog note 2023-08-09 11:52:21 +01:00
Henry Mercer
c93877b070 Merge branch 'main' into henrymercer/disk-telemetry 2023-08-09 11:50:50 +01:00
Henry Mercer
4e9f8a2be4 Merge pull request #1830 from github/mergeback/v2.21.3-to-main-5b6282e0
Mergeback v2.21.3 refs/heads/releases/v2 into main
2023-08-08 14:29:33 +01:00
github-actions[bot]
a07ea2da0c Update checked-in dependencies 2023-08-08 13:07:22 +00:00
github-actions[bot]
9a202d29ad Update changelog and version after v2.21.3 2023-08-08 13:05:38 +00:00
Henry Mercer
5b6282e01c Merge pull request #1829 from github/update-v2.21.3-f9a7c6738
Merge main into releases/v2
2023-08-08 14:03:24 +01:00
Ian Lynagh
f0f7a35b85 Add changenote for Lombok rollout 2023-08-08 13:25:26 +01:00
github-actions[bot]
dda4ed3db4 Update changelog for v2.21.3 2023-08-08 11:53:34 +00:00
Henry Mercer
f9a7c6738f Merge pull request #1827 from github/dependabot/npm_and_yarn/npm-5103036bd1
Bump the npm group with 3 updates
2023-08-08 11:20:14 +01:00
github-actions[bot]
31b9dd18d4 Update checked-in dependencies 2023-08-07 17:18:57 +00:00
dependabot[bot]
7e2f56aae3 Bump the npm group with 3 updates
Bumps the npm group with 3 updates: [@types/sinon](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/sinon), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@types/sinon` from 10.0.15 to 10.0.16
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/sinon)

Updates `@typescript-eslint/eslint-plugin` from 6.2.0 to 6.2.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.2.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.2.0 to 6.2.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.2.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@types/sinon"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 17:16:04 +00:00
Henry Mercer
834f08becb Merge branch 'main' into henrymercer/disk-telemetry 2023-08-07 17:56:50 +01:00
Henry Mercer
878ae4a749 Merge pull request #1823 from github/henrymercer/setup-swift-more-consistent
PR checks: Make Swift setup more consistent with default setup
2023-08-07 17:39:16 +01:00
Henry Mercer
63602c0f72 Merge pull request #1824 from github/henrymercer/cli-notifications-fix
Only workaround invalid notifications for CodeQL CLI 2.13.0 and earlier
2023-08-07 17:38:59 +01:00
Henry Mercer
66dc883276 Merge pull request #1826 from github/henrymercer/increase-reserved-scaling-factor
Increase scaling factor for reserved RAM to 5%
2023-08-07 17:32:27 +01:00
Henry Mercer
97ce1b094a Ignore test files in env vars query 2023-08-07 17:31:09 +01:00
Henry Mercer
ba5812e64f Add ImageVersion to safe env vars for default setup 2023-08-07 17:29:12 +01:00
Henry Mercer
2203178090 Increase scaling factor for reserved RAM to 5% 2023-08-07 16:56:27 +01:00
Henry Mercer
3b25789080 Add runner image version to status report 2023-08-07 16:27:56 +01:00
Henry Mercer
7dcb3e5276 Include runner disk info in status report 2023-08-07 16:27:56 +01:00
Henry Mercer
09ce3dbf90 Sort interfaces and enums 2023-08-07 16:27:56 +01:00
Henry Mercer
c6d284324b Pull out a dedicated status report file 2023-08-07 16:13:59 +01:00
Henry Mercer
c55207f0a2 Use vendored TypeScript version for VS Code 2023-08-07 15:08:32 +01:00
Henry Mercer
45e889b4b3 Install check-disk-space Node package 2023-08-07 15:08:26 +01:00
Henry Mercer
131cb1abb1 Suppress VS Code git limit warnings during package install 2023-08-07 11:46:47 +01:00
Henry Mercer
0ff6cfb53c Only workaround invalid notifications for CodeQL CLI 2.13.0 and earlier 2023-08-03 22:22:31 +01:00
Henry Mercer
f128379387 Make Swift setup more consistent with default setup 2023-08-03 17:23:31 +01:00
Angela P Wen
1f63aba653 PR Checks: Test codeql-bundle.tar.gz (#1822) 2023-08-03 15:38:21 +00:00
Henry Mercer
a98b9bd46b Merge pull request #1821 from github/henrymercer/pr-checks/improve-version-naming
PR checks: Rename `cached` to `default`
2023-08-03 12:02:16 +01:00
Henry Mercer
49e0fc2ba1 PR checks: Rename cached to default 2023-08-02 18:02:10 +01:00
Florin Coada
2192e3432b Merge pull request #1809 from github/igfoo/code_scanning_codeql_java_lombok
Add support for the code_scanning_codeql_java_lombok feature flag
2023-08-02 12:47:52 +01:00
Angela P Wen
1b6e91df31 Autogenerate source map 2023-08-02 11:54:32 +02:00
Angela P Wen
c32aadf8fd Merge branch 'main' into igfoo/code_scanning_codeql_java_lombok 2023-08-02 02:44:05 -07:00
Angela P Wen
7d646d3301 Empty commit 2023-08-02 11:40:37 +02:00
Henry Mercer
7b79062de0 Merge pull request #1820 from github/henrymercer/delete-bundle-archive
Clean up the bundle archive after extracting it
2023-08-01 20:16:50 +01:00
Henry Mercer
61cdd2503b Factor out common code for cleaning up bundle artifacts 2023-08-01 19:47:57 +01:00
Henry Mercer
92c848eb82 Improve variable naming 2023-08-01 19:21:17 +01:00
Henry Mercer
f93fb8df6e Clean up non-toolcached bundle 2023-08-01 18:50:45 +01:00
Henry Mercer
ea47b2ae40 Add changelog note 2023-08-01 17:54:33 +01:00
Henry Mercer
38adb40e7a Delete bundle archive after extracting it 2023-08-01 17:49:21 +01:00
dependabot[bot]
e7e35baaf0 Bump the npm group with 2 updates (#1819)
* Bump the npm group with 2 updates

Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import).


Updates `eslint` from 8.45.0 to 8.46.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.45.0...v8.46.0)

Updates `eslint-plugin-import` from 2.27.5 to 2.28.0
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.27.5...v2.28.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-08-01 03:35:02 -07:00
Nick Rolfe
a6b0ced86b Merge pull request #1818 from github/nickrolfe/disable-intra-layer-parallelism
Pass explicit option to disable intra-layer parallelism
2023-07-31 12:15:52 +01:00
Henry Mercer
6a17359b95 Merge pull request #1816 from github/henrymercer/more-user-errors
Categorize more user errors correctly in telemetry
2023-07-31 11:56:57 +01:00
Henry Mercer
245422d4c0 Merge pull request #1815 from github/henrymercer/update-readme
Simplify README to recommend default setup and refer to docs
2023-07-31 11:56:04 +01:00
Nick Rolfe
c7b7456c9e Pass explicit option to disable intra-layer parallelism 2023-07-31 11:47:25 +01:00
Nick Rolfe
cf445f7cf3 Merge pull request #1817 from github/nickrolfe/evaluator-intra-layer-parallelism-ff
Use feature flag to enable evaluator intra-layer parallelism
2023-07-31 11:03:26 +01:00
Nick Rolfe
2f8540dd31 Add CHANGELOG entry for intra-layer parallelism rollout 2023-07-31 10:08:17 +01:00
Nick Rolfe
bc068d74aa Use feature flag to enable evaluator intra-layer parallelism 2023-07-31 09:44:35 +01:00
Henry Mercer
bcfe48982e Improve function name 2023-07-28 18:51:43 +01:00
Henry Mercer
79690d4663 Make submitting advanced analysis when default setup on a user error 2023-07-28 18:21:38 +01:00
Henry Mercer
5691205077 Make not specifying a required input a user error 2023-07-28 18:18:27 +01:00
Henry Mercer
d9d3212c79 Simplify README to recommend default setup and refer to docs 2023-07-28 17:30:34 +01:00
Henry Mercer
81ae676e79 Merge pull request #1812 from github/henrymercer/no-loc-baseline-for-new-summary
Don't print the lines of code baseline when new analysis summary enabled
2023-07-28 17:18:54 +01:00
Alexander Eyers-Taylor
c8b21b59d1 Merge pull request #1814 from github/mergeback/v2.21.2-to-main-0ba42444
Mergeback v2.21.2 refs/heads/releases/v2 into main
2023-07-28 16:09:27 +01:00
github-actions[bot]
7c2bd355f3 Update checked-in dependencies 2023-07-28 14:10:21 +00:00
github-actions[bot]
868eec5e6d Update changelog and version after v2.21.2 2023-07-28 14:07:45 +00:00
Alexander Eyers-Taylor
0ba4244466 Merge pull request #1813 from github/update-v2.21.2-10c6bfee1
Merge main into releases/v2
2023-07-28 15:05:12 +01:00
Ian Lynagh
eea148f0e6 Run "npm run build" 2023-07-28 14:56:05 +01:00
Ian Lynagh
34090feb56 Lombok: Only do anything if Java is being analysed 2023-07-28 14:55:23 +01:00
github-actions[bot]
a9a416c8f4 Update changelog for v2.21.2 2023-07-28 13:26:48 +00:00
Henry Mercer
10c6bfee12 Merge pull request #1811 from github/henrymercer/print-summary-once
Only print the analysis summary once
2023-07-28 14:23:58 +01:00
Henry Mercer
67e62e7b01 Don't print the lines of code baseline when new analysis summary enabled 2023-07-28 14:03:02 +01:00
Henry Mercer
feea86eed3 Merge pull request #1810 from github/henrymercer/ci/use-platform-specific-bundles
Use platform specific bundles in PR checks
2023-07-28 13:49:54 +01:00
Henry Mercer
2e6f8c08c1 Add changelog note 2023-07-28 13:06:35 +01:00
Henry Mercer
8342844ea7 Only print the analysis summary once 2023-07-28 12:29:10 +01:00
Henry Mercer
679aac1b20 Use platform specific bundles in PR checks 2023-07-28 12:06:57 +01:00
Alexander Eyers-Taylor
de6681ceb7 Merge pull request #1797 from github/update-bundle/codeql-bundle-v2.14.1
Update default bundle to 2.14.1
2023-07-27 13:16:33 +01:00
Alexander Eyers-Taylor
f6fe5c5c70 Merge branch 'main' into update-bundle/codeql-bundle-v2.14.1 2023-07-27 12:53:27 +01:00
Ian Lynagh
976ada262f Regen 2023-07-27 12:45:19 +01:00
Ian Lynagh
c946707707 Pass codeql in to check 2023-07-27 12:45:08 +01:00
Ian Lynagh
4f6104c444 Run "npm run build" 2023-07-27 12:37:40 +01:00
Ian Lynagh
a27d3e9355 Fix lint suggestions 2023-07-27 12:36:57 +01:00
Ian Lynagh
cae6b78afc Be more consistent 2023-07-27 12:30:08 +01:00
Ian Lynagh
097823f389 Add support for the code_scanning_codeql_java_lombok feature flag 2023-07-27 12:19:38 +01:00
Andrew Eisenberg
62762170e1 Merge pull request #1808 from github/mergeback/v2.21.1-to-main-6ca1aa8c
Mergeback v2.21.1 refs/heads/releases/v2 into main
2023-07-26 12:11:01 -07:00
github-actions[bot]
e4ccfbd189 Update checked-in dependencies 2023-07-26 18:38:43 +00:00
github-actions[bot]
eaa61762f4 Update changelog and version after v2.21.1 2023-07-26 18:34:36 +00:00
Henry Mercer
6ca1aa8c19 Merge pull request #1807 from github/update-v2.21.1-055b396ea
Merge main into releases/v2
2023-07-26 19:32:45 +01:00
github-actions[bot]
84a55d4e11 Update changelog for v2.21.1 2023-07-26 16:20:35 +00:00
Stephan Brandauer
055b396ea2 Merge pull request #1800 from github/dependabot/pip/python-setup/tests/poetry/python-3.8/certifi-2023.7.22
Bump certifi from 2022.12.7 to 2023.7.22 in /python-setup/tests/poetry/python-3.8
2023-07-26 13:46:36 +02:00
Stephan Brandauer
98d57a1337 Merge pull request #1801 from github/dependabot/pip/python-setup/tests/poetry/requests-3/certifi-2023.7.22
Bump certifi from 2022.12.7 to 2023.7.22 in /python-setup/tests/poetry/requests-3
2023-07-26 13:46:20 +02:00
Stephan Brandauer
1ba3eaa7d3 Merge pull request #1802 from github/dependabot/pip/python-setup/tests/pipenv/requests-3/certifi-2023.7.22
Bump certifi from 2023.5.7 to 2023.7.22 in /python-setup/tests/pipenv/requests-3
2023-07-26 13:46:05 +02:00
Stephan Brandauer
233b9834e6 Merge pull request #1803 from github/dependabot/pip/python-setup/tests/pipenv/python-3.8/certifi-2023.7.22
Bump certifi from 2023.5.7 to 2023.7.22 in /python-setup/tests/pipenv/python-3.8
2023-07-26 13:45:43 +02:00
Stephan Brandauer
9cbfcfde24 Merge branch 'main' into dependabot/pip/python-setup/tests/pipenv/requests-3/certifi-2023.7.22 2023-07-26 12:40:45 +02:00
Stephan Brandauer
7a8ccc55bf Merge branch 'main' into dependabot/pip/python-setup/tests/poetry/requests-3/certifi-2023.7.22 2023-07-26 12:40:43 +02:00
Stephan Brandauer
ac0d76444a Merge branch 'main' into dependabot/pip/python-setup/tests/poetry/python-3.8/certifi-2023.7.22 2023-07-26 12:40:39 +02:00
Stephan Brandauer
500b1fac79 Merge branch 'main' into dependabot/pip/python-setup/tests/pipenv/python-3.8/certifi-2023.7.22 2023-07-26 12:40:26 +02:00
Stephan Brandauer
d89d3764f8 Merge pull request #1804 from github/dependabot/npm_and_yarn/npm-a99d24b4d9
Bump the npm group with 2 updates
2023-07-26 12:39:48 +02:00
Stephan Brandauer
654518ea06 Merge branch 'main' into dependabot/npm_and_yarn/npm-a99d24b4d9 2023-07-26 10:54:26 +02:00
Andrew Eisenberg
1a480074ee Merge pull request #1805 from jsoref/issue-1799
Add output for analyze action output path
2023-07-25 15:13:44 -07:00
Josh Soref
8ab72a0f47 Add output for analyze action output path 2023-07-25 16:03:16 -04:00
github-actions[bot]
658a20c06e Update checked-in dependencies 2023-07-25 17:07:05 +00:00
dependabot[bot]
818b10d9bb Bump the npm group with 2 updates
Bumps the npm group with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@typescript-eslint/eslint-plugin` from 6.1.0 to 6.2.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.2.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.1.0 to 6.2.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.2.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-25 16:40:22 +00:00
dependabot[bot]
126f9c6282 Bump certifi in /python-setup/tests/pipenv/python-3.8
Bumps [certifi](https://github.com/certifi/python-certifi) from 2023.5.7 to 2023.7.22.
- [Commits](https://github.com/certifi/python-certifi/compare/2023.05.07...2023.07.22)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-25 16:40:15 +00:00
dependabot[bot]
cfd7e3df84 Bump certifi in /python-setup/tests/pipenv/requests-3
Bumps [certifi](https://github.com/certifi/python-certifi) from 2023.5.7 to 2023.7.22.
- [Commits](https://github.com/certifi/python-certifi/compare/2023.05.07...2023.07.22)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-25 16:39:45 +00:00
dependabot[bot]
c974f40fee Bump certifi in /python-setup/tests/poetry/requests-3
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.12.7 to 2023.7.22.
- [Commits](https://github.com/certifi/python-certifi/compare/2022.12.07...2023.07.22)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-25 16:39:42 +00:00
dependabot[bot]
d34eb386d4 Bump certifi in /python-setup/tests/poetry/python-3.8
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.12.7 to 2023.7.22.
- [Commits](https://github.com/certifi/python-certifi/compare/2022.12.07...2023.07.22)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-25 16:39:37 +00:00
Angela P Wen
c57b27e4b7 Merge pull request #1798 from github/dependabot/npm_and_yarn/npm-7f457b68a6
Bump the npm group with 2 updates: `@schemastore/package` and `eslint-plugin-github`.
2023-07-25 18:34:52 +02:00
Angela P Wen
d1d5f4de97 Remove schemastore from Dependabot ignore 2023-07-25 18:00:43 +02:00
Angela P Wen
badeebcb1a Ignore prior commit in git blame 2023-07-25 17:59:56 +02:00
Angela P Wen
b16296be30 Auto-fix linting errors 2023-07-25 10:34:21 +02:00
github-actions[bot]
eff6331393 Update checked-in dependencies 2023-07-24 17:15:38 +00:00
dependabot[bot]
601c5ba56e Bump the npm group with 2 updates
Bumps the npm group with 2 updates: [@schemastore/package](https://github.com/ffflorian/schemastore-updater) and [eslint-plugin-github](https://github.com/github/eslint-plugin-github).


Updates `@schemastore/package` from 0.0.8 to 0.0.10
- [Release notes](https://github.com/ffflorian/schemastore-updater/releases)
- [Commits](https://github.com/ffflorian/schemastore-updater/commits)

Updates `eslint-plugin-github` from 4.9.0 to 4.9.2
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.9.0...v4.9.2)

---
updated-dependencies:
- dependency-name: "@schemastore/package"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-24 17:12:49 +00:00
Henry Mercer
57a11be8e4 Merge pull request #1795 from github/henrymercer/use-more-cli-errors
Improve handling of fatal CLI errors
2023-07-24 17:16:47 +01:00
Henry Mercer
7197f58bbf Add JSDoc for extractFatalErrors 2023-07-24 16:47:33 +01:00
github-actions[bot]
3007c1e340 Add changelog note 2023-07-24 15:17:23 +00:00
github-actions[bot]
4a2e8975cd Update default bundle to codeql-bundle-v2.14.1 2023-07-24 15:17:18 +00:00
Henry Mercer
7b6664fa89 Merge pull request #1796 from github/henrymercer/scaling-ram-larger-runners-only
Scale the amount of reserved RAM on large runners only
2023-07-24 12:47:48 +01:00
Henry Mercer
fda93d8ef5 Apply scaling reserved RAM to large runners only 2023-07-21 18:00:34 +01:00
Henry Mercer
18ae9813bf Test memory flag computation across all platforms and system RAM values 2023-07-21 17:55:17 +01:00
Henry Mercer
47952bf4c2 Remove generated files associated with deleted code 2023-07-21 15:29:04 +01:00
Henry Mercer
5bbe7a2b8c Add test for summarizing several fatal errors 2023-07-21 15:27:57 +01:00
Henry Mercer
9fc0c931c7 Add changelog note 2023-07-21 15:16:58 +01:00
Henry Mercer
fdedc91de2 Improve formatting of fatal errors 2023-07-21 14:39:30 +01:00
Henry Mercer
2eb34f2fb9 Always include exit code in first line of CommandInvocationError 2023-07-21 14:26:44 +01:00
Henry Mercer
a3ef0b984b Include fatal error context on a single line where possible 2023-07-21 14:24:59 +01:00
Henry Mercer
65a297b952 Display the error message on one line if possible 2023-07-21 14:14:07 +01:00
Henry Mercer
0f871fa80d Improve CommandInvocationError message 2023-07-21 14:13:17 +01:00
Henry Mercer
c84418936e Add additional tests for database finalize behavior 2023-07-21 14:12:37 +01:00
Henry Mercer
e94e15d8dd Fix extra whitespace in CommandInvocationError 2023-07-21 14:12:36 +01:00
Henry Mercer
21c926745f Capture the details of fatal errors 2023-07-21 14:11:51 +01:00
Henry Mercer
76b2afaa4a Display the CLI's no code found error for CodeQL 2.12.4+ 2023-07-20 18:16:02 +01:00
Peter Newman
ce84bed594 Correct the no code found URL (#1779) 2023-07-20 01:20:31 -07:00
Henry Mercer
d0dd7d77b4 Merge pull request #1794 from github/henrymercer/resolve-cyclic-imports
Resolve cyclic imports
2023-07-19 19:24:10 +01:00
Henry Mercer
466dbc913e Merge pull request #1792 from github/mergeback/v2.21.0-to-main-1813ca74
Mergeback v2.21.0 refs/heads/releases/v2 into main
2023-07-19 17:46:06 +01:00
Henry Mercer
bac7c32ff7 Resolve the final dependency cycle! 2023-07-19 17:37:43 +01:00
Henry Mercer
5658fd1df2 Fix dependency cycle between trap-caching and init 2023-07-19 17:30:33 +01:00
Henry Mercer
2637069a45 Resolve dependency cycles between actions-util and workflow 2023-07-19 17:21:33 +01:00
Henry Mercer
0bc4788cf7 Resolve dependency cycle between api-client and actions-util 2023-07-19 17:01:05 +01:00
Henry Mercer
004f976bef Fix dependency cycle between util and config-utils 2023-07-19 16:48:21 +01:00
Henry Mercer
d577d6f6b1 Resolve dependency cycle between util and API client 2023-07-19 16:40:31 +01:00
Henry Mercer
9922e17dbb Move code scanning config enablement into feature flags 2023-07-19 15:57:59 +01:00
Henry Mercer
bf162c4114 Enable no cyclic dependencies eslint rule 2023-07-19 15:53:39 +01:00
Henry Mercer
79ad6142b1 Update script to put unreleased section in the right place 2023-07-19 13:56:46 +01:00
github-actions[bot]
6484fb09f6 Update checked-in dependencies 2023-07-19 12:53:51 +00:00
github-actions[bot]
c1144b5fa0 Update changelog and version after v2.21.0 2023-07-19 12:49:44 +00:00
Henry Mercer
1813ca74c3 Merge pull request #1791 from github/update-v2.21.0-6ae46f7a9
Merge main into releases/v2
2023-07-19 13:47:34 +01:00
github-actions[bot]
6843540876 Update changelog for v2.21.0 2023-07-19 12:14:55 +00:00
Henry Mercer
6ae46f7a92 Merge pull request #1790 from github/henrymercer/aborted-user-error
Report user errors in the abort stage appropriately
2023-07-18 18:10:04 +01:00
Henry Mercer
0cae69e062 Report user errors in the abort stage appropriately 2023-07-18 17:22:13 +01:00
Tom Bolton
d2ed0a05b6 Merge pull request #1786 from github/dependabot/npm_and_yarn/npm-0a410f26d2
Bump the npm group with 6 updates
2023-07-18 14:22:17 +01:00
Henry Mercer
651d09131a Merge pull request #1788 from github/henrymercer/fix-feature-flag-usage
Fixes for new analysis summary and scaling reserved RAM feature flag usage
2023-07-18 14:14:43 +01:00
Henry Mercer
e0f0892f83 Add tests for new analysis summary feature flag 2023-07-18 13:43:44 +01:00
Henry Mercer
27d3b2f857 Fix scaling reserved RAM feature flag naming 2023-07-18 13:41:05 +01:00
Henry Mercer
da4e0a06c0 Fix CodeQL version checks 2023-07-18 13:41:05 +01:00
github-actions[bot]
e266801e21 Update checked-in dependencies 2023-07-17 20:17:37 +00:00
dependabot[bot]
99c9f6a498 Bump the npm group with 6 updates
Bumps the npm group with 6 updates:

| Package | Update |
| --- | --- |
| [@types/sinon](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/sinon) | 10.0.2 to 10.0.15 |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | 6.0.0 to 6.1.0 |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | 6.0.0 to 6.1.0 |
| [eslint](https://github.com/eslint/eslint) | 8.44.0 to 8.45.0 |
| [eslint-plugin-github](https://github.com/github/eslint-plugin-github) | 4.8.0 to 4.9.0 |
| [nock](https://github.com/nock/nock) | 13.3.1 to 13.3.2 |


Updates `@types/sinon` from 10.0.2 to 10.0.15
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/sinon)

Updates `@typescript-eslint/eslint-plugin` from 6.0.0 to 6.1.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.1.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.0.0 to 6.1.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.1.0/packages/parser)

Updates `eslint` from 8.44.0 to 8.45.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.44.0...v8.45.0)

Updates `eslint-plugin-github` from 4.8.0 to 4.9.0
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.8.0...v4.9.0)

Updates `nock` from 13.3.1 to 13.3.2
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v13.3.1...v13.3.2)

---
updated-dependencies:
- dependency-name: "@types/sinon"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-17 20:14:19 +00:00
Henry Mercer
942acabcd0 Merge pull request #1785 from github/henrymercer/ignore-incompatible-dependencies
Update Dependabot config to ignore incompatible updates
2023-07-17 21:11:35 +01:00
Henry Mercer
e0806ce653 Update Dependabot config to ignore incompatible updates 2023-07-17 19:01:20 +01:00
Henry Mercer
84e042b8a4 Merge pull request #1783 from github/henrymercer/check-sarif-node16
Run check-sarif Action using Node 16
2023-07-17 18:54:32 +01:00
Henry Mercer
5719ca3eb6 Run check-sarif Action using Node 16
`using: node12` Actions have already been running using Node 16 for
some time.
2023-07-17 18:29:59 +01:00
Henry Mercer
d85a177b9b Merge pull request #1780 from github/henrymercer/remove-redundant-env-var
Remove redundant environment variable from PR check
2023-07-17 17:35:06 +01:00
Henry Mercer
2e8581811e Remove redundant environment variable from PR check 2023-07-17 15:42:21 +01:00
Henry Mercer
262017ad69 Merge pull request #1759 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2023-07-17 14:13:35 +01:00
Henry Mercer
eb1ef12e40 Merge branch 'main' into update-supported-enterprise-server-versions 2023-07-17 13:35:17 +01:00
Henry Mercer
2ff6d83d07 Merge pull request #1724 from github/henrymercer/bump-minimum-codeql-version
Bump minimum CodeQL version to 2.9.4
2023-07-17 13:32:48 +01:00
Henry Mercer
5246291397 Merge branch 'main' into henrymercer/bump-minimum-codeql-version 2023-07-14 16:16:25 +01:00
Chuan-kai Lin
013a1d0cb2 Merge pull request #1778 from github/mergeback/v2.20.4-to-main-489225d8
Mergeback v2.20.4 refs/heads/releases/v2 into main
2023-07-14 07:36:36 -07:00
github-actions[bot]
aedd8c2a63 Update checked-in dependencies 2023-07-14 14:05:35 +00:00
github-actions[bot]
9a97b34d8c Update changelog and version after v2.20.4 2023-07-14 13:59:05 +00:00
Chuan-kai Lin
489225d82a Merge pull request #1777 from github/update-v2.20.4-a148c5807
Merge main into releases/v2
2023-07-14 06:57:01 -07:00
github-actions[bot]
1b6383d6be Update changelog for v2.20.4 2023-07-14 13:16:51 +00:00
Andrew Eisenberg
a148c58075 Merge pull request #1776 from github/aeisenberg/changelog-releases
Add link to releases page in changelog
2023-07-13 13:51:06 -07:00
Andrew Eisenberg
50527c5dba Add link to releases page in changelog 2023-07-13 12:24:36 -07:00
Chuan-kai Lin
814b2edab6 Merge pull request #1762 from github/update-bundle/codeql-bundle-v2.14.0
Update default bundle to 2.14.0
2023-07-13 09:36:56 -07:00
Chuan-kai Lin
d2baed4b69 Merge branch 'main' into update-bundle/codeql-bundle-v2.14.0 2023-07-13 08:19:40 -07:00
Henry Mercer
c5526174a5 Merge pull request #1774 from github/dependabot/npm_and_yarn/npm-a34e423e98
Bump the npm group with 21 updates
2023-07-13 12:14:16 +01:00
Henry Mercer
c1f49580cf Fix dependency incompatibilities 2023-07-13 11:20:39 +01:00
github-actions[bot]
40a500c743 Update checked-in dependencies 2023-07-13 09:09:17 +00:00
dependabot[bot]
4fad06f438 Bump the npm group with 21 updates
Bumps the npm group with 21 updates:

| Package | Update |
| --- | --- |
| [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact) | 1.1.0 to 1.1.1 |
| [@actions/io](https://github.com/actions/toolkit/tree/HEAD/packages/io) | 1.1.2 to 1.1.3 |
| [@octokit/plugin-retry](https://github.com/octokit/plugin-retry.js) | 5.0.2 to 6.0.0 |
| [@schemastore/package](https://github.com/ffflorian/schemastore-updater) | 0.0.6 to 0.0.9 |
| [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/uuid) | 9.0.0 to 9.0.2 |
| [adm-zip](https://github.com/cthackers/adm-zip) | 0.5.9 to 0.5.10 |
| [del](https://github.com/sindresorhus/del) | 6.1.1 to 7.0.0 |
| [long](https://github.com/dcodeIO/long.js) | 5.2.0 to 5.2.3 |
| [@ava/typescript](https://github.com/avajs/typescript) | 4.0.0 to 4.1.0 |
| [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | 7.3.13 to 7.5.0 |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | 5.48.2 to 6.0.0 |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | 5.56.0 to 6.0.0 |
| [ava](https://github.com/avajs/ava) | 5.1.1 to 5.3.1 |
| [eslint](https://github.com/eslint/eslint) | 8.32.0 to 8.44.0 |
| [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) | 3.5.3 to 3.5.5 |
| [eslint-plugin-github](https://github.com/github/eslint-plugin-github) | 4.6.0 to 4.8.0 |
| [micromatch](https://github.com/micromatch/micromatch) | 4.0.4 to 4.0.5 |
| [nock](https://github.com/nock/nock) | 13.1.1 to 13.3.1 |
| [removeNPMAbsolutePaths](https://github.com/juanjoDiaz/removeNPMAbsolutePaths) | 3.0.0 to 3.0.1 |
| [sinon](https://github.com/sinonjs/sinon) | 15.0.1 to 15.2.0 |
| [typescript](https://github.com/Microsoft/TypeScript) | 5.0.2 to 5.1.6 |


Updates `@actions/artifact` from 1.1.0 to 1.1.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/tool-cache@1.1.1/packages/artifact)

Updates `@actions/io` from 1.1.2 to 1.1.3
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/io/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/io)

Updates `@octokit/plugin-retry` from 5.0.2 to 6.0.0
- [Release notes](https://github.com/octokit/plugin-retry.js/releases)
- [Commits](https://github.com/octokit/plugin-retry.js/compare/v5.0.2...v6.0.0)

Updates `@schemastore/package` from 0.0.6 to 0.0.9
- [Release notes](https://github.com/ffflorian/schemastore-updater/releases)
- [Commits](https://github.com/ffflorian/schemastore-updater/commits)

Updates `@types/uuid` from 9.0.0 to 9.0.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/uuid)

Updates `adm-zip` from 0.5.9 to 0.5.10
- [Release notes](https://github.com/cthackers/adm-zip/releases)
- [Changelog](https://github.com/cthackers/adm-zip/blob/master/history.md)
- [Commits](https://github.com/cthackers/adm-zip/commits/v0.5.10)

Updates `del` from 6.1.1 to 7.0.0
- [Release notes](https://github.com/sindresorhus/del/releases)
- [Commits](https://github.com/sindresorhus/del/compare/v6.1.1...v7.0.0)

Updates `long` from 5.2.0 to 5.2.3
- [Release notes](https://github.com/dcodeIO/long.js/releases)
- [Commits](https://github.com/dcodeIO/long.js/compare/v5.2.0...v5.2.3)

Updates `@ava/typescript` from 4.0.0 to 4.1.0
- [Release notes](https://github.com/avajs/typescript/releases)
- [Commits](https://github.com/avajs/typescript/compare/v4.0.0...v4.1.0)

Updates `@types/semver` from 7.3.13 to 7.5.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Updates `@typescript-eslint/eslint-plugin` from 5.48.2 to 6.0.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.0.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 5.56.0 to 6.0.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.0.0/packages/parser)

Updates `ava` from 5.1.1 to 5.3.1
- [Release notes](https://github.com/avajs/ava/releases)
- [Commits](https://github.com/avajs/ava/compare/v5.1.1...v5.3.1)

Updates `eslint` from 8.32.0 to 8.44.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.32.0...v8.44.0)

Updates `eslint-import-resolver-typescript` from 3.5.3 to 3.5.5
- [Release notes](https://github.com/import-js/eslint-import-resolver-typescript/releases)
- [Changelog](https://github.com/import-js/eslint-import-resolver-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-import-resolver-typescript/compare/v3.5.3...v3.5.5)

Updates `eslint-plugin-github` from 4.6.0 to 4.8.0
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.6.0...v4.8.0)

Updates `micromatch` from 4.0.4 to 4.0.5
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.4...4.0.5)

Updates `nock` from 13.1.1 to 13.3.1
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v13.1.1...v13.3.1)

Updates `removeNPMAbsolutePaths` from 3.0.0 to 3.0.1
- [Release notes](https://github.com/juanjoDiaz/removeNPMAbsolutePaths/releases)
- [Commits](https://github.com/juanjoDiaz/removeNPMAbsolutePaths/compare/v3.0.0...v3.0.1)

Updates `sinon` from 15.0.1 to 15.2.0
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v15.0.1...v15.2.0)

Updates `typescript` from 5.0.2 to 5.1.6
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.0.2...v5.1.6)

---
updated-dependencies:
- dependency-name: "@actions/artifact"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@actions/io"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@octokit/plugin-retry"
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: "@schemastore/package"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/uuid"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: adm-zip
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: del
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: long
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@ava/typescript"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@types/semver"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: ava
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-import-resolver-typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: micromatch
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: removeNPMAbsolutePaths
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-13 09:06:22 +00:00
Henry Mercer
07224254ab Merge pull request #1773 from github/henrymercer/dependabot-grouped-updates
Group together dependency updates
2023-07-13 10:01:14 +01:00
Rasmus Wriedt Larsen
7d35788421 Merge pull request #1772 from github/RasmusWL/fix-pipenv
python-setup: Fix pipenv (`--keep-outdated` deprecated)
2023-07-13 09:32:14 +02:00
Henry Mercer
36928bf506 Group together npm dependency updates 2023-07-12 18:15:29 +01:00
Rasmus Wriedt Larsen
d1a140b28e python-setup: Fix pipenv (--keep-outdated deprecated)
Recently released pipenv removed support for `--keep-outdated` flag (see https://github.com/pypa/pipenv/blob/main/CHANGELOG.rst#pipenv-202379-2023-07-09)

Local testing showed that installation was fine without this 👍
2023-07-12 17:09:00 +02:00
Henry Mercer
12aa0a6e01 Merge pull request #1771 from github/henrymercer/update-semver
Bump semver
2023-07-12 10:52:52 +01:00
Henry Mercer
4b7eb74ef5 Bump semver 2023-07-11 20:48:18 +01:00
Angela P Wen
863a05b28b Nest alertCounts object in event_report.properties (#1770) 2023-07-11 09:20:29 -07:00
Henry Mercer
d6c8719550 Merge pull request #1769 from github/henrymercer/bump-caniuse
Update `caniuse-lite` dependency
2023-07-11 14:25:15 +01:00
Henry Mercer
859354c7e2 Merge pull request #1768 from github/henrymercer/no-languages-user-error
Telemetry: Mark configuration errors as user errors
2023-07-11 13:42:55 +01:00
Henry Mercer
0fc0483240 Update caniuse-lite dependency 2023-07-11 13:17:55 +01:00
Henry Mercer
e828ed68c6 Use Error for test errors 2023-07-11 13:08:50 +01:00
Henry Mercer
6639a31758 Mark configuration errors as user errors 2023-07-11 11:05:40 +01:00
Henry Mercer
95a5fda31a Merge pull request #1765 from github/dependabot/npm_and_yarn/octokit/types-11.1.0
Bump @octokit/types from 10.0.0 to 11.1.0
2023-07-10 21:29:49 +01:00
github-actions[bot]
b3406fda8f Update checked-in dependencies 2023-07-10 17:46:35 +00:00
dependabot[bot]
916cfef293 Bump @octokit/types from 10.0.0 to 11.1.0
Bumps [@octokit/types](https://github.com/octokit/types.ts) from 10.0.0 to 11.1.0.
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v10.0.0...v11.1.0)

---
updated-dependencies:
- dependency-name: "@octokit/types"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 17:42:54 +00:00
Henry Mercer
fed45865ba Merge branch 'main' into henrymercer/bump-minimum-codeql-version 2023-07-10 13:21:51 +01:00
Nick Rolfe
6a07b2ad43 Merge pull request #1760 from github/nickrolfe/scaling-memory
Respect `scaling_reserved_ram` feature flag
2023-07-10 10:25:38 +01:00
dependabot[bot]
8f80d7761c Bump tough-cookie and @azure/ms-rest-js (#1763)
* Bump tough-cookie and @azure/ms-rest-js

Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) and [@azure/ms-rest-js](https://github.com/Azure/ms-rest-js). These dependencies needed to be updated together.

Updates `tough-cookie` from 4.0.0 to 4.1.3
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](https://github.com/salesforce/tough-cookie/compare/v4.0.0...v4.1.3)

Updates `@azure/ms-rest-js` from 2.6.2 to 2.7.0
- [Changelog](https://github.com/Azure/ms-rest-js/blob/master/Changelog.md)
- [Commits](https://github.com/Azure/ms-rest-js/commits)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
- dependency-name: "@azure/ms-rest-js"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-10 01:41:51 -07:00
github-actions[bot]
49f147856e Add changelog note 2023-07-07 16:23:39 +00:00
github-actions[bot]
b8490d73e8 Update default bundle to codeql-bundle-v2.14.0 2023-07-07 16:23:27 +00:00
Nick Rolfe
ab9aa50acb Add integration test for scaling_reserved_ram feature flag 2023-07-07 17:01:34 +01:00
Nick Rolfe
28e070c442 Add changenote for scaling_reserved_ram change 2023-07-07 16:46:48 +01:00
Nick Rolfe
f232722edf Respect scaling_reserved_ram feature flag
The amount of RAM given to the CodeQL evaluator is the machine's total
memory size, minus a reserved amount. Currently, the reserved amount is
fixed at 1 GB (or 1.5 GB on Windows). When the scaling_reserved_ram
feature flag is enabled, we also add 2% of the total memory size to the
reserved amount. This allows for the fact that the kernel will consume
more RAM (e.g. for page tables) on machines with more physical RAM.
2023-07-07 16:46:47 +01:00
Henry Mercer
85c77f1dfc Merge pull request #1761 from github/henrymercer/remove-fetching-releases-fallback
Simplify CodeQL setup now that the last two releases have semver bundles
2023-07-07 15:53:18 +01:00
Henry Mercer
dc0234b48c Remove redundant checks 2023-07-07 15:32:20 +01:00
Henry Mercer
a41df3ae10 Add unit test for unsupported default version feature flags 2023-07-07 15:15:57 +01:00
Henry Mercer
50f2cc19ee Remove now redundant variant property
Previously, this was useful for discriminating between different
`CodeQLDefaultVersion` instances. However now all instances return a
tag name.
2023-07-07 15:15:57 +01:00
Henry Mercer
bec18d1625 Remove fallback logic for mapping default CLI version to GitHub Release
The default version feature flags will now always point to a CLI version
with a semantically versioned bundle, so we can find the GitHub
Release directly from the CLI version.
2023-07-07 15:15:57 +01:00
Henry Mercer
395fdba990 Merge pull request #1757 from github/henrymercer/cli-deprecation-warning
Add a deprecation warning for CodeQL CLIs < 2.9.4
2023-07-07 14:00:45 +01:00
Henry Mercer
5499d30c79 Merge branch 'main' into henrymercer/cli-deprecation-warning 2023-07-07 13:31:06 +01:00
Henry Mercer
bc5c834c7b Merge pull request #1758 from github/henrymercer/bundle-semantic-version-simplifications
Skip an API call when downloading a CodeQL version with a semver bundle
2023-07-07 13:22:56 +01:00
Henry Mercer
f6c51a38d7 Remove redundant set of env var 2023-07-07 13:06:53 +01:00
Henry Mercer
e1913859f3 Polish deprecation wording 2023-07-07 13:05:52 +01:00
Henry Mercer
177a5796c9 Tweak doc comment 2023-07-07 13:00:29 +01:00
Henry Mercer
6418c5d819 Skip an API call when downloading a CodeQL version with a semver bundle
Previously, we made an API call to look up the CLI version to release
mapping when the default CLI version was requested on Dotcom and that
CLI wasn't in the toolcache.
Now we compute the tag name directly for semver bundles.
2023-07-07 10:58:57 +01:00
github-actions[bot]
f60aebf286 Update supported GitHub Enterprise Server versions 2023-07-07 00:13:41 +00:00
Henry Mercer
05cb00cb77 Merge branch 'main' into henrymercer/cli-deprecation-warning 2023-07-06 18:00:18 +01:00
Dave Bartolomeo
84c057931e Merge pull request #1755 from github/mergeback/v2.20.3-to-main-46ed16de
Mergeback v2.20.3 refs/heads/releases/v2 into main
2023-07-06 12:53:21 -04:00
Henry Mercer
674e180d89 Add changelog note 2023-07-06 17:37:36 +01:00
Mathias Vorreiter Pedersen
fb57c981cc Merge pull request #1756 from github/fix-readme
Fix README link
2023-07-06 17:35:04 +01:00
github-actions[bot]
0bc3d1ffcf Update checked-in dependencies 2023-07-06 16:29:43 +00:00
Henry Mercer
9b345a50dd Only warn once about the CodeQL CLI being unsupported soon 2023-07-06 17:28:37 +01:00
Henry Mercer
3a960869ac Simplify definitions of environment variables 2023-07-06 17:28:37 +01:00
Mathias Vorreiter Pedersen
59c6251800 Fix README link 2023-07-06 17:14:12 +01:00
Henry Mercer
485b5809e8 Add deprecation warning for CodeQL CLIs < 2.9.4 2023-07-06 16:51:58 +01:00
github-actions[bot]
e97b7675af Update changelog and version after v2.20.3 2023-07-06 13:51:01 +00:00
Dave Bartolomeo
46ed16ded9 Merge pull request #1754 from github/update-v2.20.3-a2d725ddd
Merge main into releases/v2
2023-07-06 09:48:42 -04:00
github-actions[bot]
d0206e8c49 Update changelog for v2.20.3 2023-07-06 13:14:11 +00:00
Henry Mercer
a2d725ddd0 Merge pull request #1753 from github/henrymercer/new-analysis-summary
Add support for new analysis summaries
2023-07-06 11:46:16 +01:00
Henry Mercer
bbefc2b931 Merge branch 'main' into henrymercer/new-analysis-summary 2023-07-06 10:58:28 +01:00
Henry Mercer
8c2e08da10 Merge pull request #1752 from github/henrymercer/export-config-by-default
Remove feature flag for exporting the code scanning configuration
2023-07-06 10:57:31 +01:00
Henry Mercer
0c1d7efb0a Add support for new analysis summaries 2023-07-05 18:56:55 +01:00
Henry Mercer
56beae86dd Remove feature flag for exporting the code scanning configuration flag 2023-07-05 16:26:20 +01:00
Dave Bartolomeo
a42c0ca9fe Merge pull request #1743 from github/update-bundle/codeql-bundle-v2.13.5
Update default bundle to 2.13.5
2023-07-05 11:12:27 -04:00
Angela P Wen
e960e482a4 Telemetry: send event report times as ISO strings (#1751) 2023-07-05 03:25:10 -07:00
Angela P Wen
bcb460dab8 Merge pull request #1747 from github/mergeback/v2.20.2-to-main-004c5de3
Mergeback v2.20.2 refs/heads/releases/v2 into main
2023-07-03 04:22:50 -07:00
github-actions[bot]
9f236e9f54 Update checked-in dependencies 2023-07-03 11:02:30 +00:00
github-actions[bot]
56f71445bc Update changelog and version after v2.20.2 2023-07-03 11:00:39 +00:00
Angela P Wen
004c5de30b Merge pull request #1746 from github/update-v2.20.2-7dfbc0e0d
Merge main into releases/v2
2023-07-03 03:58:33 -07:00
github-actions[bot]
cb0b0a398e Update changelog for v2.20.2 2023-07-03 10:12:32 +00:00
dependabot[bot]
7dfbc0e0db Bump semver from 7.3.8 to 7.5.2 (#1745)
* Bump semver from 7.3.8 to 7.5.2

Bumps [semver](https://github.com/npm/node-semver) from 7.3.8 to 7.5.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.8...v7.5.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-03 07:45:09 +00:00
github-actions[bot]
66431bf9fd Add changelog note 2023-06-30 17:50:09 +00:00
github-actions[bot]
1c88766d17 Update default bundle to codeql-bundle-v2.13.5 2023-06-30 17:50:05 +00:00
Angela P Wen
46a6823b81 Send new per-query alert count event reports for QA telemetry (#1741) 2023-06-30 07:53:13 -07:00
Henry Mercer
cff3d9e3c9 Merge pull request #1737 from github/mergeback/v2.20.1-to-main-f6e388eb
Mergeback v2.20.1 refs/heads/releases/v2 into main
2023-06-21 14:47:13 +01:00
github-actions[bot]
75c683d9b5 Update checked-in dependencies 2023-06-21 10:59:30 +00:00
github-actions[bot]
f4eef0bfda Update changelog and version after v2.20.1 2023-06-21 10:57:02 +00:00
Henry Mercer
f6e388ebf0 Merge pull request #1736 from github/update-v2.20.1-4385ad556
Merge main into releases/v2
2023-06-21 11:54:43 +01:00
github-actions[bot]
2874247228 Update changelog for v2.20.1 2023-06-21 09:25:30 +00:00
Angela P Wen
4385ad5563 Send job_run_uuid to status report telemetry (#1685) 2023-06-20 23:45:51 -07:00
dependabot[bot]
8ba77ef4d3 Bump @octokit/types from 9.0.0 to 10.0.0 (#1734)
* Bump @octokit/types from 9.0.0 to 10.0.0

Bumps [@octokit/types](https://github.com/octokit/types.ts) from 9.0.0 to 10.0.0.
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v9.0.0...v10.0.0)

---
updated-dependencies:
- dependency-name: "@octokit/types"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Angela P Wen <angelapwen@github.com>
2023-06-20 15:21:51 +00:00
Angela P Wen
82dbde173c Fix setup-swift composite action for versions 5.8, 5.8.1 (#1735) 2023-06-20 07:43:31 -07:00
Henry Mercer
c6dff3470e Merge pull request #1721 from github/update-bundle/codeql-bundle-v2.13.4
Update default bundle to 2.13.4
2023-06-19 20:52:42 +01:00
Henry Mercer
3e0c87dc38 Merge branch 'main' into update-bundle/codeql-bundle-v2.13.4 2023-06-19 11:57:24 +01:00
Henry Mercer
de74ca6211 Merge pull request #1732 from github/henrymercer/tolerate-unexpected-processing-statuses
Tolerate unexpected processing statuses for unsuccessful execution SARIF uploads
2023-06-19 10:06:30 +01:00
Henry Mercer
d6201b58de Improve logging messages 2023-06-16 11:18:41 +01:00
Michael B. Gale
0ac18158d1 Merge pull request #1684 from github/mbg/add-resolve-environment 2023-06-15 17:50:42 +01:00
Michael B. Gale
d4006d9bc9 Improve step name in integration test 2023-06-15 15:46:54 +01:00
Henry Mercer
ee2b24e9fb Merge pull request #1733 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2023-06-15 11:15:18 +01:00
Michael B. Gale
7e5bafcdb5 Use stable-v2.13.4 for integration test 2023-06-15 11:04:44 +01:00
Michael B. Gale
eb9703ee74 Reformat 2023-06-15 10:22:00 +01:00
Michael B. Gale
7a9f099940 Don't invoke CLI when command not supported 2023-06-15 10:15:03 +01:00
github-actions[bot]
b843f9522e Update supported GitHub Enterprise Server versions 2023-06-15 00:12:06 +00:00
Michael B. Gale
899b5a286f Continue after CLI errors 2023-06-14 16:02:54 +01:00
Henry Mercer
4d7934a07c Tolerate unexpected processing statuses for red SARIF uploads 2023-06-14 14:20:27 +01:00
Michael B. Gale
f239f49a62 Rebuild integration test workflow 2023-06-13 20:51:45 +01:00
Michael B. Gale
c8785050e2 Improve changelog wording 2023-06-13 20:46:47 +01:00
Michael B. Gale
ba64fee9b1 Add CHANGELOG entry 2023-06-13 20:46:00 +01:00
Michael B. Gale
1c732358fa Update working-directory description 2023-06-13 20:46:00 +01:00
Michael B. Gale
efe0e211bb Update action description 2023-06-13 20:46:00 +01:00
Michael B. Gale
6419f994ff Handle case where workingDir is undefined 2023-06-13 20:46:00 +01:00
Michael B. Gale
16f3f1a951 Remove validateWorkflow call 2023-06-13 20:45:59 +01:00
Michael B. Gale
8e75e1a14d Apply suggestions from code review
Co-authored-by: Henry Mercer <henry.mercer@me.com>
2023-06-13 20:45:59 +01:00
Michael B. Gale
ef4bf4ae03 Use nightly-latest for test for now 2023-06-13 20:45:59 +01:00
Michael B. Gale
0b8c8128cf Add integration test for resolve-environment 2023-06-13 20:45:59 +01:00
Michael B. Gale
64fa96a8b3 Report success 2023-06-13 20:45:59 +01:00
Michael B. Gale
829bba8836 Do not download CLI 2023-06-13 20:45:59 +01:00
Michael B. Gale
e08f131aab Include CLI output in JSON error 2023-06-13 20:45:58 +01:00
Michael B. Gale
6f07b504a5 Propagate --working-dir argument 2023-06-13 20:45:58 +01:00
Michael B. Gale
fce65da29a Remove BuildEnvironmentOS 2023-06-13 20:45:58 +01:00
Michael B. Gale
ddb13a1ac7 Rename actionName to ACTION_NAME 2023-06-13 20:45:58 +01:00
Michael B. Gale
aef016d9b5 Apply suggestions from code review
Co-authored-by: Henry Mercer <henry.mercer@me.com>
2023-06-13 20:45:58 +01:00
Michael B. Gale
8216c3a1b1 Install CodeQL as part of the action 2023-06-13 20:45:58 +01:00
Michael B. Gale
59a9e3a311 Fix formatting for runResolveBuildEnvironment 2023-06-13 20:45:57 +01:00
Michael B. Gale
527ea9408c Add working-directory input 2023-06-13 20:45:57 +01:00
Michael B. Gale
4518431205 Fix: rename output 2023-06-13 20:45:57 +01:00
Michael B. Gale
0930314935 Add token and matrix inputs 2023-06-13 20:45:57 +01:00
Michael B. Gale
ee80b30f46 Add initial workflow code dependent on init 2023-06-13 20:45:57 +01:00
Michael B. Gale
4356c16c33 Add runResolveBuildEnvironment 2023-06-13 20:45:57 +01:00
Michael B. Gale
cc95e67380 Add resolve-environment to ActionName 2023-06-13 20:45:56 +01:00
Michael B. Gale
360d2b76b5 Update OS representation 2023-06-13 20:45:56 +01:00
Michael B. Gale
4322324628 Add resolveBuildEnvironment to CodeQL type 2023-06-13 20:45:56 +01:00
Michael B. Gale
dce63d8676 Add initial stub for resolve-environment action 2023-06-13 20:45:56 +01:00
dependabot[bot]
b8f204c619 Bump @octokit/plugin-retry from 4.0.4 to 5.0.2 (#1726)
* Bump @octokit/plugin-retry from 4.0.4 to 5.0.2

Bumps [@octokit/plugin-retry](https://github.com/octokit/plugin-retry.js) from 4.0.4 to 5.0.2.
- [Release notes](https://github.com/octokit/plugin-retry.js/releases)
- [Commits](https://github.com/octokit/plugin-retry.js/compare/v4.0.4...v5.0.2)

---
updated-dependencies:
- dependency-name: "@octokit/plugin-retry"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Angela P Wen <angelapwen@github.com>
2023-06-13 12:39:20 -07:00
Angela P Wen
5fa98fa5b2 Merge pull request #1731 from github/mergeback/v2.20.0-to-main-6c089f53
Mergeback v2.20.0 refs/heads/releases/v2 into main
2023-06-13 12:21:04 -07:00
github-actions[bot]
6bd6480037 Update checked-in dependencies 2023-06-13 18:27:20 +00:00
github-actions[bot]
e476d8b071 Update changelog and version after v2.20.0 2023-06-13 18:24:42 +00:00
Angela P Wen
6c089f53dd Merge pull request #1730 from github/update-v2.20.0-d5b7b3823
Merge main into releases/v2
2023-06-13 11:22:32 -07:00
github-actions[bot]
484d2f8088 Update changelog for v2.20.0 2023-06-13 17:50:40 +00:00
Angela P Wen
d5b7b38233 Bump Action version to 2.20.0 (#1729) 2023-06-13 17:46:13 +00:00
Henry Mercer
64d6bfc2d6 Merge branch 'main' into update-bundle/codeql-bundle-v2.13.4 2023-06-13 14:10:34 +01:00
Henry Mercer
543e4689d0 Merge pull request #1725 from github/henrymercer/fix-flag-name
Fix the name of the disable Python dependency installation feature flag
2023-06-12 21:16:13 +01:00
Henry Mercer
c92053157f Address review comments
Co-authored-by: Angela P Wen <angelapwen@github.com>
2023-06-12 19:31:25 +01:00
Henry Mercer
9f45792756 Update autogenerated notice to refer to specific ruamel.yaml version 2023-06-12 13:28:11 +01:00
Henry Mercer
98884904a2 Update checks formatting 2023-06-12 13:28:01 +01:00
Henry Mercer
5be8bd1c16 Pin version of ruamel.yaml to avoid checks breaking 2023-06-12 13:28:00 +01:00
Henry Mercer
eb5d323227 Bump minor version number 2023-06-12 12:02:38 +01:00
Henry Mercer
bce99ca79f Fix the name of the disable Python dependency installation feature flag 2023-06-12 11:55:51 +01:00
Henry Mercer
e287d85c90 Merge pull request #1723 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2023-06-12 11:45:24 +01:00
Henry Mercer
834c357222 Add changelog note 2023-06-12 11:36:47 +01:00
Henry Mercer
7bd23b58b5 Remove support for CodeQL CLI 2.9.3 and earlier 2023-06-12 11:34:01 +01:00
Henry Mercer
f1c4784a3f Update checks 2023-06-12 11:26:55 +01:00
Henry Mercer
a590b4afa7 Bump minimum CodeQL version to 2.9.4 2023-06-12 11:22:22 +01:00
github-actions[bot]
cd5b1ee5cf Update supported GitHub Enterprise Server versions 2023-06-10 00:11:27 +00:00
Henry Mercer
5dcc7c296d Merge pull request #1719 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2023-06-09 14:11:48 +01:00
github-actions[bot]
3437c495bd Add changelog note 2023-06-09 12:27:30 +00:00
github-actions[bot]
c94b9997cc Update default bundle to codeql-bundle-v2.13.4 2023-06-09 12:27:25 +00:00
github-actions[bot]
921d191150 Update supported GitHub Enterprise Server versions 2023-06-07 00:12:13 +00:00
6963 changed files with 858631 additions and 645878 deletions

View File

@@ -22,6 +22,7 @@
}],
"import/no-amd": "error",
"import/no-commonjs": "error",
"import/no-cycle": "error",
"import/no-dynamic-require": "error",
// Disable the rule that checks that devDependencies aren't imported since we use a single
// linting configuration file for both source and test code.

3
.git-blame-ignore-revs Normal file
View File

@@ -0,0 +1,3 @@
# .git-blame-ignore-revs
# Added trailing commas to adhere to new eslint rules
b16296be30e150034524d6dd0b0418fc6b184267

View File

@@ -16,5 +16,5 @@ inputs:
Comma separated list of query ids that should NOT be included in this SARIF file.
runs:
using: node12
using: node16
main: index.js

View File

@@ -2,8 +2,12 @@ name: "Prepare test"
description: Performs some preparation to run tests
inputs:
version:
description: "The version of the CodeQL CLI to use. Can be 'latest', 'cached', 'nightly-latest', 'nightly-YYYY-MM-DD', or 'stable-YYYY-MM-DD'."
description: "The version of the CodeQL CLI to use. Can be 'latest', 'default', 'nightly-latest', 'nightly-YYYY-MM-DD', or 'stable-YYYY-MM-DD'."
required: true
use-all-platform-bundle:
description: "If true, we output a tools URL with codeql-bundle.tar.gz file rather than platform-specific URL"
default: 'false'
required: false
outputs:
tools-url:
description: "The value that should be passed as the 'tools' input of the 'init' step."
@@ -23,18 +27,32 @@ runs:
shell: bash
run: |
set -e # Fail this Action if `gh release list` fails.
if [[ ${{ inputs.use-all-platform-bundle }} == "true" ]]; then
artifact_name="codeql-bundle.tar.gz"
elif [[ "$RUNNER_OS" == "Linux" ]]; then
artifact_name="codeql-bundle-linux64.tar.gz"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
artifact_name="codeql-bundle-osx64.tar.gz"
elif [[ "$RUNNER_OS" == "Windows" ]]; then
artifact_name="codeql-bundle-win64.tar.gz"
else
echo "::error::Unrecognized OS $RUNNER_OS"
exit 1
fi
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
tag=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$tag/$artifact_name" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$VERSION-manual/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version-manual/$artifact_name" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$VERSION/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.version }} == "latest" ]]; then
echo "tools-url=latest" >> $GITHUB_OUTPUT
elif [[ ${{ inputs.version }} == "cached" ]]; then
elif [[ ${{ inputs.version }} == "default" ]]; then
echo "tools-url=" >> $GITHUB_OUTPUT
else
echo "::error::Unrecognized version specified!"

View File

@@ -1,5 +1,5 @@
name: "Set up Swift"
description: Sets up an appropriate Swift version if supported on this platform.
name: "Set up Swift on Linux"
description: Sets up an appropriate Swift version on Linux.
inputs:
codeql-path:
description: Path to the CodeQL CLI executable.
@@ -9,29 +9,29 @@ runs:
steps:
- name: Get Swift version
id: get_swift_version
if: runner.os != 'Windows'
if: runner.os == 'Linux'
shell: bash
env:
CODEQL_PATH: ${{ inputs.codeql-path }}
run: |
if [[ $RUNNER_OS = "macOS" ]]; then
PLATFORM="osx64"
else # We do not run this step on Windows.
PLATFORM="linux64"
fi
SWIFT_EXTRACTOR_DIR="$("$CODEQL_PATH" resolve languages --format json | jq -r '.swift[0]')"
if [ $SWIFT_EXTRACTOR_DIR = "null" ]; then
VERSION="null"
else
VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/$PLATFORM/extractor" --version | awk '/version/ { print $3 }')"
# Specify 5.7.0, otherwise setup Action will default to latest minor version.
VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/linux64/extractor" --version | awk '/version/ { print $3 }')"
# Specify 5.x.0, otherwise setup Action will default to latest minor version.
if [ $VERSION = "5.7" ]; then
VERSION="5.7.0"
fi
elif [ $VERSION = "5.8" ]; then
VERSION="5.8.0"
# setup-swift does not yet support v5.8.1 Remove this when it does.
elif [ $VERSION = "5.8.1" ]; then
VERSION="5.8.0"
fi
fi
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
- uses: swift-actions/setup-swift@65540b95f51493d65f5e59e97dcef9629ddf11bf # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
if: runner.os != 'Windows' && steps.get_swift_version.outputs.version != 'null'
- uses: swift-actions/setup-swift@f51889efb55dccf13be0ee727e3d6c89a096fb4c # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null'
with:
swift-version: "${{ steps.get_swift_version.outputs.version }}"

View File

@@ -6,16 +6,31 @@ updates:
interval: weekly
labels:
- Update dependencies
# Ignore incompatible dependency updates
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-minor
- version-update:semver-patch
# There is a type incompatibility issue between v0.0.9 and our other dependencies.
- dependency-name: "@octokit/plugin-retry"
versions: ["~6.0.0"]
# v7 requires ESM
- dependency-name: "del"
versions: ["^7.0.0"]
groups:
npm:
patterns:
- "*"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
groups:
actions:
patterns:
- "*"
- package-ecosystem: github-actions
directory: "/.github/actions/setup-swift/" # All subdirectories outside of "/.github/workflows" must be explicitly included.
schedule:
interval: weekly
groups:
actions-setup-swift:
patterns:
- "*"

67
.github/workflows/__all-platform-bundle.yml generated vendored Normal file
View File

@@ -0,0 +1,67 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - All-platform bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
all-platform-bundle:
strategy:
matrix:
include:
- os: ubuntu-latest
version: nightly-latest
name: All-platform bundle
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'true'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- id: init
uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
upload-database: false
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: "PR Check - Analyze: 'ref' and 'sha' from inputs"
@@ -26,47 +26,11 @@ jobs:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
version: default
- os: macos-latest
version: stable-20220401
version: default
- os: windows-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
version: stable-20220908
- os: windows-latest
version: stable-20220908
- os: ubuntu-latest
version: stable-20221211
- os: macos-latest
version: stable-20221211
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: windows-latest
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
version: default
name: "Analyze: 'ref' and 'sha' from inputs"
permissions:
contents: read
@@ -75,12 +39,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - autobuild-action
@@ -39,12 +39,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Config export
@@ -45,12 +45,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
@@ -101,6 +102,5 @@ jobs:
}
core.info('Finished config export tests.');
env:
CODEQL_ACTION_EXPORT_CODE_SCANNING_CONFIG: true
CODEQL_PASS_CONFIG_TO_CLI: true
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Diagnostic export
@@ -51,12 +51,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Export file baseline information
@@ -39,12 +39,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
@@ -58,19 +59,15 @@ jobs:
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
CODEQL_FILE_BASELINE_INFORMATION: true
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{steps.init.outputs.codeql-path}}
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
env:
CODEQL_FILE_BASELINE_INFORMATION: true
- name: Upload SARIF
uses: actions/upload-artifact@v3
with:
@@ -81,13 +78,13 @@ jobs:
shell: bash
run: |
cd "$RUNNER_TEMP/results"
expected_baseline_languages="cpp cs go java js py rb"
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
if [[ $RUNNER_OS != "Windows" ]]; then
expected_baseline_languages+=" swift"
fi
for lang in ${expected_baseline_languages}; do
rule_name="${lang}/baseline/expected-extracted-files"
rule_name="cli/expected-extracted-files/${lang}"
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications |
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
if [[ "${found_notification}" != "true" ]]; then
@@ -98,4 +95,5 @@ jobs:
fi
done
env:
CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Extractor ram and threads options test
@@ -35,12 +35,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Go: Custom queries'
@@ -25,18 +25,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: macos-latest
version: stable-20220401
- os: windows-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
@@ -50,11 +38,29 @@ jobs:
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
version: stable-20230418
- os: macos-latest
version: cached
version: stable-20230418
- os: windows-latest
version: cached
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
@@ -75,12 +81,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -0,0 +1,96 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Go: diagnostic when Go is changed after init step'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
go-indirect-tracing-workaround-diagnostic:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-v2.14.6
name: 'Go: diagnostic when Go is changed after init step'
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
# We need a Go version that ships with statically linked binaries on Linux
go-version: '>=1.21.0'
- uses: ./../action/init
with:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}
# Deliberately change Go after the `init` step
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build code
shell: bash
run: go build main.go
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Check diagnostic appears in SARIF
uses: actions/github-script@v6
env:
SARIF_PATH: ${{ runner.temp }}/results/go.sarif
with:
script: |
const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const statusPageNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage
);
if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
env:
CODEQL_ACTION_TEST_MODE: true

94
.github/workflows/__go-indirect-tracing-workaround.yml generated vendored Normal file
View File

@@ -0,0 +1,94 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Go: workaround for indirect tracing'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
go-indirect-tracing-workaround:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-v2.14.6
name: 'Go: workaround for indirect tracing'
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
# We need a Go version that ships with statically linked binaries on Linux
go-version: '>=1.21.0'
- uses: ./../action/init
with:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code
shell: bash
run: go build main.go
- uses: ./../action/analyze
with:
upload-database: false
- shell: bash
run: |
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
"CODEQL_ACTION_GO_BINARY environment variable is not set."
exit 1
fi
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist."
exit 1
fi
# Once we start running Bash 4.2 in all environments, we can replace the
# `! -z` flag with the more elegant `-v` which confirms that the variable
# is actually unset and not potentially set to a blank value.
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
echo "Expected the Go autobuilder not to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
exit 1
fi
cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then
echo "Did not find a Go database"
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Go: tracing with autobuilder step'
@@ -25,14 +25,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: macos-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
@@ -42,9 +34,21 @@ jobs:
- os: macos-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
version: stable-20230418
- os: macos-latest
version: cached
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
@@ -61,12 +65,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
@@ -75,6 +80,9 @@ jobs:
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: ~1.21.1
- uses: ./../action/init
with:
languages: go

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Go: tracing with custom build steps'
@@ -25,14 +25,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: macos-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
@@ -42,9 +34,21 @@ jobs:
- os: macos-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
version: stable-20230418
- os: macos-latest
version: cached
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
@@ -61,12 +65,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
@@ -75,6 +80,9 @@ jobs:
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: ~1.21.1
- uses: ./../action/init
with:
languages: go

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Go: tracing with legacy workflow'
@@ -25,14 +25,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: macos-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
@@ -42,9 +34,21 @@ jobs:
- os: macos-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
version: stable-20230418
- os: macos-latest
version: cached
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
@@ -61,12 +65,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
@@ -75,6 +80,9 @@ jobs:
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: ~1.21.1
- uses: ./../action/init
with:
languages: go

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Packaging: Download using registries'
@@ -26,11 +26,11 @@ jobs:
matrix:
include:
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: windows-latest
version: cached
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
@@ -52,12 +52,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Custom source root
@@ -28,7 +28,7 @@ jobs:
- os: ubuntu-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
name: Custom source root
@@ -39,12 +39,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

69
.github/workflows/__language-aliases.yml generated vendored Normal file
View File

@@ -0,0 +1,69 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Language aliases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
language-aliases:
strategy:
matrix:
include:
- os: ubuntu-latest
version: latest
name: Language aliases
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: C#,java-kotlin,swift,typescript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check languages
run: |
expected_languages="csharp,java,swift,javascript"
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
if [ "$expected_languages" != "$actual_languages" ]; then
echo "Resolved languages did not match expected list. " \
"Expected languages: $expected_languages. Actual languages: $actual_languages."
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,160 +0,0 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# to regenerate this file.
name: PR Check - ML-powered queries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
ml-powered-queries:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: macos-latest
version: stable-20220401
- os: windows-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
version: stable-20220908
- os: windows-latest
version: stable-20220908
- os: ubuntu-latest
version: stable-20221211
- os: macos-latest
version: stable-20221211
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: windows-latest
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: ML-powered queries
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: javascript
queries: security-extended
source-root: ./../action/tests/ml-powered-queries-repo
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v3
with:
name: ml-powered-queries-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check sarif
uses: ./../action/.github/actions/check-sarif
# Running on Windows requires CodeQL CLI 2.9.0+.
if: "!(matrix.version == 'stable-20220401' && runner.os == 'Windows')"
with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run:
js/ml-powered/nosql-injection,js/ml-powered/path-injection,js/ml-powered/sql-injection,js/ml-powered/xss
queries-not-run: foo,bar
- name: Check results
env:
# Running on Windows requires CodeQL CLI 2.9.0+.
SHOULD_RUN_ML_POWERED_QUERIES: ${{ !(matrix.version == 'stable-20220401' &&
runner.os == 'Windows') }}
shell: bash
run: |
echo "Expecting ML-powered queries to be run: ${SHOULD_RUN_ML_POWERED_QUERIES}"
cd "$RUNNER_TEMP/results"
# We should run at least the ML-powered queries in `expected_rules`.
expected_rules="js/ml-powered/nosql-injection js/ml-powered/path-injection js/ml-powered/sql-injection js/ml-powered/xss"
for rule in ${expected_rules}; do
found_rule=$(jq --arg rule "${rule}" '[.runs[0].tool.extensions[].rules | select(. != null) |
flatten | .[].id] | any(. == $rule)' javascript.sarif)
echo "Did find rule '${rule}': ${found_rule}"
if [[ "${found_rule}" != "true" && "${SHOULD_RUN_ML_POWERED_QUERIES}" == "true" ]]; then
echo "Expected SARIF output to contain rule '${rule}', but found no such rule."
exit 1
elif [[ "${found_rule}" == "true" && "${SHOULD_RUN_ML_POWERED_QUERIES}" != "true" ]]; then
echo "Found rule '${rule}' in the SARIF output which shouldn't have been part of the analysis."
exit 1
fi
done
# We should have at least one alert from an ML-powered query.
num_alerts=$(jq '[.runs[0].results[] |
select(.properties.score != null and (.rule.id | startswith("js/ml-powered/")))] | length' \
javascript.sarif)
echo "Found ${num_alerts} alerts from ML-powered queries.";
if [[ "${num_alerts}" -eq 0 && "${SHOULD_RUN_ML_POWERED_QUERIES}" == "true" ]]; then
echo "Expected to find at least one alert from an ML-powered query but found ${num_alerts}."
exit 1
elif [[ "${num_alerts}" -ne 0 && "${SHOULD_RUN_ML_POWERED_QUERIES}" != "true" ]]; then
echo "Expected not to find any alerts from an ML-powered query but found ${num_alerts}."
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Multi-language repository
@@ -25,14 +25,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: macos-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
@@ -42,9 +34,21 @@ jobs:
- os: macos-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
version: stable-20230418
- os: macos-latest
version: cached
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
@@ -61,12 +65,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Packaging: Config and input passed to the CLI'
@@ -32,11 +32,11 @@ jobs:
- os: windows-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: windows-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
@@ -51,12 +51,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Packaging: Config and input'
@@ -32,11 +32,11 @@ jobs:
- os: windows-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: windows-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
@@ -51,12 +51,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Packaging: Config file'
@@ -32,11 +32,11 @@ jobs:
- os: windows-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: windows-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
@@ -51,12 +51,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: 'PR Check - Packaging: Action input'
@@ -32,11 +32,11 @@ jobs:
- os: windows-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: windows-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
@@ -51,12 +51,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Remote config file
@@ -25,18 +25,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: macos-latest
version: stable-20220401
- os: windows-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
@@ -50,11 +38,29 @@ jobs:
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
version: stable-20230418
- os: macos-latest
version: cached
version: stable-20230418
- os: windows-latest
version: cached
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
@@ -75,12 +81,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

103
.github/workflows/__resolve-environment-action.yml generated vendored Normal file
View File

@@ -0,0 +1,103 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Resolve environment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
resolve-environment-action:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-v2.13.4
- os: macos-latest
version: stable-v2.13.4
- os: windows-latest
version: stable-v2.13.4
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
name: Resolve environment
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript'
}}
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Resolve environment for Go
uses: ./../action/resolve-environment
id: resolve-environment-go
with:
language: go
- name: Fail if Go configuration missing
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
run: exit 1
- name: Resolve environment for JavaScript/TypeScript
if: matrix.version != 'stable-v2.13.4'
uses: ./../action/resolve-environment
id: resolve-environment-js
with:
language: javascript-typescript
- name: Fail if JavaScript/TypeScript configuration present
if: matrix.version != 'stable-v2.13.4' &&
fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript
run: exit 1
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - RuboCop multi-language
@@ -26,7 +26,7 @@ jobs:
matrix:
include:
- os: ubuntu-latest
version: cached
version: default
name: RuboCop multi-language
permissions:
contents: read
@@ -35,12 +35,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

9
.github/workflows/__ruby.yml generated vendored
View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Ruby analysis
@@ -30,9 +30,9 @@ jobs:
- os: macos-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
@@ -45,12 +45,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

103
.github/workflows/__scaling-reserved-ram.yml generated vendored Normal file
View File

@@ -0,0 +1,103 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Scaling reserved RAM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
scaling-reserved-ram:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
version: stable-20220908
- os: ubuntu-latest
version: stable-20221211
- os: macos-latest
version: stable-20221211
- os: ubuntu-latest
version: stable-20230418
- os: macos-latest
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: Scaling reserved RAM
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
id: analysis
with:
upload-database: false
env:
CODEQL_ACTION_SCALING_RESERVED_RAM: true
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Split workflow
@@ -30,9 +30,9 @@ jobs:
- os: macos-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
@@ -45,12 +45,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Submit SARIF after failure
@@ -28,7 +28,7 @@ jobs:
- os: ubuntu-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
name: Submit SARIF after failure
@@ -39,12 +39,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
@@ -53,7 +54,7 @@ jobs:
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./init
with:
languages: javascript

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Swift analysis using a custom build command
@@ -30,9 +30,9 @@ jobs:
- os: macos-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
@@ -45,12 +45,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Autobuild working directory
@@ -35,12 +35,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Local CodeQL bundle
@@ -35,12 +35,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
@@ -58,7 +59,7 @@ jobs:
- id: init
uses: ./../action/init
with:
tools: ./codeql-bundle.tar.gz
tools: ./codeql-bundle-linux64.tar.gz
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}

5
.github/workflows/__test-proxy.yml generated vendored
View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Proxy test
@@ -35,12 +35,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Test unsetting environment variables
@@ -25,16 +25,18 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: ubuntu-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: ubuntu-latest
version: latest
- os: ubuntu-latest
@@ -47,12 +49,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: "PR Check - Upload-sarif: 'ref' and 'sha' from inputs"
@@ -26,47 +26,11 @@ jobs:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
version: default
- os: macos-latest
version: stable-20220401
version: default
- os: windows-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
version: stable-20220908
- os: windows-latest
version: stable-20220908
- os: ubuntu-latest
version: stable-20221211
- os: macos-latest
version: stable-20221211
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: windows-latest
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-latest
version: nightly-latest
version: default
name: "Upload-sarif: 'ref' and 'sha' from inputs"
permissions:
contents: read
@@ -75,12 +39,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (

View File

@@ -1,6 +1,6 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Use a custom `checkout_path`
@@ -25,18 +25,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220401
- os: macos-latest
version: stable-20220401
- os: windows-latest
version: stable-20220401
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
@@ -50,11 +38,29 @@ jobs:
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: cached
version: stable-20230418
- os: macos-latest
version: cached
version: stable-20230418
- os: windows-latest
version: cached
version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- os: ubuntu-latest
version: latest
- os: macos-latest
@@ -75,12 +81,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
@@ -89,7 +96,7 @@ jobs:
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
path: x/y/z/some-path

View File

@@ -15,7 +15,7 @@ jobs:
steps:
- name: Checkout CodeQL Action
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check Expected Release Files
run: |
bundle_version="$(cat "./src/defaults.json" | jq -r ".bundleVersion")"

View File

@@ -26,7 +26,7 @@ jobs:
security-events: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Init with default CodeQL bundle from the VM image
id: init-default
uses: ./init
@@ -73,7 +73,7 @@ jobs:
needs: [check-codeql-versions]
strategy:
matrix:
os: [ubuntu-latest,windows-latest,macos-latest]
os: [ubuntu-20.04,ubuntu-22.04,windows-2019,windows-2022,macos-11,macos-12,macos-13]
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
runs-on: ${{ matrix.os }}
@@ -82,7 +82,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: ./init
id: init

View File

@@ -30,9 +30,9 @@ jobs:
- os: macos-latest
version: latest
- os: ubuntu-latest
version: cached
version: default
- os: macos-latest
version: cached
version: default
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
@@ -44,7 +44,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test

View File

@@ -33,7 +33,7 @@ jobs:
- name: Dump GitHub event
run: cat "${GITHUB_EVENT_PATH}"
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test

View File

@@ -25,11 +25,12 @@ jobs:
- ubuntu-latest
- macos-latest
version:
- stable-20220401
- stable-20220615
- stable-20220908
- stable-20221211
- cached
- stable-20230418
- stable-v2.13.5
- stable-v2.14.6
- default
- latest
- nightly-latest
name: Upload debug artifacts
@@ -39,7 +40,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
@@ -74,11 +75,11 @@ jobs:
- name: Check expected artifacts exist
shell: bash
run: |
VERSIONS="stable-20220401 stable-20220615 stable-20220908 stable-20221211 cached latest nightly-latest"
VERSIONS="stable-20220908 stable-20221211 stable-20230418 stable-v2.13.5 stable-v2.14.6 default latest nightly-latest"
LANGUAGES="cpp csharp go java javascript python"
for version in $VERSIONS; do
for os in ubuntu-latest macos-latest; do
pushd "./my-debug-artifacts-$os-$version"
pushd "./my-debug-artifacts-$os-${version//./}"
echo "Artifacts from version $version on $os:"
for language in $LANGUAGES; do
echo "- Checking $language"

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test

View File

@@ -35,7 +35,7 @@ jobs:
GITHUB_CONTEXT: '${{ toJson(github) }}'
run: echo "${GITHUB_CONTEXT}"
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- name: Update git config
@@ -130,7 +130,7 @@ jobs:
npm version patch --no-git-tag-version
# Update the changelog
perl -i -pe 's/^/## \[UNRELEASED\]\n\nNo user facing changes.\n\n/ if($.==3)' CHANGELOG.md
perl -i -pe 's/^/## \[UNRELEASED\]\n\nNo user facing changes.\n\n/ if($.==5)' CHANGELOG.md
git add .
git commit -m "Update changelog and version after ${VERSION}"

View File

@@ -17,7 +17,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Lint
run: npm run-script lint
@@ -31,7 +31,7 @@ jobs:
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check node modules up to date
run: .github/workflows/script/check-node-modules.sh
@@ -42,17 +42,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruamel.yaml
# When updating this, update the autogenerated code header in `sync.py` too.
pip install ruamel.yaml==0.17.31
# Ensure the generated PR check workflows are up to date.
- name: Verify PR checks up to date
@@ -68,7 +69,7 @@ jobs:
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: npm test
run: |
# Run any commands referenced in package.json using Bash, otherwise

View File

@@ -37,7 +37,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: ./init
@@ -84,7 +84,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: ./init
@@ -137,7 +137,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:

41
.github/workflows/python312-windows.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Test that the workaround for python 3.12 on windows works
on:
push:
branches: [main, releases/v2]
pull_request:
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
# by other workflows.
types: [opened, synchronize, reopened, ready_for_review]
schedule:
# Weekly on Monday.
- cron: '0 0 * * 1'
workflow_dispatch:
jobs:
test-setup-python-scripts:
timeout-minutes: 45
runs-on: windows-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.12
- uses: actions/checkout@v4
- name: Prepare test
uses: ./.github/actions/prepare-test
with:
version: default
- name: Initialize CodeQL
uses: ./../action/init
with:
tools: latest
languages: python
- name: Analyze
uses: ./../action/analyze
with:
upload-database: false

View File

@@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test

View File

@@ -0,0 +1,56 @@
name: 'PR Check - CodeQL Bundle All'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
# Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
# workaround for our PR checks.
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
test-codeql-bundle-all:
strategy:
matrix:
include:
- os: ubuntu-latest
version: nightly-latest
name: 'CodeQL Bundle All'
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: true
- id: init
uses: ./../action/init
with:
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
upload-database: false
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -26,7 +26,7 @@ jobs:
GITHUB_CONTEXT: '${{ toJson(github) }}'
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Update git config
run: |

View File

@@ -11,19 +11,20 @@ jobs:
if: contains(github.event.pull_request.labels.*.name, 'Update dependencies') && (github.event.pull_request.head.repo.full_name == 'github/codeql-action')
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Remove PR label
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
REPOSITORY: '${{ github.repository }}'
PR_NUMBER: '${{ github.event.pull_request.number }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE
- name: Push updated dependencies
env:
BRANCH: '${{ github.head_ref }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |
git fetch origin "$BRANCH" --depth=1
git checkout "origin/$BRANCH"
@@ -34,4 +35,8 @@ jobs:
git add node_modules
git commit -am "Update checked-in dependencies"
git push origin "HEAD:$BRANCH"
echo "Pushed a commit to update the checked-in dependencies." \
"Please mark the PR as ready for review to trigger PR checks." |
gh pr comment --body-file - --repo github/codeql-action "${{ github.event.pull_request.number }}"
gh pr ready --undo --repo github/codeql-action "${{ github.event.pull_request.number }}"
fi

View File

@@ -18,7 +18,7 @@ jobs:
GITHUB_CONTEXT: '${{ toJson(github) }}'
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Need full history so we calculate diffs
fetch-depth: 0

View File

@@ -18,9 +18,9 @@ jobs:
with:
python-version: "3.7"
- name: Checkout CodeQL Action
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout Enterprise Releases
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: github/enterprise-releases
ssh-key: ${{ secrets.ENTERPRISE_RELEASES_SSH_KEY }}
@@ -52,5 +52,13 @@ jobs:
git add .
git commit --message "Update supported GitHub Enterprise Server versions"
git push origin update-supported-enterprise-server-versions
gh pr create --fill --draft
body="This PR updates the list of supported GitHub Enterprise Server versions, either because a new "
body+="version is about to be feature frozen, or because an old release has been deprecated.\n\n"
body+="If an old release has been deprecated, please follow the instructions in CONTRIBUTING.md to "
body+="deprecate the corresponding version of CodeQL."
gh pr create --draft \
--title "Update supported GitHub Enterprise Server versions" \
--body "$body"
fi

View File

@@ -17,8 +17,8 @@ def main():
releases = json.loads(_RELEASE_FILE_PATH.read_text())
# Remove GHES version using a previous version numbering scheme.
if "11.10.340" in releases:
del releases["11.10.340"]
if "11.10" in releases:
del releases["11.10"]
oldest_supported_release = None
newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0")

View File

@@ -6,5 +6,11 @@
// transpiled JavaScript
"lib": true,
}
},
// Installing a new Node package often triggers VS Code's git limit warnings as there is typically
// an intermediate stage where many files are modified. This setting suppresses these warnings.
"git.ignoreLimitWarning": true,
// Use the vendored TypeScript version to have a consistent development experience across
// machines.
"typescript.tsdk": "node_modules/typescript/lib"
}

View File

@@ -1,9 +1,110 @@
# CodeQL Action Changelog
## [UNRELEASED]
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
## 2.22.3 - 13 Oct 2023
- Provide an authentication token when downloading the CodeQL Bundle from the API of a GitHub Enterprise Server instance. [#1945](https://github.com/github/codeql-action/pull/1945)
## 2.22.2 - 12 Oct 2023
- Update default CodeQL bundle version to 2.15.0. [#1938](https://github.com/github/codeql-action/pull/1938)
- Improve the log output when an error occurs in an invocation of the CodeQL CLI. [#1927](https://github.com/github/codeql-action/pull/1927)
## 2.22.1 - 09 Oct 2023
- Add a workaround for Python 3.12, which is not supported in CodeQL CLI version 2.14.6 or earlier. If you are running an analysis on Windows and using Python 3.12 or later, the CodeQL Action will switch to running Python 3.11. In this case, if Python 3.11 is not found, then the workflow will fail. [#1928](https://github.com/github/codeql-action/pull/1928)
## 2.22.0 - 06 Oct 2023
- The CodeQL Action now requires CodeQL version 2.10.5 or later. For more information, see the corresponding changelog entry for CodeQL Action version 2.21.8. [#1907](https://github.com/github/codeql-action/pull/1907)
- The CodeQL Action no longer runs ML-powered queries. For more information, including details on our investment in AI-powered security technology, see ["CodeQL code scanning deprecates ML-powered alerts."](https://github.blog/changelog/2023-09-29-codeql-code-scanning-deprecates-ml-powered-alerts/) [#1910](https://github.com/github/codeql-action/pull/1910)
- Fix a bug which prevented tracing of projects using Go 1.21 and above on Linux. [#1909](https://github.com/github/codeql-action/pull/1909)
## 2.21.9 - 27 Sep 2023
- Update default CodeQL bundle version to 2.14.6. [#1897](https://github.com/github/codeql-action/pull/1897)
- We are rolling out a feature in October 2023 that will improve the success rate of C/C++ autobuild. [#1889](https://github.com/github/codeql-action/pull/1889)
- We are rolling out a feature in October 2023 that will provide specific file coverage information for C and C++, Java and Kotlin, and JavaScript and TypeScript. Currently file coverage information for each of these pairs of languages is grouped together. [#1903](https://github.com/github/codeql-action/pull/1903)
- Add a warning to help customers avoid inadvertently analyzing the same CodeQL language in multiple matrix jobs. [#1901](https://github.com/github/codeql-action/pull/1901)
## 2.21.8 - 19 Sep 2023
- Add a deprecation warning for customers using CodeQL version 2.10.4 and earlier. These versions of CodeQL were discontinued on 12 September 2023 alongside GitHub Enterprise Server 3.6, and will be unsupported by the next minor release of the CodeQL Action. [#1884](https://github.com/github/codeql-action/pull/1884)
- If you are using one of these versions, please update to CodeQL CLI version 2.10.5 or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.
- Alternatively, if you want to continue using a version of the CodeQL CLI between 2.9.5 and 2.10.4, you can replace `github/codeql-action/*@v2` by `github/codeql-action/*@v2.21.7` in your code scanning workflow to ensure you continue using this version of the CodeQL Action.
- Enable the following language aliases when using CodeQL 2.14.4 and later: `c-cpp` for C/C++ analysis, `java-kotlin` for Java/Kotlin analysis, and `javascript-typescript` for JavaScript/TypeScript analysis. [#1883](https://github.com/github/codeql-action/pull/1883)
## 2.21.7 - 14 Sep 2023
- Update default CodeQL bundle version to 2.14.5. [#1882](https://github.com/github/codeql-action/pull/1882)
## 2.21.6 - 13 Sep 2023
- Better error message when there is a failure to determine the merge base of the code to analysis. [#1860](https://github.com/github/codeql-action/pull/1860)
- Improve the calculation of default amount of RAM used for query execution on GitHub Enterprise Server. This now reduces in proportion to the runner's total memory to better account for system memory usage, helping to avoid out-of-memory failures on larger runners. This feature is already available to GitHub.com users. [#1866](https://github.com/github/codeql-action/pull/1866)
- Enable improved file coverage information for GitHub Enterprise Server users. This feature is already available to GitHub.com users. [#1867](https://github.com/github/codeql-action/pull/1867)
- Update default CodeQL bundle version to 2.14.4. [#1873](https://github.com/github/codeql-action/pull/1873)
## 2.21.5 - 28 Aug 2023
- Update default CodeQL bundle version to 2.14.3. [#1845](https://github.com/github/codeql-action/pull/1845)
- Fixed a bug in CodeQL Action 2.21.3 onwards that affected beta support for [Project Lombok](https://projectlombok.org/) when analyzing Java. The environment variable `CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS` will now be respected if it was manually configured in the workflow. [#1844](https://github.com/github/codeql-action/pull/1844)
- Enable support for Kotlin 1.9.20 when running with CodeQL CLI v2.13.4 through v2.14.3. [#1853](https://github.com/github/codeql-action/pull/1853)
## 2.21.4 - 14 Aug 2023
- Update default CodeQL bundle version to 2.14.2. [#1831](https://github.com/github/codeql-action/pull/1831)
- Log a warning if the amount of available disk space runs low during a code scanning run. [#1825](https://github.com/github/codeql-action/pull/1825)
- When downloading CodeQL bundle version 2.13.4 and later, cache these bundles in the Actions tool cache using a simpler version number. [#1832](https://github.com/github/codeql-action/pull/1832)
- Fix an issue that first appeared in CodeQL Action v2.21.2 that prevented CodeQL invocations from being logged. [#1833](https://github.com/github/codeql-action/pull/1833)
- We are rolling out a feature in August 2023 that will improve the quality of file coverage information. [#1835](https://github.com/github/codeql-action/pull/1835)
## 2.21.3 - 08 Aug 2023
- We are rolling out a feature in August 2023 that will improve multi-threaded performance on larger runners. [#1817](https://github.com/github/codeql-action/pull/1817)
- We are rolling out a feature in August 2023 that adds beta support for [Project Lombok](https://projectlombok.org/) when analyzing Java. [#1809](https://github.com/github/codeql-action/pull/1809)
- Reduce disk space usage when downloading the CodeQL bundle. [#1820](https://github.com/github/codeql-action/pull/1820)
## 2.21.2 - 28 Jul 2023
- Update default CodeQL bundle version to 2.14.1. [#1797](https://github.com/github/codeql-action/pull/1797)
- Avoid duplicating the analysis summary within the logs. [#1811](https://github.com/github/codeql-action/pull/1811)
## 2.21.1 - 26 Jul 2023
- Improve the handling of fatal errors from the CodeQL CLI. [#1795](https://github.com/github/codeql-action/pull/1795)
- Add the `sarif-output` output to the analyze action that contains the path to the directory of the generated SARIF. [#1799](https://github.com/github/codeql-action/pull/1799)
## 2.21.0 - 19 Jul 2023
- CodeQL Action now requires CodeQL CLI 2.9.4 or later. For more information, see the corresponding changelog entry for CodeQL Action version 2.20.4. [#1724](https://github.com/github/codeql-action/pull/1724)
## 2.20.4 - 14 Jul 2023
- This is the last release of the Action that supports CodeQL CLI versions 2.8.5 to 2.9.3. These versions of the CodeQL CLI were deprecated on June 20, 2023 alongside GitHub Enterprise Server 3.5 and will not be supported by the next release of the CodeQL Action (2.21.0).
- If you are using one of these versions, please update to CodeQL CLI version 2.9.4 or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.
- Alternatively, if you want to continue using a version of the CodeQL CLI between 2.8.5 and 2.9.3, you can replace 'github/codeql-action/*@v2' by 'github/codeql-action/*@v2.20.4' in your code scanning workflow to ensure you continue using this version of the CodeQL Action.
- We are rolling out a feature in July 2023 that will slightly reduce the default amount of RAM used for query execution, in proportion to the runner's total memory. This will help to avoid out-of-memory failures on larger runners. [#1760](https://github.com/github/codeql-action/pull/1760)
- Update default CodeQL bundle version to 2.14.0. [#1762](https://github.com/github/codeql-action/pull/1762)
## 2.20.3 - 06 Jul 2023
- Update default CodeQL bundle version to 2.13.5. [#1743](https://github.com/github/codeql-action/pull/1743)
## 2.20.2 - 03 Jul 2023
No user facing changes.
## 2.20.1 - 21 Jun 2023
- Update default CodeQL bundle version to 2.13.4. [#1721](https://github.com/github/codeql-action/pull/1721)
- Experimental: add a new `resolve-environment` action which attempts to infer a configuration for the build environment that is required to build a given project. Do not use this in production as it is part of an internal experiment and subject to change at any time.
## 2.20.0 - 13 Jun 2023
- Bump the version of the Action to 2.20.0. This ensures that users who received a Dependabot upgrade to [`cdcdbb5`](https://github.com/github/codeql-action/commit/cdcdbb579706841c47f7063dda365e292e5cad7a), which was mistakenly marked as Action version 2.13.4, continue to receive updates to the CodeQL Action. Full details in [#1729](https://github.com/github/codeql-action/pull/1729)
## 2.3.6 - 01 Jun 2023
- Update default CodeQL bundle version to 2.13.3. [#1698](https://github.com/github/codeql-action/pull/1698)

View File

@@ -78,6 +78,27 @@ Since the `codeql-action` runs most of its testing through individual Actions wo
2. Run the script. If there's a reason to, you can pass in a different SHA as a CLI argument.
3. After running, go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules for `main`, `v1`, and `v2` have been updated.
## Deprecating a CodeQL version (write access required)
We typically deprecate a version of CodeQL when the GitHub Enterprise Server (GHES) version that it first shipped in is deprecated.
1. Work out the next minimum version of CodeQL. This is the version that shipped in the version of GHES after the one that has just been deprecated.
1. Notify users using the old version of CodeQL about the deprecation.
- Update `CODEQL_NEXT_MINIMUM_VERSION`, `GHES_VERSION_MOST_RECENTLY_DEPRECATED`, and `GHES_MOST_RECENT_DEPRECATION_DATE` in `src/codeql.ts` to reflect the new minimum version of CodeQL and the GHES version that has just been deprecated.
- Add a changelog note announcing the deprecation.
- Example PR: https://github.com/github/codeql-action/pull/1884
1. Release the Action, or wait for the next scheduled release of the Action, then wait at least a week so users have time to see and act on the deprecation warning.
1. Remove support for the old version of CodeQL.
- Bump `CODEQL_MINIMUM_VERSION` in `src/codeql.ts` to the new minimum version of CodeQL.
- Remove any code that is only needed to support the old version of CodeQL. This is often behind a version guard, so look for instances of version numbers between the old minimum version and the new minimum version in the codebase. A good place to start is the list of version numbers in `src/codeql.ts`.
- Update the default set of CodeQL test versions in `pr-checks/sync.py`.
- Remove the old minimum version of CodeQL.
- Add the latest patch release for any new CodeQL minor version series that have shipped in GHES.
- Run the script to update the generated PR checks.
- Do the same for PR checks that aren't auto-generated.
- Add a changelog note announcing the new minimum version of CodeQL that is now required.
- Example PR: https://github.com/github/codeql-action/pull/1907
## Resources
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)

159
README.md
View File

@@ -1,6 +1,6 @@
# CodeQL Action
This action runs GitHub's industry-leading semantic code analysis engine, [CodeQL](https://codeql.github.com/), against a repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed in the repository's security tab. CodeQL runs an extensible set of [queries](https://github.com/github/codeql), which have been developed by the community and the [GitHub Security Lab](https://securitylab.github.com/) to find common vulnerabilities in your code.
This action runs GitHub's industry-leading semantic code analysis engine, [CodeQL](https://codeql.github.com/), against a repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed on pull requests and in the repository's security tab. CodeQL runs an extensible set of [queries](https://github.com/github/codeql), which have been developed by the community and the [GitHub Security Lab](https://securitylab.github.com/) to find common vulnerabilities in your code.
For a list of recent changes, see the CodeQL Action's [changelog](CHANGELOG.md).
@@ -12,164 +12,13 @@ The underlying CodeQL CLI, used in this action, is licensed under the [GitHub Co
## Usage
This is a short walkthrough, but for more information read [configuring code scanning](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning).
We recommend using default setup to configure CodeQL analysis for your repository. For more information, see "[Configuring default setup for code scanning](https://docs.github.com/en/code-security/code-scanning/enabling-code-scanning/configuring-default-setup-for-code-scanning)."
To get code scanning results from CodeQL analysis on your repo you can use the following workflow as a template:
```yaml
name: "Code Scanning - Action"
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '30 1 * * 0'
jobs:
CodeQL-Build:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
# only required for workflows in private repositories
actions: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java, ruby
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# ✏️ If the Autobuild fails above, remove it and uncomment the following
# three lines and modify them (or add more) to build your code if your
# project uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
```
If you prefer to integrate this within an existing CI workflow, it should end up looking something like this:
```yaml
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: go, javascript
# Here is where you build your code
- run: |
make bootstrap
make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
```
### Configuration file
Use the `config-file` parameter of the `init` action to enable the configuration file. The value of `config-file` is the path to the configuration file you want to use. This example loads the configuration file `./.github/codeql/codeql-config.yml`.
```yaml
- uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yml
```
The configuration file can be located in a different repository. This is useful if you want to share the same configuration across multiple repositories. If the configuration file is in a private repository you can also specify an `external-repository-token` option. This should be a personal access token that has read access to any repositories containing referenced config files and queries.
```yaml
- uses: github/codeql-action/init@v2
with:
config-file: owner/repo/codeql-config.yml@branch
external-repository-token: ${{ secrets.EXTERNAL_REPOSITORY_TOKEN }}
```
For information on how to write a configuration file, see "[Using a custom configuration file](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#using-a-custom-configuration-file)."
If you only want to customise the queries used, you can specify them in your workflow instead of creating a config file, using the `queries` property of the `init` action:
```yaml
- uses: github/codeql-action/init@v2
with:
queries: <local-or-remote-query>,<another-query>
```
By default, this will override any queries specified in a config file. If you wish to use both sets of queries, prefix the list of queries in the workflow with `+`:
```yaml
- uses: github/codeql-action/init@v2
with:
queries: +<local-or-remote-query>,<another-query>
```
### Configuration via `config` input
You can alternatively configure CodeQL using the `config` input to the `init` Action. The value of this input must be a YAML string that follows the configuration file format documented at "[Using a custom configuration file](https://aka.ms/code-scanning-docs/config-file)."
#### Example configuration
```yaml
- uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config: |
disable-default-queries: true
queries:
- uses: security-extended
- uses: security-and-quality
query-filters:
- include:
tags: /cwe-020/
```
#### Sharing configuration across multiple repositories
You can use Actions or environment variables to share configuration across multiple repositories and to modify configuration without needing to edit the workflow file. In the following example, `vars.CODEQL_CONF` is an [Actions configuration variable](https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows):
```yaml
- uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config: ${{ vars.CODEQL_CONF }}
```
You can also configure advanced setup for a repository to find security vulnerabilities in your code using a highly customizable code scanning configuration. For more information, see "[Configuring advanced setup for code scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/configuring-advanced-setup-for-code-scanning)" and "[Customizing your advanced setup for code scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning)."
## Troubleshooting
Read about [troubleshooting code scanning](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning).
Read about [troubleshooting code scanning](https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning).
## Contributing

View File

@@ -79,6 +79,8 @@ inputs:
outputs:
db-locations:
description: A map from language to absolute path for each database created by CodeQL.
sarif-output:
description: Absolute, local path to the directory containing the generated SARIF file.
sarif-id:
description: The ID of the uploaded SARIF file.
runs:

View File

@@ -7,7 +7,8 @@ inputs:
required: false
# If not specified the Action will check in several places until it finds the CodeQL tools.
languages:
description: The languages to be analysed
description: |
A comma-separated value of the languages to be analysed e.g. python,javascript
required: false
token:
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input.
@@ -44,7 +45,7 @@ inputs:
db-location:
description: Path where CodeQL databases should be created. If not specified, a temporary directory will be used.
required: false
config:
config:
description: Configuration passed as a YAML string in the same format as the config-file input. This takes precedence over the config-file input.
required: false
queries:

311
lib/actions-util.js generated
View File

@@ -23,17 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.getWorkflowEventName = exports.sendStatusReport = exports.createStatusReportBase = exports.getActionVersion = exports.getActionsStatus = exports.getRef = exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
exports.getFileType = exports.getWorkflowRunAttempt = exports.getWorkflowRunID = exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.getWorkflowEventName = exports.getActionVersion = exports.getRef = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
const fs = __importStar(require("fs"));
const os = __importStar(require("os"));
const path = __importStar(require("path"));
const core = __importStar(require("@actions/core"));
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
const api = __importStar(require("./api-client"));
const sharedEnv = __importStar(require("./shared-environment"));
const util_1 = require("./util");
const workflow_1 = require("./workflow");
// eslint-disable-next-line import/no-commonjs
const pkg = require("../package.json");
/**
@@ -42,9 +38,13 @@ const pkg = require("../package.json");
*
* This allows us to get stronger type checking of required/optional inputs.
*/
function getRequiredInput(name) {
return core.getInput(name, { required: true });
}
const getRequiredInput = function (name) {
const value = core.getInput(name);
if (!value) {
throw new util_1.UserError(`Input required and not supplied: ${name}`);
}
return value;
};
exports.getRequiredInput = getRequiredInput;
/**
* Wrapper around core.getInput that converts empty inputs to undefined.
@@ -75,6 +75,7 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
// the merge commit, which must mean that git is available.
// Even if this does go wrong, it's not a huge problem for the alerts to
// reported on the merge commit.
let stderr = "";
try {
let commitOid = "";
await new toolrunner.ToolRunner(await safeWhich.safeWhich("git"), ["rev-parse", ref], {
@@ -84,7 +85,7 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
commitOid += data.toString();
},
stderr: (data) => {
process.stderr.write(data);
stderr += data.toString();
},
},
cwd: checkoutPath,
@@ -92,9 +93,13 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
return commitOid.trim();
}
catch (e) {
core.info("Could not determine current commit SHA using git. Continuing with data from user input or environment.");
core.debug(`Reason: ${e.message}`);
core.debug(e.stack || "NO STACK");
if (stderr.includes("not a git repository")) {
core.info("Could not determine current commit SHA using git. Continuing with data from user input or environment. " +
"The checkout path provided to the action does not appear to be a git repository.");
}
else {
core.info(`Could not determine current commit SHA using git. Continuing with data from user input or environment. ${stderr}`);
}
return (0, exports.getOptionalInput)("sha") || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
}
};
@@ -103,12 +108,13 @@ exports.getCommitOid = getCommitOid;
* If the action was triggered by a pull request, determine the commit sha of the merge base.
* Returns undefined if run by other triggers or the merge base cannot be determined.
*/
const determineMergeBaseCommitOid = async function () {
const determineMergeBaseCommitOid = async function (checkoutPathOverride) {
if (getWorkflowEventName() !== "pull_request") {
return undefined;
}
const mergeSha = (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
const checkoutPath = (0, exports.getOptionalInput)("checkout_path");
const checkoutPath = checkoutPathOverride ?? (0, exports.getOptionalInput)("checkout_path");
let stderr = "";
try {
let commitOid = "";
let baseOid = "";
@@ -130,7 +136,7 @@ const determineMergeBaseCommitOid = async function () {
}
},
stderr: (data) => {
process.stderr.write(data);
stderr += data.toString();
},
},
cwd: checkoutPath,
@@ -144,57 +150,18 @@ const determineMergeBaseCommitOid = async function () {
return undefined;
}
catch (e) {
core.info(`Failed to call git to determine merge base. Continuing with data from environment: ${e}`);
core.info(e.stack || "NO STACK");
if (stderr.includes("not a git repository")) {
core.info("The checkout path provided to the action does not appear to be a git repository. " +
"Will calculate the merge base on the server.");
}
else {
core.info(`Failed to call git to determine merge base. Will calculate the merge base on ` +
`the server. Reason: ${stderr}`);
}
return undefined;
}
};
exports.determineMergeBaseCommitOid = determineMergeBaseCommitOid;
/**
* Get the analysis key parameter for the current job.
*
* This will combine the workflow path and current job name.
* Computing this the first time requires making requests to
* the GitHub API, but after that the result will be cached.
*/
async function getAnalysisKey() {
const analysisKeyEnvVar = "CODEQL_ACTION_ANALYSIS_KEY";
let analysisKey = process.env[analysisKeyEnvVar];
if (analysisKey !== undefined) {
return analysisKey;
}
const workflowPath = await (0, workflow_1.getWorkflowRelativePath)();
const jobName = (0, util_1.getRequiredEnvParam)("GITHUB_JOB");
analysisKey = `${workflowPath}:${jobName}`;
core.exportVariable(analysisKeyEnvVar, analysisKey);
return analysisKey;
}
exports.getAnalysisKey = getAnalysisKey;
async function getAutomationID() {
const analysis_key = await getAnalysisKey();
const environment = getRequiredInput("matrix");
return computeAutomationID(analysis_key, environment);
}
exports.getAutomationID = getAutomationID;
function computeAutomationID(analysis_key, environment) {
let automationID = `${analysis_key}/`;
const matrix = (0, util_1.parseMatrixInput)(environment);
if (matrix !== undefined) {
// the id has to be deterministic so we sort the fields
for (const entry of Object.entries(matrix).sort()) {
if (typeof entry[1] === "string") {
automationID += `${entry[0]}:${entry[1]}/`;
}
else {
// In code scanning we just handle the string values,
// the rest get converted to the empty string
automationID += `${entry[0]}:/`;
}
}
}
return automationID;
}
exports.computeAutomationID = computeAutomationID;
/**
* Get the ref currently being analyzed.
*/
@@ -265,170 +232,10 @@ function getRefFromEnv() {
}
return refEnv;
}
function getActionsStatus(error, otherFailureCause) {
if (error || otherFailureCause) {
return error instanceof util_1.UserError ? "user-error" : "failure";
}
else {
return "success";
}
}
exports.getActionsStatus = getActionsStatus;
function getActionVersion() {
return pkg.version;
}
exports.getActionVersion = getActionVersion;
/**
* Compose a StatusReport.
*
* @param actionName The name of the action, e.g. 'init', 'finish', 'upload-sarif'
* @param status The status. Must be 'success', 'failure', or 'starting'
* @param startedAt The time this action started executing.
* @param cause Cause of failure (only supply if status is 'failure')
* @param exception Exception (only supply if status is 'failure')
*/
async function createStatusReportBase(actionName, status, actionStartedAt, cause, exception) {
const commitOid = (0, exports.getOptionalInput)("sha") || process.env["GITHUB_SHA"] || "";
const ref = await getRef();
const workflowRunID = (0, workflow_1.getWorkflowRunID)();
const workflowRunAttempt = (0, workflow_1.getWorkflowRunAttempt)();
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
const jobName = process.env["GITHUB_JOB"] || "";
const analysis_key = await getAnalysisKey();
let workflowStartedAt = process.env[sharedEnv.CODEQL_WORKFLOW_STARTED_AT];
if (workflowStartedAt === undefined) {
workflowStartedAt = actionStartedAt.toISOString();
core.exportVariable(sharedEnv.CODEQL_WORKFLOW_STARTED_AT, workflowStartedAt);
}
const runnerOs = (0, util_1.getRequiredEnvParam)("RUNNER_OS");
const codeQlCliVersion = (0, util_1.getCachedCodeQlVersion)();
const actionRef = process.env["GITHUB_ACTION_REF"];
const testingEnvironment = process.env[sharedEnv.CODEQL_ACTION_TESTING_ENVIRONMENT] || "";
// re-export the testing environment variable so that it is available to subsequent steps,
// even if it was only set for this step
if (testingEnvironment !== "") {
core.exportVariable(sharedEnv.CODEQL_ACTION_TESTING_ENVIRONMENT, testingEnvironment);
}
const statusReport = {
workflow_run_id: workflowRunID,
workflow_run_attempt: workflowRunAttempt,
workflow_name: workflowName,
job_name: jobName,
analysis_key,
commit_oid: commitOid,
ref,
action_name: actionName,
action_ref: actionRef,
action_oid: "unknown",
started_at: workflowStartedAt,
action_started_at: actionStartedAt.toISOString(),
status,
testing_environment: testingEnvironment,
runner_os: runnerOs,
action_version: getActionVersion(),
};
// Add optional parameters
if (cause) {
statusReport.cause = cause;
}
if (exception) {
statusReport.exception = exception;
}
if (status === "success" ||
status === "failure" ||
status === "aborted" ||
status === "user-error") {
statusReport.completed_at = new Date().toISOString();
}
const matrix = getRequiredInput("matrix");
if (matrix) {
statusReport.matrix_vars = matrix;
}
if ("RUNNER_ARCH" in process.env) {
// RUNNER_ARCH is available only in GHES 3.4 and later
// Values other than X86, X64, ARM, or ARM64 are discarded server side
statusReport.runner_arch = process.env["RUNNER_ARCH"];
}
if (runnerOs === "Windows" || runnerOs === "macOS") {
statusReport.runner_os_release = os.release();
}
if (codeQlCliVersion !== undefined) {
statusReport.codeql_version = codeQlCliVersion;
}
return statusReport;
}
exports.createStatusReportBase = createStatusReportBase;
const GENERIC_403_MSG = "The repo on which this action is running is not opted-in to CodeQL code scanning.";
const GENERIC_404_MSG = "Not authorized to use the CodeQL code scanning feature on this repo.";
const OUT_OF_DATE_MSG = "CodeQL Action is out-of-date. Please upgrade to the latest version of codeql-action.";
const INCOMPATIBLE_MSG = "CodeQL Action version is incompatible with the code scanning endpoint. Please update to a compatible version of codeql-action.";
/**
* Send a status report to the code_scanning/analysis/status endpoint.
*
* Optionally checks the response from the API endpoint and sets the action
* as failed if the status report failed. This is only expected to be used
* when sending a 'starting' report.
*
* Returns whether sending the status report was successful of not.
*/
async function sendStatusReport(statusReport) {
const statusReportJSON = JSON.stringify(statusReport);
core.debug(`Sending status report: ${statusReportJSON}`);
// If in test mode we don't want to upload the results
if ((0, util_1.isInTestMode)()) {
core.debug("In test mode. Status reports are not uploaded.");
return true;
}
const nwo = (0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY");
const [owner, repo] = nwo.split("/");
const client = api.getApiClient();
try {
await client.request("PUT /repos/:owner/:repo/code-scanning/analysis/status", {
owner,
repo,
data: statusReportJSON,
});
return true;
}
catch (e) {
console.log(e);
if ((0, util_1.isHTTPError)(e)) {
switch (e.status) {
case 403:
if (getWorkflowEventName() === "push" &&
process.env["GITHUB_ACTOR"] === "dependabot[bot]") {
core.setFailed('Workflows triggered by Dependabot on the "push" event run with read-only access. ' +
"Uploading Code Scanning results requires write access. " +
'To use Code Scanning with Dependabot, please ensure you are using the "pull_request" event for this workflow and avoid triggering on the "push" event for Dependabot branches. ' +
"See https://docs.github.com/en/code-security/secure-coding/configuring-code-scanning#scanning-on-push for more information on how to configure these events.");
}
else {
core.setFailed(e.message || GENERIC_403_MSG);
}
return false;
case 404:
core.setFailed(GENERIC_404_MSG);
return false;
case 422:
// schema incompatibility when reporting status
// this means that this action version is no longer compatible with the API
// we still want to continue as it is likely the analysis endpoint will work
if ((0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL") !== util_1.GITHUB_DOTCOM_URL) {
core.debug(INCOMPATIBLE_MSG);
}
else {
core.debug(OUT_OF_DATE_MSG);
}
return true;
}
}
// something else has gone wrong and the request/response will be logged by octokit
// it's possible this is a transient error and we should continue scanning
core.error("An unexpected error occurred when sending code scanning status report.");
return true;
}
}
exports.sendStatusReport = sendStatusReport;
/**
* Returns the name of the event that triggered this workflow.
*
@@ -543,4 +350,64 @@ function getUploadValue(input) {
}
}
exports.getUploadValue = getUploadValue;
/**
* Get the workflow run ID.
*/
function getWorkflowRunID() {
const workflowRunIdString = (0, util_1.getRequiredEnvParam)("GITHUB_RUN_ID");
const workflowRunID = parseInt(workflowRunIdString, 10);
if (Number.isNaN(workflowRunID)) {
throw new Error(`GITHUB_RUN_ID must define a non NaN workflow run ID. Current value is ${workflowRunIdString}`);
}
if (workflowRunID < 0) {
throw new Error(`GITHUB_RUN_ID must be a non-negative integer. Current value is ${workflowRunIdString}`);
}
return workflowRunID;
}
exports.getWorkflowRunID = getWorkflowRunID;
/**
* Get the workflow run attempt number.
*/
function getWorkflowRunAttempt() {
const workflowRunAttemptString = (0, util_1.getRequiredEnvParam)("GITHUB_RUN_ATTEMPT");
const workflowRunAttempt = parseInt(workflowRunAttemptString, 10);
if (Number.isNaN(workflowRunAttempt)) {
throw new Error(`GITHUB_RUN_ATTEMPT must define a non NaN workflow run attempt. Current value is ${workflowRunAttemptString}`);
}
if (workflowRunAttempt <= 0) {
throw new Error(`GITHUB_RUN_ATTEMPT must be a positive integer. Current value is ${workflowRunAttemptString}`);
}
return workflowRunAttempt;
}
exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
/**
* Tries to obtain the output of the `file` command for the file at the specified path.
* The output will vary depending on the type of `file`, which operating system we are running on, etc.
*/
const getFileType = async (filePath) => {
let stderr = "";
let stdout = "";
try {
// The `file` command will output information about the type of file pointed at by `filePath`.
// For binary files, this may include e.g. whether they are static of dynamic binaries.
// The `-L` switch instructs the command to follow symbolic links.
await new toolrunner.ToolRunner(await safeWhich.safeWhich("file"), ["-L", filePath], {
silent: true,
listeners: {
stdout: (data) => {
stdout += data.toString();
},
stderr: (data) => {
stderr += data.toString();
},
},
}).exec();
return stdout.trim();
}
catch (e) {
core.info(`Could not determine type of ${filePath} from ${stdout}. ${stderr}`);
throw e;
}
};
exports.getFileType = getFileType;
//# sourceMappingURL=actions-util.js.map

File diff suppressed because one or more lines are too long

View File

@@ -28,15 +28,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const core = __importStar(require("@actions/core"));
const ava_1 = __importDefault(require("ava"));
const sinon = __importStar(require("sinon"));
const actionsutil = __importStar(require("./actions-util"));
const actionsUtil = __importStar(require("./actions-util"));
const api_client_1 = require("./api-client");
const environment_1 = require("./environment");
const testing_utils_1 = require("./testing-utils");
const util_1 = require("./util");
(0, testing_utils_1.setupTests)(ava_1.default);
(0, ava_1.default)("getRef() throws on the empty string", async (t) => {
process.env["GITHUB_REF"] = "";
await t.throwsAsync(actionsutil.getRef);
await t.throwsAsync(actionsUtil.getRef);
});
(0, ava_1.default)("getRef() returns merge PR ref if GITHUB_SHA still checked out", async (t) => {
await (0, util_1.withTmpDir)(async (tmpDir) => {
@@ -45,9 +48,9 @@ const util_1 = require("./util");
const currentSha = "a".repeat(40);
process.env["GITHUB_REF"] = expectedRef;
process.env["GITHUB_SHA"] = currentSha;
const callback = sinon.stub(actionsutil, "getCommitOid");
const callback = sinon.stub(actionsUtil, "getCommitOid");
callback.withArgs("HEAD").resolves(currentSha);
const actualRef = await actionsutil.getRef();
const actualRef = await actionsUtil.getRef();
t.deepEqual(actualRef, expectedRef);
callback.restore();
});
@@ -59,10 +62,10 @@ const util_1 = require("./util");
process.env["GITHUB_REF"] = expectedRef;
process.env["GITHUB_SHA"] = "b".repeat(40);
const sha = "a".repeat(40);
const callback = sinon.stub(actionsutil, "getCommitOid");
const callback = sinon.stub(actionsUtil, "getCommitOid");
callback.withArgs("refs/remotes/pull/1/merge").resolves(sha);
callback.withArgs("HEAD").resolves(sha);
const actualRef = await actionsutil.getRef();
const actualRef = await actionsUtil.getRef();
t.deepEqual(actualRef, expectedRef);
callback.restore();
});
@@ -72,10 +75,10 @@ const util_1 = require("./util");
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
process.env["GITHUB_REF"] = "refs/pull/1/merge";
process.env["GITHUB_SHA"] = "a".repeat(40);
const callback = sinon.stub(actionsutil, "getCommitOid");
const callback = sinon.stub(actionsUtil, "getCommitOid");
callback.withArgs(tmpDir, "refs/pull/1/merge").resolves("a".repeat(40));
callback.withArgs(tmpDir, "HEAD").resolves("b".repeat(40));
const actualRef = await actionsutil.getRef();
const actualRef = await actionsUtil.getRef();
t.deepEqual(actualRef, "refs/pull/1/head");
callback.restore();
});
@@ -83,16 +86,16 @@ const util_1 = require("./util");
(0, ava_1.default)("getRef() returns ref provided as an input and ignores current HEAD", async (t) => {
await (0, util_1.withTmpDir)(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
const getAdditionalInputStub = sinon.stub(actionsutil, "getOptionalInput");
const getAdditionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
getAdditionalInputStub.withArgs("ref").resolves("refs/pull/2/merge");
getAdditionalInputStub.withArgs("sha").resolves("b".repeat(40));
// These values are be ignored
process.env["GITHUB_REF"] = "refs/pull/1/merge";
process.env["GITHUB_SHA"] = "a".repeat(40);
const callback = sinon.stub(actionsutil, "getCommitOid");
const callback = sinon.stub(actionsUtil, "getCommitOid");
callback.withArgs("refs/pull/1/merge").resolves("b".repeat(40));
callback.withArgs("HEAD").resolves("b".repeat(40));
const actualRef = await actionsutil.getRef();
const actualRef = await actionsUtil.getRef();
t.deepEqual(actualRef, "refs/pull/2/merge");
callback.restore();
getAdditionalInputStub.restore();
@@ -106,7 +109,7 @@ const util_1 = require("./util");
process.env["CODE_SCANNING_REF"] = expectedRef;
process.env["GITHUB_REF"] = "";
process.env["GITHUB_SHA"] = currentSha;
const actualRef = await actionsutil.getRef();
const actualRef = await actionsUtil.getRef();
t.deepEqual(actualRef, expectedRef);
});
});
@@ -118,17 +121,17 @@ const util_1 = require("./util");
process.env["CODE_SCANNING_REF"] = "refs/pull/1/HEAD";
process.env["GITHUB_REF"] = expectedRef;
process.env["GITHUB_SHA"] = currentSha;
const actualRef = await actionsutil.getRef();
const actualRef = await actionsUtil.getRef();
t.deepEqual(actualRef, expectedRef);
});
});
(0, ava_1.default)("getRef() throws an error if only `ref` is provided as an input", async (t) => {
await (0, util_1.withTmpDir)(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
const getAdditionalInputStub = sinon.stub(actionsutil, "getOptionalInput");
const getAdditionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
getAdditionalInputStub.withArgs("ref").resolves("refs/pull/1/merge");
await t.throwsAsync(async () => {
await actionsutil.getRef();
await actionsUtil.getRef();
}, {
instanceOf: Error,
message: "Both 'ref' and 'sha' are required if one of them is provided.",
@@ -140,10 +143,10 @@ const util_1 = require("./util");
await (0, util_1.withTmpDir)(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
process.env["GITHUB_WORKSPACE"] = "/tmp";
const getAdditionalInputStub = sinon.stub(actionsutil, "getOptionalInput");
const getAdditionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
getAdditionalInputStub.withArgs("sha").resolves("a".repeat(40));
await t.throwsAsync(async () => {
await actionsutil.getRef();
await actionsUtil.getRef();
}, {
instanceOf: Error,
message: "Both 'ref' and 'sha' are required if one of them is provided.",
@@ -152,29 +155,29 @@ const util_1 = require("./util");
});
});
(0, ava_1.default)("computeAutomationID()", async (t) => {
let actualAutomationID = actionsutil.computeAutomationID(".github/workflows/codeql-analysis.yml:analyze", '{"language": "javascript", "os": "linux"}');
let actualAutomationID = (0, api_client_1.computeAutomationID)(".github/workflows/codeql-analysis.yml:analyze", '{"language": "javascript", "os": "linux"}');
t.deepEqual(actualAutomationID, ".github/workflows/codeql-analysis.yml:analyze/language:javascript/os:linux/");
// check the environment sorting
actualAutomationID = actionsutil.computeAutomationID(".github/workflows/codeql-analysis.yml:analyze", '{"os": "linux", "language": "javascript"}');
actualAutomationID = (0, api_client_1.computeAutomationID)(".github/workflows/codeql-analysis.yml:analyze", '{"os": "linux", "language": "javascript"}');
t.deepEqual(actualAutomationID, ".github/workflows/codeql-analysis.yml:analyze/language:javascript/os:linux/");
// check that an empty environment produces the right results
actualAutomationID = actionsutil.computeAutomationID(".github/workflows/codeql-analysis.yml:analyze", "{}");
actualAutomationID = (0, api_client_1.computeAutomationID)(".github/workflows/codeql-analysis.yml:analyze", "{}");
t.deepEqual(actualAutomationID, ".github/workflows/codeql-analysis.yml:analyze/");
// check non string environment values
actualAutomationID = actionsutil.computeAutomationID(".github/workflows/codeql-analysis.yml:analyze", '{"number": 1, "object": {"language": "javascript"}}');
actualAutomationID = (0, api_client_1.computeAutomationID)(".github/workflows/codeql-analysis.yml:analyze", '{"number": 1, "object": {"language": "javascript"}}');
t.deepEqual(actualAutomationID, ".github/workflows/codeql-analysis.yml:analyze/number:/object:/");
// check undefined environment
actualAutomationID = actionsutil.computeAutomationID(".github/workflows/codeql-analysis.yml:analyze", undefined);
actualAutomationID = (0, api_client_1.computeAutomationID)(".github/workflows/codeql-analysis.yml:analyze", undefined);
t.deepEqual(actualAutomationID, ".github/workflows/codeql-analysis.yml:analyze/");
});
(0, ava_1.default)("initializeEnvironment", (t) => {
(0, util_1.initializeEnvironment)("1.2.3");
t.deepEqual(process.env.CODEQL_ACTION_VERSION, "1.2.3");
t.deepEqual(process.env[environment_1.EnvVar.VERSION], "1.2.3");
});
(0, ava_1.default)("isAnalyzingDefaultBranch()", async (t) => {
process.env["GITHUB_EVENT_NAME"] = "push";
process.env["CODE_SCANNING_IS_ANALYZING_DEFAULT_BRANCH"] = "true";
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), true);
t.deepEqual(await actionsUtil.isAnalyzingDefaultBranch(), true);
process.env["CODE_SCANNING_IS_ANALYZING_DEFAULT_BRANCH"] = "false";
await (0, util_1.withTmpDir)(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
@@ -187,18 +190,18 @@ const util_1 = require("./util");
process.env["GITHUB_EVENT_PATH"] = envFile;
process.env["GITHUB_REF"] = "main";
process.env["GITHUB_SHA"] = "1234";
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), true);
t.deepEqual(await actionsUtil.isAnalyzingDefaultBranch(), true);
process.env["GITHUB_REF"] = "refs/heads/main";
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), true);
t.deepEqual(await actionsUtil.isAnalyzingDefaultBranch(), true);
process.env["GITHUB_REF"] = "feature";
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), false);
t.deepEqual(await actionsUtil.isAnalyzingDefaultBranch(), false);
fs.writeFileSync(envFile, JSON.stringify({
schedule: "0 0 * * *",
}));
process.env["GITHUB_EVENT_NAME"] = "schedule";
process.env["GITHUB_REF"] = "refs/heads/main";
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), true);
const getAdditionalInputStub = sinon.stub(actionsutil, "getOptionalInput");
t.deepEqual(await actionsUtil.isAnalyzingDefaultBranch(), true);
const getAdditionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
getAdditionalInputStub
.withArgs("ref")
.resolves("refs/heads/something-else");
@@ -207,8 +210,36 @@ const util_1 = require("./util");
.resolves("0000000000000000000000000000000000000000");
process.env["GITHUB_EVENT_NAME"] = "schedule";
process.env["GITHUB_REF"] = "refs/heads/main";
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), false);
t.deepEqual(await actionsUtil.isAnalyzingDefaultBranch(), false);
getAdditionalInputStub.restore();
});
});
(0, ava_1.default)("determineMergeBaseCommitOid non-pullrequest", async (t) => {
const infoStub = sinon.stub(core, "info");
process.env["GITHUB_EVENT_NAME"] = "hucairz";
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
const result = await actionsUtil.determineMergeBaseCommitOid(__dirname);
t.deepEqual(result, undefined);
t.deepEqual(0, infoStub.callCount);
infoStub.restore();
});
(0, ava_1.default)("determineMergeBaseCommitOid no error", async (t) => {
const infoStub = sinon.stub(core, "info");
process.env["GITHUB_EVENT_NAME"] = "pull_request";
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../.."));
t.deepEqual(1, infoStub.callCount);
t.assert(infoStub.firstCall.args[0].startsWith("The checkout path provided to the action does not appear to be a git repository."));
infoStub.restore();
});
(0, ava_1.default)("determineMergeBaseCommitOid other error", async (t) => {
const infoStub = sinon.stub(core, "info");
process.env["GITHUB_EVENT_NAME"] = "pull_request";
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
const result = await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../../i-dont-exist"));
t.deepEqual(result, undefined);
t.deepEqual(1, infoStub.callCount);
t.assert(infoStub.firstCall.args[0].startsWith("Failed to call git to determine merge base."));
infoStub.restore();
});
//# sourceMappingURL=actions-util.test.js.map

File diff suppressed because one or more lines are too long

View File

@@ -30,7 +30,9 @@ const ava_1 = __importDefault(require("ava"));
const sinon = __importStar(require("sinon"));
const actionsUtil = __importStar(require("./actions-util"));
const analyze = __importStar(require("./analyze"));
const api = __importStar(require("./api-client"));
const configUtils = __importStar(require("./config-utils"));
const statusReport = __importStar(require("./status-report"));
const testing_utils_1 = require("./testing-utils");
const util = __importStar(require("./util"));
(0, testing_utils_1.setupTests)(ava_1.default);
@@ -46,9 +48,9 @@ const util = __importStar(require("./util"));
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
process.env["GITHUB_API_URL"] = "https://api.github.com";
sinon
.stub(actionsUtil, "createStatusReportBase")
.stub(statusReport, "createStatusReportBase")
.resolves({});
sinon.stub(actionsUtil, "sendStatusReport").resolves(true);
sinon.stub(statusReport, "sendStatusReport").resolves(true);
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
const gitHubVersion = {
type: util.GitHubVariant.DOTCOM,
@@ -65,7 +67,7 @@ const util = __importStar(require("./util"));
const optionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
optionalInputStub.withArgs("cleanup-level").returns("none");
optionalInputStub.withArgs("expect-error").returns("false");
sinon.stub(util, "getGitHubVersion").resolves(gitHubVersion);
sinon.stub(api, "getGitHubVersion").resolves(gitHubVersion);
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, {});
// When there are no action inputs for RAM and threads, the action uses

View File

@@ -1 +1 @@
{"version":3,"file":"analyze-action-env.test.js","sourceRoot":"","sources":["../src/analyze-action-env.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AACvB,6CAA+B;AAE/B,4DAA8C;AAC9C,mDAAqC;AACrC,4DAA8C;AAC9C,mDAIyB;AACzB,6CAA+B;AAE/B,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,4EAA4E;AAC5E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,iCAAiC;AAEjC,IAAA,aAAI,EAAC,8DAA8D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC/E,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,sCAAsC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,wBAAwB,CAAC;QACzD,KAAK;aACF,IAAI,CAAC,WAAW,EAAE,wBAAwB,CAAC;aAC3C,QAAQ,CAAC,EAAkC,CAAC,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEnE,MAAM,aAAa,GAAuB;YACxC,IAAI,EAAE,IAAI,CAAC,aAAa,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a,CAAC,CAAC;QAC5D,IAAA,gCAAgB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAA,0CAA0B,EAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAEpC,uEAAuE;QACvE,0EAA0E;QAC1E,iBAAiB;QACjB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;QAEnC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC3D,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACzD,MAAM,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAElD,uEAAuE;QACvE,oEAAoE;QACpE,4EAA4E;QAC5E,wEAAwE;QACxE,MAAM,aAAa,CAAC,UAAU,CAAC;QAE/B,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC/D,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QAC7D,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC9D,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -30,7 +30,9 @@ const ava_1 = __importDefault(require("ava"));
const sinon = __importStar(require("sinon"));
const actionsUtil = __importStar(require("./actions-util"));
const analyze = __importStar(require("./analyze"));
const api = __importStar(require("./api-client"));
const configUtils = __importStar(require("./config-utils"));
const statusReport = __importStar(require("./status-report"));
const testing_utils_1 = require("./testing-utils");
const util = __importStar(require("./util"));
(0, testing_utils_1.setupTests)(ava_1.default);
@@ -46,9 +48,9 @@ const util = __importStar(require("./util"));
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
process.env["GITHUB_API_URL"] = "https://api.github.com";
sinon
.stub(actionsUtil, "createStatusReportBase")
.stub(statusReport, "createStatusReportBase")
.resolves({});
sinon.stub(actionsUtil, "sendStatusReport").resolves(true);
sinon.stub(statusReport, "sendStatusReport").resolves(true);
const gitHubVersion = {
type: util.GitHubVariant.DOTCOM,
};
@@ -64,7 +66,7 @@ const util = __importStar(require("./util"));
const optionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
optionalInputStub.withArgs("cleanup-level").returns("none");
optionalInputStub.withArgs("expect-error").returns("false");
sinon.stub(util, "getGitHubVersion").resolves(gitHubVersion);
sinon.stub(api, "getGitHubVersion").resolves(gitHubVersion);
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, {});

View File

@@ -1 +1 @@
{"version":3,"file":"analyze-action-input.test.js","sourceRoot":"","sources":["../src/analyze-action-input.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AACvB,6CAA+B;AAE/B,4DAA8C;AAC9C,mDAAqC;AACrC,4DAA8C;AAC9C,mDAIyB;AACzB,6CAA+B;AAE/B,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,4EAA4E;AAC5E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,iCAAiC;AAEjC,IAAA,aAAI,EAAC,sDAAsD,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvE,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;Q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C,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACzD,MAAM,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAElD,uEAAuE;QACvE,oEAAoE;QACpE,4EAA4E;QAC5E,wEAAwE;QACxE,MAAM,aAAa,CAAC,UAAU,CAAC;QAE/B,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC/D,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QAC7D,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC9D,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

65
lib/analyze-action.js generated
View File

@@ -26,11 +26,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.runPromise = exports.sendStatusReport = void 0;
exports.runPromise = void 0;
const fs = __importStar(require("fs"));
const path_1 = __importDefault(require("path"));
const perf_hooks_1 = require("perf_hooks");
const core = __importStar(require("@actions/core"));
const safe_which_1 = require("@chrisgavin/safe-which");
const actionsUtil = __importStar(require("./actions-util"));
const analyze_1 = require("./analyze");
const api_client_1 = require("./api-client");
@@ -38,41 +39,38 @@ const autobuild_1 = require("./autobuild");
const codeql_1 = require("./codeql");
const config_utils_1 = require("./config-utils");
const database_upload_1 = require("./database-upload");
const diagnostics_1 = require("./diagnostics");
const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages");
const logging_1 = require("./logging");
const repository_1 = require("./repository");
const shared_environment_1 = require("./shared-environment");
const statusReport = __importStar(require("./status-report"));
const status_report_1 = require("./status-report");
const trap_caching_1 = require("./trap-caching");
const upload_lib = __importStar(require("./upload-lib"));
const uploadLib = __importStar(require("./upload-lib"));
const util = __importStar(require("./util"));
const util_1 = require("./util");
async function sendStatusReport(startedAt, config, stats, error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, logger) {
const status = actionsUtil.getActionsStatus(error, stats?.analyze_failure_language);
const statusReportBase = await actionsUtil.createStatusReportBase("finish", status, startedAt, error?.message, error?.stack);
const statusReport = {
const status = (0, status_report_1.getActionsStatus)(error, stats?.analyze_failure_language);
const statusReportBase = await (0, status_report_1.createStatusReportBase)("finish", status, startedAt, await util.checkDiskUsage(), error?.message, error?.stack);
const report = {
...statusReportBase,
...(config
? {
ml_powered_javascript_queries: util.getMlPoweredJsQueriesStatus(config),
}
: {}),
...(stats || {}),
...(dbCreationTimings || {}),
};
if (config && didUploadTrapCaches) {
const trapCacheUploadStatusReport = {
...statusReport,
...report,
trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
trap_cache_upload_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
};
await actionsUtil.sendStatusReport(trapCacheUploadStatusReport);
await statusReport.sendStatusReport(trapCacheUploadStatusReport);
}
else {
await actionsUtil.sendStatusReport(statusReport);
await statusReport.sendStatusReport(report);
}
}
exports.sendStatusReport = sendStatusReport;
// `expect-error` should only be set to a non-false value by the CodeQL Action PR checks.
function hasBadExpectErrorInput() {
return (actionsUtil.getOptionalInput("expect-error") !== "false" &&
@@ -114,7 +112,7 @@ async function runAutobuildIfLegacyGoWorkflow(config, logger) {
if (!config.languages.includes(languages_1.Language.go)) {
return;
}
if (process.env[shared_environment_1.CODEQL_ACTION_DID_AUTOBUILD_GOLANG] === "true") {
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] === "true") {
logger.debug("Won't run Go autobuild since it has already been run.");
return;
}
@@ -132,6 +130,7 @@ async function runAutobuildIfLegacyGoWorkflow(config, logger) {
}
return;
}
logger.debug("Running Go autobuild because extraction output (TRAP files) for Go code has not been found.");
await (0, autobuild_1.runAutobuild)(languages_1.Language.go, config, logger);
}
async function run() {
@@ -145,7 +144,7 @@ async function run() {
util.initializeEnvironment(actionsUtil.getActionVersion());
const logger = (0, logging_1.getActionsLogger)();
try {
if (!(await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("finish", "starting", startedAt)))) {
if (!(await statusReport.sendStatusReport(await (0, status_report_1.createStatusReportBase)("finish", "starting", startedAt, await util.checkDiskUsage(logger))))) {
return;
}
config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger);
@@ -153,15 +152,36 @@ async function run() {
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
}
if (hasBadExpectErrorInput()) {
throw new Error("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.");
throw new util.UserError("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.");
}
const apiDetails = (0, api_client_1.getApiDetails)();
const outputDir = actionsUtil.getRequiredInput("output");
const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads") || process.env["CODEQL_THREADS"], logger);
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"]);
const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger);
// Check that `which go` still points at the wrapper script we installed in the `init` Action,
// if the corresponding environment variable is set. This is to ensure that there isn't a step
// in the workflow after the `init` step which installs a different version of Go and takes
// precedence in the PATH, thus potentially circumventing our workaround that allows tracing to work.
const goWrapperPath = process.env[environment_1.EnvVar.GO_BINARY_LOCATION];
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
goWrapperPath !== undefined) {
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
if (goWrapperPath !== goBinaryPath) {
core.warning(`Expected \`which go\` to return ${goWrapperPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`);
(0, diagnostics_1.addDiagnostic)(config, languages_1.Language.go, (0, diagnostics_1.makeDiagnostic)("go/workflow/go-installed-after-codeql-init", "Go was installed after the `codeql-action/init` Action was run", {
markdownMessage: "To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
visibility: {
statusPage: true,
telemetry: true,
cliSummaryTable: true,
},
severity: "warning",
}));
}
}
await runAutobuildIfLegacyGoWorkflow(config, logger);
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
@@ -175,9 +195,10 @@ async function run() {
dbLocations[language] = util.getCodeQLDatabasePath(config, language);
}
core.setOutput("db-locations", dbLocations);
core.setOutput("sarif-output", path_1.default.resolve(outputDir));
const uploadInput = actionsUtil.getOptionalInput("upload");
if (runStats && actionsUtil.getUploadValue(uploadInput) === "always") {
uploadResult = await upload_lib.uploadFromActions(outputDir, actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getOptionalInput("category"), logger);
uploadResult = await uploadLib.uploadFromActions(outputDir, actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getOptionalInput("category"), logger, { considerInvalidRequestUserError: false });
core.setOutput("sarif-id", uploadResult.sarifID);
}
else {
@@ -196,13 +217,13 @@ async function run() {
}
else if (uploadResult !== undefined &&
actionsUtil.getRequiredInput("wait-for-processing") === "true") {
await upload_lib.waitForProcessing((0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY")), uploadResult.sarifID, (0, logging_1.getActionsLogger)());
await uploadLib.waitForProcessing((0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY")), uploadResult.sarifID, (0, logging_1.getActionsLogger)());
}
// If we did not throw an error yet here, but we expect one, throw it.
if (actionsUtil.getOptionalInput("expect-error") === "true") {
core.setFailed(`expect-error input was set to true but no error was thrown.`);
}
core.exportVariable(shared_environment_1.CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY, "true");
core.exportVariable(environment_1.EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY, "true");
}
catch (unwrappedError) {
const error = (0, util_1.wrapError)(unwrappedError);

File diff suppressed because one or more lines are too long

75
lib/analyze.js generated
View File

@@ -39,6 +39,7 @@ const configUtils = __importStar(require("./config-utils"));
const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages");
const tracer_config_1 = require("./tracer-config");
const upload_lib_1 = require("./upload-lib");
const util = __importStar(require("./util"));
class CodeQLAnalysisError extends Error {
constructor(queriesStatusReport, message) {
@@ -54,7 +55,7 @@ async function setupPythonExtractor(logger, features, codeql) {
// If CODEQL_PYTHON is not set, no dependencies were installed, so we don't need to do anything
return;
}
if (await features.getValue(feature_flags_1.Feature.DisablePythonDependencyInstallation, codeql)) {
if (await features.getValue(feature_flags_1.Feature.DisablePythonDependencyInstallationEnabled, codeql)) {
logger.warning("We recommend that you remove the CODEQL_PYTHON environment variable from your workflow. This environment variable was originally used to specify a Python executable that included the dependencies of your Python code, however Python analysis no longer uses these dependencies." +
"\nIf you used CODEQL_PYTHON to force the version of Python to analyze as, please use CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION instead, such as 'CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=2.7' or 'CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=3.11'.");
return;
@@ -132,13 +133,16 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
const statusReport = {};
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
const queryFlags = [memoryFlag, threadsFlag];
await util.logCodeScanningConfigInCli(codeql, features, logger);
await (0, feature_flags_1.logCodeScanningConfigInCli)(codeql, features, logger);
for (const language of config.languages) {
const queries = config.queries[language];
const queryFilters = validateQueryFilters(config.originalUserInput["query-filters"]);
const packsWithVersion = config.packs[language] || [];
try {
if (await util.useCodeScanningConfigInCli(codeql, features)) {
const sarifFile = path.join(sarifFolder, `${language}.sarif`);
let startTimeInterpretResults;
let endTimeInterpretResults;
if (await (0, feature_flags_1.useCodeScanningConfigInCli)(codeql, features)) {
// If we are using the code scanning config in the CLI,
// much of the work needed to generate the query suites
// is done in the CLI. We just need to make a single
@@ -152,11 +156,12 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
statusReport[`analyze_builtin_queries_${language}_duration_ms`] =
new Date().getTime() - startTimeBuiltIn;
logger.startGroup(`Interpreting results for ${language}`);
const startTimeInterpretResults = new Date().getTime();
const sarifFile = path.join(sarifFolder, `${language}.sarif`);
startTimeInterpretResults = new Date();
const analysisSummary = await runInterpretResults(language, undefined, sarifFile, config.debugMode);
endTimeInterpretResults = new Date();
statusReport[`interpret_results_${language}_duration_ms`] =
new Date().getTime() - startTimeInterpretResults;
endTimeInterpretResults.getTime() -
startTimeInterpretResults.getTime();
logger.endGroup();
logger.info(analysisSummary);
}
@@ -201,23 +206,39 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
}
logger.endGroup();
logger.startGroup(`Interpreting results for ${language}`);
const startTimeInterpretResults = new Date().getTime();
const sarifFile = path.join(sarifFolder, `${language}.sarif`);
startTimeInterpretResults = new Date();
const analysisSummary = await runInterpretResults(language, querySuitePaths, sarifFile, config.debugMode);
endTimeInterpretResults = new Date();
statusReport[`interpret_results_${language}_duration_ms`] =
new Date().getTime() - startTimeInterpretResults;
endTimeInterpretResults.getTime() -
startTimeInterpretResults.getTime();
logger.endGroup();
logger.info(analysisSummary);
}
await runPrintLinesOfCode(language);
if (await features.getValue(feature_flags_1.Feature.QaTelemetryEnabled)) {
const perQueryAlertCounts = getPerQueryAlertCounts(sarifFile, logger);
const perQueryAlertCountEventReport = {
event: "codeql database interpret-results",
started_at: startTimeInterpretResults.toISOString(),
completed_at: endTimeInterpretResults.toISOString(),
exit_status: "success",
language,
properties: {
alertCounts: perQueryAlertCounts,
},
};
if (statusReport["event_reports"] === undefined) {
statusReport["event_reports"] = [];
}
statusReport["event_reports"].push(perQueryAlertCountEventReport);
}
if (!(await features.getValue(feature_flags_1.Feature.AnalysisSummaryV2Enabled, codeql))) {
await runPrintLinesOfCode(language);
}
}
catch (e) {
logger.info(String(e));
if (e instanceof Error) {
logger.info(e.stack);
}
statusReport.analyze_failure_language = language;
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${e}`);
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${util.wrapError(e).message}`);
}
}
return statusReport;
@@ -225,6 +246,26 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
const databasePath = util.getCodeQLDatabasePath(config, language);
return await codeql.databaseInterpretResults(databasePath, queries, sarifFile, addSnippetsFlag, threadsFlag, enableDebugLogging ? "-vv" : "-v", automationDetailsId, config, features, logger);
}
/** Get an object with all queries and their counts parsed from a SARIF file path. */
function getPerQueryAlertCounts(sarifPath, log) {
(0, upload_lib_1.validateSarifFileSchema)(sarifPath, log);
const sarifObject = JSON.parse(fs.readFileSync(sarifPath, "utf8"));
// We do not need to compute fingerprints because we are not sending data based off of locations.
// Generate the query: alert count object
const perQueryAlertCounts = {};
// All rules (queries), from all results, from all runs
for (const sarifRun of sarifObject.runs) {
if (sarifRun.results) {
for (const result of sarifRun.results) {
const query = result.rule?.id || result.ruleId;
if (query) {
perQueryAlertCounts[query] = (perQueryAlertCounts[query] || 0) + 1;
}
}
}
}
return perQueryAlertCounts;
}
async function runPrintLinesOfCode(language) {
const databasePath = util.getCodeQLDatabasePath(config, language);
return await codeql.databasePrintBaseline(databasePath);
@@ -240,7 +281,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
fs.writeFileSync(querySuitePath, querySuiteContents);
logger.debug(`Query suite file for ${language}-${type}...\n${querySuiteContents}`);
}
await codeql.databaseRunQueries(databasePath, searchPath, querySuitePath, queryFlags, optimizeForLastQueryRun);
await codeql.databaseRunQueries(databasePath, searchPath, querySuitePath, queryFlags, optimizeForLastQueryRun, features);
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
return querySuitePath;
}
@@ -254,7 +295,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
const querySuitePath = `${databasePath}-queries-${type}.qls`;
fs.writeFileSync(querySuitePath, yaml.dump(querySuite));
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
await codeql.databaseRunQueries(databasePath, undefined, querySuitePath, queryFlags, optimizeForLastQueryRun);
await codeql.databaseRunQueries(databasePath, undefined, querySuitePath, queryFlags, optimizeForLastQueryRun, features);
return querySuitePath;
}
}

File diff suppressed because one or more lines are too long

45
lib/analyze.test.js generated
View File

@@ -37,11 +37,16 @@ const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages");
const logging_1 = require("./logging");
const testing_utils_1 = require("./testing-utils");
const uploadLib = __importStar(require("./upload-lib"));
const util = __importStar(require("./util"));
(0, testing_utils_1.setupTests)(ava_1.default);
// Checks that the duration fields are populated for the correct language
// and correct case of builtin or custom. Also checks the correct search
// paths are set in the database analyze invocation.
/** Checks that the duration fields are populated for the correct language
* and correct case of builtin or custom. Also checks the correct search
* paths are set in the database analyze invocation.
*
* Mocks the QA telemetry feature flag and checks the appropriate status report
* fields.
*/
(0, ava_1.default)("status report fields and search path setting", async (t) => {
let searchPathsUsed = [];
return await util.withTmpDir(async (tmpDir) => {
@@ -53,6 +58,7 @@ const util = __importStar(require("./util"));
[languages_1.Language.cpp]: ["a/b@1.0.0"],
[languages_1.Language.java]: ["c/d@2.0.0"],
};
sinon.stub(uploadLib, "validateSarifFileSchema");
for (const language of Object.values(languages_1.Language)) {
(0, codeql_1.setCodeQL)({
packDownload: async () => ({ packs: [] }),
@@ -116,7 +122,6 @@ const util = __importStar(require("./util"));
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false,
queriesInputCombines: false,
},
@@ -130,18 +135,27 @@ const util = __importStar(require("./util"));
builtin: ["foo.ql"],
custom: [],
};
const builtinStatusReport = await (0, analyze_1.runQueries)(tmpDir, memoryFlag, addSnippetsFlag, threadsFlag, undefined, config, (0, logging_1.getRunnerLogger)(true), (0, testing_utils_1.createFeatures)([]));
const builtinStatusReport = await (0, analyze_1.runQueries)(tmpDir, memoryFlag, addSnippetsFlag, threadsFlag, undefined, config, (0, logging_1.getRunnerLogger)(true), (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.QaTelemetryEnabled]));
const hasPacks = language in packs;
const statusReportKeys = Object.keys(builtinStatusReport).sort();
if (hasPacks) {
t.deepEqual(statusReportKeys.length, 3, statusReportKeys.toString());
t.deepEqual(statusReportKeys.length, 4, statusReportKeys.toString());
t.deepEqual(statusReportKeys[0], `analyze_builtin_queries_${language}_duration_ms`);
t.deepEqual(statusReportKeys[1], `analyze_custom_queries_${language}_duration_ms`);
t.deepEqual(statusReportKeys[2], `interpret_results_${language}_duration_ms`);
t.deepEqual(statusReportKeys[2], "event_reports");
t.deepEqual(statusReportKeys[3], `interpret_results_${language}_duration_ms`);
}
else {
t.deepEqual(statusReportKeys[0], `analyze_builtin_queries_${language}_duration_ms`);
t.deepEqual(statusReportKeys[1], `interpret_results_${language}_duration_ms`);
t.deepEqual(statusReportKeys[1], "event_reports");
t.deepEqual(statusReportKeys[2], `interpret_results_${language}_duration_ms`);
}
if (builtinStatusReport.event_reports) {
for (const eventReport of builtinStatusReport.event_reports) {
t.deepEqual(eventReport.event, "codeql database interpret-results");
t.true("properties" in eventReport);
t.true("alertCounts" in eventReport.properties);
}
}
config.queries[language] = {
builtin: [],
@@ -156,14 +170,22 @@ const util = __importStar(require("./util"));
},
],
};
const customStatusReport = await (0, analyze_1.runQueries)(tmpDir, memoryFlag, addSnippetsFlag, threadsFlag, undefined, config, (0, logging_1.getRunnerLogger)(true), (0, testing_utils_1.createFeatures)([]));
t.deepEqual(Object.keys(customStatusReport).length, 2);
const customStatusReport = await (0, analyze_1.runQueries)(tmpDir, memoryFlag, addSnippetsFlag, threadsFlag, undefined, config, (0, logging_1.getRunnerLogger)(true), (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.QaTelemetryEnabled]));
t.deepEqual(Object.keys(customStatusReport).length, 3);
t.true(`analyze_custom_queries_${language}_duration_ms` in customStatusReport);
const expectedSearchPathsUsed = hasPacks
? [undefined, undefined, "/1", "/2", undefined]
: [undefined, "/1", "/2"];
t.deepEqual(searchPathsUsed, expectedSearchPathsUsed);
t.true(`interpret_results_${language}_duration_ms` in customStatusReport);
t.true("event_reports" in customStatusReport);
if (customStatusReport.event_reports) {
for (const eventReport of customStatusReport.event_reports) {
t.deepEqual(eventReport.event, "codeql database interpret-results");
t.true("properties" in eventReport);
t.true("alertCounts" in eventReport.properties);
}
}
}
verifyQuerySuites(tmpDir);
});
@@ -192,7 +214,7 @@ const util = __importStar(require("./util"));
});
function mockCodeQL() {
return {
getVersion: async () => "2.12.2",
getVersion: async () => (0, testing_utils_1.makeVersionInfo)("1.0.0"),
databaseRunQueries: sinon.spy(),
databaseInterpretResults: async () => "",
databasePrintBaseline: async () => "",
@@ -216,7 +238,6 @@ function createBaseConfig(tmpDir) {
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false,
queriesInputCombines: false,
},

File diff suppressed because one or more lines are too long

96
lib/api-client.js generated
View File

@@ -26,18 +26,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGitHubVersion = exports.getApiClientWithExternalAuth = exports.getApiClient = exports.getApiDetails = exports.DisallowedAPIVersionReason = void 0;
exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRelativePath = exports.getGitHubVersion = exports.getGitHubVersionFromApi = exports.getApiClientWithExternalAuth = exports.getApiClient = exports.getApiDetails = exports.DisallowedAPIVersionReason = void 0;
const core = __importStar(require("@actions/core"));
const githubUtils = __importStar(require("@actions/github/lib/utils"));
const retry = __importStar(require("@octokit/plugin-retry"));
const console_log_level_1 = __importDefault(require("console-log-level"));
const actions_util_1 = require("./actions-util");
const util = __importStar(require("./util"));
const util_1 = require("./util");
const GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
var DisallowedAPIVersionReason;
(function (DisallowedAPIVersionReason) {
DisallowedAPIVersionReason[DisallowedAPIVersionReason["ACTION_TOO_OLD"] = 0] = "ACTION_TOO_OLD";
DisallowedAPIVersionReason[DisallowedAPIVersionReason["ACTION_TOO_NEW"] = 1] = "ACTION_TOO_NEW";
})(DisallowedAPIVersionReason = exports.DisallowedAPIVersionReason || (exports.DisallowedAPIVersionReason = {}));
})(DisallowedAPIVersionReason || (exports.DisallowedAPIVersionReason = DisallowedAPIVersionReason = {}));
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
const auth = (allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
@@ -64,6 +65,29 @@ function getApiClientWithExternalAuth(apiDetails) {
}
exports.getApiClientWithExternalAuth = getApiClientWithExternalAuth;
let cachedGitHubVersion = undefined;
async function getGitHubVersionFromApi(apiClient, apiDetails) {
// We can avoid making an API request in the standard dotcom case
if ((0, util_1.parseGitHubUrl)(apiDetails.url) === util_1.GITHUB_DOTCOM_URL) {
return { type: util_1.GitHubVariant.DOTCOM };
}
// Doesn't strictly have to be the meta endpoint as we're only
// using the response headers which are available on every request.
const response = await apiClient.rest.meta.get();
// This happens on dotcom, although we expect to have already returned in that
// case. This can also serve as a fallback in cases we haven't foreseen.
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === undefined) {
return { type: util_1.GitHubVariant.DOTCOM };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "GitHub AE") {
return { type: util_1.GitHubVariant.GHAE };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "ghe.com") {
return { type: util_1.GitHubVariant.GHE_DOTCOM };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER];
return { type: util_1.GitHubVariant.GHES, version };
}
exports.getGitHubVersionFromApi = getGitHubVersionFromApi;
/**
* Report the GitHub server version. This is a wrapper around
* util.getGitHubVersion() that automatically supplies GitHub API details using
@@ -73,9 +97,73 @@ let cachedGitHubVersion = undefined;
*/
async function getGitHubVersion() {
if (cachedGitHubVersion === undefined) {
cachedGitHubVersion = await util.getGitHubVersion(getApiDetails());
cachedGitHubVersion = await getGitHubVersionFromApi(getApiClient(), getApiDetails());
}
return cachedGitHubVersion;
}
exports.getGitHubVersion = getGitHubVersion;
/**
* Get the path of the currently executing workflow relative to the repository root.
*/
async function getWorkflowRelativePath() {
const repo_nwo = (0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY").split("/");
const owner = repo_nwo[0];
const repo = repo_nwo[1];
const run_id = Number((0, util_1.getRequiredEnvParam)("GITHUB_RUN_ID"));
const apiClient = getApiClient();
const runsResponse = await apiClient.request("GET /repos/:owner/:repo/actions/runs/:run_id?exclude_pull_requests=true", {
owner,
repo,
run_id,
});
const workflowUrl = runsResponse.data.workflow_url;
const workflowResponse = await apiClient.request(`GET ${workflowUrl}`);
return workflowResponse.data.path;
}
exports.getWorkflowRelativePath = getWorkflowRelativePath;
/**
* Get the analysis key parameter for the current job.
*
* This will combine the workflow path and current job name.
* Computing this the first time requires making requests to
* the GitHub API, but after that the result will be cached.
*/
async function getAnalysisKey() {
const analysisKeyEnvVar = "CODEQL_ACTION_ANALYSIS_KEY";
let analysisKey = process.env[analysisKeyEnvVar];
if (analysisKey !== undefined) {
return analysisKey;
}
const workflowPath = await getWorkflowRelativePath();
const jobName = (0, util_1.getRequiredEnvParam)("GITHUB_JOB");
analysisKey = `${workflowPath}:${jobName}`;
core.exportVariable(analysisKeyEnvVar, analysisKey);
return analysisKey;
}
exports.getAnalysisKey = getAnalysisKey;
async function getAutomationID() {
const analysis_key = await getAnalysisKey();
const environment = (0, actions_util_1.getRequiredInput)("matrix");
return computeAutomationID(analysis_key, environment);
}
exports.getAutomationID = getAutomationID;
function computeAutomationID(analysis_key, environment) {
let automationID = `${analysis_key}/`;
const matrix = (0, util_1.parseMatrixInput)(environment);
if (matrix !== undefined) {
// the id has to be deterministic so we sort the fields
for (const entry of Object.entries(matrix).sort()) {
if (typeof entry[1] === "string") {
automationID += `${entry[0]}:${entry[1]}/`;
}
else {
// In code scanning we just handle the string values,
// the rest get converted to the empty string
automationID += `${entry[0]}:/`;
}
}
}
return automationID;
}
exports.computeAutomationID = computeAutomationID;
//# sourceMappingURL=api-client.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,6DAA+C;AAC/C,0EAAgD;AAEhD,iDAAoE;AACpE,6CAA+B;AAC/B,iCAA4D;AAE5D,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IACpC,+FAAc,CAAA;IACd,+FAAc,CAAA;AAChB,CAAC,EAHW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAGrC;AAiBD,SAAS,0BAA0B,CACjC,UAAoC,EACpC,EAAE,aAAa,GAAG,KAAK,EAAE,GAAG,EAAE;IAE9B,MAAM,IAAI,GACR,CAAC,aAAa,IAAI,UAAU,CAAC,gBAAgB,CAA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M,cAAc,EAAE,CAAC;IAC5C,MAAM,WAAW,GAAG,IAAA,+BAAgB,EAAC,QAAQ,CAAC,CAAC;IAE/C,OAAO,mBAAmB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC;AALD,0CAKC;AAED,SAAgB,mBAAmB,CACjC,YAAoB,EACpB,WAA+B;IAE/B,IAAI,YAAY,GAAG,GAAG,YAAY,GAAG,CAAC;IAEtC,MAAM,MAAM,GAAG,IAAA,uBAAgB,EAAC,WAAW,CAAC,CAAC;IAC7C,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,uDAAuD;QACvD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACjD,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;gBAChC,YAAY,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;aAC5C;iBAAM;gBACL,qDAAqD;gBACrD,6CAA6C;gBAC7C,YAAY,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;aACjC;SACF;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AArBD,kDAqBC"}

74
lib/api-client.test.js generated
View File

@@ -26,23 +26,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const github = __importStar(require("@actions/github"));
const githubUtils = __importStar(require("@actions/github/lib/utils"));
const ava_1 = __importDefault(require("ava"));
const sinon = __importStar(require("sinon"));
const actionsUtil = __importStar(require("./actions-util"));
const api_client_1 = require("./api-client");
const api = __importStar(require("./api-client"));
const testing_utils_1 = require("./testing-utils");
const util = __importStar(require("./util"));
(0, testing_utils_1.setupTests)(ava_1.default);
let pluginStub;
let githubStub;
ava_1.default.beforeEach(() => {
pluginStub = sinon.stub(githubUtils.GitHub, "plugin");
githubStub = sinon.stub();
pluginStub.returns(githubStub);
util.initializeEnvironment(actionsUtil.getActionVersion());
});
(0, ava_1.default)("getApiClient", async (t) => {
const pluginStub = sinon.stub(githubUtils.GitHub, "plugin");
const githubStub = sinon.stub();
pluginStub.returns(githubStub);
sinon.stub(actionsUtil, "getRequiredInput").withArgs("token").returns("xyz");
const requiredEnvParamStub = sinon.stub(util, "getRequiredEnvParam");
requiredEnvParamStub
@@ -51,7 +50,7 @@ ava_1.default.beforeEach(() => {
requiredEnvParamStub
.withArgs("GITHUB_API_URL")
.returns("http://api.github.localhost");
(0, api_client_1.getApiClient)();
api.getApiClient();
t.assert(githubStub.calledOnceWithExactly({
auth: "token xyz",
baseUrl: "http://api.github.localhost",
@@ -59,4 +58,65 @@ ava_1.default.beforeEach(() => {
userAgent: `CodeQL-Action/${actionsUtil.getActionVersion()}`,
}));
});
function mockGetMetaVersionHeader(versionHeader) {
// Passing an auth token is required, so we just use a dummy value
const client = github.getOctokit("123");
const response = {
headers: {
"x-github-enterprise-version": versionHeader,
},
};
const spyGetContents = sinon
.stub(client.rest.meta, "get")
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
.resolves(response);
sinon.stub(api, "getApiClient").value(() => client);
return spyGetContents;
}
(0, ava_1.default)("getGitHubVersion for Dotcom", async (t) => {
const apiDetails = {
auth: "",
url: "https://github.com",
apiURL: "",
};
sinon.stub(api, "getApiDetails").returns(apiDetails);
const v = await api.getGitHubVersionFromApi(github.getOctokit("123"), apiDetails);
t.deepEqual(util.GitHubVariant.DOTCOM, v.type);
});
(0, ava_1.default)("getGitHubVersion for GHES", async (t) => {
mockGetMetaVersionHeader("2.0");
const v2 = await api.getGitHubVersionFromApi(api.getApiClient(), {
auth: "",
url: "https://ghe.example.com",
apiURL: undefined,
});
t.deepEqual({ type: util.GitHubVariant.GHES, version: "2.0" }, v2);
});
(0, ava_1.default)("getGitHubVersion for GHAE", async (t) => {
mockGetMetaVersionHeader("GitHub AE");
const ghae = await api.getGitHubVersionFromApi(api.getApiClient(), {
auth: "",
url: "https://example.githubenterprise.com",
apiURL: undefined,
});
t.deepEqual({ type: util.GitHubVariant.GHAE }, ghae);
});
(0, ava_1.default)("getGitHubVersion for different domain", async (t) => {
mockGetMetaVersionHeader(undefined);
const v3 = await api.getGitHubVersionFromApi(api.getApiClient(), {
auth: "",
url: "https://ghe.example.com",
apiURL: undefined,
});
t.deepEqual({ type: util.GitHubVariant.DOTCOM }, v3);
});
(0, ava_1.default)("getGitHubVersion for GHE_DOTCOM", async (t) => {
mockGetMetaVersionHeader("ghe.com");
const gheDotcom = await api.getGitHubVersionFromApi(api.getApiClient(), {
auth: "",
url: "https://foo.ghe.com",
apiURL: undefined,
});
t.deepEqual({ type: util.GitHubVariant.GHE_DOTCOM }, gheDotcom);
});
//# sourceMappingURL=api-client.test.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"api-client.test.js","sourceRoot":"","sources":["../src/api-client.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,8CAAuB;AACvB,6CAA+B;AAE/B,4DAA8C;AAC9C,6CAA4C;AAC5C,mDAA6C;AAC7C,6CAA+B;AAE/B,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,IAAI,UAA2B,CAAC;AAChC,IAAI,UAA2B,CAAC;AAEhC,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtD,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,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AE;QACR,GAAG,EAAE,sCAAsC;QAC3C,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IACH,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,uCAAuC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACxD,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,uBAAuB,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE;QAC/D,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,yBAAyB;QAC9B,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IACH,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,iCAAiC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAClD,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,uBAAuB,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE;QACtE,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,qBAAqB;QAC1B,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IACH,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,SAAS,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC"}

View File

@@ -1 +1 @@
{ "maximumVersion": "3.9", "minimumVersion": "3.5" }
{ "maximumVersion": "3.11", "minimumVersion": "3.7" }

View File

@@ -28,20 +28,19 @@ const actions_util_1 = require("./actions-util");
const api_client_1 = require("./api-client");
const autobuild_1 = require("./autobuild");
const configUtils = __importStar(require("./config-utils"));
const languages_1 = require("./languages");
const logging_1 = require("./logging");
const shared_environment_1 = require("./shared-environment");
const status_report_1 = require("./status-report");
const util_1 = require("./util");
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
async function sendCompletedStatusReport(logger, startedAt, allLanguages, failingLanguage, cause) {
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
const status = (0, actions_util_1.getActionsStatus)(cause, failingLanguage);
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("autobuild", status, startedAt, cause?.message, cause?.stack);
const status = (0, status_report_1.getActionsStatus)(cause, failingLanguage);
const statusReportBase = await (0, status_report_1.createStatusReportBase)("autobuild", status, startedAt, await (0, util_1.checkDiskUsage)(logger), cause?.message, cause?.stack);
const statusReport = {
...statusReportBase,
autobuild_languages: allLanguages.join(","),
autobuild_failure: failingLanguage,
};
await (0, actions_util_1.sendStatusReport)(statusReport);
await (0, status_report_1.sendStatusReport)(statusReport);
}
async function run() {
const startedAt = new Date();
@@ -49,7 +48,7 @@ async function run() {
let currentLanguage = undefined;
let languages = undefined;
try {
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("autobuild", "starting", startedAt)))) {
if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)("autobuild", "starting", startedAt, await (0, util_1.checkDiskUsage)(logger))))) {
return;
}
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
@@ -68,19 +67,16 @@ async function run() {
for (const language of languages) {
currentLanguage = language;
await (0, autobuild_1.runAutobuild)(language, config, logger);
if (language === languages_1.Language.go) {
core.exportVariable(shared_environment_1.CODEQL_ACTION_DID_AUTOBUILD_GOLANG, "true");
}
}
}
}
catch (unwrappedError) {
const error = (0, util_1.wrapError)(unwrappedError);
core.setFailed(`We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. ${error.message}`);
await sendCompletedStatusReport(startedAt, languages ?? [], currentLanguage, error);
await sendCompletedStatusReport(logger, startedAt, languages ?? [], currentLanguage, error);
return;
}
await sendCompletedStatusReport(startedAt, languages ?? []);
await sendCompletedStatusReport(logger, startedAt, languages ?? []);
}
async function runWrapper() {
try {

View File

@@ -1 +1 @@
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAQwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,4DAA8C;AAC9C,2CAAuC;AACvC,uCAA6C;AAC7C,6DAA0E;AAC1E,iCAIgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,+BAAgB,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,qCAAsB,EACnD,WAAW,EACX,MAAM,EACN,SAAS,EACT,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,KAAK,CACb,CAAC;IACF,MAAM,YAAY,GAA0B;QAC1C,GAAG,gBAAgB;QACnB,mBAAmB,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,iBAAiB,EAAE,eAAe;KACnC,CAAC;IACF,MAAM,IAAA,+BAAgB,EAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,IAAI,eAAe,GAAyB,SAAS,CAAC;IACtD,IAAI,SAAS,GAA2B,SAAS,CAAC;IAClD,IAAI;QACF,IACE,CAAC,CAAC,MAAM,IAAA,+BAAgB,EACtB,MAAM,IAAA,qCAAsB,EAAC,WAAW,EAAE,UAAU,EAAE,SAAS,CA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AAC,OAAO,EAAE,CAClJ,CAAC;QACF,MAAM,yBAAyB,CAC7B,MAAM,EACN,SAAS,EACT,SAAS,IAAI,EAAE,EACf,eAAe,EACf,KAAK,CACN,CAAC;QACF,OAAO;KACR;IAED,MAAM,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KACxE;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

62
lib/autobuild.js generated
View File

@@ -1,8 +1,38 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.runAutobuild = exports.determineAutobuildLanguages = void 0;
const core = __importStar(require("@actions/core"));
const actions_util_1 = require("./actions-util");
const api_client_1 = require("./api-client");
const codeql_1 = require("./codeql");
const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages");
const repository_1 = require("./repository");
const util_1 = require("./util");
async function determineAutobuildLanguages(config, logger) {
// Attempt to find a language to autobuild
// We want pick the dominant language in the repo from the ones we're able to build
@@ -70,10 +100,42 @@ async function determineAutobuildLanguages(config, logger) {
return languages;
}
exports.determineAutobuildLanguages = determineAutobuildLanguages;
async function setupCppAutobuild(codeql, logger) {
const envVar = feature_flags_1.featureConfig[feature_flags_1.Feature.CppDependencyInstallation].envVar;
const featureName = "C++ automatic installation of dependencies";
const envDoc = "https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow";
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
if (await features.getValue(feature_flags_1.Feature.CppDependencyInstallation, codeql)) {
// disable autoinstall on self-hosted runners unless explicitly requested
if (process.env["RUNNER_ENVIRONMENT"] === "self-hosted" &&
process.env[envVar] !== "true") {
logger.info(`Disabling ${featureName} as we are on a self-hosted runner.${(0, actions_util_1.getWorkflowEventName)() !== "dynamic"
? ` To override this, set the ${envVar} environment variable to 'true' in your workflow (see ${envDoc}).`
: ""}`);
core.exportVariable(envVar, "false");
}
else {
logger.info(`Enabling ${featureName}. This can be disabled by setting the ${envVar} environment variable to 'false' (see ${envDoc}).`);
core.exportVariable(envVar, "true");
}
}
else {
logger.info(`Disabling ${featureName}.`);
core.exportVariable(envVar, "false");
}
}
async function runAutobuild(language, config, logger) {
logger.startGroup(`Attempting to automatically build ${language} code`);
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
if (language === languages_1.Language.cpp) {
await setupCppAutobuild(codeQL, logger);
}
await codeQL.runAutobuild(language);
if (language === languages_1.Language.go) {
core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true");
}
logger.endGroup();
}
exports.runAutobuild = runAutobuild;

View File

@@ -1 +1 @@
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAyD;AAGlD,KAAK,UAAU,2BAA2B,CAC/C,MAA0B,EAC1B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACvD,IAAA,4BAAgB,EAAC,CAAC,CAAC,CACpB,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,2BAA2B,GAAG,kBAAkB,CAAC,MAAM,CAC3D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,oBAAQ,CAAC,EAAE,CACzB,CAAC;IAEF,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,yEAAyE;IACzE,UAAU;IACV,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QAChD,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;KAChD;IACD,uEAAuE;IACvE,wCAAwC;IACxC,IAAI,kBAAkB,CAAC,MAAM,KAAK,2BAA2B,CAAC,MAAM,EAAE;QACpE,SAAS,CAAC,IAAI,CAAC,oBAAQ,CAAC,EAAE,CAAC,CAAC;KAC7B;IAED,MAAM,CAAC,KAAK,CAAC,kBAAkB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE3D,2EAA2E;IAC3E,4EAA4E;IAC5E,2CAA2C;IAC3C,uEAAuE;IACvE,2EAA2E;IAC3E,uEAAuE;IACvE,yCAAyC;IAC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;IACjD,IAAI,QAAQ,KAAK,oBAAQ,CAAC,GAAG,EAAE;QAC7B,MAAM,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACzC;IACD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,QAAQ,KAAK,oBAAQ,CAAC,EAAE,EAAE;QAC5B,IAAI,CAAC,cAAc,CAAC,oBAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;KAC1D;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAfD,oCAeC"}

377
lib/codeql.js generated
View File

@@ -23,27 +23,39 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
exports.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_LANGUAGE_ALIASING = exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CommandInvocationError = void 0;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const core = __importStar(require("@actions/core"));
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
const yaml = __importStar(require("js-yaml"));
const actions_util_1 = require("./actions-util");
const config_utils_1 = require("./config-utils");
const error_matcher_1 = require("./error-matcher");
const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages");
const setupCodeql = __importStar(require("./setup-codeql"));
const toolrunner_error_catcher_1 = require("./toolrunner-error-catcher");
const trap_caching_1 = require("./trap-caching");
const util = __importStar(require("./util"));
const util_1 = require("./util");
class CommandInvocationError extends Error {
constructor(cmd, args, exitCode, error, output) {
super(`Failure invoking ${cmd} with arguments ${args}.\n
Exit code ${exitCode} and error was:\n
${error}`);
this.output = output;
constructor(cmd, args, exitCode, stderr, stdout) {
const prettyCommand = [cmd, ...args]
.map((x) => (x.includes(" ") ? `'${x}'` : x))
.join(" ");
const fatalErrors = extractFatalErrors(stderr);
const lastLine = stderr.trim().split("\n").pop()?.trim();
let error = fatalErrors
? ` and error was: ${fatalErrors.trim()}`
: lastLine
? ` and last log line was: ${lastLine}`
: "";
if (error[error.length - 1] !== ".") {
error += ".";
}
super(`Encountered a fatal error while running "${prettyCommand}". ` +
`Exit code was ${exitCode}${error} See the logs for more details.`);
this.exitCode = exitCode;
this.stderr = stderr;
this.stdout = stdout;
}
}
exports.CommandInvocationError = CommandInvocationError;
@@ -60,35 +72,60 @@ let cachedCodeQL = undefined;
* The version flags below can be used to conditionally enable certain features
* on versions newer than this.
*/
const CODEQL_MINIMUM_VERSION = "2.8.5";
const CODEQL_MINIMUM_VERSION = "2.10.5";
/**
* This version will shortly become the oldest version of CodeQL that the Action will run with.
*/
const CODEQL_NEXT_MINIMUM_VERSION = "2.10.5";
/**
* This is the version of GHES that was most recently deprecated.
*/
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.6";
/**
* This is the deprecation date for the version of GHES that was most recently deprecated.
*/
const GHES_MOST_RECENT_DEPRECATION_DATE = "2023-09-12";
/*
* Versions of CodeQL that version-flag certain functionality in the Action.
* For convenience, please keep these in descending order. Once a version
* flag is older than the oldest supported version above, it may be removed.
*/
const CODEQL_VERSION_LUA_TRACER_CONFIG = "2.10.0";
const CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED = "2.10.4";
exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = "2.10.4";
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
/**
* Versions 2.9.0+ of the CodeQL CLI run machine learning models from a temporary directory, which
* resolves an issue on Windows where TensorFlow models are not correctly loaded due to the path of
* some of their files being greater than MAX_PATH (260 characters).
*/
exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = "2.9.0";
/**
* Previous versions had the option already, but were missing the
* --extractor-options-verbosity that we need.
*/
exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = "2.10.3";
/**
* Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for each language.
* Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for
* each language.
*/
exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
/**
* Versions 2.12.3+ of the CodeQL CLI support exporting configuration information from a code
* scanning config file to SARIF.
*/
exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = "2.12.3";
/**
* Versions 2.12.4+ of the CodeQL CLI support the `--qlconfig-file` flag in calls to `database init`.
*/
exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4";
/**
* Versions 2.12.4+ of the CodeQL CLI provide a better error message when `database finalize`
* determines that no code has been found.
*/
exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = "2.12.4";
/**
* Versions 2.13.1+ of the CodeQL CLI fix a bug where diagnostics export could produce invalid SARIF.
*/
exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = "2.13.1";
/**
* Versions 2.13.4+ of the CodeQL CLI support the `resolve build-environment` command.
*/
exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = "2.13.4";
/**
* Versions 2.14.2+ of the CodeQL CLI support language-specific baseline configuration.
*/
exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = "2.14.2";
/**
* Versions 2.14.4+ of the CodeQL CLI support language aliasing.
*/
exports.CODEQL_VERSION_LANGUAGE_ALIASING = "2.14.4";
/**
* Set up CodeQL CLI access.
*
@@ -156,7 +193,9 @@ function resolveFunction(partialCodeql, methodName, defaultImplementation) {
function setCodeQL(partialCodeql) {
cachedCodeQL = {
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve("1.0.0"))),
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve({
version: "1.0.0",
}))),
printVersion: resolveFunction(partialCodeql, "printVersion"),
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
@@ -165,6 +204,7 @@ function setCodeQL(partialCodeql) {
resolveLanguages: resolveFunction(partialCodeql, "resolveLanguages"),
betterResolveLanguages: resolveFunction(partialCodeql, "betterResolveLanguages"),
resolveQueries: resolveFunction(partialCodeql, "resolveQueries"),
resolveBuildEnvironment: resolveFunction(partialCodeql, "resolveBuildEnvironment"),
packDownload: resolveFunction(partialCodeql, "packDownload"),
databaseCleanup: resolveFunction(partialCodeql, "databaseCleanup"),
databaseBundle: resolveFunction(partialCodeql, "databaseBundle"),
@@ -217,7 +257,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
async getVersion() {
let result = util.getCachedCodeQlVersion();
if (result === undefined) {
result = (await runTool(cmd, ["version", "--format=terse"])).trim();
const output = await runTool(cmd, ["version", "--format=json"]);
try {
result = JSON.parse(output);
}
catch (err) {
throw Error(`Invalid JSON output from \`version --format=json\`: ${output}`);
}
util.cacheCodeQlVersion(result);
}
return result;
@@ -229,19 +275,8 @@ async function getCodeQLForCmd(cmd, checkVersion) {
const extraArgs = config.languages.map((language) => `--language=${language}`);
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l)).length > 0) {
extraArgs.push("--begin-tracing");
extraArgs.push(...(await (0, trap_caching_1.getTrapCachingExtractorConfigArgs)(config)));
extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config)));
extraArgs.push(`--trace-process-name=${processName}`);
if (
// There's a bug in Lua tracing for Go on Windows in versions earlier than
// `CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED`, so don't use Lua tracing
// when tracing Go on Windows on these CodeQL versions.
(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACER_CONFIG)) &&
config.languages.includes(languages_1.Language.go) &&
(0, languages_1.isTracedLanguage)(languages_1.Language.go) &&
process.platform === "win32" &&
!(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED))) {
extraArgs.push("--no-internal-use-lua-tracing");
}
}
// A code scanning config file is only generated if the CliConfigFileEnabled feature flag is enabled.
const codeScanningConfigFile = await generateCodeScanningConfig(codeql, config, features, logger);
@@ -258,12 +293,22 @@ async function getCodeQLForCmd(cmd, checkVersion) {
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
}
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
extraArgs.push("--calculate-language-specific-baseline");
}
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
extraArgs.push("--sublanguage-file-coverage");
}
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
extraArgs.push("--no-sublanguage-file-coverage");
}
await runTool(cmd, [
"database",
"init",
"--db-cluster",
config.dbLocation,
`--source-root=${sourceRoot}`,
...(await getLanguageAliasingArguments(this)),
...extraArgs,
...getExtraOptionsFromEnv(["database", "init"]),
], { stdin: externalRepositoryToken });
@@ -302,15 +347,15 @@ async function getCodeQLForCmd(cmd, checkVersion) {
const ext = process.platform === "win32" ? ".cmd" : ".sh";
const traceCommand = path.resolve(await this.resolveExtractor(language), "tools", `autobuild${ext}`);
// Run trace command
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, [
await runTool(cmd, [
"database",
"trace-command",
...(await (0, trap_caching_1.getTrapCachingExtractorConfigArgsForLang)(config, language)),
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
...getExtraOptionsFromEnv(["database", "trace-command"]),
databasePath,
"--",
traceCommand,
], error_matcher_1.errorMatchers);
]);
},
async finalizeDatabase(databasePath, threadsFlag, memoryFlag) {
const args = [
@@ -322,7 +367,18 @@ async function getCodeQLForCmd(cmd, checkVersion) {
...getExtraOptionsFromEnv(["database", "finalize"]),
databasePath,
];
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, args, error_matcher_1.errorMatchers);
try {
await runTool(cmd, args);
}
catch (e) {
if (e instanceof CommandInvocationError &&
!(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE)) &&
isNoCodeFoundError(e)) {
throw new util.UserError("No code found during the build. Please see: " +
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build");
}
throw e;
}
},
async resolveLanguages() {
const codeqlArgs = [
@@ -345,6 +401,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"languages",
"--format=betterjson",
"--extractor-options-verbosity=4",
...(await getLanguageAliasingArguments(this)),
...getExtraOptionsFromEnv(["resolve", "languages"]),
];
const output = await runTool(cmd, codeqlArgs);
@@ -374,7 +431,26 @@ async function getCodeQLForCmd(cmd, checkVersion) {
throw new Error(`Unexpected output from codeql resolve queries: ${e}`);
}
},
async databaseRunQueries(databasePath, extraSearchPath, querySuitePath, flags, optimizeForLastQueryRun) {
async resolveBuildEnvironment(workingDir, language) {
const codeqlArgs = [
"resolve",
"build-environment",
`--language=${language}`,
...(await getLanguageAliasingArguments(this)),
...getExtraOptionsFromEnv(["resolve", "build-environment"]),
];
if (workingDir !== undefined) {
codeqlArgs.push("--working-dir", workingDir);
}
const output = await runTool(cmd, codeqlArgs);
try {
return JSON.parse(output);
}
catch (e) {
throw new Error(`Unexpected output from codeql resolve build-environment: ${e} in\n${output}`);
}
},
async databaseRunQueries(databasePath, extraSearchPath, querySuitePath, flags, optimizeForLastQueryRun, features) {
const codeqlArgs = [
"database",
"run-queries",
@@ -394,12 +470,18 @@ async function getCodeQLForCmd(cmd, checkVersion) {
if (querySuitePath) {
codeqlArgs.push(querySuitePath);
}
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
if (await features.getValue(feature_flags_1.Feature.EvaluatorIntraLayerParallelismEnabled, this)) {
codeqlArgs.push("--intra-layer-parallelism");
}
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_INTRA_LAYER_PARALLELISM)) {
codeqlArgs.push("--no-intra-layer-parallelism");
}
await runTool(cmd, codeqlArgs);
},
async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, verbosityFlag, automationDetailsId, config, features, logger) {
const shouldExportDiagnostics = await features.getValue(feature_flags_1.Feature.ExportDiagnosticsEnabled, this);
// Update this to take into account the CodeQL version when we have a version with the fix.
const shouldWorkaroundInvalidNotifications = shouldExportDiagnostics;
const shouldWorkaroundInvalidNotifications = shouldExportDiagnostics &&
!(await isDiagnosticsExportInvalidSarifFixed(this));
const codeqlOutputFile = shouldWorkaroundInvalidNotifications
? path.join(config.tempDir, "codeql-intermediate-results.sarif")
: sarifFile;
@@ -415,7 +497,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"--print-metrics-summary",
"--sarif-add-query-help",
"--sarif-group-rules-by-pack",
...(await getCodeScanningConfigExportArguments(config, this, features)),
...(await getCodeScanningConfigExportArguments(config, this)),
...getExtraOptionsFromEnv(["database", "interpret-results"]),
];
if (automationDetailsId !== undefined) {
@@ -424,22 +506,37 @@ async function getCodeQLForCmd(cmd, checkVersion) {
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_FILE_BASELINE_INFORMATION)) {
codeqlArgs.push("--sarif-add-baseline-file-info");
}
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
codeqlArgs.push("--sublanguage-file-coverage");
}
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
codeqlArgs.push("--no-sublanguage-file-coverage");
}
if (shouldExportDiagnostics) {
codeqlArgs.push("--sarif-include-diagnostics");
}
else if (await util.codeQlVersionAbove(this, "2.12.4")) {
codeqlArgs.push("--no-sarif-include-diagnostics");
}
if (await features.getValue(feature_flags_1.Feature.AnalysisSummaryV2Enabled, this)) {
codeqlArgs.push("--new-analysis-summary");
}
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) {
codeqlArgs.push("--no-new-analysis-summary");
}
codeqlArgs.push(databasePath);
if (querySuitePaths) {
codeqlArgs.push(...querySuitePaths);
}
// capture stdout, which contains analysis summaries
const returnState = await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
// Capture the stdout, which contains the analysis summary. Don't stream it to the Actions
// logs to avoid printing it twice.
const analysisSummary = await runTool(cmd, codeqlArgs, {
noStreamStdout: true,
});
if (shouldWorkaroundInvalidNotifications) {
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
}
return returnState.stdout;
return analysisSummary;
},
async databasePrintBaseline(databasePath) {
const codeqlArgs = [
@@ -516,8 +613,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
await new toolrunner.ToolRunner(cmd, args).exec();
},
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId, tempDir, logger) {
// Update this to take into account the CodeQL version when we have a version with the fix.
const shouldWorkaroundInvalidNotifications = true;
const shouldWorkaroundInvalidNotifications = !(await isDiagnosticsExportInvalidSarifFixed(this));
const codeqlOutputFile = shouldWorkaroundInvalidNotifications
? path.join(tempDir, "codeql-intermediate-results.sarif")
: sarifFile;
@@ -541,13 +637,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
}
},
async diagnosticsExport(sarifFile, automationDetailsId, config, features) {
async diagnosticsExport(sarifFile, automationDetailsId, config) {
const args = [
"diagnostics",
"export",
"--format=sarif-latest",
`--output=${sarifFile}`,
...(await getCodeScanningConfigExportArguments(config, this, features)),
...(await getCodeScanningConfigExportArguments(config, this)),
...getExtraOptionsFromEnv(["diagnostics", "export"]),
];
if (automationDetailsId !== undefined) {
@@ -564,6 +660,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"extractor",
"--format=json",
`--language=${language}`,
...(await getLanguageAliasingArguments(this)),
...getExtraOptionsFromEnv(["resolve", "extractor"]),
], {
silent: true,
@@ -589,7 +686,24 @@ async function getCodeQLForCmd(cmd, checkVersion) {
// CodeQL object is created.
if (checkVersion &&
!(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))) {
throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${await codeql.getVersion()}`);
throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${(await codeql.getVersion()).version}`);
}
else if (checkVersion &&
process.env[environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING] !== "true" &&
!(await util.codeQlVersionAbove(codeql, CODEQL_NEXT_MINIMUM_VERSION))) {
const result = await codeql.getVersion();
core.warning(`CodeQL CLI version ${result.version} was discontinued on ` +
`${GHES_MOST_RECENT_DEPRECATION_DATE} alongside GitHub Enterprise Server ` +
`${GHES_VERSION_MOST_RECENTLY_DEPRECATED} and will not be supported by the next minor ` +
`release of the CodeQL Action. Please update to CodeQL CLI version ` +
`${CODEQL_NEXT_MINIMUM_VERSION} or later. For instance, if you have specified a custom ` +
"version of the CLI using the 'tools' input to the 'init' Action, you can remove this " +
"input to use the default version.\n\n" +
"Alternatively, if you want to continue using CodeQL CLI version " +
`${result.version}, you can replace 'github/codeql-action/*@v2' by ` +
`'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)()}' in your code scanning workflow to ` +
"continue using this version of the CodeQL Action.");
core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true");
}
return codeql;
}
@@ -651,10 +765,15 @@ const maxErrorSize = 20000;
async function runTool(cmd, args = [], opts = {}) {
let output = "";
let error = "";
process.stdout.write(`[command]${cmd} ${args.join(" ")}\n`);
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
ignoreReturnCode: true,
listeners: {
stdout: (data) => {
output += data.toString("utf8");
if (!opts.noStreamStdout) {
process.stdout.write(data);
}
},
stderr: (data) => {
let readStartIndex = 0;
@@ -664,15 +783,79 @@ async function runTool(cmd, args = [], opts = {}) {
readStartIndex = data.length - maxErrorSize + 1;
}
error += data.toString("utf8", readStartIndex);
// Mimic the standard behavior of the toolrunner by writing stderr to stdout
process.stdout.write(data);
},
},
ignoreReturnCode: true,
silent: true,
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
}).exec();
if (exitCode !== 0)
if (exitCode !== 0) {
throw new CommandInvocationError(cmd, args, exitCode, error, output);
}
return output;
}
/**
* Provide a better error message from the stderr of a CLI invocation that failed with a fatal
* error.
*
* - If the CLI invocation failed with a fatal error, this returns that fatal error, followed by
* any fatal errors that occurred in plumbing commands.
* - If the CLI invocation did not fail with a fatal error, this returns `undefined`.
*
* ### Example
*
* ```
* Running TRAP import for CodeQL database at /home/runner/work/_temp/codeql_databases/javascript...
* A fatal error occurred: Evaluator heap must be at least 384.00 MiB
* A fatal error occurred: Dataset import for
* /home/runner/work/_temp/codeql_databases/javascript/db-javascript failed with code 2
* ```
*
* becomes
*
* ```
* Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset
* --threads=2 --ram=2048 db". Exit code was 32 and error was: A fatal error occurred: Dataset
* import for /home/runner/work/_temp/codeql_databases/javascript/db-javascript failed with code 2.
* Context: A fatal error occurred: Evaluator heap must be at least 384.00 MiB.
* ```
*
* Where possible, this tries to summarize the error into a single line, as this displays better in
* the Actions UI.
*/
function extractFatalErrors(error) {
const fatalErrorRegex = /.*fatal error occurred:/gi;
let fatalErrors = [];
let lastFatalErrorIndex;
let match;
while ((match = fatalErrorRegex.exec(error)) !== null) {
if (lastFatalErrorIndex !== undefined) {
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index).trim());
}
lastFatalErrorIndex = match.index;
}
if (lastFatalErrorIndex !== undefined) {
const lastError = error.slice(lastFatalErrorIndex).trim();
if (fatalErrors.length === 0) {
// No other errors
return lastError;
}
const isOneLiner = !fatalErrors.some((e) => e.includes("\n"));
if (isOneLiner) {
fatalErrors = fatalErrors.map(ensureEndsInPeriod);
}
return [
ensureEndsInPeriod(lastError),
"Context:",
...fatalErrors.reverse(),
].join(isOneLiner ? " " : "\n");
}
return undefined;
}
function ensureEndsInPeriod(text) {
return text[text.length - 1] === "." ? text : `${text}.`;
}
/**
* If appropriate, generates a code scanning configuration that is to be used for a scan.
* If the configuration is not to be generated, returns undefined.
@@ -682,10 +865,10 @@ async function runTool(cmd, args = [], opts = {}) {
* @returns the path to the generated user configuration file.
*/
async function generateCodeScanningConfig(codeql, config, features, logger) {
if (!(await util.useCodeScanningConfigInCli(codeql, features))) {
if (!(await (0, feature_flags_1.useCodeScanningConfigInCli)(codeql, features))) {
return;
}
const codeScanningConfigFile = (0, config_utils_1.getGeneratedCodeScanningConfigPath)(config);
const codeScanningConfigFile = getGeneratedCodeScanningConfigPath(config);
// make a copy so we can modify it
const augmentedConfig = cloneObject(config.originalUserInput);
// Inject the queries from the input
@@ -724,21 +907,6 @@ async function generateCodeScanningConfig(codeql, config, features, logger) {
if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) {
delete augmentedConfig.packs;
}
if (config.augmentationProperties.injectedMlQueries) {
// We need to inject the ML queries into the original user input before
// we pass this on to the CLI, to make sure these get run.
const packString = await util.getMlPoweredJsQueriesPack(codeql);
if (augmentedConfig.packs === undefined)
augmentedConfig.packs = [];
if (Array.isArray(augmentedConfig.packs)) {
augmentedConfig.packs.push(packString);
}
else {
if (!augmentedConfig.packs.javascript)
augmentedConfig.packs["javascript"] = [];
augmentedConfig.packs["javascript"].push(packString);
}
}
logger.info(`Writing augmented user configuration file to ${codeScanningConfigFile}`);
logger.startGroup("Augmented user configuration file contents");
logger.info(yaml.dump(augmentedConfig));
@@ -755,12 +923,63 @@ function cloneObject(obj) {
*
* Returns an empty list if a code scanning configuration file was not generated by the CLI.
*/
async function getCodeScanningConfigExportArguments(config, codeql, features) {
const codeScanningConfigPath = (0, config_utils_1.getGeneratedCodeScanningConfigPath)(config);
async function getCodeScanningConfigExportArguments(config, codeql) {
const codeScanningConfigPath = getGeneratedCodeScanningConfigPath(config);
if (fs.existsSync(codeScanningConfigPath) &&
(await features.getValue(feature_flags_1.Feature.ExportCodeScanningConfigEnabled, codeql))) {
(await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG))) {
return ["--sarif-codescanning-config", codeScanningConfigPath];
}
return [];
}
// This constant sets the size of each TRAP cache in megabytes.
const TRAP_CACHE_SIZE_MB = 1024;
async function getTrapCachingExtractorConfigArgs(config) {
const result = [];
for (const language of config.languages)
result.push(await getTrapCachingExtractorConfigArgsForLang(config, language));
return result.flat();
}
exports.getTrapCachingExtractorConfigArgs = getTrapCachingExtractorConfigArgs;
async function getTrapCachingExtractorConfigArgsForLang(config, language) {
const cacheDir = config.trapCaches[language];
if (cacheDir === undefined)
return [];
const write = await (0, actions_util_1.isAnalyzingDefaultBranch)();
return [
`-O=${language}.trap.cache.dir=${cacheDir}`,
`-O=${language}.trap.cache.bound=${TRAP_CACHE_SIZE_MB}`,
`-O=${language}.trap.cache.write=${write}`,
];
}
exports.getTrapCachingExtractorConfigArgsForLang = getTrapCachingExtractorConfigArgsForLang;
/**
* Get the path to the code scanning configuration generated by the CLI.
*
* This will not exist if the configuration is being parsed in the Action.
*/
function getGeneratedCodeScanningConfigPath(config) {
return path.resolve(config.tempDir, "user-config.yaml");
}
exports.getGeneratedCodeScanningConfigPath = getGeneratedCodeScanningConfigPath;
function isNoCodeFoundError(e) {
/**
* Earlier versions of the JavaScript extractor (pre-CodeQL 2.12.0) extract externs even if no
* source code was found. This means that we don't get the no code found error from
* `codeql database finalize`. To ensure users get a good error message, we detect this manually
* here, and upon detection override the error message.
*
* This can be removed once support for CodeQL 2.11.6 is removed.
*/
const javascriptNoCodeFoundWarning = "No JavaScript or TypeScript code found.";
return e.exitCode === 32 || e.stderr.includes(javascriptNoCodeFoundWarning);
}
async function isDiagnosticsExportInvalidSarifFixed(codeql) {
return await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED);
}
async function getLanguageAliasingArguments(codeql) {
if (await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_LANGUAGE_ALIASING)) {
return ["--extractor-include-aliases"];
}
return [];
}
//# sourceMappingURL=codeql.js.map

File diff suppressed because one or more lines are too long

269
lib/codeql.test.js generated
View File

@@ -38,13 +38,12 @@ const yaml = __importStar(require("js-yaml"));
const nock_1 = __importDefault(require("nock"));
const sinon = __importStar(require("sinon"));
const actionsUtil = __importStar(require("./actions-util"));
const api = __importStar(require("./api-client"));
const codeql = __importStar(require("./codeql"));
const defaults = __importStar(require("./defaults.json"));
const feature_flags_1 = require("./feature-flags");
const init_1 = require("./init");
const languages_1 = require("./languages");
const logging_1 = require("./logging");
const setup_codeql_1 = require("./setup-codeql");
const testing_utils_1 = require("./testing-utils");
const util = __importStar(require("./util"));
const util_1 = require("./util");
@@ -74,7 +73,6 @@ ava_1.default.beforeEach(() => {
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false,
queriesInputCombines: false,
},
@@ -85,7 +83,7 @@ ava_1.default.beforeEach(() => {
async function installIntoToolcache({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, cliVersion, isPinned, tagName, tmpDir, }) {
const url = (0, testing_utils_1.mockBundleDownloadApi)({ apiDetails, isPinned, tagName });
await codeql.setupCodeQL(cliVersion !== undefined ? undefined : url, apiDetails, tmpDir, util.GitHubVariant.GHES, cliVersion !== undefined
? { cliVersion, tagName, variant: util.GitHubVariant.GHES }
? { cliVersion, tagName }
: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
}
function mockReleaseApi({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, assetNames, tagName, }) {
@@ -126,12 +124,27 @@ function mockApiDetails(apiDetails) {
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
t.is(result.toolsVersion, `0.0.0-${version}`);
t.is(result.toolsSource, init_1.ToolsSource.Download);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
}
t.is(toolcache.findAllVersions("CodeQL").length, 2);
});
});
(0, ava_1.default)("caches semantically versioned bundles using their semantic version number", async (t) => {
await util.withTmpDir(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
const url = (0, testing_utils_1.mockBundleDownloadApi)({
tagName: `codeql-bundle-v2.14.0`,
isPinned: false,
});
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.is(toolcache.findAllVersions("CodeQL").length, 1);
t.assert(toolcache.find("CodeQL", `2.14.0`));
t.is(result.toolsVersion, `2.14.0`);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
});
});
(0, ava_1.default)("downloads an explicitly requested bundle even if a different version is cached", async (t) => {
await util.withTmpDir(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
@@ -146,7 +159,7 @@ function mockApiDetails(apiDetails) {
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
t.is(result.toolsSource, init_1.ToolsSource.Download);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
});
});
@@ -181,26 +194,16 @@ for (const { cliVersion, expectedToolcacheVersion, } of EXPLICITLY_REQUESTED_BUN
t.assert(releaseApiMock.isDone(), "Releases API should have been called");
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
t.deepEqual(result.toolsVersion, cliVersion);
t.is(result.toolsSource, init_1.ToolsSource.Download);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
});
});
}
for (const { githubReleases, toolcacheVersion } of [
for (const toolcacheVersion of [
// Test that we use the tools from the toolcache when `SAMPLE_DEFAULT_CLI_VERSION` is requested
// and `SAMPLE_DEFAULT_CLI_VERSION-` is in the toolcache.
{
toolcacheVersion: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion,
},
{
githubReleases: {
"codeql-bundle-20230101": `cli-version-${testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion}.txt`,
},
toolcacheVersion: "0.0.0-20230101",
},
{
toolcacheVersion: `${testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion}-20230101`,
},
testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion,
`${testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion}-20230101`,
]) {
(0, ava_1.default)(`uses tools from toolcache when ${testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion} is requested and ` +
`${toolcacheVersion} is installed`, async (t) => {
@@ -211,24 +214,9 @@ for (const { githubReleases, toolcacheVersion } of [
.withArgs("CodeQL", toolcacheVersion)
.returns("path/to/cached/codeql");
sinon.stub(toolcache, "findAllVersions").returns([toolcacheVersion]);
if (githubReleases) {
sinon.stub(api, "getApiClient").value(() => ({
repos: {
listReleases: sinon.stub().resolves(undefined),
},
paginate: sinon.stub().resolves(Object.entries(githubReleases).map(([releaseTagName, cliVersionMarkerFile]) => ({
assets: [
{
name: cliVersionMarkerFile,
},
],
tag_name: releaseTagName,
}))),
}));
}
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.is(result.toolsVersion, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
t.is(result.toolsSource, init_1.ToolsSource.Toolcache);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Toolcache);
t.is(result.toolsDownloadDurationMs, undefined);
});
});
@@ -245,10 +233,9 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, variant, {
cliVersion: defaults.cliVersion,
tagName: defaults.bundleVersion,
variant,
}, (0, logging_1.getRunnerLogger)(true), false);
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
t.is(result.toolsSource, init_1.ToolsSource.Toolcache);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Toolcache);
t.is(result.toolsDownloadDurationMs, undefined);
const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 1);
@@ -268,10 +255,9 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, variant, {
cliVersion: defaults.cliVersion,
tagName: defaults.bundleVersion,
variant,
}, (0, logging_1.getRunnerLogger)(true), false);
t.deepEqual(result.toolsVersion, defaults.cliVersion);
t.is(result.toolsSource, init_1.ToolsSource.Download);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 2);
@@ -291,7 +277,7 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
});
const result = await codeql.setupCodeQL("latest", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.deepEqual(result.toolsVersion, defaults.cliVersion);
t.is(result.toolsSource, init_1.ToolsSource.Download);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 2);
@@ -333,9 +319,8 @@ for (const isBundleVersionInUrl of [true, false]) {
const result = await codeql.setupCodeQL(undefined, sampleGHAEApiDetails, tmpDir, util.GitHubVariant.GHAE, {
cliVersion: defaults.cliVersion,
tagName: defaults.bundleVersion,
variant: util.GitHubVariant.GHAE,
}, (0, logging_1.getRunnerLogger)(true), false);
t.is(result.toolsSource, init_1.ToolsSource.Download);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 1);
@@ -358,7 +343,7 @@ for (const isBundleVersionInUrl of [true, false]) {
});
const result = await codeql.setupCodeQL("https://github.com/codeql-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.is(result.toolsVersion, "0.0.0-20230203");
t.is(result.toolsSource, init_1.ToolsSource.Download);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
t.true(Number.isInteger(result.toolsDownloadDurationMs));
const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 1);
@@ -392,14 +377,13 @@ for (const isBundleVersionInUrl of [true, false]) {
await util.withTmpDir(async (tempDir) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.8.1");
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.10.5"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
const thisStubConfig = {
...stubConfig,
tempDir,
augmentationProperties: {
injectedMlQueries: false,
queriesInputCombines: false,
packsInputCombines: false,
},
@@ -419,7 +403,8 @@ const injectedConfigMacro = ava_1.default.macro({
const codeqlObject = await codeql.getCodeQLForTesting();
sinon
.stub(codeqlObject, "getVersion")
.resolves(feature_flags_1.featureConfig[feature_flags_1.Feature.CliConfigFileEnabled].minimumVersion);
.resolves((0, testing_utils_1.makeVersionInfo)(feature_flags_1.featureConfig[feature_flags_1.Feature.CliConfigFileEnabled].minimumVersion ||
"1.0.0"));
const thisStubConfig = {
...stubConfig,
...configOverride,
@@ -440,49 +425,10 @@ const injectedConfigMacro = ava_1.default.macro({
title: (providedTitle = "") => `databaseInitCluster() injected config: ${providedTitle}`,
});
(0, ava_1.default)("basic", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false,
packsInputCombines: false,
}, {}, {});
(0, ava_1.default)("injected ML queries", injectedConfigMacro, {
injectedMlQueries: true,
queriesInputCombines: false,
packsInputCombines: false,
}, {}, {
packs: ["codeql/javascript-experimental-atm-queries@~0.4.0"],
});
(0, ava_1.default)("injected ML queries with existing packs", injectedConfigMacro, {
injectedMlQueries: true,
queriesInputCombines: false,
packsInputCombines: false,
}, {
originalUserInput: {
packs: { javascript: ["codeql/something-else"] },
},
}, {
packs: {
javascript: [
"codeql/something-else",
"codeql/javascript-experimental-atm-queries@~0.4.0",
],
},
});
(0, ava_1.default)("injected ML queries with existing packs of different language", injectedConfigMacro, {
injectedMlQueries: true,
queriesInputCombines: false,
packsInputCombines: false,
}, {
originalUserInput: {
packs: { cpp: ["codeql/something-else"] },
},
}, {
packs: {
cpp: ["codeql/something-else"],
javascript: ["codeql/javascript-experimental-atm-queries@~0.4.0"],
},
});
(0, ava_1.default)("injected packs from input", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false,
packsInputCombines: false,
packsInput: ["xxx", "yyy"],
@@ -490,7 +436,6 @@ const injectedConfigMacro = ava_1.default.macro({
packs: ["xxx", "yyy"],
});
(0, ava_1.default)("injected packs from input with existing packs combines", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false,
packsInputCombines: true,
packsInput: ["xxx", "yyy"],
@@ -506,7 +451,6 @@ const injectedConfigMacro = ava_1.default.macro({
},
});
(0, ava_1.default)("injected packs from input with existing packs overrides", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false,
packsInputCombines: false,
packsInput: ["xxx", "yyy"],
@@ -519,23 +463,8 @@ const injectedConfigMacro = ava_1.default.macro({
}, {
packs: ["xxx", "yyy"],
});
(0, ava_1.default)("injected packs from input with existing packs overrides and ML model inject", injectedConfigMacro, {
injectedMlQueries: true,
queriesInputCombines: false,
packsInputCombines: false,
packsInput: ["xxx", "yyy"],
}, {
originalUserInput: {
packs: {
cpp: ["codeql/something-else"],
},
},
}, {
packs: ["xxx", "yyy", "codeql/javascript-experimental-atm-queries@~0.4.0"],
});
// similar, but with queries
(0, ava_1.default)("injected queries from input", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false,
packsInputCombines: false,
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
@@ -550,7 +479,6 @@ const injectedConfigMacro = ava_1.default.macro({
],
});
(0, ava_1.default)("injected queries from input overrides", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false,
packsInputCombines: false,
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
@@ -569,7 +497,6 @@ const injectedConfigMacro = ava_1.default.macro({
],
});
(0, ava_1.default)("injected queries from input combines", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: true,
packsInputCombines: false,
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
@@ -591,7 +518,6 @@ const injectedConfigMacro = ava_1.default.macro({
],
});
(0, ava_1.default)("injected queries from input combines 2", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: true,
packsInputCombines: true,
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
@@ -606,7 +532,6 @@ const injectedConfigMacro = ava_1.default.macro({
],
});
(0, ava_1.default)("injected queries and packs, but empty", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: true,
packsInputCombines: true,
queriesInput: [],
@@ -622,7 +547,7 @@ const injectedConfigMacro = ava_1.default.macro({
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
// stubbed version doesn't matter. It just needs to be valid semver.
sinon.stub(codeqlObject, "getVersion").resolves("0.0.0");
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("0.0.0"));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1];
// should not have used a config file
@@ -639,7 +564,7 @@ const injectedConfigMacro = ava_1.default.macro({
const codeqlObject = await codeql.getCodeQLForTesting();
sinon
.stub(codeqlObject, "getVersion")
.resolves(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG);
.resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1];
// should have used a config file
@@ -654,7 +579,7 @@ const injectedConfigMacro = ava_1.default.macro({
await util.withTmpDir(async (tempDir) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.12.2");
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.2"));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1];
// should have used a config file
@@ -671,7 +596,7 @@ const injectedConfigMacro = ava_1.default.macro({
const codeqlObject = await codeql.getCodeQLForTesting();
sinon
.stub(codeqlObject, "getVersion")
.resolves(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG);
.resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), undefined, // undefined qlconfigFile
(0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1];
@@ -682,7 +607,7 @@ const injectedConfigMacro = ava_1.default.macro({
(0, ava_1.default)("databaseInterpretResults() sets --sarif-add-baseline-file-info for 2.11.3", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.11.3");
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.3"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
@@ -691,17 +616,129 @@ const injectedConfigMacro = ava_1.default.macro({
(0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.11.2");
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.2"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
t.false(runnerConstructorStub.firstCall.args[1].includes("--sarif-add-baseline-file-info"), "--sarif-add-baseline-file-info must be absent, but it is present");
});
function stubToolRunnerConstructor() {
const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
{
featureEnabled: true,
codeqlVersion: "2.15.0",
flagPassed: true,
negativeFlagPassed: false,
},
{
featureEnabled: false,
codeqlVersion: "2.15.0",
flagPassed: false,
negativeFlagPassed: true,
},
{
featureEnabled: false,
codeqlVersion: "2.14.6",
flagPassed: false,
negativeFlagPassed: false,
},
];
for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of NEW_ANALYSIS_SUMMARY_TEST_CASES) {
(0, ava_1.default)(`database interpret-results passes ${flagPassed
? "--new-analysis-summary"
: negativeFlagPassed
? "--no-new-analysis-summary"
: "nothing"} for CodeQL CLI v${codeqlVersion} when the new analysis summary feature is ${featureEnabled ? "enabled" : "disabled"}`, async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting();
sinon
.stub(codeqlObject, "getVersion")
.resolves((0, testing_utils_1.makeVersionInfo)(codeqlVersion));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)(featureEnabled ? [feature_flags_1.Feature.AnalysisSummaryV2Enabled] : []), (0, logging_1.getRunnerLogger)(true));
t.is(runnerConstructorStub.firstCall.args[1].includes("--new-analysis-summary"), flagPassed, `--new-analysis-summary should${flagPassed ? "" : "n't"} be passed`);
t.is(runnerConstructorStub.firstCall.args[1].includes("--no-new-analysis-summary"), negativeFlagPassed, `--no-new-analysis-summary should${negativeFlagPassed ? "" : "n't"} be passed`);
});
}
(0, ava_1.default)("database finalize recognises JavaScript no code found error on CodeQL 2.11.6", async (t) => {
stubToolRunnerConstructor(1, `2020-09-07T17:39:53.9050522Z [2020-09-07 17:39:53] [build] Done extracting /opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/data/externs/web/ie_vml.js (3 ms)
2020-09-07T17:39:53.9051849Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found.
2020-09-07T17:39:53.9052444Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found.
2020-09-07T17:39:53.9251124Z [2020-09-07 17:39:53] [ERROR] Spawned process exited abnormally (code 255; tried to run: [/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/autobuild.sh])`);
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), {
message: "No code found during the build. Please see: " +
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build",
});
});
(0, ava_1.default)("database finalize overrides no code found error on CodeQL 2.11.6", async (t) => {
stubToolRunnerConstructor(32);
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), {
message: "No code found during the build. Please see: " +
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build",
});
});
(0, ava_1.default)("database finalize does not override no code found error on CodeQL 2.12.4", async (t) => {
const cliMessage = "CodeQL did not detect any code written in languages supported by CodeQL. Review our troubleshooting guide at " +
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build.";
stubToolRunnerConstructor(32, cliMessage);
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
`Exit code was 32 and last log line was: ${cliMessage} See the logs for more details.`,
});
});
(0, ava_1.default)("runTool summarizes several fatal errors", async (t) => {
const heapError = "A fatal error occurred: Evaluator heap must be at least 384.00 MiB";
const datasetImportError = "A fatal error occurred: Dataset import for /home/runner/work/_temp/codeql_databases/javascript/db-javascript failed with code 2";
const cliStderr = `Running TRAP import for CodeQL database at /home/runner/work/_temp/codeql_databases/javascript...\n` +
`${heapError}\n${datasetImportError}.`;
stubToolRunnerConstructor(32, cliStderr);
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
`Exit code was 32 and error was: ${datasetImportError}. Context: ${heapError}. See the logs for more details.`,
});
});
(0, ava_1.default)("runTool outputs last line of stderr if fatal error could not be found", async (t) => {
const cliStderr = "line1\nline2\nline3\nline4\nline5";
stubToolRunnerConstructor(32, cliStderr);
const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
// safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
"Exit code was 32 and last log line was: line5. See the logs for more details.",
});
});
function stubToolRunnerConstructor(exitCode = 0, stderr) {
const runnerObjectStub = sinon.createStubInstance(toolrunner.ToolRunner);
runnerObjectStub.exec.resolves(0);
const runnerConstructorStub = sinon.stub(toolrunner, "ToolRunner");
runnerConstructorStub.returns(runnerObjectStub);
let stderrListener = undefined;
runnerConstructorStub.callsFake((_cmd, _args, options) => {
stderrListener = options.listeners?.stderr;
return runnerObjectStub;
});
runnerObjectStub.exec.callsFake(async () => {
if (stderrListener !== undefined && stderr !== undefined) {
stderrListener(Buffer.from(stderr));
}
return exitCode;
});
return runnerConstructorStub;
}
exports.stubToolRunnerConstructor = stubToolRunnerConstructor;

File diff suppressed because one or more lines are too long

210
lib/config-utils.js generated
View File

@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGeneratedCodeScanningConfigPath = exports.wrapEnvironment = exports.generateRegistries = exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePackSpecification = exports.prettyPrintPack = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
exports.wrapEnvironment = exports.generateRegistries = exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguageAliases = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const perf_hooks_1 = require("perf_hooks");
@@ -45,13 +45,12 @@ const PATHS_IGNORE_PROPERTY = "paths-ignore";
const PATHS_PROPERTY = "paths";
const PACKS_PROPERTY = "packs";
/**
* The default, empty augmentation properties. This is most useeful
* The default, empty augmentation properties. This is most useful
* for tests.
*/
exports.defaultAugmentationProperties = {
queriesInputCombines: false,
packsInputCombines: false,
injectedMlQueries: false,
packsInput: undefined,
queriesInput: undefined,
};
@@ -81,13 +80,13 @@ function validateQueries(resolvedQueries) {
const noDeclaredLanguage = resolvedQueries.noDeclaredLanguage;
const noDeclaredLanguageQueries = Object.keys(noDeclaredLanguage);
if (noDeclaredLanguageQueries.length !== 0) {
throw new Error(`${"The following queries do not declare a language. " +
throw new util_1.UserError(`${"The following queries do not declare a language. " +
"Their qlpack.yml files are either missing or is invalid.\n"}${noDeclaredLanguageQueries.join("\n")}`);
}
const multipleDeclaredLanguages = resolvedQueries.multipleDeclaredLanguages;
const multipleDeclaredLanguagesQueries = Object.keys(multipleDeclaredLanguages);
if (multipleDeclaredLanguagesQueries.length !== 0) {
throw new Error(`${"The following queries declare multiple languages. " +
throw new util_1.UserError(`${"The following queries declare multiple languages. " +
"Their qlpack.yml files are either missing or is invalid.\n"}${multipleDeclaredLanguagesQueries.join("\n")}`);
}
}
@@ -139,45 +138,20 @@ const builtinSuites = [
/**
* Determine the set of queries associated with suiteName's suites and add them to resultMap.
* Throws an error if suiteName is not a valid builtin suite.
* May inject ML queries, and the return value will declare if this was done.
*/
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suiteName, features, configFile) {
let injectedMlQueries = false;
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, suiteName, configFile) {
const found = builtinSuites.find((suite) => suite === suiteName);
if (!found) {
throw new Error(getQueryUsesInvalid(configFile, suiteName));
throw new util_1.UserError(getQueryUsesInvalid(configFile, suiteName));
}
if (suiteName === "security-experimental" &&
!(await (0, util_1.codeQlVersionAbove)(codeQL, codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE))) {
throw new Error(`The 'security-experimental' suite is not supported on CodeQL CLI versions earlier than
throw new util_1.UserError(`The 'security-experimental' suite is not supported on CodeQL CLI versions earlier than
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE}. Please upgrade to CodeQL CLI version
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE} or later.`);
}
// If we're running the JavaScript security-extended analysis (or a superset of it), the repo is
// opted into the ML-powered queries beta, and a user hasn't already added the ML-powered query
// pack, then add the ML-powered query pack so that we run ML-powered queries.
if (
// Only run ML-powered queries on Windows if we have a CLI that supports it.
(process.platform !== "win32" ||
(await (0, util_1.codeQlVersionAbove)(codeQL, codeql_1.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS))) &&
languages.includes("javascript") &&
(found === "security-experimental" ||
found === "security-extended" ||
found === "security-and-quality") &&
!packs.javascript?.some(isMlPoweredJsQueriesPack) &&
(await features.getValue(feature_flags_1.Feature.MlPoweredQueriesEnabled, codeQL))) {
if (!packs.javascript) {
packs.javascript = [];
}
packs.javascript.push(await (0, util_1.getMlPoweredJsQueriesPack)(codeQL));
injectedMlQueries = true;
}
const suites = languages.map((l) => `${l}-${suiteName}.qls`);
await runResolveQueries(codeQL, resultMap, suites, undefined);
return injectedMlQueries;
}
function isMlPoweredJsQueriesPack(pack) {
return parsePacksSpecification(pack).name === util_1.ML_POWERED_JS_QUERIES_PACK_NAME;
}
/**
* Retrieve the set of queries at localQueryPath and add them to resultMap.
@@ -188,13 +162,13 @@ async function addLocalQueries(codeQL, resultMap, localQueryPath, workspacePath,
let absoluteQueryPath = path.join(workspacePath, localQueryPath);
// Check the file exists
if (!fs.existsSync(absoluteQueryPath)) {
throw new Error(getLocalPathDoesNotExist(configFile, localQueryPath));
throw new util_1.UserError(getLocalPathDoesNotExist(configFile, localQueryPath));
}
// Call this after checking file exists, because it'll fail if file doesn't exist
absoluteQueryPath = fs.realpathSync(absoluteQueryPath);
// Check the local path doesn't jump outside the repo using '..' or symlinks
if (!(absoluteQueryPath + path.sep).startsWith(fs.realpathSync(workspacePath) + path.sep)) {
throw new Error(getLocalPathOutsideOfRepository(configFile, localQueryPath));
throw new util_1.UserError(getLocalPathOutsideOfRepository(configFile, localQueryPath));
}
const extraSearchPath = workspacePath;
await runResolveQueries(codeQL, resultMap, [absoluteQueryPath], extraSearchPath);
@@ -205,7 +179,7 @@ async function addLocalQueries(codeQL, resultMap, localQueryPath, workspacePath,
async function addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetails, logger, configFile) {
let tok = queryUses.split("@");
if (tok.length !== 2) {
throw new Error(getQueryUsesInvalid(configFile, queryUses));
throw new util_1.UserError(getQueryUsesInvalid(configFile, queryUses));
}
const ref = tok[1];
tok = tok[0].split("/");
@@ -213,11 +187,11 @@ async function addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetail
// The second token is the repo
// The rest is a path, if there is more than one token combine them to form the full path
if (tok.length < 2) {
throw new Error(getQueryUsesInvalid(configFile, queryUses));
throw new util_1.UserError(getQueryUsesInvalid(configFile, queryUses));
}
// Check none of the parts of the repository name are empty
if (tok[0].trim() === "" || tok[1].trim() === "") {
throw new Error(getQueryUsesInvalid(configFile, queryUses));
throw new util_1.UserError(getQueryUsesInvalid(configFile, queryUses));
}
const nwo = `${tok[0]}/${tok[1]}`;
// Checkout the external repository
@@ -234,33 +208,28 @@ async function addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetail
* parsing the 'uses' actions in the workflow file. So it can handle
* local paths starting with './', or references to remote repos, or
* a finite set of hardcoded terms for builtin suites.
*
* This may inject ML queries into the packs to use, and the return value will
* declare if this was done.
*
* @returns whether or not we injected ML queries into the packs
*/
async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, tempDir, workspacePath, apiDetails, features, logger, configFile) {
async function parseQueryUses(languages, codeQL, resultMap, queryUses, tempDir, workspacePath, apiDetails, features, logger, configFile) {
queryUses = queryUses.trim();
if (queryUses === "") {
throw new Error(getQueryUsesInvalid(configFile));
throw new util_1.UserError(getQueryUsesInvalid(configFile));
}
// Check for the local path case before we start trying to parse the repository name
if (queryUses.startsWith("./")) {
await addLocalQueries(codeQL, resultMap, queryUses.slice(2), workspacePath, configFile);
return false;
return;
}
// Check for one of the builtin suites
if (queryUses.indexOf("/") === -1 && queryUses.indexOf("@") === -1) {
return await addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, queryUses, features, configFile);
await addBuiltinSuiteQueries(languages, codeQL, resultMap, queryUses, configFile);
return;
}
// Otherwise, must be a reference to another repo.
// If config parsing is handled in CLI, then this repo will be downloaded
// later by the CLI.
if (!(await (0, util_1.useCodeScanningConfigInCli)(codeQL, features))) {
if (!(await (0, feature_flags_1.useCodeScanningConfigInCli)(codeQL, features))) {
await addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetails, logger, configFile);
}
return false;
}
// Regex validating stars in paths or paths-ignore entries.
// The intention is to only allow ** to appear when immediately
@@ -284,12 +253,12 @@ function validateAndSanitisePath(originalPath, propertyName, configFile, logger)
}
// An empty path is not allowed as it's meaningless
if (newPath === "") {
throw new Error(getConfigFilePropertyError(configFile, propertyName, `"${originalPath}" is not an invalid path. ` +
throw new util_1.UserError(getConfigFilePropertyError(configFile, propertyName, `"${originalPath}" is not an invalid path. ` +
`It is not necessary to include it, and it is not allowed to exclude it.`));
}
// Check for illegal uses of **
if (newPath.match(pathStarsRegex)) {
throw new Error(getConfigFilePropertyError(configFile, propertyName, `"${originalPath}" contains an invalid "**" wildcard. ` +
throw new util_1.UserError(getConfigFilePropertyError(configFile, propertyName, `"${originalPath}" contains an invalid "**" wildcard. ` +
`They must be immediately preceded and followed by a slash as in "/**/", or come at the start or end.`));
}
// Check for other regex characters that we don't support.
@@ -302,7 +271,7 @@ function validateAndSanitisePath(originalPath, propertyName, configFile, logger)
// This may not play nicely with project layouts.
// This restriction can be lifted later if we determine they are ok.
if (newPath.indexOf("\\") !== -1) {
throw new Error(getConfigFilePropertyError(configFile, propertyName, `"${originalPath}" contains an "\\" character. These are not allowed in filters. ` +
throw new util_1.UserError(getConfigFilePropertyError(configFile, propertyName, `"${originalPath}" contains an "\\" character. These are not allowed in filters. ` +
`If running on windows we recommend using "/" instead for path filters.`));
}
return newPath;
@@ -399,7 +368,7 @@ function getNoLanguagesError() {
}
exports.getNoLanguagesError = getNoLanguagesError;
function getUnknownLanguagesError(languages) {
return `Did not recognise the following languages: ${languages.join(", ")}`;
return `Did not recognize the following languages: ${languages.join(", ")}`;
}
exports.getUnknownLanguagesError = getUnknownLanguagesError;
/**
@@ -408,7 +377,7 @@ exports.getUnknownLanguagesError = getUnknownLanguagesError;
*/
async function getLanguagesInRepo(repository, logger) {
logger.debug(`GitHub repo ${repository.owner} ${repository.repo}`);
const response = await api.getApiClient().repos.listLanguages({
const response = await api.getApiClient().rest.repos.listLanguages({
owner: repository.owner,
repo: repository.repo,
});
@@ -440,25 +409,31 @@ exports.getLanguagesInRepo = getLanguagesInRepo;
async function getLanguages(codeQL, languagesInput, repository, logger) {
// Obtain languages without filtering them.
const { rawLanguages, autodetected } = await getRawLanguages(languagesInput, repository, logger);
let languages = rawLanguages.map(languages_1.resolveAlias);
let languages = rawLanguages;
if (autodetected) {
const availableLanguages = await codeQL.resolveLanguages();
languages = languages.filter((value) => value in availableLanguages);
const supportedLanguages = Object.keys(await codeQL.resolveLanguages());
languages = languages
.map(languages_1.parseLanguage)
.filter((value) => value && supportedLanguages.includes(value))
.map((value) => value);
logger.info(`Automatically detected languages: ${languages.join(", ")}`);
}
else {
const aliases = await getLanguageAliases(codeQL);
if (aliases) {
languages = languages.map((lang) => aliases[lang] || lang);
}
logger.info(`Languages from configuration: ${languages.join(", ")}`);
}
// If the languages parameter was not given and no languages were
// detected then fail here as this is a workflow configuration error.
if (languages.length === 0) {
throw new Error(getNoLanguagesError());
throw new util_1.UserError(getNoLanguagesError());
}
// Make sure they are supported
const parsedLanguages = [];
const unknownLanguages = [];
for (const language of languages) {
// We know this is not an alias since we resolved it above.
const parsedLanguage = (0, languages_1.parseLanguage)(language);
if (parsedLanguage === undefined) {
unknownLanguages.push(language);
@@ -470,11 +445,22 @@ async function getLanguages(codeQL, languagesInput, repository, logger) {
// Any unknown languages here would have come directly from the input
// since we filter unknown languages coming from the GitHub API.
if (unknownLanguages.length > 0) {
throw new Error(getUnknownLanguagesError(unknownLanguages));
throw new util_1.UserError(getUnknownLanguagesError(unknownLanguages));
}
return parsedLanguages;
}
exports.getLanguages = getLanguages;
/**
* Gets the set of languages supported by CodeQL, along with their aliases if supported by the
* version of the CLI.
*/
async function getLanguageAliases(codeql) {
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_LANGUAGE_ALIASING)) {
return (await codeql.betterResolveLanguages()).aliases;
}
return undefined;
}
exports.getLanguageAliases = getLanguageAliases;
/**
* Gets the set of languages in the current repository without checking to
* see if these languages are actually supported by CodeQL.
@@ -503,16 +489,13 @@ async function getRawLanguages(languagesInput, repository, logger) {
return { rawLanguages, autodetected };
}
exports.getRawLanguages = getRawLanguages;
async function addQueriesAndPacksFromWorkflow(codeQL, queriesInput, languages, resultMap, packs, tempDir, workspacePath, apiDetails, features, logger) {
let injectedMlQueries = false;
async function addQueriesFromWorkflow(codeQL, queriesInput, languages, resultMap, tempDir, workspacePath, apiDetails, features, logger) {
queriesInput = queriesInput.trim();
// "+" means "don't override config file" - see shouldAddConfigFileQueries
queriesInput = queriesInput.replace(/^\+/, "");
for (const query of queriesInput.split(",")) {
const didInject = await parseQueryUses(languages, codeQL, resultMap, packs, query, tempDir, workspacePath, apiDetails, features, logger);
injectedMlQueries = injectedMlQueries || didInject;
await parseQueryUses(languages, codeQL, resultMap, query, tempDir, workspacePath, apiDetails, features, logger);
}
return injectedMlQueries;
}
// Returns true if either no queries were provided in the workflow.
// or if the queries in the workflow were provided in "additive" mode,
@@ -544,8 +527,7 @@ async function getDefaultConfig(languagesInput, rawQueriesInput, rawPacksInput,
}
: {};
if (rawQueriesInput) {
augmentationProperties.injectedMlQueries =
await addQueriesAndPacksFromWorkflow(codeQL, rawQueriesInput, languages, queries, packs, tempDir, workspacePath, apiDetails, features, logger);
await addQueriesFromWorkflow(codeQL, rawQueriesInput, languages, queries, tempDir, workspacePath, apiDetails, features, logger);
}
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
return {
@@ -595,10 +577,10 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
// even though we don't use the value yet.
if (NAME_PROPERTY in parsedYAML) {
if (typeof parsedYAML[NAME_PROPERTY] !== "string") {
throw new Error(getNameInvalid(configFile));
throw new util_1.UserError(getNameInvalid(configFile));
}
if (parsedYAML[NAME_PROPERTY].length === 0) {
throw new Error(getNameInvalid(configFile));
throw new util_1.UserError(getNameInvalid(configFile));
}
}
const languages = await getLanguages(codeQL, languagesInput, repository, logger);
@@ -614,7 +596,7 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
let disableDefaultQueries = false;
if (DISABLE_DEFAULT_QUERIES_PROPERTY in parsedYAML) {
if (typeof parsedYAML[DISABLE_DEFAULT_QUERIES_PROPERTY] !== "boolean") {
throw new Error(getDisableDefaultQueriesInvalid(configFile));
throw new util_1.UserError(getDisableDefaultQueriesInvalid(configFile));
}
disableDefaultQueries = parsedYAML[DISABLE_DEFAULT_QUERIES_PROPERTY];
}
@@ -628,40 +610,39 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
// unless they're prefixed with "+", in which case they supplement those
// in the config file.
if (rawQueriesInput) {
augmentationProperties.injectedMlQueries =
await addQueriesAndPacksFromWorkflow(codeQL, rawQueriesInput, languages, queries, packs, tempDir, workspacePath, apiDetails, features, logger);
await addQueriesFromWorkflow(codeQL, rawQueriesInput, languages, queries, tempDir, workspacePath, apiDetails, features, logger);
}
if (shouldAddConfigFileQueries(rawQueriesInput) &&
QUERIES_PROPERTY in parsedYAML) {
const queriesArr = parsedYAML[QUERIES_PROPERTY];
if (!Array.isArray(queriesArr)) {
throw new Error(getQueriesInvalid(configFile));
throw new util_1.UserError(getQueriesInvalid(configFile));
}
for (const query of queriesArr) {
if (typeof query[QUERIES_USES_PROPERTY] !== "string") {
throw new Error(getQueriesMissingUses(configFile));
throw new util_1.UserError(getQueriesMissingUses(configFile));
}
await parseQueryUses(languages, codeQL, queries, packs, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, features, logger, configFile);
await parseQueryUses(languages, codeQL, queries, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, features, logger, configFile);
}
}
if (PATHS_IGNORE_PROPERTY in parsedYAML) {
if (!Array.isArray(parsedYAML[PATHS_IGNORE_PROPERTY])) {
throw new Error(getPathsIgnoreInvalid(configFile));
throw new util_1.UserError(getPathsIgnoreInvalid(configFile));
}
for (const ignorePath of parsedYAML[PATHS_IGNORE_PROPERTY]) {
if (typeof ignorePath !== "string" || ignorePath === "") {
throw new Error(getPathsIgnoreInvalid(configFile));
throw new util_1.UserError(getPathsIgnoreInvalid(configFile));
}
pathsIgnore.push(validateAndSanitisePath(ignorePath, PATHS_IGNORE_PROPERTY, configFile, logger));
}
}
if (PATHS_PROPERTY in parsedYAML) {
if (!Array.isArray(parsedYAML[PATHS_PROPERTY])) {
throw new Error(getPathsInvalid(configFile));
throw new util_1.UserError(getPathsInvalid(configFile));
}
for (const includePath of parsedYAML[PATHS_PROPERTY]) {
if (typeof includePath !== "string" || includePath === "") {
throw new Error(getPathsInvalid(configFile));
throw new util_1.UserError(getPathsInvalid(configFile));
}
paths.push(validateAndSanitisePath(includePath, PATHS_PROPERTY, configFile, logger));
}
@@ -711,7 +692,6 @@ function calculateAugmentation(rawPacksInput, rawQueriesInput, languages) {
const queriesInputCombines = shouldCombine(rawQueriesInput);
const queriesInput = parseQueriesFromInput(rawQueriesInput, queriesInputCombines);
return {
injectedMlQueries: false,
packsInputCombines,
packsInput: packsInput?.[languages[0]],
queriesInput,
@@ -727,7 +707,7 @@ function parseQueriesFromInput(rawQueriesInput, queriesInputCombines) {
? rawQueriesInput.trim().slice(1).trim()
: rawQueriesInput?.trim() ?? "";
if (queriesInputCombines && trimmedInput.length === 0) {
throw new Error(getConfigFilePropertyError(undefined, "queries", "A '+' was used in the 'queries' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs."));
throw new util_1.UserError(getConfigFilePropertyError(undefined, "queries", "A '+' was used in the 'queries' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs."));
}
return trimmedInput.split(",").map((query) => ({ uses: query.trim() }));
}
@@ -754,12 +734,12 @@ function parsePacksFromConfig(packsByLanguage, languages, configFile, logger) {
else {
// this is an error since multi-language analysis requires
// packs split by language
throw new Error(getPacksInvalidSplit(configFile));
throw new util_1.UserError(getPacksInvalidSplit(configFile));
}
}
for (const [lang, packsArr] of Object.entries(packsByLanguage)) {
if (!Array.isArray(packsArr)) {
throw new Error(getPacksInvalid(configFile));
throw new util_1.UserError(getPacksInvalid(configFile));
}
if (!languages.includes(lang)) {
// This particular language is not being analyzed in this run.
@@ -769,7 +749,7 @@ function parsePacksFromConfig(packsByLanguage, languages, configFile, logger) {
}
else {
// This language is invalid, probably a misspelling
throw new Error(getPacksRequireLanguage(configFile, lang));
throw new util_1.UserError(getPacksRequireLanguage(configFile, lang));
}
}
packs[lang] = packsArr.map((packStr) => validatePackSpecification(packStr, configFile));
@@ -782,16 +762,16 @@ function parsePacksFromInput(rawPacksInput, languages, packsInputCombines) {
return undefined;
}
if (languages.length > 1) {
throw new Error("Cannot specify a 'packs' input in a multi-language analysis. Use a codeql-config.yml file instead and specify packs by language.");
throw new util_1.UserError("Cannot specify a 'packs' input in a multi-language analysis. Use a codeql-config.yml file instead and specify packs by language.");
}
else if (languages.length === 0) {
throw new Error("No languages specified. Cannot process the packs input.");
throw new util_1.UserError("No languages specified. Cannot process the packs input.");
}
rawPacksInput = rawPacksInput.trim();
if (packsInputCombines) {
rawPacksInput = rawPacksInput.trim().substring(1).trim();
if (!rawPacksInput) {
throw new Error(getConfigFilePropertyError(undefined, "packs", "A '+' was used in the 'packs' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs."));
throw new util_1.UserError(getConfigFilePropertyError(undefined, "packs", "A '+' was used in the 'packs' input to specify that you wished to add some packs to your CodeQL analysis. However, no packs were specified. Please either remove the '+' or specify some packs."));
}
}
return {
@@ -821,7 +801,7 @@ function parsePacksFromInput(rawPacksInput, languages, packsInputCombines) {
*/
function parsePacksSpecification(packStr, configFile) {
if (typeof packStr !== "string") {
throw new Error(getPacksStrInvalid(packStr, configFile));
throw new util_1.UserError(getPacksStrInvalid(packStr, configFile));
}
packStr = packStr.trim();
const atIndex = packStr.indexOf("@");
@@ -842,7 +822,7 @@ function parsePacksSpecification(packStr, configFile) {
? packStr.slice(pathStart, pathEnd).trim()
: undefined;
if (!PACK_IDENTIFIER_PATTERN.test(packName)) {
throw new Error(getPacksStrInvalid(packStr, configFile));
throw new util_1.UserError(getPacksStrInvalid(packStr, configFile));
}
if (version) {
try {
@@ -850,7 +830,7 @@ function parsePacksSpecification(packStr, configFile) {
}
catch (e) {
// The range string is invalid. OK to ignore the caught error
throw new Error(getPacksStrInvalid(packStr, configFile));
throw new util_1.UserError(getPacksStrInvalid(packStr, configFile));
}
}
if (packPath &&
@@ -861,11 +841,11 @@ function parsePacksSpecification(packStr, configFile) {
// which seems more awkward.
path.normalize(packPath).split(path.sep).join("/") !==
packPath.split(path.sep).join("/"))) {
throw new Error(getPacksStrInvalid(packStr, configFile));
throw new util_1.UserError(getPacksStrInvalid(packStr, configFile));
}
if (!packPath && pathStart) {
// 0 length path
throw new Error(getPacksStrInvalid(packStr, configFile));
throw new util_1.UserError(getPacksStrInvalid(packStr, configFile));
}
return {
name: packName,
@@ -874,12 +854,8 @@ function parsePacksSpecification(packStr, configFile) {
};
}
exports.parsePacksSpecification = parsePacksSpecification;
function prettyPrintPack(pack) {
return `${pack.name}${pack.version ? `@${pack.version}` : ""}${pack.path ? `:${pack.path}` : ""}`;
}
exports.prettyPrintPack = prettyPrintPack;
function validatePackSpecification(pack, configFile) {
return prettyPrintPack(parsePacksSpecification(pack, configFile));
return (0, util_1.prettyPrintPack)(parsePacksSpecification(pack, configFile));
}
exports.validatePackSpecification = validatePackSpecification;
// exported for testing
@@ -891,7 +867,7 @@ function parsePacks(rawPacksFromConfig, rawPacksFromInput, packsInputCombines, l
}
if (!packsInputCombines) {
if (!packsFromInput) {
throw new Error(getPacksInvalid(configFile));
throw new util_1.UserError(getPacksInvalid(configFile));
}
return packsFromInput;
}
@@ -954,8 +930,8 @@ async function initConfig(languagesInput, queriesInput, packsInput, registriesIn
// When using the codescanning config in the CLI, pack downloads
// happen in the CLI during the `database init` command, so no need
// to download them here.
await (0, util_1.logCodeScanningConfigInCli)(codeQL, features, logger);
if (!(await (0, util_1.useCodeScanningConfigInCli)(codeQL, features))) {
await (0, feature_flags_1.logCodeScanningConfigInCli)(codeQL, features, logger);
if (!(await (0, feature_flags_1.useCodeScanningConfigInCli)(codeQL, features))) {
// The list of queries should not be empty for any language. If it is then
// it is a user configuration error.
// This check occurs in the CLI when it parses the config file.
@@ -964,7 +940,7 @@ async function initConfig(languagesInput, queriesInput, packsInput, registriesIn
const hasCustomQueries = config.queries[language]?.custom.length > 0;
const hasPacks = (config.packs[language]?.length || 0) > 0;
if (!hasPacks && !hasBuiltinQueries && !hasCustomQueries) {
throw new Error(`Did not detect any queries to run for ${language}. ` +
throw new util_1.UserError(`Did not detect any queries to run for ${language}. ` +
"Please make sure that the default queries are enabled, or you are specifying queries to run.");
}
}
@@ -982,7 +958,7 @@ function parseRegistries(registriesInput) {
: undefined;
}
catch (e) {
throw new Error("Invalid registries input. Must be a YAML string.");
throw new util_1.UserError("Invalid registries input. Must be a YAML string.");
}
}
function isLocal(configPath) {
@@ -995,11 +971,11 @@ function isLocal(configPath) {
function getLocalConfig(configFile, workspacePath) {
// Error if the config file is now outside of the workspace
if (!(configFile + path.sep).startsWith(workspacePath + path.sep)) {
throw new Error(getConfigFileOutsideWorkspaceErrorMessage(configFile));
throw new util_1.UserError(getConfigFileOutsideWorkspaceErrorMessage(configFile));
}
// Error if the file does not exist
if (!fs.existsSync(configFile)) {
throw new Error(getConfigFileDoesNotExistErrorMessage(configFile));
throw new util_1.UserError(getConfigFileDoesNotExistErrorMessage(configFile));
}
return yaml.load(fs.readFileSync(configFile, "utf8"));
}
@@ -1009,11 +985,11 @@ async function getRemoteConfig(configFile, apiDetails) {
const pieces = format.exec(configFile);
// 5 = 4 groups + the whole expression
if (pieces === null || pieces.groups === undefined || pieces.length < 5) {
throw new Error(getConfigFileRepoFormatInvalidMessage(configFile));
throw new util_1.UserError(getConfigFileRepoFormatInvalidMessage(configFile));
}
const response = await api
.getApiClientWithExternalAuth(apiDetails)
.repos.getContent({
.rest.repos.getContent({
owner: pieces.groups.owner,
repo: pieces.groups.repo,
path: pieces.groups.path,
@@ -1024,10 +1000,10 @@ async function getRemoteConfig(configFile, apiDetails) {
fileContents = response.data.content;
}
else if (Array.isArray(response.data)) {
throw new Error(getConfigFileDirectoryGivenMessage(configFile));
throw new util_1.UserError(getConfigFileDirectoryGivenMessage(configFile));
}
else {
throw new Error(getConfigFileFormatInvalidMessage(configFile));
throw new util_1.UserError(getConfigFileFormatInvalidMessage(configFile));
}
return yaml.load(Buffer.from(fileContents, "base64").toString("binary"));
}
@@ -1066,7 +1042,7 @@ async function getConfig(tempDir, logger) {
exports.getConfig = getConfig;
async function downloadPacks(codeQL, languages, packs, apiDetails, registriesInput, tempDir, logger) {
// This code path is only used when config parsing occurs in the Action.
const { registriesAuthTokens, qlconfigFile } = await generateRegistries(registriesInput, codeQL, tempDir, logger);
const { registriesAuthTokens, qlconfigFile } = await generateRegistries(registriesInput, tempDir, logger);
await wrapEnvironment({
GITHUB_TOKEN: apiDetails.auth,
CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
@@ -1106,14 +1082,11 @@ exports.downloadPacks = downloadPacks;
* @returns The path to the generated `qlconfig.yml` file and the auth tokens to
* use for each registry.
*/
async function generateRegistries(registriesInput, codeQL, tempDir, logger) {
async function generateRegistries(registriesInput, tempDir, logger) {
const registries = parseRegistries(registriesInput);
let registriesAuthTokens;
let qlconfigFile;
if (registries) {
if (!(await (0, util_1.codeQlVersionAbove)(codeQL, codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD))) {
throw new Error(`The 'registries' input is not supported on CodeQL CLI versions earlier than ${codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD}. Please upgrade to CodeQL CLI version ${codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD} or later.`);
}
// generate a qlconfig.yml file to hold the registry configs.
const qlconfig = createRegistriesBlock(registries);
qlconfigFile = path.join(tempDir, "qlconfig.yml");
@@ -1139,7 +1112,7 @@ exports.generateRegistries = generateRegistries;
function createRegistriesBlock(registries) {
if (!Array.isArray(registries) ||
registries.some((r) => !r.url || !r.packages)) {
throw new Error("Invalid 'registries' input. Must be an array of objects with 'url' and 'packages' properties.");
throw new util_1.UserError("Invalid 'registries' input. Must be an array of objects with 'url' and 'packages' properties.");
}
// be sure to remove the `token` field from the registry before writing it to disk.
const safeRegistries = registries.map((registry) => ({
@@ -1186,13 +1159,4 @@ async function wrapEnvironment(env, operation) {
}
}
exports.wrapEnvironment = wrapEnvironment;
/**
* Get the path to the code scanning configuration generated by the CLI.
*
* This will not exist if the configuration is being parsed in the Action.
*/
function getGeneratedCodeScanningConfigPath(config) {
return path.resolve(config.tempDir, "user-config.yaml");
}
exports.getGeneratedCodeScanningConfigPath = getGeneratedCodeScanningConfigPath;
//# sourceMappingURL=config-utils.js.map

File diff suppressed because one or more lines are too long

227
lib/config-utils.test.js generated
View File

@@ -35,12 +35,11 @@ const sinon = __importStar(require("sinon"));
const api = __importStar(require("./api-client"));
const codeql_1 = require("./codeql");
const configUtils = __importStar(require("./config-utils"));
const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages");
const logging_1 = require("./logging");
const repository_1 = require("./repository");
const testing_utils_1 = require("./testing-utils");
const util = __importStar(require("./util"));
const util_1 = require("./util");
(0, testing_utils_1.setupTests)(ava_1.default);
const sampleApiDetails = {
auth: "token",
@@ -49,7 +48,7 @@ const sampleApiDetails = {
apiURL: undefined,
registriesAuthTokens: undefined,
};
const gitHubVersion = { type: util.GitHubVariant.DOTCOM };
const gitHubVersion = { type: util_1.GitHubVariant.DOTCOM };
// Returns the filepath of the newly-created file
function createConfigFile(inputFileContents, tmpDir) {
const configFilePath = path.join(tmpDir, "input");
@@ -63,7 +62,7 @@ function mockGetContents(content) {
data: content,
};
const spyGetContents = sinon
.stub(client.repos, "getContent")
.stub(client.rest.repos, "getContent")
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
.resolves(response);
sinon.stub(api, "getApiClient").value(() => client);
@@ -80,11 +79,11 @@ function mockListLanguages(languages) {
response.data[language] = 123;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
sinon.stub(client.repos, "listLanguages").resolves(response);
sinon.stub(client.rest.repos, "listLanguages").resolves(response);
sinon.stub(api, "getApiClient").value(() => client);
}
(0, ava_1.default)("load empty config", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const logger = (0, logging_1.getRunnerLogger)(true);
const languages = "javascript,python";
const codeQL = (0, codeql_1.setCodeQL)({
@@ -107,7 +106,7 @@ function mockListLanguages(languages) {
});
});
(0, ava_1.default)("loading config saves config", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const logger = (0, logging_1.getRunnerLogger)(true);
const codeQL = (0, codeql_1.setCodeQL)({
async resolveQueries() {
@@ -142,18 +141,18 @@ function mockListLanguages(languages) {
});
});
(0, ava_1.default)("load input outside of workspace", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
try {
await configUtils.initConfig(undefined, undefined, undefined, undefined, "../input", undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
throw new Error("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(configUtils.getConfigFileOutsideWorkspaceErrorMessage(path.join(tmpDir, "../input"))));
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileOutsideWorkspaceErrorMessage(path.join(tmpDir, "../input"))));
}
});
});
(0, ava_1.default)("load non-local input with invalid repo syntax", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
// no filename given, just a repo
const configFile = "octo-org/codeql-config@main";
try {
@@ -161,12 +160,12 @@ function mockListLanguages(languages) {
throw new Error("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(configUtils.getConfigFileRepoFormatInvalidMessage("octo-org/codeql-config@main")));
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileRepoFormatInvalidMessage("octo-org/codeql-config@main")));
}
});
});
(0, ava_1.default)("load non-existent input", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const languages = "javascript";
const configFile = "input";
t.false(fs.existsSync(path.join(tmpDir, configFile)));
@@ -175,12 +174,12 @@ function mockListLanguages(languages) {
throw new Error("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(configUtils.getConfigFileDoesNotExistErrorMessage(path.join(tmpDir, "input"))));
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileDoesNotExistErrorMessage(path.join(tmpDir, "input"))));
}
});
});
(0, ava_1.default)("load non-empty input", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const codeQL = (0, codeql_1.setCodeQL)({
async resolveQueries() {
return {
@@ -253,7 +252,7 @@ function mockListLanguages(languages) {
});
});
(0, ava_1.default)("Default queries are used", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
// Check that the default behaviour is to add the default queries.
// In this case if a config file is specified but does not include
// the disable-default-queries field.
@@ -314,7 +313,7 @@ function queriesToResolvedQueryForm(queries) {
};
}
(0, ava_1.default)("Queries can be specified in config file", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const inputFileContents = `
name: my config
queries:
@@ -347,7 +346,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Queries from config file can be overridden in workflow file", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const inputFileContents = `
name: my config
queries:
@@ -383,7 +382,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Queries in workflow file can be used in tandem with the 'disable default queries' option", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
process.env["RUNNER_TEMP"] = tmpDir;
process.env["GITHUB_WORKSPACE"] = tmpDir;
const inputFileContents = `
@@ -417,7 +416,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Multiple queries can be specified in workflow file, no config file required", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
fs.mkdirSync(path.join(tmpDir, "override1"));
fs.mkdirSync(path.join(tmpDir, "override2"));
const testQueries = "./override1,./override2";
@@ -450,7 +449,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Queries in workflow file can be added to the set of queries without overriding config file", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
process.env["RUNNER_TEMP"] = tmpDir;
process.env["GITHUB_WORKSPACE"] = tmpDir;
const inputFileContents = `
@@ -496,7 +495,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Queries can be specified using config input", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const configInput = `
name: my config
queries:
@@ -538,7 +537,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Using config input and file together, config input should be used.", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
process.env["RUNNER_TEMP"] = tmpDir;
process.env["GITHUB_WORKSPACE"] = tmpDir;
const inputFileContents = `
@@ -587,7 +586,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Invalid queries in workflow file handled correctly", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const queries = "foo/bar@v1@v3";
const languages = "javascript";
// This function just needs to be type-correct; it doesn't need to do anything,
@@ -611,12 +610,12 @@ function queriesToResolvedQueryForm(queries) {
t.fail("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(configUtils.getQueryUsesInvalid(undefined, "foo/bar@v1@v3")));
t.deepEqual(err, new util_1.UserError(configUtils.getQueryUsesInvalid(undefined, "foo/bar@v1@v3")));
}
});
});
(0, ava_1.default)("API client used when reading remote config", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const codeQL = (0, codeql_1.setCodeQL)({
async resolveQueries() {
return {
@@ -658,7 +657,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Remote config handles the case where a directory is provided", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const dummyResponse = []; // directories are returned as arrays
mockGetContents(dummyResponse);
const repoReference = "octo-org/codeql-config/config.yaml@main";
@@ -667,12 +666,12 @@ function queriesToResolvedQueryForm(queries) {
throw new Error("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(configUtils.getConfigFileDirectoryGivenMessage(repoReference)));
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileDirectoryGivenMessage(repoReference)));
}
});
});
(0, ava_1.default)("Invalid format of remote config handled correctly", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const dummyResponse = {
// note no "content" property here
};
@@ -683,12 +682,12 @@ function queriesToResolvedQueryForm(queries) {
throw new Error("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(configUtils.getConfigFileFormatInvalidMessage(repoReference)));
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileFormatInvalidMessage(repoReference)));
}
});
});
(0, ava_1.default)("No detected languages", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
mockListLanguages([]);
const codeQL = (0, codeql_1.setCodeQL)({
async resolveLanguages() {
@@ -703,24 +702,24 @@ function queriesToResolvedQueryForm(queries) {
throw new Error("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(configUtils.getNoLanguagesError()));
t.deepEqual(err, new util_1.UserError(configUtils.getNoLanguagesError()));
}
});
});
(0, ava_1.default)("Unknown languages", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const languages = "rubbish,english";
try {
await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
throw new Error("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(configUtils.getUnknownLanguagesError(["rubbish", "english"])));
t.deepEqual(err, new util_1.UserError(configUtils.getUnknownLanguagesError(["rubbish", "english"])));
}
});
});
(0, ava_1.default)("Config specifies packages", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const codeQL = (0, codeql_1.setCodeQL)({
async resolveQueries() {
return {
@@ -749,7 +748,7 @@ function queriesToResolvedQueryForm(queries) {
});
});
(0, ava_1.default)("Config specifies packages for multiple languages", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const codeQL = (0, codeql_1.setCodeQL)({
async resolveQueries() {
return {
@@ -807,7 +806,7 @@ function queriesToResolvedQueryForm(queries) {
});
function doInvalidInputTest(testName, inputFileContents, expectedErrorMessageGenerator) {
(0, ava_1.default)(`load invalid input - ${testName}`, async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const codeQL = (0, codeql_1.setCodeQL)({
async resolveQueries() {
return {
@@ -829,7 +828,7 @@ function doInvalidInputTest(testName, inputFileContents, expectedErrorMessageGen
throw new Error("initConfig did not throw error");
}
catch (err) {
t.deepEqual(err, new Error(expectedErrorMessageGenerator(inputFile)));
t.deepEqual(err, new util_1.UserError(expectedErrorMessageGenerator(inputFile)));
}
});
});
@@ -990,7 +989,7 @@ const packSpecPrettyPrintingMacro = ava_1.default.macro({
exec: (t, packStr, packObj) => {
const parsed = configUtils.parsePacksSpecification(packStr);
t.deepEqual(parsed, packObj, "parsed pack spec is correct");
const stringified = configUtils.prettyPrintPack(packObj);
const stringified = (0, util_1.prettyPrintPack)(packObj);
t.deepEqual(stringified, packStr.trim(), "pretty-printed pack spec is correct");
t.deepEqual(configUtils.validatePackSpecification(packStr), packStr.trim(), "pack spec is valid");
},
@@ -1062,80 +1061,6 @@ parseInputAndConfigErrorMacro.title = (providedTitle) => `Parse Packs input and
(0, ava_1.default)("input with two languages", parseInputAndConfigErrorMacro, {}, "c/d", [languages_1.Language.cpp, languages_1.Language.csharp], false, /multi-language analysis/);
(0, ava_1.default)("input with + only", parseInputAndConfigErrorMacro, {}, " + ", [languages_1.Language.cpp], true, /remove the '\+'/);
(0, ava_1.default)("input with invalid pack name", parseInputAndConfigErrorMacro, {}, " xxx", [languages_1.Language.cpp], false, /"xxx" is not a valid pack/);
const mlPoweredQueriesMacro = ava_1.default.macro({
exec: async (t, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString) => {
return await util.withTmpDir(async (tmpDir) => {
const codeQL = (0, codeql_1.setCodeQL)({
async getVersion() {
return codeQLVersion;
},
async resolveQueries() {
return {
byLanguage: {
javascript: { "fake-query.ql": {} },
},
noDeclaredLanguage: {},
multipleDeclaredLanguages: {},
};
},
async packDownload() {
return { packs: [] };
},
});
const { packs } = await configUtils.initConfig("javascript", queriesInput, packsInput, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)(isMlPoweredQueriesEnabled ? [feature_flags_1.Feature.MlPoweredQueriesEnabled] : []), (0, logging_1.getRunnerLogger)(true));
if (expectedVersionString !== undefined) {
t.deepEqual(packs, {
[languages_1.Language.javascript]: [
`codeql/javascript-experimental-atm-queries@${expectedVersionString}`,
],
});
}
else {
t.deepEqual(packs, {});
}
});
},
title: (_providedTitle, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString) => `ML-powered queries ${expectedVersionString !== undefined
? `${expectedVersionString} are`
: "aren't"} loaded for packs: ${packsInput}, queries: ${queriesInput} using CLI v${codeQLVersion} when feature is ${isMlPoweredQueriesEnabled ? "enabled" : "disabled"}`,
});
// macro, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString
// Test that ML-powered queries aren't run when the feature is off.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", false, undefined, "security-extended", undefined);
// Test that the ~0.1.0 version of ML-powered queries is run on v2.8.3 of the CLI.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.8.3", true, undefined, "security-extended", process.platform === "win32" ? undefined : "~0.1.0");
// Test that ML-powered queries aren't run when the user hasn't specified that we should run the
// `security-extended`, `security-and-quality`, or `security-experimental` query suite.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.7.5", true, undefined, undefined, undefined);
// Test that ML-powered queries are run on non-Windows platforms running `security-extended` on
// versions of the CodeQL CLI prior to 2.9.0.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.8.5", true, undefined, "security-extended", process.platform === "win32" ? undefined : "~0.2.0");
// Test that ML-powered queries are run on non-Windows platforms running `security-and-quality` on
// versions of the CodeQL CLI prior to 2.9.0.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.8.5", true, undefined, "security-and-quality", process.platform === "win32" ? undefined : "~0.2.0");
// Test that ML-powered queries are run on all platforms running `security-extended` on CodeQL CLI
// 2.9.0+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.0", true, undefined, "security-extended", "~0.2.0");
// Test that ML-powered queries are run on all platforms running `security-and-quality` on CodeQL
// CLI 2.9.0+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.0", true, undefined, "security-and-quality", "~0.2.0");
// Test that we don't inject an ML-powered query pack if the user has already specified one.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.0", true, "codeql/javascript-experimental-atm-queries@0.0.1", "security-and-quality", "0.0.1");
// Test that ML-powered queries are run on all platforms running `security-extended` on CodeQL
// CLI 2.9.3+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.3", true, undefined, "security-extended", "~0.3.0");
// Test that ML-powered queries are run on all platforms running `security-and-quality` on CodeQL
// CLI 2.9.3+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.3", true, undefined, "security-and-quality", "~0.3.0");
// Test that ML-powered queries are run on all platforms running `security-extended` on CodeQL
// CLI 2.11.3+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.11.3", true, undefined, "security-extended", "~0.4.0");
// Test that ML-powered queries are run on all platforms running `security-and-quality` on CodeQL
// CLI 2.11.3+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.11.3", true, undefined, "security-and-quality", "~0.4.0");
// Test that ML-powered queries are run on all platforms running `security-experimental` on CodeQL
// CLI 2.12.1+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.1", true, undefined, "security-experimental", "~0.4.0");
const calculateAugmentationMacro = ava_1.default.macro({
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedAugmentationProperties) => {
const actualAugmentationProperties = configUtils.calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
@@ -1148,35 +1073,30 @@ const calculateAugmentationMacro = ava_1.default.macro({
queriesInput: undefined,
packsInputCombines: false,
packsInput: undefined,
injectedMlQueries: false,
});
(0, ava_1.default)(calculateAugmentationMacro, "With queries", undefined, " a, b , c, d", [languages_1.Language.javascript], {
queriesInputCombines: false,
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
packsInputCombines: false,
packsInput: undefined,
injectedMlQueries: false,
});
(0, ava_1.default)(calculateAugmentationMacro, "With queries combining", undefined, " + a, b , c, d ", [languages_1.Language.javascript], {
queriesInputCombines: true,
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
packsInputCombines: false,
packsInput: undefined,
injectedMlQueries: false,
});
(0, ava_1.default)(calculateAugmentationMacro, "With packs", " codeql/a , codeql/b , codeql/c , codeql/d ", undefined, [languages_1.Language.javascript], {
queriesInputCombines: false,
queriesInput: undefined,
packsInputCombines: false,
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
injectedMlQueries: false,
});
(0, ava_1.default)(calculateAugmentationMacro, "With packs combining", " + codeql/a, codeql/b, codeql/c, codeql/d", undefined, [languages_1.Language.javascript], {
queriesInputCombines: false,
queriesInput: undefined,
packsInputCombines: true,
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
injectedMlQueries: false,
});
const calculateAugmentationErrorMacro = ava_1.default.macro({
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedError) => {
@@ -1190,7 +1110,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
(0, ava_1.default)(calculateAugmentationErrorMacro, "Packs input with no languages", " + a/b, c/d ", undefined, [], /No languages specified/);
(0, ava_1.default)(calculateAugmentationErrorMacro, "Invalid packs", " a-pack-without-a-scope ", undefined, [languages_1.Language.javascript], /"a-pack-without-a-scope" is not a valid pack/);
(0, ava_1.default)("downloadPacks-no-registries", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const packDownloadStub = sinon.stub();
packDownloadStub.callsFake((packs) => ({
packs,
@@ -1217,7 +1137,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
(0, ava_1.default)("downloadPacks-with-registries", async (t) => {
// same thing, but this time include a registries block and
// associated env vars
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
process.env.GITHUB_TOKEN = "not-a-token";
process.env.CODEQL_REGISTRIES_AUTH = undefined;
const logger = (0, logging_1.getRunnerLogger)(true);
@@ -1257,7 +1177,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
});
const codeQL = (0, codeql_1.setCodeQL)({
packDownload: packDownloadStub,
getVersion: () => Promise.resolve("2.10.5"),
getVersion: () => Promise.resolve((0, testing_utils_1.makeVersionInfo)("2.10.5")),
});
// packs are supplied for go, java, and python
// analyzed languages are java, javascript, and python
@@ -1281,37 +1201,10 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
t.deepEqual(process.env.CODEQL_REGISTRIES_AUTH, undefined);
});
});
(0, ava_1.default)("downloadPacks-with-registries fails on 2.10.3", async (t) => {
// same thing, but this time include a registries block and
// associated env vars
return await util.withTmpDir(async (tmpDir) => {
process.env.GITHUB_TOKEN = "not-a-token";
process.env.CODEQL_REGISTRIES_AUTH = "not-a-registries-auth";
const logger = (0, logging_1.getRunnerLogger)(true);
const registriesInput = yaml.dump([
{
url: "http://ghcr.io",
packages: ["codeql/*", "codeql-testing/*"],
token: "not-a-token",
},
{
url: "https://containers.GHEHOSTNAME1/v2/",
packages: "semmle/*",
token: "still-not-a-token",
},
]);
const codeQL = (0, codeql_1.setCodeQL)({
getVersion: () => Promise.resolve("2.10.3"),
});
await t.throwsAsync(async () => {
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
}, { instanceOf: Error }, "'registries' input is not supported on CodeQL versions less than 2.10.4.");
});
});
(0, ava_1.default)("downloadPacks-with-registries fails with invalid registries block", async (t) => {
// same thing, but this time include a registries block and
// associated env vars
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
process.env.GITHUB_TOKEN = "not-a-token";
process.env.CODEQL_REGISTRIES_AUTH = "not-a-registries-auth";
const logger = (0, logging_1.getRunnerLogger)(true);
@@ -1328,48 +1221,24 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
},
]);
const codeQL = (0, codeql_1.setCodeQL)({
getVersion: () => Promise.resolve("2.10.4"),
getVersion: () => Promise.resolve((0, testing_utils_1.makeVersionInfo)("2.10.4")),
});
await t.throwsAsync(async () => {
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
}, { instanceOf: Error }, "Invalid 'registries' input. Must be an array of objects with 'url' and 'packages' properties.");
});
});
// the happy path for generateRegistries is already tested in downloadPacks.
// these following tests are for the error cases and when nothing is generated.
(0, ava_1.default)("no generateRegistries when CLI is too old", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
const registriesInput = yaml.dump([
{
// no slash
url: "http://ghcr.io",
packages: ["codeql/*", "codeql-testing/*"],
token: "not-a-token",
},
]);
const codeQL = (0, codeql_1.setCodeQL)({
// Accepted CLI versions are 2.10.4 or higher
getVersion: () => Promise.resolve("2.10.3"),
});
const logger = (0, logging_1.getRunnerLogger)(true);
await t.throwsAsync(async () => await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger), undefined, "'registries' input is not supported on CodeQL versions less than 2.10.4.");
});
});
(0, ava_1.default)("no generateRegistries when registries is undefined", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const registriesInput = undefined;
const codeQL = (0, codeql_1.setCodeQL)({
// Accepted CLI versions are 2.10.4 or higher
getVersion: () => Promise.resolve(codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD),
});
const logger = (0, logging_1.getRunnerLogger)(true);
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger);
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, tmpDir, logger);
t.is(registriesAuthTokens, undefined);
t.is(qlconfigFile, undefined);
});
});
(0, ava_1.default)("generateRegistries prefers original CODEQL_REGISTRIES_AUTH", async (t) => {
return await util.withTmpDir(async (tmpDir) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
process.env.CODEQL_REGISTRIES_AUTH = "original";
const registriesInput = yaml.dump([
{
@@ -1378,12 +1247,8 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
token: "not-a-token",
},
]);
const codeQL = (0, codeql_1.setCodeQL)({
// Accepted CLI versions are 2.10.4 or higher
getVersion: () => Promise.resolve(codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD),
});
const logger = (0, logging_1.getRunnerLogger)(true);
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger);
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, tmpDir, logger);
t.is(registriesAuthTokens, "original");
t.is(qlconfigFile, path.join(tmpDir, "qlconfig.yml"));
});

File diff suppressed because one or more lines are too long

View File

@@ -56,12 +56,14 @@ async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
const bundledDb = await (0, util_1.bundleDb)(config, language, codeql, language);
const bundledDbSize = fs.statSync(bundledDb).size;
const bundledDbReadStream = fs.createReadStream(bundledDb);
const commitOid = await actionsUtil.getCommitOid(actionsUtil.getRequiredInput("checkout_path"));
try {
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`, {
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid`, {
owner: repositoryNwo.owner,
repo: repositoryNwo.repo,
language,
name: `${language}-database`,
commit_oid: commitOid,
data: bundledDbReadStream,
headers: {
authorization: `token ${apiDetails.auth}`,

View File

@@ -1 +1 @@
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAIrC,6CAA+B;AAC/B,iCAAkC;AAE3B,KAAK,UAAU,eAAe,CACnC,aAA4B,EAC5B,MAAc,EACd,UAA4B,EAC5B,MAAc;IAEd,IAAI,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,MAAM,EAAE;QAC9D,M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{
// Passing an auth token is required, so we just use a dummy value
const client = github.getOctokit("123");
const requestSpy = sinon.stub(client, "request");
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name";
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid";
const databaseUploadSpy = requestSpy.withArgs(url);
if (databaseUploadStatusCode < 300) {
databaseUploadSpy.resolves(undefined);
@@ -93,7 +93,8 @@ async function mockHttpRequests(databaseUploadStatusCode) {
const loggedMessages = [];
await (0, database_upload_1.uploadDatabases)(testRepoName, getTestConfig(tmpDir), testApiDetails, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
t.assert(loggedMessages.find((v) => v.type === "debug" &&
v.message === "Database upload disabled in workflow. Skipping upload.") !== undefined);
v.message ===
"Database upload disabled in workflow. Skipping upload.") !== undefined);
});
});
(0, ava_1.default)("Abort database upload if running against GHES", async (t) => {

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More