From 6b3098d26c5e696e4c9a6dfb324b5ce0e7276837 Mon Sep 17 00:00:00 2001 From: Chad Bentz <1760475+felickz@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:26:18 -0500 Subject: [PATCH] Add configuration instructions for trusted Action publishers using data extensions --- .../Security/CWE-829/UnpinnedActionsTag.md | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/actions/ql/src/Security/CWE-829/UnpinnedActionsTag.md b/actions/ql/src/Security/CWE-829/UnpinnedActionsTag.md index d7c114f0404e..cdeca42249b7 100644 --- a/actions/ql/src/Security/CWE-829/UnpinnedActionsTag.md +++ b/actions/ql/src/Security/CWE-829/UnpinnedActionsTag.md @@ -8,6 +8,42 @@ Using a tag for a 3rd party Action that is not pinned to a commit can lead to ex 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. + +### Configuration + +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. + +#### Example + +To allow any Action from the publisher `octodemo`, such as `octodemo/3rd-party-action`, follow these steps: + +1. Create a data extension file `/models/trusted-owner.model.yml` with the following content: + + ```yaml + extensions: + - addsTo: + pack: codeql/actions-all + extensible: trustedActionsOwnerDataModel + data: + - ["octodemo"] + ``` + +2. Create a model pack file `/codeql-pack.yml` with the following content: + + ```yaml + name: my-org/actions-extensions-model-pack + version: 0.0.0 + library: true + extensionTargets: + codeql/actions-all: '*' + dataExtensions: + - models/**/*.yml + ``` + +3. Ensure that the model pack is included in your CodeQL analysis. + +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. + ## Examples ### Incorrect Usage @@ -25,3 +61,6 @@ Pinning an action to a full length commit SHA is currently the only way to use a ## References - [Using third-party actions](https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions) +- [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) +- [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) +