-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (70 loc) · 3.38 KB
/
Copy pathstale-secrets.yml
File metadata and controls
74 lines (70 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: stale-secrets-check
# Catches two failure modes of the chunked-secret release flow before the
# real build runs:
#
# 1. Secret corruption in transit (chunked base64 over Actions env vars
# is robust, but a single bit-flip in 12 secrets would otherwise
# produce a build that dies in tarfile.extract with no actionable
# pointer at the cause).
#
# 2. Drift between the secrets and the working tree. If the maintainer
# edited src/*.rs locally and forgot to re-pack + refresh the
# GitHub secrets, the chunks currently in CI do not match the source
# the build will be tested against. Without this check the wheel
# ships and the discrepancy is invisible.
#
# The check uses `python scripts/pack_rust_core.py verify`, which is
# already part of the repo. No script changes required.
#
# This is a one-command, ~10s job that runs on every push and PR. If it
# fails the rest of the suite still runs (so a real source bug is not
# hidden behind a stale-secret error) but the failure surfaces a clear
# "you need to re-pack and refresh the RUST_SRC_B64_* secrets" message
# in the run log.
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
verify-packed-secrets:
name: packed secrets match working tree
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify packed secrets
env:
RUST_SRC_B64_1: ${{ secrets.RUST_SRC_B64_1 }}
RUST_SRC_B64_2: ${{ secrets.RUST_SRC_B64_2 }}
RUST_SRC_B64_3: ${{ secrets.RUST_SRC_B64_3 }}
RUST_SRC_B64_4: ${{ secrets.RUST_SRC_B64_4 }}
RUST_SRC_B64_5: ${{ secrets.RUST_SRC_B64_5 }}
RUST_SRC_B64_6: ${{ secrets.RUST_SRC_B64_6 }}
RUST_SRC_B64_7: ${{ secrets.RUST_SRC_B64_7 }}
RUST_SRC_B64_8: ${{ secrets.RUST_SRC_B64_8 }}
RUST_SRC_B64_9: ${{ secrets.RUST_SRC_B64_9 }}
RUST_SRC_B64_10: ${{ secrets.RUST_SRC_B64_10 }}
RUST_SRC_B64_11: ${{ secrets.RUST_SRC_B64_11 }}
RUST_SRC_B64_12: ${{ secrets.RUST_SRC_B64_12 }}
run: |
# First, restore the proprietary Rust core from the secrets so
# `verify` has something to compare against.
python scripts/pack_rust_core.py unpack --from-env
# Then, re-pack the just-restored tree and compare its SHA-256
# to the SHA-256 of the chunked archive. The archives are
# deterministic (fixed mtime, sorted names) so a matching hash
# is a real guarantee that the secrets are self-consistent.
python scripts/pack_rust_core.py verify --from-env
# `verify` above proves the secrets are self-consistent, which on a
# fresh checkout is all it CAN prove: src/* is gitignored and absent
# until the line above restores it, so the comparison is the secrets
# against themselves. It cannot see failure mode 2 in this file's
# header - a maintainer who edited src/, re-packed, and never ran
# `gh secret set`. That drift is exactly what shipped a local fix
# nowhere for hours.
#
# rust_core.sha256 IS tracked, so it travels with the commit. Compare
# the restored tree against it: if the secrets are older than the last
# pack, the digests differ and this fails with instructions.
python scripts/pack_rust_core.py check-manifest