Skip to content

Commit 292ed88

Browse files
author
Michelangelo Partipilo
authored
Merge pull request #423 from weaviate/security/pin-actions-and-linters
ci: pin GitHub Actions to server SHAs and add hidden-unicode lint
2 parents 9c6a71b + b80fe15 commit 292ed88

2 files changed

Lines changed: 48 additions & 13 deletions

File tree

.github/workflows/main.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
checks:
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v3
25-
- uses: actions/setup-node@v3
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25+
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
2626
with:
2727
node-version: "24.x"
2828
- name: "Run checks"
@@ -48,13 +48,13 @@ jobs:
4848
{ node: "24.x", weaviate: $WEAVIATE_137 },
4949
]
5050
steps:
51-
- uses: actions/checkout@v3
52-
- uses: actions/setup-node@v3
51+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
52+
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
5353
with:
5454
node-version: ${{ matrix.versions.node }}
5555
- name: Login to Docker Hub
5656
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
57-
uses: docker/login-action@v3
57+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
5858
with:
5959
username: ${{secrets.DOCKER_USERNAME}}
6060
password: ${{secrets.DOCKER_PASSWORD}}
@@ -77,13 +77,13 @@ jobs:
7777
matrix:
7878
versions: [{ node: "24.x", weaviate: $WEAVIATE_137 }]
7979
steps:
80-
- uses: actions/checkout@v3
81-
- uses: actions/setup-node@v3
80+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
81+
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
8282
with:
8383
node-version: ${{ matrix.versions.node }}
8484
- name: Login to Docker Hub
8585
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
86-
uses: docker/login-action@v3
86+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
8787
with:
8888
username: ${{secrets.DOCKER_USERNAME}}
8989
password: ${{secrets.DOCKER_PASSWORD}}
@@ -111,9 +111,9 @@ jobs:
111111
pages: write # to deploy to Pages
112112
id-token: write # to authenticate with OIDC when publishing to npm
113113
steps:
114-
- uses: actions/checkout@v3
114+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
115115
# Setup .npmrc file to publish to npm
116-
- uses: actions/setup-node@v3
116+
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
117117
with:
118118
node-version: "24.x"
119119
registry-url: "https://registry.npmjs.org"
@@ -122,13 +122,13 @@ jobs:
122122
- run: npm publish
123123
- run: npm run docs
124124
- name: "Upload docs as pages artifact"
125-
uses: actions/upload-pages-artifact@v3
125+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
126126
with:
127127
path: ./docs
128128
- name: "Deploy the uploaded pages artifact"
129-
uses: actions/deploy-pages@v4
129+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
130130
- name: "Create a GitHub release"
131-
uses: softprops/action-gh-release@v1
131+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
132132
with:
133133
generate_release_notes: true
134134
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)