Skip to content

Commit d9f0360

Browse files
Sarah Edwardslucascosti
andauthored
[Do not merge until feature ship] Full length SHAs required for actions (#17293)
Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
1 parent 054f9ab commit d9f0360

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

content/actions/creating-actions/about-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ steps:
122122
123123
#### Using a commit's SHA for release management
124124
125-
Each Git commit receives a calculated SHA value, which is unique and immutable. Your action's users might prefer to rely on a commit's SHA value, as this approach can be more reliable than specifying a tag, which could be deleted or moved. However, this means that users will not receive further updates made to the action. Using a commit's full SHA value instead of the abbreviated value can help prevent people from using a malicious commit that uses the same abbreviation.
125+
Each Git commit receives a calculated SHA value, which is unique and immutable. Your action's users might prefer to rely on a commit's SHA value, as this approach can be more reliable than specifying a tag, which could be deleted or moved. However, this means that users will not receive further updates made to the action. {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %}You must use a commit's full SHA value, and not an abbreviated value.{% else %}Using a commit's full SHA value instead of the abbreviated value can help prevent people from using a malicious commit that uses the same abbreviation.{% endif %}
126126
127127
```yaml
128128
steps:

content/actions/learn-github-actions/finding-and-customizing-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ steps:
7171
7272
#### Using SHAs
7373
74-
If you need more reliable versioning, you should use the SHA value associated with the version of the action. SHAs are immutable and therefore more reliable than tags or branches. However this approach means you will not automatically receive updates for an action, including important bug fixes and security updates. This example targets an action's SHA:
74+
If you need more reliable versioning, you should use the SHA value associated with the version of the action. SHAs are immutable and therefore more reliable than tags or branches. However this approach means you will not automatically receive updates for an action, including important bug fixes and security updates. {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %}You must use a commit's full SHA value, and not an abbreviated value. {% endif %}This example targets an action's SHA:
7575
7676
```yaml
7777
steps:

content/actions/learn-github-actions/security-hardening-for-github-actions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ This means that a compromise of a single action within a workflow can be very si
5454

5555
Pinning an action to a full length commit SHA is currently the only way to use an 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.
5656

57+
{% if currentVersion ver_lt "enterprise-server@3.1" %}
5758
{% warning %}
5859

5960
**Warning:** The short version of the commit SHA is insecure and should never be used for specifying an action's Git reference. Because of how repository networks work, any user can fork the repository and push a crafted commit to it that collides with the short SHA. This causes subsequent clones at that SHA to fail because it becomes an ambiguous commit. As a result, any workflows that use the shortened SHA will immediately fail.
6061

6162
{% endwarning %}
63+
{% endif %}
6264

6365

6466
* **Audit the source code of the action**

content/actions/reference/workflow-syntax-for-github-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ Actions are either JavaScript files or Docker containers. If the action you're u
518518
```yaml
519519
steps:
520520
# Reference a specific commit
521-
- uses: actions/setup-node@74bc508
521+
- uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
522522
# Reference the major version of a release
523523
- uses: actions/setup-node@v1
524524
# Reference a minor version of a release

0 commit comments

Comments
 (0)