Repository navigation
feat(ceremony): tell an expired authorization code apart - #186
Merged
Merged
Conversation
A slow connection can spend longer setting up the notarized token request than the platform keeps its authorization code: X refuses one older than about 25 s. The refusal then looked like any other. Each notarized platform now declares its measured answer to an expired code and the code's lifetime. When the token request is refused with exactly that answer and the Prover has run at least that long, platform-refusal carries reason authorization-expired, the failure text says to check the connection, and the Client raises a CeremonyError with that reason. Timing alone never sets it. X's answer and lifetime were measured with real codes (accepted up to 24 s, refused at 25 s); GitHub's answer was measured and its lifetime is the documented 10 minutes until measured. Adding a platform now requires the measurement. Assisted-by: Claude Opus 5.5 Signed-off-by: Wondertan <hlibwondertan@gmail.com>
Real GitHub codes redeemed from the redirect were accepted at 540 s and refused at 660 s with bad_verification_code, bracketing the 10 minutes GitHub documents. Assisted-by: Claude Opus 5.5 Signed-off-by: Wondertan <hlibwondertan@gmail.com>
Ships authorization-expired: CeremonyError.reason for a platform-refused, expired authorization code. Assisted-by: Claude Opus 5.5 Signed-off-by: Wondertan <hlibwondertan@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An expired authorization code now fails as
authorization-expired, which applications can catch and explain, instead of an unexplained platform refusal.A slow connection can spend longer setting up the notarized token request than the platform keeps its authorization code. On Nov 20 an X run's token setup took 94 s on a high-latency link, and X refused the code; with #182 the refusal is visible, but it still looks like any other.
Changes
provider.tsdeclaresexpiredCode, its answer to an expired code and the code's lifetime.invalid_requestwith "Value passed for the authorization code was invalid." (the description is matched too, sinceinvalid_requestalone names other failures). Lifetime 25 s: real codes redeemed from X's redirect were accepted at 10, 15, 18, 21, 22, 23 and 24 s and refused at 25 and 40 s.bad_verification_code. Lifetime 600 s, the 10 minutes GitHub documents: real codes were accepted at 540 s and refused at 660 s with that answer.prover-ms, a lower bound on the code's age),platform-refusalcarriesreason: 'authorization-expired'and the failure text starts with "X did not accept the sign-in: it expired after N s, while this connection set up the proof. Check your connection and try again." Timing alone never sets it; a refusal before the lifetime keeps no reason.CeremonyErrorwithreason: 'authorization-expired'(new optional property).specs/ccdp.mddefines this one reason, carried by the event, never byCeremonyFailed.docs/metrics.mddocuments the attribute.docs/provers.md(Adding a platform) requires measuring a notarized platform's code lifetime and exact expired-code answer with real codes before release.Verified
@libid/ceremonytests: 1070 passed, covering for GitHub and X the expired-code answer before and after the lifetime, and a different answer however late; and the client attaching the reason only to the failure the event named.pnpm -C ts lint,fmt:checkand the ceremony typecheck pass.Not verified / known issues
🤖 Generated with Claude Code