Skip to content

Commit f814849

Browse files
authored
Merge pull request #19427 from felickz/unpinned-actions-tags-docs
Adding comprehensive docs for customizing `actions/unpinned-tag` query
2 parents 60cc63f + d3aa2a1 commit f814849

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

docs/codeql/codeql-language-guides/customizing-library-models-for-actions.rst

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,43 @@ Customizing Actions-specific analysis:
4343
- **untrustedGhCommandDataModel**\(cmd_regex, flag)
4444
- **untrustedGitCommandDataModel**\(cmd_regex, flag)
4545
- **vulnerableActionsDataModel**\(action, vulnerable_version, vulnerable_sha, fixed_version)
46-
- **workflowDataModel**\(path, trigger, job, secrets_source, permissions, runner)
46+
- **workflowDataModel**\(path, trigger, job, secrets_source, permissions, runner)
47+
48+
Examples of custom model definitions
49+
------------------------------------
50+
51+
The examples in this section are taken from the standard CodeQL Actions query pack published by GitHub. They demonstrate how to add tuples to extend extensible predicates that are used by the standard queries.
52+
53+
Example: Extend the trusted Actions publishers for the ``actions/unpinned-tag`` query
54+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55+
56+
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.
57+
58+
To allow any Action from the publisher ``octodemo``, such as ``octodemo/3rd-party-action``, follow these steps:
59+
60+
1. Create a data extension file ``/models/trusted-owner.model.yml`` with the following content:
61+
62+
.. code-block:: yaml
63+
64+
extensions:
65+
- addsTo:
66+
pack: codeql/actions-all
67+
extensible: trustedActionsOwnerDataModel
68+
data:
69+
- ["octodemo"]
70+
71+
2. Create a model pack file ``/codeql-pack.yml`` with the following content:
72+
73+
.. code-block:: yaml
74+
75+
name: my-org/actions-extensions-model-pack
76+
version: 0.0.0
77+
library: true
78+
extensionTargets:
79+
codeql/actions-all: '*'
80+
dataExtensions:
81+
- models/**/*.yml
82+
83+
3. Ensure that the model pack is included in your CodeQL analysis.
84+
85+
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. For more information, see `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>`_ and `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>`_.

0 commit comments

Comments
 (0)