Skip to content

Commit 2bef3c3

Browse files
authored
Adding comprehensive docs for customizing query
1 parent c8e564b commit 2bef3c3

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
### Configuration
2+
3+
If there is an Action publisher that you trust, you can include the owner name/organization in a data extension model pack to add it to the allow list for this query. Adding owners to this list will prevent security alerts when using unpinned tags for Actions published by that owner.
4+
5+
#### Example
6+
7+
To allow any Action from the publisher `octodemo`, such as `octodemo/3rd-party-action`, follow these steps:
8+
9+
1. Create a data extension file `/models/trusted-owner.model.yml` with the following content:
10+
11+
```yaml
12+
extensions:
13+
- addsTo:
14+
pack: codeql/actions-all
15+
extensible: trustedActionsOwnerDataModel
16+
data:
17+
- ["octodemo"]
18+
```
19+
20+
2. Create a model pack file `/codeql-pack.yml` with the following content:
21+
22+
```yaml
23+
name: my-org/actions-extensions-model-pack
24+
version: 0.0.0
25+
library: true
26+
extensionTargets:
27+
codeql/actions-all: '*'
28+
dataExtensions:
29+
- models/**/*.yml
30+
```
31+
32+
3. Ensure that the model pack is included in your CodeQL analysis.
33+
34+
By following these steps, you will add `octodemo` to the list of trusted Action publishers, and the query will no longer generate security alerts for unpinned tags from this publisher.
35+
36+
## References
37+
- [Extending CodeQL coverage with CodeQL model packs in default setup](https://docs.github.com/en/code-security/code-scanning/managing-your-code-scanning-configuration/editing-your-configuration-of-default-setup#extending-codeql-coverage-with-codeql-model-packs-in-default-setup)
38+
- [Creating and working with CodeQL packs](https://docs.github.com/en/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/creating-and-working-with-codeql-packs#creating-a-codeql-model-pack)
39+
- [Customizing library models for GitHub Actions](https://codeql.github.com/docs/codeql-language-guides/customizing-library-models-for-actions/)

actions/ql/src/Security/CWE-829/UnpinnedActionsTag.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Using a tag for a 3rd party Action that is not pinned to a commit can lead to ex
88

99
Pinning an action to a full length commit SHA is currently the only way to use a non-immutable action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. When selecting a SHA, you should verify it is from the action's repository and not a repository fork.
1010

11+
See the [`UnpinnedActionsTag-CUSTOMIZING.md`](https://github.com/github/codeql/blob/main/actions/ql/src/Security/CWE-829/UnpinnedActionsTag-CUSTOMIZING.md) file in the source code for this query for information on how to extend the list of Action publishers trusted by this query.
12+
1113
## Examples
1214

1315
### Incorrect Usage

0 commit comments

Comments
 (0)