Skip to content

Commit 63d53b3

Browse files
authored
Ci/actions sec (#7488)
* ci: add harden-runner action to all workflows * remove owasp zap * ci: pin all GitHub Actions to commit SHAs
1 parent 62fa4bf commit 63d53b3

File tree

9 files changed

+87
-64
lines changed

9 files changed

+87
-64
lines changed

.github/workflows/bld_docker.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,19 @@ jobs:
112112

113113
runs-on: ubuntu-latest
114114
steps:
115+
- name: Harden the runner (Audit all outbound calls)
116+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
117+
with:
118+
egress-policy: audit
119+
115120
- name: git-checkout-ref-action
116121
id: ref
117-
uses: ORCID/git-checkout-ref-action@main
122+
uses: ORCID/git-checkout-ref-action@4258c0cbe4b164e410d0263416034787fb300f26 # main
118123
with:
119124
default_branch: ${{ github.event.repository.default_branch }}
120125
ref: ${{ inputs.ref }}
121126

122-
- uses: actions/checkout@v4
127+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
123128
with:
124129
ref: ${{ steps.ref.outputs.ref }}
125130
# checkout some history so we can scan commits for bump messages
@@ -128,15 +133,15 @@ jobs:
128133

129134
- name: find next version
130135
id: version
131-
uses: ORCID/version-bump-action@main
136+
uses: ORCID/version-bump-action@75233259407ae3728171973d09bc66fcf4b15b6a # main
132137
with:
133138
version_tag: ${{ inputs.version_tag }}
134139
bump: ${{ inputs.bump }}
135140

136-
- uses: docker/setup-buildx-action@v3
141+
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
137142

138143
- name: Login to private registry
139-
uses: docker/login-action@v3
144+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
140145
with:
141146
registry: ${{ secrets.DOCKER_REG_PRIVATE }}
142147
username: ${{ secrets.DOCKER_USER }}
@@ -152,7 +157,7 @@ jobs:
152157
run: |
153158
echo ${{ steps.dynamic_defaults.outputs.default_file }}
154159
155-
- uses: docker/build-push-action@v6
160+
- uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
156161
with:
157162
push: ${{ inputs.push }}
158163
tags: ${{ secrets.DOCKER_REG_PRIVATE }}/${{ matrix.docker_name}}:${{ steps.version.outputs.version_tag_numeric }}

.github/workflows/bld_mvn.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,19 @@ jobs:
9898

9999
runs-on: ubuntu-latest
100100
steps:
101+
- name: Harden the runner (Audit all outbound calls)
102+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
103+
with:
104+
egress-policy: audit
105+
101106
- name: git-checkout-ref-action
102107
id: ref
103-
uses: ORCID/git-checkout-ref-action@main
108+
uses: ORCID/git-checkout-ref-action@4258c0cbe4b164e410d0263416034787fb300f26 # main
104109
with:
105110
default_branch: ${{ github.event.repository.default_branch }}
106111
ref: ${{ inputs.ref }}
107112

108-
- uses: actions/checkout@v4
113+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
109114
with:
110115
ref: ${{ steps.ref.outputs.ref }}
111116
# checkout some history so we can scan commits for bump messages
@@ -114,13 +119,13 @@ jobs:
114119

115120
- name: find next version
116121
id: version
117-
uses: ORCID/version-bump-action@main
122+
uses: ORCID/version-bump-action@75233259407ae3728171973d09bc66fcf4b15b6a # main
118123
with:
119124
version_tag: ${{ inputs.version_tag }}
120125
bump: ${{ inputs.bump }}
121126

122127
- name: Set up Open JDK 11
123-
uses: actions/setup-java@v4
128+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
124129
with:
125130
distribution: 'temurin'
126131
java-version: '11'
@@ -129,7 +134,7 @@ jobs:
129134

130135
- name: if not installing dependencies restore special previous git_sha cache
131136
if: ${{ ! inputs.install_maven_dependencies }}
132-
uses: actions/cache@v4
137+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
133138
with:
134139
path: ~/.m2/repository
135140
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ steps.version.outputs.version_tag_numeric }}-${{ github.sha }}
@@ -148,7 +153,7 @@ jobs:
148153

149154
- name: if installing dependencies use a standard cache key name
150155
if: ${{ inputs.install_maven_dependencies }}
151-
uses: actions/cache@v4
156+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
152157
with:
153158
path: ~/.m2/repository
154159
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-seed-cache
@@ -158,14 +163,14 @@ jobs:
158163
- name: seed_maven_cache
159164
if: ${{ inputs.seed_maven_cache }}
160165
id: cache
161-
uses: ORCID/ORCID-Source-cache-action@main
166+
uses: ORCID/ORCID-Source-cache-action@9831e0ffb2e9db46bffa6bb55fb897d159da5668 # main
162167
with:
163168
version_tag_numeric: ${{ steps.version.outputs.version_tag_numeric }}
164169

165170
- name: install_dependencies and bump version
166171
if: ${{ inputs.install_maven_dependencies }}
167172
id: install_dependencies
168-
uses: ORCID/ORCID-Source-dependencies-action@main
173+
uses: ORCID/ORCID-Source-dependencies-action@e470d485ef8dc69858100998d77d03ccefb06ef1 # main
169174
with:
170175
version_tag_numeric: ${{ steps.version.outputs.version_tag_numeric }}
171176

@@ -187,7 +192,7 @@ jobs:
187192

188193
- name: setup node for angular static file
189194
if: ${{ matrix.project == 'orcid-web' }}
190-
uses: actions/setup-node@v4
195+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
191196
with:
192197
node-version: 18.7.0
193198

.github/workflows/install_maven_dependencies.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,19 @@ jobs:
6666
install_deps:
6767
runs-on: ubuntu-latest
6868
steps:
69+
- name: Harden the runner (Audit all outbound calls)
70+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
71+
with:
72+
egress-policy: audit
73+
6974
- name: git-checkout-ref-action
7075
id: ref
71-
uses: ORCID/git-checkout-ref-action@main
76+
uses: ORCID/git-checkout-ref-action@4258c0cbe4b164e410d0263416034787fb300f26 # main
7277
with:
7378
default_branch: ${{ github.event.repository.default_branch }}
7479
ref: ${{ inputs.ref }}
7580

76-
- uses: actions/checkout@v4
81+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
7782
with:
7883
ref: ${{ steps.ref.outputs.ref }}
7984
# checkout some history so we can scan commits for bump messages
@@ -82,19 +87,19 @@ jobs:
8287

8388
- name: find next version
8489
id: version
85-
uses: ORCID/version-bump-action@main
90+
uses: ORCID/version-bump-action@75233259407ae3728171973d09bc66fcf4b15b6a # main
8691
with:
8792
version_tag: ${{ inputs.version_tag }}
8893
bump: ${{ inputs.bump }}
8994

9095
- name: Set up Open JDK 11
91-
uses: actions/setup-java@v4
96+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
9297
with:
9398
distribution: 'temurin'
9499
java-version: '11'
95100

96101
- name: Restore the seeded cache but save dependencies into a new unique git sha hash with the expected version of the build
97-
uses: actions/cache@v4
102+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
98103
with:
99104
path: ~/.m2/repository
100105
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ steps.version.outputs.version_tag_numeric }}-${{ github.sha }}
@@ -120,7 +125,7 @@ jobs:
120125

121126
- name: install_dependencies
122127
id: install_dependencies
123-
uses: ORCID/ORCID-Source-dependencies-action@main
128+
uses: ORCID/ORCID-Source-dependencies-action@e470d485ef8dc69858100998d77d03ccefb06ef1 # main
124129
with:
125130
version_tag_numeric: ${{ steps.version.outputs.version_tag_numeric }}
126131

.github/workflows/lint.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ jobs:
1616
pre-commit:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-python@v5
19+
- name: Harden the runner (Audit all outbound calls)
20+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
25+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2126
with:
2227
python-version: '3.10'
23-
- uses: pre-commit/action@576ff52938d158a24ac7e009dfa94b1455e7df99
28+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.github/workflows/owasp_zap_full_scan.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/rel_tag.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,20 @@ jobs:
5656
rel_tag:
5757
runs-on: ubuntu-latest
5858
steps:
59+
- name: Harden the runner (Audit all outbound calls)
60+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
61+
with:
62+
egress-policy: audit
63+
5964
- name: git-checkout-ref-action
6065
id: ref
61-
uses: ORCID/git-checkout-ref-action@main
66+
uses: ORCID/git-checkout-ref-action@4258c0cbe4b164e410d0263416034787fb300f26 # main
6267
with:
6368
default_branch: ${{ github.event.repository.default_branch }}
6469
ref: ${{ inputs.ref }}
6570

6671

67-
- uses: actions/checkout@v4
72+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
6873
with:
6974
# token with write permissions to protected branches
7075
# standard github token does not allow this
@@ -76,13 +81,13 @@ jobs:
7681

7782
- name: find next version
7883
id: version
79-
uses: ORCID/version-bump-action@main
84+
uses: ORCID/version-bump-action@75233259407ae3728171973d09bc66fcf4b15b6a # main
8085
with:
8186
version_tag: ${{ inputs.version_tag }}
8287
bump: ${{ inputs.bump }}
8388

8489
- name: tag repo create changelog and create release
85-
uses: ORCID/changelog-action@main
90+
uses: ORCID/changelog-action@a5a2787feb8462255492cdfc732b32adf4d0c5d0 # main
8691
with:
8792
version_tag: ${{ steps.version.outputs.version_tag }}
8893
slack_channel: tech-release

.github/workflows/sast.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ jobs:
99
buildmavenDepTree:
1010
runs-on: ubuntu-latest
1111
steps:
12+
- name: Harden the runner (Audit all outbound calls)
13+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
14+
with:
15+
egress-policy: audit
16+
1217
- name: Checkout code
13-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
18+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1419
- name: Set up JDK 11
15-
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00
20+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
1621
with:
1722
java-version: '11'
1823
distribution: 'temurin'
@@ -23,7 +28,7 @@ jobs:
2328
- name: Create zip with all dependency trees
2429
run: find . -type f -name 'maven_dep_tree.txt' -exec zip -r deptree.zip {} +
2530
- name: Upload zip
26-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
31+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2732
with:
2833
name: deptree
2934
path: deptree.zip
@@ -41,9 +46,9 @@ jobs:
4146
if: (github.actor != 'dependabot[bot]')
4247
steps:
4348
- name: Checkout code
44-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
49+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
4550
- name: Download Maven Dependencies
46-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
51+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
4752
with:
4853
name: deptree
4954
- name: Extract zip and run Semgrep

.github/workflows/seed_maven_cache.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,19 @@ jobs:
6464
seed_cache:
6565
runs-on: ubuntu-latest
6666
steps:
67+
- name: Harden the runner (Audit all outbound calls)
68+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
69+
with:
70+
egress-policy: audit
71+
6772
- name: git-checkout-ref-action
6873
id: ref
69-
uses: ORCID/git-checkout-ref-action@main
74+
uses: ORCID/git-checkout-ref-action@4258c0cbe4b164e410d0263416034787fb300f26 # main
7075
with:
7176
default_branch: ${{ github.event.repository.default_branch }}
7277
ref: ${{ inputs.ref }}
7378

74-
- uses: actions/checkout@v4
79+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
7580
with:
7681
ref: ${{ steps.ref.outputs.ref }}
7782
# checkout some history so we can scan commits for bump messages
@@ -80,19 +85,19 @@ jobs:
8085

8186
- name: find next version
8287
id: version
83-
uses: ORCID/version-bump-action@main
88+
uses: ORCID/version-bump-action@75233259407ae3728171973d09bc66fcf4b15b6a # main
8489
with:
8590
version_tag: ${{ inputs.version_tag }}
8691
bump: ${{ inputs.bump }}
8792

8893
- name: Set up Open JDK 11
89-
uses: actions/setup-java@v4
94+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
9095
with:
9196
distribution: 'temurin'
9297
java-version: '11'
9398

9499
- name: Cache local Maven repository keyed off the pom
95-
uses: actions/cache@v4
100+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
96101
with:
97102
path: ~/.m2/repository
98103
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-seed-cache
@@ -101,7 +106,7 @@ jobs:
101106
102107
- name: seed_cache
103108
id: cache
104-
uses: ORCID/ORCID-Source-cache-action@main
109+
uses: ORCID/ORCID-Source-cache-action@9831e0ffb2e9db46bffa6bb55fb897d159da5668 # main
105110
with:
106111
version_tag_numeric: ${{ steps.version.outputs.version_tag_numeric }}
107112

0 commit comments

Comments
 (0)