Repository navigation
Conversation
The merge of #2079 after #2224 put back the first draft of session_lifecycle.go and its test: Refresh checked the secret and rotated it under two separate locks, so two refreshes with one secret could both pass the check, and the absolute expiry, list and revoke test was gone. Restore #2224's checkLocked and test, document the two errors, and restore the guide section both PRs added, saying the service does not use the directory yet.
The merge of #2076 after #2225 put back the first draft of public.go: Users returned profiles in map order again, a nil context panicked, and the filter and private copy test and the note's ordering sentence were gone. Restore them, document the two username errors and add a test that concurrent claims of one username leave exactly one owner.
ChangePassword (#2127) hashed the new password directly with HashPassword, which checks only the maximum length, so a signed-in player could change a password to a single character. It now calls ValidatePassword first, and the service's hashPassword uses it too. ValidatePassword (#2126) counted bytes where the service counts characters, so it passed passwords the service refused; it counts characters now. The guide sentence #2126 added was dropped by a later merge; the passwords section now states the rule.
…deletion #2128 added GET /v1/me/export and DELETE /v1/me without a test of either. The export marshalled Account and Identity, which had no JSON tags, so it wrote "ID", "Email" and "Provider" where every other route writes camel-case keys, and null for an account without identities. Tag the two types (the liveops client already decodes identities case-insensitively, so it is unaffected), document the document's shape, list both routes and last_credential in Handler's comment, and test that the export carries no secrets and that a deleted account can neither refresh nor sign in. Restore the guide's table rows and paragraph a later merge dropped, keeping its warning that cloud saves and leaderboards are not erased.
…idToken The OIDC verifier merged from #2123 and #2240 decoded each JWKS entry into a map of strings, so an entry with an array member, such as the x5c and key_ops that Microsoft's and Auth0's key sets carry, failed to decode and its key was silently dropped: every token from those issuers was refused. Decode only the members it needs. Refusals now wrap identity.ErrInvalidToken, which #2240 exported but the merged verifier never returned, and a test covers wrong audience and issuer, expiry, not-before, a missing subject, a wrong key, a tampered payload and a rotated-in key. The two PRs also left two changelog fragments and two notes for one verifier; keep #2240's, absorbing the other's rejected alternative, and say in the guide that the nonce is not checked.
…ffer A later merge dropped the In-app purchases section #2242 added to liveops.md in both languages, and BuyOffer had no test. Restore the section under In-app purchases, saying how to set the account token, and test that BuyOffer sends the signed offer to the store and delivers the subscription.
…log guides #2103 inserted ProviderSteam before ProviderMiniGame, changing the value of an existing exported constant; append it instead. The guides it added said achievements with a Steam ID are dispatched by a Steamworks adapter, but nothing reports catalog IDs to Steam (ServiceFor never picks Steam, no leaderboard code submits there), and repeated each section's sentence twice in both languages; say what the IDs do and how to use them with online/steam. The PR also carried two notes and two changelog fragments for the one change; keep one of each.
This branch has not been deployed
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.
Follow-up review of the accounts, purchases, achievements and anti-addiction pull requests the merge train landed, as they stand on main.
#2079 and #2224: session lifecycle core
Two attempts at the same
SessionDirectory. #2079 merged after #2224 and put back its first draft:Refreshchecked the secret and rotated it under two separate locks again, and #2224's absolute expiry, list and revoke test was gone, as was the guide section both PRs added. This PR restores #2224'scheckLocked, its test, and the guide section (en and zh), which now says the service'sStore, config and HTTP routes do not use the directory yet, and documentsErrSessionExpiredandErrSessionReuse.#2079 said Fixes #1683, but #1683's acceptance (config fields,
Storemethods with migrations,GET /v1/sessionsand sign out everywhere, expiry checked incheckSession) is not met: the directory is in-memory and unused.#2076 and #2225: public profiles
Same pattern: #2076 merged after #2225 and reverted it.
Usersreturned profiles in map order, a nil context panicked, and the filter and private copy test and the note's ordering sentence were gone. Restored, with doc comments on the two username errors and a test that 16 concurrent claims of one username leave one owner. #1684 (closed by both) still lacks persistence, a schema migration and HTTP routes.#2126 and #2127: password policy, password change and unlink
ChangePasswordhashed the new password withHashPassword, which checks only the maximum, soPOST /v1/passwordaccepted a one-character password. It now appliesValidatePasswordfirst, and the service's own check uses the same function.ValidatePasswordcounted bytes where the service counts characters, so it passed passwords registration refused. It counts characters now.Not fixed here: a password change does not revoke other sessions, and two concurrent unlinks on an account without email can remove both of its identities because
Store.UnlinkIdentitydoes not check the last credential atomically. Both are #1651's scope (still open).#2128: data export and deletion
GET /v1/me/exportandDELETE /v1/mehad no tests. The export marshalledAccountandIdentity, which had no JSON tags, so it wroteID,Email,Providerinstead of the camel-case keys every other route uses, andnullfor no identities. This PR tags both types (the liveops client already decodes identities case-insensitively, so it is unaffected), documents the document's shape, lists both routes andlast_credentialinHandler's comment, and tests that the export carries no secrets and that a deleted account can neither refresh nor sign in. The guide's table rows and paragraph a later merge dropped are restored, along with its warning that cloud saves and leaderboards are not erased. #1650 (closed) asked for that erasure, plus tests and docs incloudsave.mdandleaderboard-selfhost.md, and none of it was done.#2123 and #2240: identity verifiers
Two verifiers for one issue, already merged into one
oidc.goby 5ebd0b0. Remaining defects:map[string]string, so an entry with an array member, such as thex5candkey_opsin Microsoft's and Auth0's key sets, failed to decode and its key was silently dropped. Every token from those issuers was refused. The decoder now reads only the members it uses.identity.ErrInvalidTokenwas exported but never returned by the verifier. Refusals now wrap it.#2240 said Fixes #1652, but #1652 asks for nonce checks, recorded fixtures and mini program error codes, and there is no nonce check.
#2242: account tokens and offers
The liveops guide section was dropped by a later merge. It is restored in en and zh under In-app purchases, saying how to set
PurchasesOptions.AccountToken.BuyOfferhad no test; one now checks that the signed offer reaches the store and the subscription is delivered.#2103: Steam catalog identifiers
ProviderSteamwas inserted beforeProviderMiniGame, changing the value of an existing exported constant. It is appended after it now.ServiceFornever picksSteam, and no leaderboard code submits there. They also repeated each section's sentence twice. Both guides (en and zh) now say what the IDs do and to pass them toonline/steam.#2129: anti-addiction age rules
OK as folded by #2473. No changes.
Verification
go tool nsgo test ./pkg/online/accounts/... ./pkg/online/liveops/... ./pkg/online/leaderboard/... ./pkg/online/achievements/... ./internal/repocheck/...: 0 failed.go tool nsgo check ./pkg/online/...,go run ./tools/changelog checkandbun run verify-notespass.Screenshots: None