Skip to content

server: accept multiple l1 auth secrets during rotation - #59

Merged
bruce-y merged 2 commits into
patchsetfrom
bruce-y/multiple-l1-auth-keys
Oct 20, 2026
Merged

bruce-y merged 2 commits into
patchsetfrom
bruce-y/multiple-l1-auth-keys

Conversation

@bruce-y

@bruce-y bruce-y commented Oct 20, 2026 •

Copy link
Copy Markdown

L1 credential rotation currently forces clients and servers to switch a single shared secret together. Allow BAZEL_REMOTE_L1_AUTH_SECRET to contain a comma-separated set of accepted keys so servers can accept new,old while runner agents move to the new key.

Parse, trim, and deduplicate accepted keys into a hash set when constructing the unary and streaming interceptors. Each request checks membership with a single map lookup. Requests still supply exactly one credential. A non-empty configuration with no usable keys rejects requests; the existing explicitly empty development configuration and exempt RPCs retain their behavior. Document the server-first rotation sequence and single-key client configuration.

Validation passed on Blacksmith Testbox: go test -race ./server . -count=1. Coverage includes both RPC interceptor types, overlap, retired keys, empty entries, malformed request lists, and duplicate metadata. Repository-wide gofmt and diff checks pass. BenchmarkAuthSecretLookup measures hits and misses for 1, 2, 16, and 128 configured keys.

Targets patchset, which contains the Blacksmith L1 authentication code and is the source of release tags. No credentials, releases, or deployments are changed.

On the same AMD EPYC Testbox, a successful lookup with two configured 64-byte keys measured a median of 7.44 ns/op versus 32.43 ns/op for the previous scan (three 200 ms samples per case). Both used 0 allocations/op. At 128 keys, the lookup measured 8.73 ns/op versus 1767 ns/op. These are lookup microbenchmarks, not end-to-end RPC latency.

@bruce-y
bruce-y marked this pull request as ready for review October 20, 2026 16:18
@blacksmith-staging

blacksmith-staging Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Checked Overlap list accepts new and old keys

Before, both keys were rejected because the list was compared as one literal secret. After, both new-key and old-key pass on unary and streaming RPCs.

Merge-base

Overlap list rejected

This PR 929e14a7

Both keys accepted

Also checked · 3 more claims, all matched observations

Checked Retired key rejected after rotation
Checked Empty-only list rejects everything
Checked Clients must send exactly one key

Proof on 929e14a7

View full Proof report

@bruce-y
bruce-y merged commit ebe4b14 into patchset Oct 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant