Repository navigation
Conversation
…MAP-1) The server now answers a value read the secret's own state refuses with 409 SecretExpired / SecretSuspended / SecretMaxReadsExhausted, or 403 SecretAccessOutsideSchedule, instead of 500. Expose the stable code on the base error and raise SecretUnavailable* for the three 409 codes; the schedule 403 stays Forbidden* with an accurate message. Local message text, never the server body. Session: ERRMAP-1 Signed-off-by: Andrei Beshkov <andrey.beshkov@gmail.com>
…ce on a ternary Signed-off-by: Andrei Beshkov <andrey.beshkov@gmail.com>
…nstructor throws it) Signed-off-by: Andrei Beshkov <andrey.beshkov@gmail.com>
keyorix main requires MFA by default (ADR-112), so the contract suites' password login stopped at the MFA step. A bootstrap script now creates the admin, enrols TOTP from the returned seed, completes the real MFA login and mints a short-lived PAT that every SDK suite uses. Each suite also asserts a password-only login still returns an MFA challenge. The role-less machine token expectation accepts the current empty list as well as 403. Signed-off-by: Andrei Beshkov <andrey.beshkov@gmail.com>
…al-server contract tests for the 403/409 refusals login on an MFA account now returns a typed MFA-required error carrying the challenge id and methods (instead of 'no token in login response'), with verifyMfa to complete it. The bootstrap creates per-SDK MFA accounts and one secret per refusal state through the API; each suite exercises MFA login->TOTP->session and the four refusals against the real server. Signed-off-by: Andrei Beshkov <andrey.beshkov@gmail.com>
…ation burns the current step; challenge logins hold rate-limit slots) Signed-off-by: Andrei Beshkov <andrey.beshkov@gmail.com>
Signed-off-by: Andrei Beshkov <andrey.beshkov@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.
STACKED ON #59 — merge after it (this branch contains #59's commits; the diff on top of them is the last commit). It also needs keyorix #3175 on the server for the refusal contract tests (see "Server ref" below).
What
loginon an account with a second factor (the server default, ADR-112) answers 200 withmfa_required+mfa_challengeand no token. Every SDK used to report that as a generic "no token in login response". Now:loginon an MFA account*MFARequiredError{Challenge,TOTPAvailable,WebAuthnAvailable,Methods()}VerifyMFA(ctx, url, challenge, code)MFARequiredError(extendsAuthError).challenge,.methodsverifyMfa(url, challenge, code)MFARequiredError(extendsAuthError).challenge,.methodsverify_mfa(url, challenge, code)MFARequiredException(extendsAuthException)getChallenge(),getMethods()Keyorix.verifyMfa(url, challenge, code)verifyMfacallsPOST /auth/mfa/verifywith{mfa_challenge, code}(TOTP or recovery code); a wrong or expired code/challenge is the SDK's auth error.loginalready threw for this case, so existingcatch AuthErrorhandlers keep working. Go had no matchable type before.webauthnin the methods but does not complete it (documented).["totp"]; wrong code -> auth error; fresh login + TOTP computed from the account's seed -> a session that authenticates.SecretSuspended,SecretExpired,SecretMaxReadsExhausted= 409 -> secret-unavailable error;SecretAccessOutsideSchedule= 403 -> forbidden error), each checked for status, stable code, type, and that the value does not leak.scripts/contract_bootstrap.py(still MFA ON, neverrequire_mfa:false) now also creates: one MFA-enrolled account per SDK (contract-mfa-<lang>, seed exported masked asKEYORIX_CONTRACT_MFA_SEED_<LANG>; one each because the server burns a TOTP step per account), and one secret per refusal state (suspend viaPOST /secrets/{id}/suspend, a 2 s expiration,max_reads=1with the one read spent, a schedule closed for today and tomorrow UTC).Server ref (not .github)
Main answers these refusals 500 today; the codes come from keyorix #3175 (open).
.keyorix-server-refis set toerrmap1/value-read-refusal-codesso the contract job builds that server. After #3175 merges, set.keyorix-server-refback tomain(one-line change, I will do it on request). Codes used are #3175's table: 403SecretAccessOutsideSchedule; 409SecretExpired,SecretSuspended,SecretMaxReadsExhausted..github
No
.githubchange needed: the bootstrap step already runs once and exports through$GITHUB_ENV.Verification (local, sandbox)
Server built from keyorix
errmap1/value-read-refusal-codes(#3175), fresh SQLite DB, MFA on, thencontract_bootstrap.py:go test -race ./...ok (unit + contract); gofmt, go vet clean.test.js66/0;contract-test.js31/0.~/.m2in the sandbox): 58/59 pass; the one failure isKeyorixClientTest.testTlsPrivateCa, which cannot create its temp dir in the sandbox (Operation not permitted), unrelated.ContractTest(incl. the two new tests) andMfaLoginTestpass.Session: SDK-MFA-ERR-1