Skip to content

Commit bfd19d3

Browse files
committed
fix: use 3-part secret split for Rust src (encrypted payload size limit)
1 parent 53fa643 commit bfd19d3

2 files changed

Lines changed: 25 additions & 24 deletions

File tree

.github/workflows/CI.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# CI -- Build wheels on Linux/Windows/macOS, publish to PyPI on tag.
22
#
3-
# Rust source is injected at build time from two GitHub Actions secrets
4-
# (RUST_SRC_B64_1 + RUST_SRC_B64_2) to keep the proprietary core private.
3+
# Rust source is injected at build time from three GitHub Actions secrets
4+
# (RUST_SRC_B64_1 + RUST_SRC_B64_2 + RUST_SRC_B64_3) to keep the proprietary
5+
# core private. Secrets are base64 chunks that reassemble to src.tar.gz.
56
# On forks / external PRs the secrets will be empty and wheel builds are skipped.
67
#
78
# Trigger: push to main/master, any tag v*, pull_request, manual dispatch.
@@ -41,12 +42,13 @@ jobs:
4142
env:
4243
PART1: ${{ secrets.RUST_SRC_B64_1 }}
4344
PART2: ${{ secrets.RUST_SRC_B64_2 }}
45+
PART3: ${{ secrets.RUST_SRC_B64_3 }}
4446
run: |
4547
if [ -z "$PART1" ]; then
4648
echo "::warning::RUST_SRC_B64_1 secret not set -- skipping wheel build"
4749
echo "SKIP_BUILD=1" >> "$GITHUB_ENV"
4850
else
49-
echo "${PART1}${PART2}" | base64 -d | tar -xzf - -C .
51+
echo "${PART1}${PART2}${PART3}" | base64 -d | tar -xzf - -C .
5052
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
5153
fi
5254
@@ -87,13 +89,14 @@ jobs:
8789
env:
8890
PART1: ${{ secrets.RUST_SRC_B64_1 }}
8991
PART2: ${{ secrets.RUST_SRC_B64_2 }}
92+
PART3: ${{ secrets.RUST_SRC_B64_3 }}
9093
shell: bash
9194
run: |
9295
if [ -z "$PART1" ]; then
9396
echo "::warning::RUST_SRC_B64_1 secret not set -- skipping wheel build"
9497
echo "SKIP_BUILD=1" >> "$GITHUB_ENV"
9598
else
96-
echo "${PART1}${PART2}" | base64 -d | tar -xzf - -C .
99+
echo "${PART1}${PART2}${PART3}" | base64 -d | tar -xzf - -C .
97100
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
98101
fi
99102
@@ -134,12 +137,13 @@ jobs:
134137
env:
135138
PART1: ${{ secrets.RUST_SRC_B64_1 }}
136139
PART2: ${{ secrets.RUST_SRC_B64_2 }}
140+
PART3: ${{ secrets.RUST_SRC_B64_3 }}
137141
run: |
138142
if [ -z "$PART1" ]; then
139143
echo "::warning::RUST_SRC_B64_1 secret not set -- skipping wheel build"
140144
echo "SKIP_BUILD=1" >> "$GITHUB_ENV"
141145
else
142-
echo "${PART1}${PART2}" | base64 -d | tar -xzf - -C .
146+
echo "${PART1}${PART2}${PART3}" | base64 -d | tar -xzf - -C .
143147
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
144148
fi
145149
@@ -179,12 +183,13 @@ jobs:
179183
env:
180184
PART1: ${{ secrets.RUST_SRC_B64_1 }}
181185
PART2: ${{ secrets.RUST_SRC_B64_2 }}
186+
PART3: ${{ secrets.RUST_SRC_B64_3 }}
182187
run: |
183188
if [ -z "$PART1" ]; then
184189
echo "::warning::RUST_SRC_B64_1 secret not set -- skipping wheel build"
185190
echo "SKIP_BUILD=1" >> "$GITHUB_ENV"
186191
else
187-
echo "${PART1}${PART2}" | base64 -d | tar -xzf - -C .
192+
echo "${PART1}${PART2}${PART3}" | base64 -d | tar -xzf - -C .
188193
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
189194
fi
190195
@@ -220,11 +225,12 @@ jobs:
220225
env:
221226
PART1: ${{ secrets.RUST_SRC_B64_1 }}
222227
PART2: ${{ secrets.RUST_SRC_B64_2 }}
228+
PART3: ${{ secrets.RUST_SRC_B64_3 }}
223229
run: |
224230
if [ -z "$PART1" ]; then
225231
echo "SKIP_BUILD=1" >> "$GITHUB_ENV"
226232
else
227-
echo "${PART1}${PART2}" | base64 -d | tar -xzf - -C .
233+
echo "${PART1}${PART2}${PART3}" | base64 -d | tar -xzf - -C .
228234
echo "SKIP_BUILD=0" >> "$GITHUB_ENV"
229235
fi
230236

OIDC_SETUP.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,13 @@ Complete these steps **once** in a browser before pushing the first release tag.
3434

3535
---
3636

37-
## Step 3: Add GitHub Secrets (2 minutes)
37+
## Step 3: Add GitHub Secrets (already done via API)
3838

39-
The Rust source archive is split across two secrets.
39+
The Rust source archive was split across **three** secrets and uploaded automatically.
40+
To verify they are present, go to:
41+
<https://github.com/qectorlab/qector-decoder/settings/secrets/actions>
4042

41-
1. Go to <https://github.com/qectorlab/qector-decoder/settings/secrets/actions>
42-
2. Add secret **`RUST_SRC_B64_1`**:
43-
- Content: copy the **entire content** of `C:\Users\Admin\Desktop\qector_src_b64_part1.txt`
44-
3. Add secret **`RUST_SRC_B64_2`**:
45-
- Content: copy the **entire content** of `C:\Users\Admin\Desktop\qector_src_b64_part2.txt`
46-
47-
> The CI workflow concatenates `RUST_SRC_B64_1 + RUST_SRC_B64_2`, base64-decodes
48-
> the result, and extracts `src/`, `build.rs`, and `proto/` before running maturin.
49-
> Forks and external PRs will not have these secrets so their wheel builds are
50-
> gracefully skipped (lint and Docker checks still run).
43+
You should see: `RUST_SRC_B64_1`, `RUST_SRC_B64_2`, `RUST_SRC_B64_3`
5144

5245
---
5346

@@ -59,12 +52,14 @@ tar -czf C:\Users\Admin\Desktop\qector_src_only.tar.gz `
5952
-C C:\Users\Admin\Desktop\qector-decoder-main src build.rs proto
6053
6154
$b64 = [Convert]::ToBase64String([IO.File]::ReadAllBytes("C:\Users\Admin\Desktop\qector_src_only.tar.gz"))
62-
$half = [int]($b64.Length / 2)
63-
[IO.File]::WriteAllText("C:\Users\Admin\Desktop\qector_src_b64_part1.txt", $b64.Substring(0, $half))
64-
[IO.File]::WriteAllText("C:\Users\Admin\Desktop\qector_src_b64_part2.txt", $b64.Substring($half))
65-
```
55+
$third = [int]($b64.Length / 3)
56+
[IO.File]::WriteAllText("C:\Users\Admin\Desktop\src_p1.txt", $b64.Substring(0, $third))
57+
[IO.File]::WriteAllText("C:\Users\Admin\Desktop\src_p2.txt", $b64.Substring($third, $third))
58+
[IO.File]::WriteAllText("C:\Users\Admin\Desktop\src_p3.txt", $b64.Substring($third * 2))
6659
67-
Then update both GitHub secrets with the new content.
60+
# Then re-run the upload script:
61+
python C:\Users\Admin\Desktop\upload_secrets.py <GITHUB_TOKEN> <KEY_ID> <PUB_KEY>
62+
```
6863

6964
---
7065

0 commit comments

Comments
 (0)