Skip to content

Protected secrets: a change needs your passkey

When you protect an App secret, no change to it takes effect until the person who asked for it approves it with their own passkey, on a page the server hosts. An agent cannot approve anything: it has no passkey. So an agent can ask for a change, but the change does not happen until a person says yes.

Who can ask matters. On a deployment with passkey signing, if your assistant works through your own signed-in account, a change it asks for is held as a request and you get a link to approve it. If the change comes from a worker-bound session, an App key, a run or an impersonated session (the same list as the reference), it is refused outright: no request is made and no link is given. A "run" here is an automated execution that is not a person signed in as themselves; an agent you drive on your own login is the first case, not this one.

Any App member who is a person can ask to store a new value or to turn protection on. Only the secret's creator or whoever manages the App can ask to delete it, and only a manager can ask to turn protection off. Whoever asks is the only one who can approve, so protecting a secret does not give you a veto over other members.

This page explains the idea. The exact calls, answers and limits are in Secret change requests.

Source and status

This page describes hadron-server pull request #4177 as merged at e42bb189, and the specs cor:sec:070, cor:sec:070:01 and cor:sec:070:02 (decided, unminted). Nothing here was run against a deployment. Claims below carry their source; a claim with none is marked unverified. "Decided, unminted" means the specs are written and agreed but not yet published as the platform's law; "as merged at" names the exact commit read.

What protection guards

Protection applies to an App-owned secret only. Spec cor:sec:070:01 says: "org- and user-owned secrets are never protected in v1", and the schema says the flag is "always false for org and user secrets" (typeDefs.ts:6530 in the source at e42bb189).

While a secret is protected, three things happen only through a change request that a person completes with their own passkey: storing a value, deleting the secret and turning its protection off (cor:sec:070:01, "What protection guards"). Creating a secret already protected works the same way (cor:sec:070:02, "A protected create"). Turning protection on for a secret that is not protected yet is also held as a request, not applied at once (resolvers.secret.ts:239 to :241 and :417).

Who can protect a secret, and who can unprotect it

Any member of the App who is a person can ask to turn protection on. Only whoever manages the App can ask to turn it off. Both are held as a change request that the asker approves.

  • Source: resolvers.secret.ts:234 requires an App member when protecting and :235 requires whoever manages the App when unprotecting, at e42bb189.
  • Spec: cor:sec:070:01, "Who turns it on and off".

What you do when a change is waiting

You ask your assistant to change the secret, the way you would for any other, working through your own signed-in account. For a protected secret the server does not apply the change. It keeps the request, and answers with a refusal that carries a request id and a link to a page on the server (changeRequests.ts:56, the path under /secret-changes/ at :15). Open that link yourself, prove it is you with your passkey, check what the page says you are approving, and approve it. The server's page has no decline button yet (a decline path is specified, not built; see the reference); to say no, leave the request alone and let it expire, or withdraw it yourself.

Three things are worth knowing before you do:

  • Only you can approve your own request. A request is opened by a person acting as themselves, and only that person completes it (cor:sec:070:02, "Only a person, in person"). Someone else who opens your link cannot complete it.
  • You will not see the value. After the proof the page shows the App, the secret, the change and, for a new value, its size. It never shows the value (cor:sec:070:02, "Nothing before the proof, and never the value").
  • Your agent must not approve it for you. A client hands you the link and never completes the ceremony itself (cor:sec:070, "hadron-cli ... never completes a change itself"; cor:sec:070:02, "Only on the server's page"). If an agent offers to approve a protected change for you, that is a bug (unverified as a statement about any particular client; it follows from the two sources just cited).

If you change your mind, withdraw the request yourself. Only the person who opened it can withdraw it; no manager can do it for them. Withdrawing, like asking, needs a person acting as themselves, so a worker session or an App key cannot do it (resolvers.secretChanges.ts:8 to :11 and :23, :24). An open request counts against your allowance of open requests on that secret until it ends, and it expires on its own after an hour (see the reference).

Unverified: what your agent says when it gets the refusal depends on the client it runs through. The released CLI (v0.55.0) predates this server change; its hadron secret --help still names the older refusal SECRET_PROTECTED, so a client that matches on that code will need updating. Whether the CLI or the portal hands you the link is separate companion work (hadron-cli#2738 and hadron-portal#2380) and is not described here.

An extra rule for reading a protected secret

Protection also adds a rule for reading: on a protected secret, the person who issues a read client may not also be that client's holder as a person (cor:sec:070:01, "The two-person rule"). The rule has an exception: it does not reach a worker the issuer holds, so one person can still read through their own worker; the passkey signature and the audit row are the control there, as the spec records under "Decided and Set Aside". The server enforces it as SECRET_PROTECTED_TWO_PERSON_REQUIRED (protection.ts:10).

On a deployment without signing

Passkey signing is a deployment switch (deploymentSchema.ts:7 and :24; the name of the switch is not described here). Where it is off, protection and change requests are not offered: setSecretProtected, withdrawSecretChangeRequest and the type SecretChangeRequest are absent from the schema (deploymentSchema.ts:7 and :24 at e42bb189). A refused change on a protected secret there carries no request id: changeRequests.ts:37 throws the refusal with no request when signing is off.

A secret that was protected while signing was on is frozen while it is off. Every route that would change it goes through that same staging path, so each that still exists is refused with no request: storing a value, deleting it, and turning protection off (the only route left, updateSecret's protected argument, resolvers.secret.ts:417 to :421; setSecretProtected does not exist there; a delete stages at :463). It is changeable again only when signing is back on. This is read from the source, not run on a deployment, and how a secret comes to be protected on a deployment without signing (for example, signing was switched off later) is not something the source says.

How to tell which kind of deployment you are on, and what an operator turns on, is not described here.