Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2789712
Send tool names as parameter to upload endpoint
kevinsawicki Apr 28, 2020
b419ff6
Error on queries with missing/multiple languages
Daverlo Apr 29, 2020
5c74b0f
Parse ignoreDefaultQueries field
Daverlo Apr 29, 2020
8bd6c1e
Ignore default queries
Daverlo Apr 29, 2020
32ced8c
Update README
Daverlo Apr 29, 2020
6f11b5d
Add initial util test
kevinsawicki Apr 29, 2020
0916a68
Merge branch 'master' into send-tool-names
kevinsawicki Apr 29, 2020
62f756f
Fix other typo
kevinsawicki Apr 29, 2020
20a0628
Fix typos / errors in PR template
robertbrignull Apr 29, 2020
0cf8450
Bump @actions/http-client from 1.0.4 to 1.0.8
dependabot[bot] Apr 29, 2020
bbc0dc8
Merge pull request #2 from github/send-tool-names
kevinsawicki Apr 29, 2020
f237316
Improve errors & warnings in autobuild
Apr 29, 2020
34db3b0
Update README.md
jhutchings1 Apr 29, 2020
2809bdc
ignore-default-queries -> disable-default-queries
Daverlo Apr 30, 2020
d60a855
Merge pull request #9 from github/dependabot/npm_and_yarn/actions/htt…
Daverlo Apr 30, 2020
6997a21
Address comments
Daverlo Apr 30, 2020
9fa2bfe
Merge branch 'master' into no-ql-pack
Daverlo Apr 30, 2020
9e35ea1
Merge branch 'master' into disable-default-queries
Daverlo Apr 30, 2020
f16b356
Merge pull request #4 from github/no-ql-pack
Daverlo Apr 30, 2020
1bb13e0
Merge branch 'master' into pr_template_typos
robertbrignull Apr 30, 2020
2927476
Merge pull request #8 from github/pr_template_typos
robertbrignull Apr 30, 2020
d2a505d
Merge branch 'master' into disable-default-queries
Daverlo Apr 30, 2020
1cdde3e
Merge pull request #7 from github/disable-default-queries
Daverlo Apr 30, 2020
7963db1
Move error to correct catch block
Apr 30, 2020
26e955c
report status as failure if upload fails
Apr 30, 2020
1da651c
Add retries to the upload
robertbrignull May 1, 2020
5d2700f
Increase the log level of the message showing what SARIF files were u…
chrisgavin May 1, 2020
cffc0f7
fix typo
robertbrignull May 1, 2020
e52e34b
remove change to behaviour on 500 errors
robertbrignull May 1, 2020
b6a0306
Fail the upload action if uploading a folder with no SARIF files in.
chrisgavin May 1, 2020
0c4fc16
only retry on 5xx status codes
robertbrignull May 1, 2020
a23cb1d
include status code is error message
robertbrignull May 1, 2020
129ce28
Update upload-lib.ts
robertbrignull May 1, 2020
5bceb2b
Merge pull request #13 from github/upload_retry
robertbrignull May 1, 2020
1fe0932
Merge branch 'master' into autobuild_errors
robertbrignull May 1, 2020
4e9886a
Stop the upload action early if no files will be uploaded.
chrisgavin May 1, 2020
d68eb11
Merge branch 'master' into report-upload-failures
May 1, 2020
8ff10b4
Merge branch 'master' into better-feedback-folder-uploads
chrisgavin May 1, 2020
3d3dccf
Merge pull request #14 from github/better-feedback-folder-uploads
chrisgavin May 1, 2020
43e2701
Merge branch 'master' into report-upload-failures
May 1, 2020
d46c1c7
Merge pull request #12 from github/report-upload-failures
joshhale May 1, 2020
984552a
Merge branch 'master' into autobuild_errors
May 1, 2020
5218f93
Merge pull request #10 from github/autobuild_errors
May 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Merge / deployment checklist

- Run test builds as necessary. Can be on this repository or elsewhere as needed in order to test the change - please include links to tests in otehr repos!
- [ ] CodeQL using init/finish actions
- Run test builds as necessary. Can be on this repository or elsewhere as needed in order to test the change - please include links to tests in other repos!
- [ ] CodeQL using init/analyze actions
- [ ] 3rd party tool using upload action
- [ ] Confirm this change is backwards compatible with existing workflows.
- [ ] Confirm the [readme](https://github.com/github/codeql-action/blob/master/README.md) has been updated if necessary.
- [ ] Confirm the [readme](https://github.com/github/codeql-action/blob/master/README.md) has been updated if necessary.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

This action runs GitHub's industry-leading static analysis engine, CodeQL, 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/semmle/ql), which have been developed by the community and the [GitHub Security Lab](https://securitylab.github.com/) to find common vulnerabilities in your code.

[Sign up for the Advanced Security beta](https://github.com/features/security/advanced-security/signup)

## Usage

To get code scanning results from CodeQL analysis on your repo you can use the following workflow as a template:
Expand Down Expand Up @@ -82,6 +80,8 @@ The CodeQL action should be run on `push` events, and on a `schedule`. `Push` ev

You may optionally specify additional queries for CodeQL to execute by using a config file. The queries must belong to a [QL pack](https://help.semmle.com/codeql/codeql-cli/reference/qlpack-overview.html) and can be in your repository or any public repository. You can choose a single .ql file, a folder containing multiple .ql files, a .qls [query suite](https://help.semmle.com/codeql/codeql-cli/procedures/query-suites.html) file, or any combination of the above. To use queries from other repositories use the same syntax as when [using an action](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsuses).

You can disable the default queries using `disable-default-queries: true`.

You can choose to ignore some files or folders from the analysis, or include additional files/folders for analysis. This *only* works for Javascript and Python analysis.
Identifying potential files for extraction:

Expand All @@ -102,6 +102,8 @@ A config file looks like this:
```yaml
name: "My CodeQL config"

disable-default-queries: true

queries:
- name: In-repo queries (Runs the queries located in the my-queries folder of the repo)
uses: ./my-queries
Expand Down
10 changes: 7 additions & 3 deletions lib/autobuild.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/config-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions lib/finalize-db.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 65 additions & 26 deletions lib/upload-lib.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions lib/upload-sarif.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions lib/util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@actions/core": "^1.0.0",
"@actions/exec": "^1.0.1",
"@actions/http-client": "^1.0.4",
"@actions/http-client": "^1.0.8",
"@actions/io": "^1.0.1",
"@actions/tool-cache": "^1.1.2",
"@octokit/rest": "^17.1.0",
Expand Down
11 changes: 8 additions & 3 deletions src/autobuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ async function run() {
// We want pick the dominant language in the repo from the ones we're able to build
// The languages are sorted in order specified by user or by lines of code if we got
// them from the GitHub API, so try to build the first language on the list.
const language = process.env[sharedEnv.CODEQL_ACTION_TRACED_LANGUAGES]?.split(',')[0];
const autobuildLanguages = process.env[sharedEnv.CODEQL_ACTION_TRACED_LANGUAGES]?.split(',') || [];
const language = autobuildLanguages[0];

if (!language) {
core.info("None of the languages in this project require extra build steps");
Expand All @@ -24,6 +25,10 @@ async function run() {

core.debug(`Detected dominant traced language: ${language}`);

if (autobuildLanguages.length > 1) {
core.warning(`We will only automatically build ${language} code. If you wish to scan ${autobuildLanguages.slice(1).join(' and ')}, you must replace this block with custom build steps.`);
}

core.startGroup(`Attempting to automatically build ${language} code`);
// TODO: share config accross actions better via env variables
const codeqlCmd = util.getRequiredEnvParam(sharedEnv.CODEQL_ACTION_CMD);
Expand All @@ -44,7 +49,7 @@ async function run() {
core.endGroup();

} catch (error) {
core.setFailed(error.message);
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 util.reportActionFailed('autobuild', error.message, error.stack);
return;
}
Expand All @@ -53,6 +58,6 @@ async function run() {
}

run().catch(e => {
core.setFailed("autobuild action failed: " + e);
core.setFailed("autobuild action failed. " + e);
console.log(e);
});
Loading