Skip to content

Commit 71cd779

Browse files
committed
feat: Update README
1 parent 80f4c28 commit 71cd779

File tree

1 file changed

+118
-15
lines changed

1 file changed

+118
-15
lines changed

README.md

Lines changed: 118 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
# gh-codeql-scan
1+
<!-- markdownlint-disable -->
2+
<div align="center">
23

3-
GitHub CLI CodeQL Scan Extension to help abstract CodeQL away from users.
4+
<h1>gh-codeql-scan</h1>
5+
6+
[![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)][github]
7+
[![GitHub Issues](https://img.shields.io/github/issues/advanced-security/gh-codeql-scan?style=for-the-badge)][github-issues]
8+
[![GitHub Stars](https://img.shields.io/github/stars/advanced-security/gh-codeql-scan?style=for-the-badge)][github]
9+
[![License](https://img.shields.io/github/license/advanced-security/gh-codeql-scan?style=for-the-badge)][license]
10+
11+
</div>
12+
<!-- markdownlint-restore -->
13+
14+
[GitHub CLI CodeQL Scan Extension][github] to help abstract [CodeQL][codeql] away from users.
15+
16+
<details>
17+
<summary>Motivation</summary>
18+
19+
This project was created to make the lives of users that use CodeQL simpiler.
20+
CodeQL outside of GitHub Actions can be complicated but this projects aim is to make it as simple as possible.
21+
22+
</details>
423

524
## Requirements
625

726
- [GitHub CLI](https://cli.github.com/)
27+
- [CodeQL GH Extension][gh-codeql] (optional)
828

929
## Install and Setup
1030

@@ -17,9 +37,59 @@ gh extensions install advanced-security/gh-codeql-scan
1737
gh codeql-scan --help
1838
```
1939

40+
<details>
41+
<summary>CLI Help</summary>
42+
43+
<pre>
44+
GitHub CodeQL Scan tool
45+
46+
gh codeql-scan {MODE} {ARGS}
47+
48+
# Modes
49+
50+
gh codeql-scan # default: "scan"
51+
gh codeql-scan init # initialise the scan
52+
gh codeql-scan analyze # run the analysis
53+
gh codeql-scan upload # upload present SARIF files
54+
gh codeql-scan scan # full end-to-end scan
55+
56+
# Arguments
57+
58+
> All arguments can be set with enviroment variables
59+
60+
-h|--help # Print help
61+
--debug # Enable debugging
62+
63+
-r=*|--repo=* # GitHub Respository (OWNER/NAME)
64+
-i=*|--instance=* # GitHub Instance (github.com or Enterprise Server)
65+
66+
-l=*|--language=* # Set language to scan
67+
--auto-detect # Auto-detect languages
68+
69+
-s=*|--suite=* # Query Suite to use
70+
-d=*|--databases=* # Location of the databases to store
71+
-b=*|--binary=* # Path to the CodeQL Binary
72+
-w=*|--workspace=* # Workspace for the souce code
73+
74+
-c=*|--command=* # Set the build comment (compiled languages)
75+
-m=*|--mode=* # Build mode (autobuild | none)
76+
--buildless # Enable buildless / build mode none
77+
78+
--view-in-vscode # Auto-open the results in VSCode
79+
80+
--disable-tracing # Disable Build Tracing
81+
--disable-trap-caching # Disable Trap file caching
82+
--disable-upload # Disable Uploading SARIF to GitHub
83+
--disable-banner # Disable printing banner
84+
</pre>
85+
86+
</details>
87+
88+
### Alias / Stub
89+
2090
A couple of tips and tricks:
2191

22-
```
92+
```bash
2393
# Create an alias to make things even easier
2494
alias codeql-scan="gh codeql-scan"
2595
```
@@ -33,46 +103,79 @@ The main use of the script is to automatically run CodeQL in a number of modes.
33103
gh codeql-scan
34104
```
35105

106+
#### Initialise with language
107+
108+
Automatically detect languages or manually set the language to create an initial CodeQL database.
109+
36110
```bash
37-
# `init` mode: Create only the Codeql database
38111
gh codeql-scan init --auto-detect
39112
# or manually set language
40113
gh codeql-scan init -l=java
41114
```
42115

116+
#### Scan without build
117+
118+
This will scan your code in build mode `none`.
119+
120+
```bash
121+
gh codeql-scan -m="none"
122+
# or simply
123+
gh codeql-scan --buildless
124+
```
125+
126+
#### Scan with Build Command
127+
128+
Pass in the build command for a compiled language and it will be run along with CodeQL.
129+
43130
```bash
44-
# Compiled languages - pass in build command
45131
gh codeql-scan -c "mvn build ..."
46132
```
47133

134+
#### Indirect build tracing
135+
136+
For Compiled languages, complicated build process using indirect build tracing
137+
48138
```bash
49-
# Compiled languages - complicated build process using indirect build tracing
50139
gh codeql-scan init
51140
echo "password=$password" > settings.xml
52141
mvn build --random-custom=flags
53142
gh codeql-scan analyze
54143
```
55144

145+
#### Running analysis
146+
147+
Run query-suites on an existing database (auto-detects databases)
148+
56149
```bash
57-
# `analyze` mode: Run query-suites on an existing database (auto-detects databases)
58150
gh codeql-scan analyze
59151
```
60152

153+
#### Uploading results to GitHub
154+
155+
The `upload` mode will upload all SARIF files for you to a repository
156+
61157
```bash
62-
# `upload` mode: Upload all SARIF files
63158
gh codeql-scan upload
64159
```
65160

66-
## License
67-
68-
This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE.md) for the full terms.
69-
70161
## Maintainers
71162

72163
- @GeekMasher
73164

74-
## Support
165+
## Support / Maintainance
166+
167+
Support is via [GitHub Issues][github-issues]
168+
169+
## License
170+
171+
This project is licensed under the terms of the MIT open source license.
172+
Please refer to [MIT][license] for the full terms.
173+
174+
<!-- Resources -->
75175

76-
Support is via [GitHub Issues](https://github.com/advanced-security/gh-codeql-scan/issues)
176+
[license]: ./LICENSE
177+
[github]: https://github.com/advanced-security/gh-codeql-scan
178+
[github-issues]: https://github.com/advanced-security/gh-codeql-scan/issues
179+
[codeql]: https://codeql.github.com/
180+
[gh-codeql]: https://github.com/github/gh-codeql
77181

78-
## Acknowledgement

0 commit comments

Comments
 (0)