Skip to content

Commit 4af413b

Browse files
committed
fix(ci): scope CS_* creds to the bench step, not job env
Job-scoped secrets are exposed to every step, including third-party actions (actions/checkout, jdx/mise-action, Swatinem/rust-cache) referenced by mutable tags — a compromised tag could exfiltrate ZeroKMS/client creds before the bench script runs. Move the four CS_* vars onto the 'Run bench tests' step that actually needs them (fixture:generate:all). Least privilege; addresses PR review.
1 parent 340b52e commit 4af413b

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/bench-eql.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@ jobs:
4141

4242
env:
4343
POSTGRES_VERSION: "17"
44-
# test:sqlx:prep regenerates the per-type fixtures by encrypting plaintext
45-
# through cipherstash-client, which needs BOTH a ZeroKMS auth credential
46-
# (CS_CLIENT_ACCESS_KEY + CS_WORKSPACE_CRN) AND a client key (CS_CLIENT_ID +
47-
# CS_CLIENT_KEY). Without them fixture:generate:all fails with
48-
# "Auth strategy error: Not authenticated". Mirrors test-eql.yml.
49-
CS_CLIENT_ACCESS_KEY: ${{ secrets.CS_CLIENT_ACCESS_KEY }}
50-
CS_WORKSPACE_CRN: ${{ secrets.CS_WORKSPACE_CRN }}
51-
CS_CLIENT_ID: ${{ secrets.CS_CLIENT_ID }}
52-
CS_CLIENT_KEY: ${{ secrets.CS_CLIENT_KEY }}
5344

5445
steps:
5546
- uses: actions/checkout@v4
@@ -70,6 +61,17 @@ jobs:
7061
mise run postgres:up postgres-${POSTGRES_VERSION} --extra-args "--detach --wait"
7162
7263
- name: Run bench tests
64+
# CS_* scoped to THIS step only (least privilege): test:bench -> test:sqlx:prep
65+
# -> fixture:generate:all encrypts via cipherstash-client and needs BOTH a
66+
# ZeroKMS auth credential (CS_CLIENT_ACCESS_KEY + CS_WORKSPACE_CRN) AND a client
67+
# key (CS_CLIENT_ID + CS_CLIENT_KEY); without them it fails "Auth strategy error:
68+
# Not authenticated". Kept off job scope so checkout/mise/rust-cache actions
69+
# never see them.
70+
env:
71+
CS_CLIENT_ACCESS_KEY: ${{ secrets.CS_CLIENT_ACCESS_KEY }}
72+
CS_WORKSPACE_CRN: ${{ secrets.CS_WORKSPACE_CRN }}
73+
CS_CLIENT_ID: ${{ secrets.CS_CLIENT_ID }}
74+
CS_CLIENT_KEY: ${{ secrets.CS_CLIENT_KEY }}
7375
run: |
7476
export active_rust_toolchain=$(rustup show active-toolchain | cut -d' ' -f1)
7577
rustup component add --toolchain ${active_rust_toolchain} rustfmt clippy

0 commit comments

Comments
 (0)