Skip to content

Control plane: formalize signed-token verification — secret distribution, rotation, and revocation freshness #1184

Open

Description

@bjagg

Part of #1041.

Why

ADR 0002's whole independence argument rests on offline signed-token validation: a service like LDE verifies lifk_<payload>.<hmac> with a shared secret and takes no runtime dependency on the issuer. That property is what makes the control plane extractable at all — but the secret distribution, rotation, and revocation-freshness story are currently implicit.

Scope

  • Formalise the token format and the verification contract as a documented, versioned interface (payload fields: key id, owner, workspace, expiry).
  • Secret distribution + rotation. Where the shared secret lives per environment (SSM), how a rotation happens without invalidating live keys, and how a verifying service picks up a rotated secret. Support at least two valid secrets during a rotation window.
  • Revocation freshness. ADR 0002 accepts a deliberate trade — short expiry or a small cached revocation list. Pick one and implement it; today revocation is effectively "wait for expiry".
  • Verification lives in a brick every API service can package without pulling the control plane in.

Watch out

Strip whitespace on any secret read from SSM. A trailing newline on an SSM value took the demo advisor down (urllib3 InvalidHeader); hardened in PR #1115 for adapter credentials, but a new secret-reading path must not reintroduce it.

Done when

LDE validates keys with no network call to the control plane, a secret rotation is demonstrated end-to-end on dev without breaking live keys, and revocation takes effect within the documented window.

Activity

  1. added a commit that references this issue on Oct 5, 2026
  2. dereck-symmetry commented on Oct 5, 2026

    @dereck-symmetry
    Contributor

    ADR 0006 partly reopens ADR 0002's Decision 2, and this issue's premise changes with it. The issue assumes keys are lifk_<payload>.<hmac> signed tokens, verified offline. That was #1033's design, but #1038 shipped lifk_ plus secrets.token_urlsafe(32), stored as a plain SHA-256 hash (components/lif/mdr_services/developer_api_key_service.py:32-33). An opaque key carries no payload to verify, so it can only be checked by looking it up.

    The ADR leaves the format to this issue (decision 5), with one rule from decision 1: only the control plane reads the key store. That leaves two options:

    1. Opaque keys, validated through a control-plane verify endpoint. These are today's keys, so nothing is reissued. Revocation takes effect immediately, and LastUsedDate gets written as a side effect. The cost is that LDE takes a runtime dependency on the control plane, which is the property ADR 0002 set out to avoid.
    2. Signed keys, verified offline. This keeps 0002's independence argument, and everything this issue already lists applies: secret distribution, rotation with two live secrets, revocation freshness, and stripping whitespace from SSM values. The costs: existing keys can't become signed, so they need reissuing or a dual-format period; revocation is only as fresh as the chosen window; and nothing writes LastUsedDate unless something reports usage.

    LDE reading the store directly, a third option the ADR's earlier draft left open, is ruled out by decision 1.

    Proposed retitle: "Control plane: decide and implement key verification — opaque via a verify endpoint, or signed offline". The current "Done when" ("LDE validates keys with no network call") only holds for option 2. I'd make it option-neutral: LDE accepts a valid key and rejects revoked, expired and unknown ones, revocation takes effect within the documented window, and (option 2 only) a secret rotation is shown end-to-end on dev.

    #1186 and #1188 depend on whichever option is picked here writing LastUsedDate.

  3. added a commit that references this issue on Oct 9, 2026
  4. dereck-symmetry commented on Oct 9, 2026

    @dereck-symmetry
    Contributor

    #1362 merged today, so ADR 0006 is now Accepted. Its decision 1 is now the accepted way forward: only the control plane reads or writes the key store. As @bjagg noted in his #1362 review, that rules out the "LDE looks up opaque keys directly" path. This issue now has two options: opaque keys validated through a control-plane verify endpoint, or signed keys verified offline. My 10-05 comment above goes through both.

    One correction to that comment: the key generation it cites has moved with #1363. It's now at components/lif/developer_keys/core.py:33-34, and it still generates lifk_ plus secrets.token_urlsafe(32), stored as a plain SHA-256 hash.

    The issue body still describes only the signed-token design, so here's a concrete re-scope to replace it. Nothing in it picks an option. That's still this issue's decision.

    Title: Control plane: decide and implement key verification — opaque via a verify endpoint, or signed offline

    Scope

    • Decide between (1) opaque keys validated through a control-plane verify endpoint and (2) signed keys verified offline. Record the decision against ADR 0002 decision 2 and ADR 0006 decision 5.
    • Either option: a documented, versioned verification contract, plus a verification brick every API service can package without pulling the control plane in. Write LastUsedDate and the revocation data Control plane: admin API — key usage, revocation audit, per-service health aggregation #1186 and Control plane: admin console UI for deployment operators #1188 need.
    • Option 1 only: the verify endpoint, its latency and availability budget for LDE, and whether to cache results for a short time.
    • Option 2 only: the token format and payload fields, secret distribution (SSM) and rotation with two valid secrets, a revocation-freshness window, and a path for existing opaque keys (reissue them, or a period accepting both formats).

    Watch out (unchanged; it applies to option 2 and to any new SSM read): strip whitespace from secrets read from SSM (see PR #1115).

    Done when: LDE accepts a valid key and rejects revoked, expired and unknown ones. Revocation takes effect within the documented window. Option 2 only: a secret rotation is shown end-to-end on dev without breaking live keys.

    @bjagg, if this reads right to you, I can make the edit to the title and body, or you can if you'd rather. I'm leaving the choice between the two options to you and the team.

  5. added a commit that references this issue on Nov 4, 2026
  6. dereck-symmetry commented on Nov 4, 2026

    @dereck-symmetry
    Contributor

    @bjagg a nudge on the choice in my 10-09 re-scope (issuecomment-6089161943). It's become the next blocker on #1041.

    Where things are. The control-plane service and its key store are on main (#1384, #1466). The copy from MDR (#1183) is starting next, and it doesn't depend on this choice. Everything after the copy does: #1185's cutover needs LDE to validate keys, and LDE's _developer_key_strategy is still a stub (TODO(#1034)).

    The choice, unchanged since 10-09. ADR 0006 decision 1 says only the control plane reads the key store, so there are two options:

    1. Opaque keys, checked through a control-plane verify endpoint. These are today's keys (lifk_ + token_urlsafe(32), SHA-256 hashed), so nothing is reissued. Revocation is immediate, and LastUsedDate gets written as a side effect. The cost: LDE takes a runtime dependency on the control plane.
    2. Signed keys, verified offline. This keeps ADR 0002's independence argument. The costs:
      • existing keys need reissuing, or a period that accepts both formats;
      • a secret has to be distributed and rotated, with two valid at once during a rotation;
      • revocation is only as fresh as the chosen window;
      • nothing writes LastUsedDate unless something reports usage.

    What I need: the option, or a pointer to who should decide it. I can also make the title and body edit from the 10-09 re-scope, if it still reads right. I'm not starting code here until the choice is made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions