Skip to content

tools/gosamldev: forget a pending SP logout only once the IdP's answer is verified - #1007

Merged
crewjam merged 1 commit into
mainfrom
claude/great-pasteur-pr0lje-gosamldev-slo
Nov 13, 2026
Merged

crewjam merged 1 commit into
mainfrom
claude/great-pasteur-pr0lje-gosamldev-slo

Conversation

@crewjam

@crewjam crewjam commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Summary

This is the follow-up noted in #996.

The gosamldev SP's single logout service deleted the logout in progress from its store before ParseResponse checked the LogoutResponse. So a junk response posted with the browser's RelayState cancelled the logout, and the IdP's real answer was then refused with "No logout is in progress for this LogoutResponse".

Changes

  • server/sp_slo.go:
    • The pending logout is now deleted only when ParseResponse verified the response: success, slo.ErrPartialLogout, or a saml.ErrBadStatus. This is the same rule as pendinglogout.Answered in x/samlsp/slo/pendinglogout: track logouts in progress in cookies #996.
    • A PartialLogout response, which ParseResponse returns together with ErrPartialLogout, now shows the partial-logout message instead of the generic failure. The old check for it sat in the success branch and could never run.
  • New test TestSingleLogoutJunkResponseKeepsLogout: it starts an SP-initiated logout, posts a junk LogoutResponse with the same RelayState (refused), and then delivers the IdP's real answer, which is still accepted ("Logged out everywhere"). The test fails without the fix.

Testing

In tools/gosamldev:

  • go vet ./... and go test ./... pass.
  • golangci-lint v2.15 reports 0 issues.

Generated by Claude Code

…r is verified

The SP's single logout service deleted the logout in progress before
ParseResponse checked the LogoutResponse, so a junk response posted with
the browser's RelayState cancelled the logout, and the IdP's real answer
was then refused as answering no logout in progress. Delete it only when
ParseResponse verified the response (success, PartialLogout or another
status), as x/samlsp/slo/pendinglogout does. A PartialLogout response,
which ParseResponse returns with ErrPartialLogout, now shows its own
message instead of the failure one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFDLnyEpWvYnSDCnCib9sD
@crewjam
crewjam merged commit 7dcc89e into main Nov 13, 2026
11 checks passed
@crewjam
crewjam deleted the claude/great-pasteur-pr0lje-gosamldev-slo branch November 13, 2026 12:42
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.

2 participants