Skip to content

Commit 74eb3b3

Browse files
authored
Merge pull request #6 from github/master
Merge changes from master into v1
2 parents 28ccc3d + 606ff65 commit 74eb3b3

File tree

3 files changed

+60
-52
lines changed

3 files changed

+60
-52
lines changed

README.md

Lines changed: 58 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# CodeQL Action
2-
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.
3-
1+
# CodeQL Action
2+
3+
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.
4+
45
[Sign up for the Advanced Security beta](https://github.com/features/security/advanced-security/signup)
5-
6-
## Usage
6+
7+
## Usage
78

89
To get code scanning results from CodeQL analysis on your repo you can use the following workflow as a template:
910

@@ -22,39 +23,38 @@ jobs:
2223
strategy:
2324
fail-fast: false
2425

25-
2626
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
2727
runs-on: ubuntu-latest
2828

2929
steps:
30-
- name: Checkout repository
31-
uses: actions/checkout@v2
32-
33-
# Initializes the CodeQL tools for scanning.
34-
- name: Initialize CodeQL
35-
uses: github/codeql-action/init@v1
36-
# Override language selection by uncommenting this and choosing your languages
37-
# with:
38-
# languages: go, javascript, csharp, python, cpp, java
39-
40-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
41-
# If this step fails, then you should remove it and run the build manually (see below).
42-
- name: Autobuild
43-
uses: github/codeql-action/autobuild@v1
44-
45-
# ℹ️ Command-line programs to run using the OS shell.
46-
# 📚 https://git.io/JvXDl
47-
48-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
49-
# and modify them (or add more) to build your code if your project
50-
# uses a compiled language
51-
52-
#- run: |
53-
# make bootstrap
54-
# make release
55-
56-
- name: Perform CodeQL Analysis
57-
uses: github/codeql-action/analyze@v1
30+
- name: Checkout repository
31+
uses: actions/checkout@v2
32+
33+
# Initializes the CodeQL tools for scanning.
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@v1
36+
# Override language selection by uncommenting this and choosing your languages
37+
# with:
38+
# languages: go, javascript, csharp, python, cpp, java
39+
40+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
41+
# If this step fails, then you should remove it and run the build manually (see below).
42+
- name: Autobuild
43+
uses: github/codeql-action/autobuild@v1
44+
45+
# ℹ️ Command-line programs to run using the OS shell.
46+
# 📚 https://git.io/JvXDl
47+
48+
# ✏️ If the Autobuild fails above, remove it and uncomment the following
49+
# three lines and modify them (or add more) to build your code if your
50+
# project uses a compiled language
51+
52+
#- run: |
53+
# make bootstrap
54+
# make release
55+
56+
- name: Perform CodeQL Analysis
57+
uses: github/codeql-action/analyze@v1
5858
```
5959
6060
If you prefer to integrate this within an existing CI workflow, it should end up looking something like this:
@@ -73,19 +73,23 @@ If you prefer to integrate this within an existing CI workflow, it should end up
7373
- name: Perform CodeQL Analysis
7474
uses: github/codeql-action/analyze@v1
7575
```
76+
7677
### Actions triggers
77-
The CodeQL action should be run on `push` events, and on a `schedule`. `Push` events allow us to do detailed analysis of the delta in a pull request, while the `schedule` event ensures that GitHub regularly scans the repository for the latest vulnerabilities, even if the repository becomes inactive. This action does not support the `pull_request` event.
7878
79-
### Configuration
79+
The CodeQL action should be run on `push` events, and on a `schedule`. `Push` events allow us to do a detailed analysis of the delta in a pull request, while the `schedule` event ensures that GitHub regularly scans the repository for the latest vulnerabilities, even if the repository becomes inactive. This action does not support the `pull_request` event.
80+
81+
### Configuration
82+
8083
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).
8184

8285
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.
8386
Identifying potential files for extraction:
84-
- Scans each folder that's defined as `paths` in turn, traversing subfolders and looking for relevant files.
87+
88+
- Scans each folder that's defined as `paths` in turn, traversing subfolders, and looking for relevant files.
8589
- If it finds a subfolder that's defined as `paths-ignore`, stop traversing.
8690
- If a file or folder is both in `paths` and `paths-ignore`, the `paths-ignore` is ignored.
8791

88-
Use the config-file parameter of the init action to enable the configuration file. For example:
92+
Use the `config-file` parameter of the init action to enable the configuration file. For example:
8993

9094
```yaml
9195
- uses: github/codeql-action/init@v1
@@ -103,17 +107,17 @@ queries:
103107
uses: ./my-queries
104108
- name: External Javascript QL pack (Runs a QL pack located in an external repo)
105109
uses: /Semmle/ql/javascript/ql/src/Electron@master
106-
- name: External query (Runs a single query located in an external QL pack)
107-
uses: Semmle/ql/javascript/ql/src/AngularJS/DeadAngularJSEventListener.ql@master
110+
- name: External query (Runs a single query located in an external QL pack)
111+
uses: Semmle/ql/javascript/ql/src/AngularJS/DeadAngularJSEventListener.ql@master
108112
- name: Select query suite (Runs a query suites)
109113
uses: ./codeql-querypacks/complex-python-querypack/rootAndBar.qls
110114
111115
paths:
112116
- src/util.ts
113117
114118
paths-ignore:
115-
- src
116-
- lib
119+
- src
120+
- lib
117121
```
118122

119123
## Troubleshooting
@@ -128,6 +132,7 @@ Try passing
128132
env:
129133
GOFLAGS: "-mod=vendor"
130134
```
135+
131136
to `github/codeql-action/analyze`.
132137

133138
### If you do not use a vendor directory
@@ -136,21 +141,24 @@ Dependencies on public repositories should just work. If you have dependencies o
136141

137142
```yaml
138143
steps:
139-
- name: Configure git private repo access
140-
env:
141-
TOKEN: ${{ secrets.GITHUB_PAT }}
142-
run: |
143-
git config --global url."https://${TOKEN}@github.com/foo/bar".insteadOf "https://github.com/foo/bar"
144-
git config --global url."https://${TOKEN}@github.com/foo/baz".insteadOf "https://github.com/foo/baz"
144+
- name: Configure git private repo access
145+
env:
146+
TOKEN: ${{ secrets.GITHUB_PAT }}
147+
run: |
148+
git config --global url."https://${TOKEN}@github.com/foo/bar".insteadOf "https://github.com/foo/bar"
149+
git config --global url."https://${TOKEN}@github.com/foo/baz".insteadOf "https://github.com/foo/baz"
145150
```
146-
before any codeql actions. A similar thing can also be done with a SSH key or deploy key.
151+
152+
before any codeql actions. A similar thing can also be done with an SSH key or deploy key.
147153

148154
### C# using dotnet version 2 on linux
149155

150156
This currently requires invoking `dotnet` with the `/p:UseSharedCompilation=false` flag. For example:
151-
```
157+
158+
```shell
152159
dotnet build /p:UseSharedCompilation=false
153160
```
161+
154162
Version 3 does not require the additional flag.
155163

156164
## License

lib/config-utils.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function initConfig(): Config {
9191
}
9292

9393
const pathsIgnore = parsedYAML['paths-ignore'];
94-
if (pathsIgnore && queries instanceof Array) {
94+
if (pathsIgnore && pathsIgnore instanceof Array) {
9595
pathsIgnore.forEach(path => {
9696
if (typeof path === "string") {
9797
config.pathsIgnore.push(path);

0 commit comments

Comments
 (0)