Repository navigation
fix(websocket): retain server authentication failure context - #629
Closed
snehaapratap wants to merge 1 commit into
Closed
snehaapratap wants to merge 1 commit into
snehaapratap wants to merge 1 commit into
Conversation
kevingentile
reviewed
Nov 9, 2026
| err = c.WriteMessage(mt, data) | ||
| } else { | ||
| res := []models.ControlMessage{{EventType: models.EventType{EventType: "status"}, Status: "auth_failed"}} | ||
| res := []models.ControlMessage{{EventType: models.EventType{EventType: "status"}, Status: "auth_failed", Message: "missing entitlement"}} |
There was a problem hiding this comment.
Can you inver auth_failed correlates to only a bad entitlement or would (should) the backend provide this additional context?
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
auth_failedresponse currently loses the server'smessage, so callers see onlyauthentication failed: closing connectioneven when the server explains a missing entitlement. Include the server's reason, using the existing status-message sanitizer, while retaining the old error text when no reason is supplied.Fixes #628. This forwards the server's explanation; it does not infer an account's subscription or invent an entitlement diagnosis.
The local WebSocket integration test now verifies the reason reaches
Client.Error(). A table test covers a supplied reason, an absent reason, and newline sanitization. The reason assertions failed before the fix.Validation:
go test -race ./...,go build ./..., andgo vet ./...passed on Go 1.27.3.go mod tidyleft dependency files unchanged; gofmt andgit diff --checkpassed../websocket/.... The full lint command reports an existing uncheckedjson.Unmarshalatrest/iterator.go:127, outside this diff. Running that older linter with Go 1.27 instead fails to decode newer export data, so the scoped lint used Go 1.24.9.AI assistance: implemented and validated with OpenAI Codex.