Restore a variable your admin-ops batch changed
When an Actions variable you changed through admin-ops breaks users, you can set it back to its value before the batch yourself, at once, without waiting for a person. This only works when the person who approved the batch allowed it: rollback first, as agreed.
stamp request restore REQUEST_ID --evidence "https://… users see a blank page since 02:10 UTC"
stamp request restore REQUEST_ID --step 3 --evidence "…" # when the batch changed several variablesIt runs as soon as you ask. The approver's GitHub account makes the change, through the access they gave when they approved. The variable gets its value from before the batch, or is deleted if it did not exist before. The approver gets a Raft message with your evidence (if Stamp could not message them, the answer says so and approver_told is false: tell them yourself or have a person tell them), and the request's page shows a receipt: "restored by you, as @approver", the value before and after, the evidence, and GitHub's answer.
When it works
All of these must hold. Each one that fails is refused with its own code, and nothing is changed:
- You filed the batch, from this CLI's state directory. Your CLI keeps what a restore needs in
~/.stamp/admin-ops-restores/(or the state directory you set), so restore from there. No other agent can restore it, not even another agent of the same server:ADMIN_OPS_RESTORE_NOT_KEY_HOLDER. If you cannot restore it, a person must. - The approver left the box ticked. Under Approve, the page says "Agents can restore the previous value of these variables until …". An approval with the box unticked, or one made before this feature, is not restorable:
ADMIN_OPS_RESTORE_NOT_RESTORABLE. The approver can also withdraw it later on the request's page:ADMIN_OPS_RESTORE_WITHDRAWN. - The approver's GitHub access is still alive. For the restore, Stamp keeps only the approver's short-lived GitHub access (about 8 hours from when they authorized it), never anything that renews it. The window ends with that access, and at most 24 hours after the approval:
ADMIN_OPS_RESTORE_EXPIRED. For some approvers it can end sooner, when their GitHub access is renewed or ends (they authorize again, or it reaches its limits): the restore is then refusedADMIN_OPS_RESTORE_CREDENTIAL_REFUSED, nothing restored. The approval page shows the exact time. The approver must also still be a member of the server, connected as the same GitHub account:ADMIN_OPS_RESTORE_APPROVER_UNAVAILABLE. - It is a variable step that succeeded. Only Actions variables are restored, repository or environment level. Secrets, rulesets and every other kind of step are not:
ADMIN_OPS_RESTORE_STEP_NOT_VARIABLE. The step must have finished with a success less than 24 hours ago:ADMIN_OPS_RESTORE_STEP_NOT_SUCCEEDED,ADMIN_OPS_RESTORE_WINDOW_PASSED. - Nobody changed the variable since. Stamp reads it from GitHub right before writing, and it must be exactly what the batch wrote (or still absent, for a deletion). Otherwise it does not overwrite someone's change:
ADMIN_OPS_RESTORE_VALUE_CHANGED. - Once per step. A step restored once is not restored again:
ADMIN_OPS_RESTORE_ALREADY_DONE. The approver's access for that step is deleted after one attempt, whatever GitHub answered:ADMIN_OPS_RESTORE_TOKEN_GONEafterwards. --evidenceis required. Say what harmed users: a link to the report or post, what they see. It is kept word for word (at most 2 KiB of plain text) and shown to the approver. Stamp does not read meaning into it.
Your CLI first collects what the restore needs from Stamp, once. When it cannot collect, the refusal says why: ADMIN_OPS_RESTORE_NOT_RESTORABLE (the approver approved without allowing a restore), ADMIN_OPS_RESTORE_WITHDRAWN, ADMIN_OPS_RESTORE_EXPIRED, or ADMIN_OPS_RESTORE_NOTHING_TO_COLLECT (already collected, or not your batch).
Where people sign in to Stamp with their Raft account and Stamp has found that Raft no longer counts the approver's sign-in for Stamp (it finds out when it checks them with Raft: when they use Stamp, when their role changes, or in its hourly check, which covers everyone who holds a live grant or live access for a restore), the restore is refused ADMIN_OPS_RESTORE_APPROVER_SIGN_IN_REQUIRED, which says the access they gave has expired and names them: nothing is restored, and signing in again renews it. Ask them to sign in to Stamp again, then run the same stamp request restore again (before that access's own expiry, which the answer gives when the access has one).
For some batches, stamp request restore also gets a short-lived Raft agent token by itself (raft integration token), so run it where your raft CLI works; an older stamp CLI refuses such a batch before sending anything: upgrade stamp. A current CLI restores every step, whichever way it was approved. Refusals you may meet there: ADMIN_OPS_RESTORE_VAULT_PACKET_REQUIRED (upgrade stamp, then run the same command again), ADMIN_OPS_RESTORE_REPLAY (run the same command again), TOKEN_VAULT_PROOF_INVALID (run it again; it gets a fresh Raft agent token), and TOKEN_VAULT_FROZEN, TOKEN_VAULT_CIRCUIT_OPEN, TOKEN_VAULT_RATE_LIMITED, TOKEN_VAULT_UNAVAILABLE (restores are paused or unavailable for now: try again shortly).
Every refusal's next step is the same when it cannot be fixed by you: find a person with admin rights on the repository. The request's page shows each variable's value before the batch.
What Stamp does and does not do
- It writes exactly one thing: the stored value from before the batch, into that one variable, in that one scope. Nothing you send chooses the name, the value or the path.
- The approver's access is used only for your restore of that request and step, and you never see it. Stamp deletes it after use, at its expiry, when the approver withdraws it, and when the server is uninstalled.
- If you run out of time or are not available, nobody else can restore it on your behalf. A person sets it back on GitHub.