Skip to content

Commit 3ae56c7

Browse files
authored
[Security] Pin GitHub Actions to a full-length commit SHA (#44)
## Pin GitHub Actions to SHA hashes This automated PR pins third-party GitHub Actions references from mutable tag versions (e.g., `@v4`) to their corresponding SHA hashes (e.g., `@abc123...`). The original tag is preserved as a comment for readability. Your workflows will work exactly the same way. Internal actions (under the `DataDog` organization) are not pinned. Read https://docs.github.com/en/actions/reference/security/secure-use#using-third-party-actions for more details and info on how to configure this for entire repos. ### Why pin GitHub Actions? Git tags are mutable: they can be moved to point to different commits at any time. A compromised or malicious action maintainer could update a tag to inject arbitrary code into your CI workflows (see the [tj-actions incident](https://www.wiz.io/blog/github-action-tj-actions-changed-files-supply-chain-attack-cve-2025-30066)). Pinning to SHA hashes ensures you always run the exact code you reviewed, protecting your repository from supply chain attacks such as the tj-actions incident. ### What if something breaks? If a pinned action doesn't work for your use case, you can push a commit directly to this branch to fix it. As a last resort, reach out to **#sdlc-security** on Slack. ### Set up Dependabot or Renovate for automatic updates Once actions are pinned to SHA hashes, you should configure Dependabot or Renovate to receive weekly update PRs when new versions are available. In the case of Dependabot, create or update `.github/dependabot.yml`: ```yaml version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" groups: github-actions: patterns: - "*" open-pull-requests-limit: 10 ``` Dependabot will automatically propose PRs that update both the SHA hash and the version comment like [in this example](DataDog/datadog-agent#46761). --- *This PR was automatically generated by the GitHub Actions Pinning tool, owned by #sdlc-security.* Co-authored-by: julien.doutre <julien.doutre@datadoghq.com>
1 parent 43b48ff commit 3ae56c7

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

.github/workflows/dev.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
container:
1313
image: datadog/docker-library:dd-trace-cpp-ci
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1616
- run: ./scripts/codestyle.sh lint
1717

1818
build:
@@ -21,7 +21,7 @@ jobs:
2121
container:
2222
image: datadog/docker-library:httpd-datadog-ci-2.4-cdb3cb2
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2525
with:
2626
submodules: true
2727
- name: Add cloned repo as safe
@@ -33,7 +33,7 @@ jobs:
3333
cmake --build build -j --verbose
3434
cmake --install build --prefix dist
3535
- name: Export library
36-
uses: actions/upload-artifact@v4
36+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3737
with:
3838
name: mod_datadog_artifact
3939
path: dist/lib/mod_datadog.so
@@ -51,12 +51,12 @@ jobs:
5151
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
5252
LLVM_PROFILE_FILE: /tmp/httpd.%p-%m.profraw
5353
steps:
54-
- uses: actions/checkout@v4
54+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
5555
- run: |
5656
pip install -r requirements.txt --break-system-packages
5757
pip install ddtrace --break-system-packages
5858
- name: Import library from build job
59-
uses: actions/download-artifact@v4
59+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
6060
with:
6161
name: mod_datadog_artifact
6262
path: dist/lib
@@ -69,7 +69,7 @@ jobs:
6969
llvm-profdata merge -sparse /tmp/*.profraw -o /tmp/default.profdata
7070
llvm-cov export dist/lib/mod_datadog.so -format=lcov -instr-profile=/tmp/default.profdata -ignore-filename-regex=/httpd/ > coverage.lcov
7171
- name: Upload coverage reports to Codecov
72-
uses: codecov/codecov-action@v5
72+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
7373
with:
7474
files: coverage.lcov
7575
name: github-actions

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
container:
88
image: datadog/docker-library:httpd-datadog-ci-2.4-cdb3cb2
99
steps:
10-
- uses: actions/checkout@v4
10+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1111
with:
1212
submodules: true
1313
- name: Add cloned repo as safe
@@ -19,12 +19,12 @@ jobs:
1919
cmake --build build -j --verbose
2020
cmake --install build --prefix dist
2121
- name: Export library
22-
uses: actions/upload-artifact@v4
22+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2323
with:
2424
name: mod_datadog_artifact
2525
path: dist/lib/mod_datadog.so
2626
- name: Export library (debug symbol)
27-
uses: actions/upload-artifact@v4
27+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2828
with:
2929
name: mod_datadog_artifact-debug
3030
path: dist/lib/mod_datadog.so.debug

.github/workflows/system-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
container:
2222
image: datadog/docker-library:httpd-datadog-ci-2.4-cdb3cb2
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2525
with:
2626
submodules: true
2727
- name: Add cloned repo as safe
@@ -33,7 +33,7 @@ jobs:
3333
cmake --build build -j --verbose
3434
cmake --install build --prefix dist
3535
- name: Export library
36-
uses: actions/upload-artifact@v4
36+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3737
with:
3838
name: system_tests_binaries
3939
path: dist/lib/mod_datadog.so

0 commit comments

Comments
 (0)