Skip to content

config: substrate.yaml's credentials: and auth: sections are documented but never parsed #736

Closed

Description

@scttfrdmn

substrate.yaml.example documents two sections that Config has no mapstructure tags for and LoadConfig therefore discards:

  • credentials: (substrate.yaml.example), with an enabled flag and a list of entries carrying access_key_id / secret_access_key / account_id
  • auth: (substrate.yaml.example), with an enabled flag for cross-service IAM enforcement

Both are real subsystems — CredentialRegistry and AuthController exist and are wired through ServerOptions — but the only way to reach them is in-process, via emulator.NewServer. A consumer running the shipped substrate server binary cannot turn either on, and gets no error for trying: viper reads the keys, nothing consumes them, and the server starts with both off.

Noticed while landing #734, which added an account: section beside them and had to reckon with the fact that the two neighbours above it are decorative.

Why it is not a one-line fix

Wiring credentials: cannot be done independently of #630. Server verifies SigV4 exactly when ServerOptions.Credentials != nil (emulator/server.go, steps 1.5 and 1.6), so parsing a credentials: block into a registry also switches signature enforcement on for the whole server — and substrate's own documented credentials (test/test) are not in any registry, so they would start answering InvalidClientTokenId 403. #630 is the decoupling that has to land first.

auth: is more tractable: NewAuthController needs only state, a logger and the time controller, and AuthController.CheckAccess already treats a caller that resolves to no IAM entity as unenforced, so enabling it changes nothing for a consumer who never created a principal.

Acceptance criteria

  • Config grows tags for whichever of the two sections is wired, and LoadConfig sets its defaults
  • cmd/substrate/main.go passes the resulting controller/registry through ServerOptions
  • Validate refuses a malformed entry (a non-12-digit account_id, an empty access_key_id) rather than silently dropping it
  • The section left unwired, if any, is marked as such in substrate.yaml.example rather than reading as though it works
  • A test asserts that a config file enabling the section produces a server that behaves accordingly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions