Repository navigation
Description
ServerOptions.Credentials does two unrelated jobs, and there is no way to ask for one without the other.
What is coupled
In Server.ServeHTTP the registry is what maps an access key to an account (emulator/server.go, step 1.5):
if s.opts.Credentials != nil {
if entry, ok := s.opts.Credentials.Lookup(accessKey); ok {
reqCtx.AccountID = entry.AccountID
registryHit = true
}
}and immediately after, step 1.6 runs SigV4 verification gated on the same field being non-nil. An access key the registry does not know is then InvalidClientTokenId 403 (emulator/credentials.go, VerifySigV4).
So Credentials non-nil means two things at once: "resolve accounts from this table" and "enforce signatures on every request". The resolvePrincipal doc comment already notes the coupling; this issue is about removing it.
Why it matters
StartTestServer (emulator/testing.go) does not wire a registry, so every in-repo test authenticates as either 123456789012 (any AKIA… key) or 000000000000 (anything else) via extractAccount in emulator/parser.go. A test that needs to be a third account — or a specific vended member account — has no route.
Wiring a registry into StartTestServer to fix that would switch signature verification on for the whole repository in one step, since the two are the same flag. That is a repository-wide behaviour change, and it does not belong inside whatever feature happens to need multi-account tests.
Where this came from
#623 needs to authenticate as a vended member account. It works around this by adding a separate opt-in entry point (StartTestServerWithAccounts) that wires its own registry, leaving StartTestServer untouched. That is the right call for one feature but it is a second door, not a fix: the repository ends up with two test servers whose auth behaviour differs, and the difference is not the one a reader would guess from the names.
What it would take
Give signature verification its own ServerOptions field, so the four combinations are all expressible:
| Credentials | Verify signatures | Meaning |
|---|---|---|
| nil | off | today's StartTestServer — keys map by prefix heuristic |
| set | off | the missing one — real multi-account identity, unsigned requests fine |
| set | on | today's behaviour when Credentials is set |
| nil | on | nothing to verify against; must be rejected at construction |
Then StartTestServer can wire a registry for everyone, StartTestServerWithAccounts collapses into it, and a test that wants signature enforcement asks for it explicitly.
The last row is the one to get right: Verify: true with no registry has no key material to check against, so it should be a construction-time error rather than a server that 403s everything.
Acceptance criteria
- Signature verification is controlled by its own
ServerOptionsfield, independent ofCredentials -
VerifywithoutCredentialsis refused at construction, not at request time -
StartTestServerwires aCredentialRegistrywith verification off; no existing test changes behaviour -
StartTestServerWithAccountsis folded back intoStartTestServer(or kept as a thin wrapper), so there is one test server whose auth behaviour is described in one place - A test asserts the
set/offcombination: a registered key resolves to its account, and an unsigned request with that key is not a 403 - A test asserts the
set/oncombination still 403s an unregistered key withInvalidClientTokenId
Activity
fix(organizations): a member account sees the organization it belongs…
scttfrdmn commentedon Aug 14, 2026
A data point from v0.99.0's live verification gate, worth recording here because it widens the issue's consequence beyond tests.
substrate serverwires noServerOptions.Credentialsat all, and it has no flag or config key to supply one. So account resolution for the standalone server is entirelyextractAccount(emulator/parser.go:730): anyAKIA…key is123456789012, everything else is000000000000. There are exactly two reachable identities.That means v0.99.0's member-account behaviour — #623's reverse index and #619's
DescribeResourcePolicyasymmetry — cannot be exercised against a running server at all, only throughStartTestServerWithAccountsin-process. The live run confirmed the two identities it can drive (management reads its policy; a non-AKIAcaller auto-creates its own organization and readsResourcePolicyNotFoundExceptionfor it), but theAccessDeniedExceptionpath — a member of management's organization with no delegation — is unreachable from the CLI, because there is no way to be one.So this is not only "a test cannot have a registry without SigV4 enforcement". It is also "a server operator cannot map keys to accounts at all", and the two are the same coupling: the only way to supply a registry today is to accept signature verification, which for a server pointed at by arbitrary SDKs and CLIs is a much larger behaviour change than a test opting in. Decoupling the two would let
substrate servergrow a credential map without becoming a SigV4 gate, which is what would make the member-account paths reachable outside Go tests.scttfrdmn commentedon Aug 22, 2026
#734 (PR #740) touches this and deliberately does not land the
cmd/substrate/main.gohalf that the v0.108.0 plan had assigned to it. Recording why, because the reasoning is the argument for this issue.The plan's premise was that the shipped binary is permanently stuck on the access-key sniff:
main.gobuildsServerOptionswithoutCredentials, soserver.gocan never take the registry path, so the account can never be anything but whatever the sniff decided. Wiring a registry looked like the fix.That premise no longer holds. #734 makes the account come from
account.defaultinsubstrate.yaml, resolved before any credential is consulted, so the binary is configurable without a registry. What a registry would add is per-credential accounts — which is a real feature, but not the one that was blocking.And wiring one now would be a regression.
Servergates both step 1.5 (registry account lookup) and step 1.6 (signature verification) ons.opts.Credentials != nil, so a registry parsed from config would switch SigV4 enforcement on for the whole server. Substrate's own documentedtest/testcredentials are in no registry, so every call in every quickstart would start answeringInvalidClientTokenId403.That is exactly the coupling this issue is about, and it now blocks a second thing: #736, which is
substrate.yaml'scredentials:section being documented but never parsed.auth:in the same file is independently wireable —AuthController.CheckAccesstreats a caller resolving to no IAM entity as unenforced — butcredentials:cannot move until identification and enforcement are separable.The same coupling is already documented in
emulator/testing.go, which is whyStartTestServerWithAccountsis a separate entry point fromStartTestServerrather than an option on it, and inresolvePrincipal's doc comment, which reads state rather than the registry for the same reason. #734 adds a third mention indocs/services.mdunder "Which account a request is attributed to".Staying open. The shape of the fix is two independent switches — "which account does this key belong to" and "must signatures verify" — rather than one nil check standing in for both.
fix(parser,config): one server serves one account (#734) (#740)
feat(server): give signature verification its own option, separate fr…
feat(config): read substrate.yaml's credentials: section (#736) (#768)