Skip to content

Commit c307d97

Browse files
authored
Merge pull request #2016 from weaviate/security/pin-actions-and-linters
ci: pin GitHub Actions to server SHAs and add hidden-unicode lint
2 parents fb401d9 + 2188fd7 commit c307d97

2 files changed

Lines changed: 72 additions & 37 deletions

File tree

.github/workflows/main.yaml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
runs-on: ubuntu-latest
3737
timeout-minutes: 5
3838
steps:
39-
- uses: actions/checkout@v4
40-
- uses: actions/setup-python@v5
39+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
40+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
4141
with:
4242
python-version: "3.11"
4343
cache: 'pip' # caching pip dependencies
@@ -67,13 +67,13 @@ jobs:
6767
version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
6868
folder: ["weaviate", "integration", "integration_embedded"]
6969
steps:
70-
- uses: actions/checkout@v4
71-
- uses: actions/setup-python@v5
70+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
71+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
7272
with:
7373
python-version: ${{ matrix.version }}
7474
cache: 'pip' # caching pip dependencies
7575
- run: pip install -r requirements-devel.txt
76-
- uses: jakebailey/pyright-action@v2
76+
- uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e # v2
7777
with:
7878
version: 1.1.399
7979
working-directory: ${{ matrix.folder }}
@@ -88,8 +88,8 @@ jobs:
8888
version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
8989
folder: ["test", "mock_tests"]
9090
steps:
91-
- uses: actions/checkout@v4
92-
- uses: actions/setup-python@v5
91+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
92+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
9393
with:
9494
python-version: ${{ matrix.version }}
9595
cache: 'pip' # caching pip dependencies
@@ -98,7 +98,7 @@ jobs:
9898
run: pytest --cov -v --cov-report=term-missing --cov=weaviate --cov-report xml:coverage-${{ matrix.folder }}.xml ${{ matrix.folder }}
9999
- name: Archive code coverage results
100100
if: matrix.version == '3.10' && (github.ref_name != 'main')
101-
uses: actions/upload-artifact@v4
101+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
102102
with:
103103
name: coverage-report-${{ matrix.folder }}
104104
path: coverage-${{ matrix.folder }}.xml
@@ -113,8 +113,8 @@ jobs:
113113
grpc: ["1.59.5", "1.63.0", "1.65.0", "1.66.0", "1.68.0", "1.72.1", "1.73.0", "1.74.0"]
114114
protobuf: ["4.25.8", "5.26.0", "5.27.4", "5.28.3", "5.29.0", "6.30.0", "6.31.1", "6.32.0"]
115115
steps:
116-
- uses: actions/checkout@v4
117-
- uses: actions/setup-python@v5
116+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
117+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
118118
with:
119119
python-version: "3.11"
120120
cache: 'pip' # caching pip dependencies
@@ -133,11 +133,11 @@ jobs:
133133
version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
134134
optional_dependencies: [false]
135135
steps:
136-
- uses: actions/checkout@v4
136+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
137137
with:
138138
fetch-depth: 0
139139
fetch-tags: true
140-
- uses: actions/setup-python@v5
140+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
141141
with:
142142
python-version: ${{ matrix.version }}
143143
cache: 'pip' # caching pip dependencies
@@ -149,7 +149,7 @@ jobs:
149149
run: pytest -v --cov --cov-report=term-missing --cov=weaviate --cov-report xml:coverage-integration-embedded.xml integration_embedded
150150
- name: Archive code coverage results
151151
if: matrix.version == '3.10' && (github.ref_name != 'main') && !github.event.pull_request.head.repo.fork
152-
uses: actions/upload-artifact@v4
152+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
153153
with:
154154
name: coverage-report-integration-embedded
155155
path: coverage-integration-embedded.xml
@@ -170,16 +170,16 @@ jobs:
170170
]
171171
optional_dependencies: [false]
172172
steps:
173-
- uses: actions/checkout@v4
173+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
174174
with:
175175
fetch-depth: 0
176176
fetch-tags: true
177-
- uses: actions/setup-python@v5
177+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
178178
with:
179179
python-version: ${{ matrix.versions.py }}
180180
cache: 'pip' # caching pip dependencies
181181
- name: Login to Docker Hub
182-
uses: docker/login-action@v3
182+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
183183
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
184184
with:
185185
username: ${{secrets.DOCKER_USERNAME}}
@@ -203,7 +203,7 @@ jobs:
203203
run: pytest -n auto --dist loadgroup -v --cov --cov-report=term-missing --cov=weaviate --cov-report xml:coverage-integration.xml integration
204204
- name: Archive code coverage results
205205
if: matrix.versions.py == '3.10' && (github.ref_name != 'main')
206-
uses: actions/upload-artifact@v4
206+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
207207
with:
208208
name: coverage-report-integration
209209
path: coverage-integration.xml
@@ -226,13 +226,13 @@ jobs:
226226
]
227227
optional_dependencies: [false]
228228
steps:
229-
- uses: actions/checkout@v4
230-
- uses: actions/setup-python@v5
229+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
230+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
231231
with:
232232
python-version: "3.11"
233233
cache: 'pip' # caching pip dependencies
234234
- name: Login to Docker Hub
235-
uses: docker/login-action@v3
235+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
236236
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
237237
with:
238238
username: ${{secrets.DOCKER_USERNAME}}
@@ -252,25 +252,25 @@ jobs:
252252
timeout-minutes: 5
253253
if: github.ref_name != 'main' && !github.event.pull_request.head.repo.fork
254254
steps:
255-
- uses: actions/checkout@v4
255+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
256256
- name: Download coverage artifacts mock
257-
uses: actions/download-artifact@v4
257+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
258258
with:
259259
name: coverage-report-mock_tests
260260
- name: Download coverage artifacts unit
261-
uses: actions/download-artifact@v4
261+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
262262
with:
263263
name: coverage-report-test
264264
- name: Download coverage integration
265-
uses: actions/download-artifact@v4
265+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
266266
with:
267267
name: coverage-report-integration
268268
- name: Download coverage integration embedded
269-
uses: actions/download-artifact@v4
269+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
270270
with:
271271
name: coverage-report-integration-embedded
272272
- name: Codecov
273-
uses: codecov/codecov-action@v4
273+
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
274274
with:
275275
fail_ci_if_error: true
276276
files: ./coverage-integration.xml, ./coverage-integration-embedded.xml, ./coverage-test.xml, ./coverage-mock_tests.xml
@@ -283,11 +283,11 @@ jobs:
283283
timeout-minutes: 10
284284
steps:
285285
- name: Checkout
286-
uses: actions/checkout@v4
286+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
287287
with:
288288
fetch-depth: 0
289289
- name: Set up Python 3.11
290-
uses: actions/setup-python@v5
290+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
291291
with:
292292
python-version: "3.11"
293293
cache: 'pip' # caching pip dependencies
@@ -296,7 +296,7 @@ jobs:
296296
- name: Build a binary wheel
297297
run: python -m build
298298
- name: Create Wheel Artifacts
299-
uses: actions/upload-artifact@v4
299+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
300300
with:
301301
path: "dist/*.whl"
302302
name: weaviate-python-client-wheel
@@ -324,17 +324,17 @@ jobs:
324324
]
325325
steps:
326326
- name: Checkout
327-
uses: actions/checkout@v4
327+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
328328
with:
329329
fetch-depth: 0
330330
- name: Login to Docker Hub
331-
uses: docker/login-action@v3
331+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
332332
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
333333
with:
334334
username: ${{secrets.DOCKER_USERNAME}}
335335
password: ${{secrets.DOCKER_PASSWORD}}
336336
- name: Download build artifact to append to release
337-
uses: actions/download-artifact@v4
337+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
338338
with:
339339
name: weaviate-python-client-wheel
340340
- run: |
@@ -353,11 +353,11 @@ jobs:
353353
timeout-minutes: 20
354354
steps:
355355
- name: Checkout
356-
uses: actions/checkout@v4
356+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
357357
with:
358358
fetch-depth: 0
359359
- name: Set up Python 3.11
360-
uses: actions/setup-python@v5
360+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
361361
with:
362362
python-version: "3.11"
363363
cache: 'pip' # caching pip dependencies
@@ -367,7 +367,7 @@ jobs:
367367
run: python -m build
368368
- name: Publish distribution 📦 to PyPI on new tags
369369
if: startsWith(github.ref, 'refs/tags')
370-
uses: pypa/gh-action-pypi-publish@release/v1
370+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
371371
with:
372372
verbose: true
373373
password: ${{ secrets.PYPI_API_TOKEN }}
@@ -380,12 +380,12 @@ jobs:
380380
needs: [build-and-publish]
381381
steps:
382382
- name: Download build artifact to append to release
383-
uses: actions/download-artifact@v4
383+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
384384
with:
385385
name: weaviate-python-client-wheel
386386
path: dist
387387
- name: Release
388-
uses: softprops/action-gh-release@v1
388+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
389389
with:
390390
generate_release_notes: true
391391
draft: true
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PR Security Lint
2+
3+
# SECURITY: This workflow uses pull_request_target intentionally so that the
4+
# workflow definition runs from the BASE branch (main), not the PR. The
5+
# composite action it invokes lives at a pinned 40-char SHA in
6+
# weaviate/weaviate — attackers cannot alter the lint logic via a PR or by
7+
# tampering with an upstream tag.
8+
#
9+
# Rules:
10+
# 1. Do NOT add `ref: ${{ github.event.pull_request.head.sha }}` or any
11+
# reference to PR-controlled refs. The composite uses the GitHub API to
12+
# fetch the diff text — no PR code is ever executed.
13+
# 2. Do NOT add secrets to this workflow. The pull_request_target context
14+
# grants a token with write access to the base repo and access to all
15+
# repo secrets if any are referenced. We reference none and request
16+
# minimal permissions; keep it that way.
17+
# 3. Keep the composite action pinned to a full-length commit SHA. Tag or
18+
# branch refs would let an upstream change alter the lint logic at
19+
# execution time.
20+
on:
21+
pull_request_target:
22+
23+
permissions: {}
24+
25+
jobs:
26+
hidden-unicode:
27+
name: hidden unicode characters
28+
runs-on: ubuntu-latest
29+
permissions:
30+
pull-requests: read # required by the composite's `gh pr diff` call
31+
steps:
32+
- uses: weaviate/weaviate/.github/actions/security-lint@3e52fc80a244f4644d4facc6a4e705ea6eda9039 # PR #11093
33+
with:
34+
pr-number: ${{ github.event.pull_request.number }}
35+
github-token: ${{ github.token }}

0 commit comments

Comments
 (0)