Skip to content

Commit ee57816

Browse files
committed
📝 Add gh-actions-lock, remove pinact
1 parent 25d9dbc commit ee57816

2 files changed

Lines changed: 87 additions & 6 deletions

File tree

‎docs/productive/security/dependencies.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ Alternatively, you can use ``pip-compile --generate-hashes`` from the
204204

205205
However, you should not only use hash pinning for your Python dependencies, but
206206
also, for example, for your :doc:`pre-commit checks
207-
<../git/advanced/hooks/checks>` and :ref:`GitHub Actions <pinact>`.
207+
<../git/advanced/hooks/checks>` and :ref:`GitHub Actions <gh-actions-lock>`.
208208

209209
Hash pinning does not, however, protect against installing a malicious package
210210
for the first time; in that case, you would simply be pinning the hash of the

‎docs/productive/security/environments.rst‎

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,89 @@ their hashes should be updated regularly, for example using:
6767
.. seealso::
6868
:doc:`../git/advanced/hooks/prek`
6969

70-
.. _pinact:
71-
7270
Check your GitHub Actions
7371
-------------------------
7472

75-
For GitHub Actions, you can use `pinact
76-
<https://github.com/suzuki-shunsuke/pinact>`_, for example with:
73+
.. _gh-actions-lock:
74+
75+
gh-actions-lock
76+
~~~~~~~~~~~~~~~
77+
78+
As GitHub Actions are retrieved from :doc:`Git <../git/index>`, it is
79+
recommended that you specify a full SHA rather than a tag, as tags can be
80+
altered and are vulnerable to supply-chain attacks. `gh-actions-lock
81+
<https://github.com/github/gh-actions-lock#install>`_ writes these to the
82+
:file:`.github/workflows/actions.lock` file. You can install
83+
``gh-actions-lock`` using `GitHub CLI <https://cli.github.com/>`_:
84+
85+
.. code-block:: console
86+
87+
$ gh extension install github/gh-actions-lock
88+
✓ Installed extension github/gh-actions-lock
89+
90+
You can then lock your GitHub Actions in your repository using
7791

7892
.. code-block:: console
7993
80-
$ pinact run -u --min-age 7
94+
gh actions-lock
95+
96+
✓ Pinned 7 actions (+ 3 transitive) across 3 workflows
97+
actions/checkout@v7.0.1 (3d3c42e)
98+
└─ .github/workflows/docs.yml
99+
└─ .github/workflows/prek.yml
100+
└─ .github/workflows/zizmor.yml
101+
pandoc/actions@v1.1.1 (86321b6)
102+
└─ .github/workflows/docs.yml
103+
ts-graphviz/setup-graphviz@v2.0.2 (b1de5da)
104+
└─ .github/workflows/docs.yml
105+
actions/setup-python@v7.0.0 (5fda3b9)
106+
└─ .github/workflows/docs.yml
107+
hynek/setup-cached-uv@v2.6.0 (34e35d3)
108+
└─ .github/workflows/docs.yml
109+
j178/prek-action@v3.0.0 (4e14d07)
110+
└─ .github/workflows/prek.yml
111+
zizmorcore/zizmor-action@v0.6.4 (cc914d7)
112+
└─ .github/workflows/zizmor.yml
113+
114+
Transitive dependencies (from composite actions):
115+
actions/cache@55cc834 via hynek/setup-cached-uv@v2.6.0
116+
gacts/run-and-post-run@598d7a8 via hynek/setup-cached-uv@v2.6.0
117+
github/codeql-action@cdf488f via zizmorcore/zizmor-action@v0.6.4
118+
119+
The :file:`.github/workflows/actions.lock` will then begin with:
120+
121+
.. code-block:: yaml
122+
123+
# This file is machine-generated by `gh actions-lock`.
124+
# Do not edit by hand; run `gh actions-lock` to update.
125+
# Docs: https://gh.io/actions-lockfile
126+
version: 'v0.0.3'
127+
workflows:
128+
'.github/workflows/docs.yml':
129+
- 'actions/checkout@v7.0.1'
130+
- 'actions/setup-python@v7.0.0'
131+
- 'hynek/setup-cached-uv@v2.6.0'
132+
- 'pandoc/actions@v1.1.1'
133+
- 'ts-graphviz/setup-graphviz@v2.0.2'
134+
'.github/workflows/prek.yml':
135+
- 'actions/checkout@v7.0.1'
136+
- 'j178/prek-action@v3.0.0'
137+
'.github/workflows/zizmor.yml':
138+
- 'actions/checkout@v7.0.1'
139+
- 'zizmorcore/zizmor-action@v0.6.4'
140+
dependencies:
141+
'actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9':
142+
ref: 'v6.1.0'
143+
commit: 'sha1-55cc8345863c7cc4c66a329aec7e433d2d1c52a9'
144+
owner_id: 44036562
145+
repo_id: 215566462
146+
…
147+
148+
:doc:`../envs/uv/renovate` also `supports these *.lock files
149+
<https://docs.renovatebot.com/modules/manager/github-actions/#github-actions-lockfile-actionslock>`_.
150+
151+
zizmor
152+
~~~~~~
81153

82154
`zizmor <https://docs.zizmor.sh>`_ is a static analysis tool that detects
83155
security vulnerabilities in GitHub Actions workflows – including template
@@ -86,5 +158,14 @@ injection, unpinned actions, excessive permissions, credential exposure and
86158
vulnerabilities such as those exploited through :ref:`token exfiltration
87159
<token-exfiltration>`.
88160

161+
You can also use zizmor together with :doc:`../git/advanced/hooks/prek`:
162+
163+
.. code-block:: yaml
164+
165+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
166+
rev: 06a39750ec31860bb44f2acf67182c40016cd1e7 # frozen: v1.32.0
167+
hooks:
168+
- id: zizmor
169+
89170
.. seealso::
90171
* :ref:`zizmorcore`

0 commit comments

Comments
 (0)