Skip to content

Accept only this provider's own confirmation tokens in verify login - #319

Merged
umputun merged 1 commit into
go-pkgz:masterfrom
paskal:verify-require-provider
Oct 11, 2026
Merged

umputun merged 1 commit into
go-pkgz:masterfrom
paskal:verify-require-provider

Conversation

@paskal

@paskal paskal commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Previously, VerifyHandler.LoginHandler accepted any token with a user::address handshake signed with the service secret, including handshake tokens an application issues for its own purposes, which are not login confirmations. A session token, which has no handshake, caused a nil dereference.

After this change, the handler requires a handshake and a provider name matching its own before the replay store is touched, and rejects anything else with 403. Its own confirmation requests have set that name since 2024, so recently issued links keep working. The rejected token is redacted from the logged request. The README notes which tokens the provider accepts.

The change is mirrored in v1 and v2. Regression tests cover rejection, replay-store isolation and log redaction in both modules, and the existing test that sends a real confirmation and signs in with it still passes.

LoginHandler accepted any token with a user::address handshake signed
with the service secret, including handshake tokens an application
issues for its own purposes, which are not login confirmations. A
session token, which has no handshake, caused a nil dereference.

The handler now requires a handshake and a provider name matching its
own before the replay store is touched, and rejects anything else with
403. Its own confirmation requests have set that name since 2024. The
rejected token is redacted from the logged request.

Mirrored in v1 and v2. The confirmation fixtures are re-minted with the
provider name, as the confirmation request produces them.
@paskal
paskal requested a review from umputun as a code owner October 11, 2026 06:06
@coveralls

coveralls commented Oct 11, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38117006047

Coverage increased (+0.06%) to 86.72%

Details

  • Coverage increased (+0.06%) from the base build.
  • Patch coverage: 5 of 5 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 3848
Covered Lines: 3337
Line Coverage: 86.72%
Coverage Strength: 9.86 hits per line

💛 - Coveralls

@umputun umputun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@umputun
umputun merged commit b4cbc19 into go-pkgz:master Oct 11, 2026
6 checks passed
@paskal
paskal deleted the verify-require-provider branch October 11, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants