Skip to content

MM-69450: Notify users when GitHub SAML SSO or token auth fails#1032

Open
jgheithcock wants to merge 1 commit into
masterfrom
mm-69450-surface-auth-errors
Open

MM-69450: Notify users when GitHub SAML SSO or token auth fails#1032
jgheithcock wants to merge 1 commit into
masterfrom
mm-69450-surface-auth-errors

Conversation

@jgheithcock

Copy link
Copy Markdown
Contributor

Summary

When GitHub API calls fail due to revoked tokens (401) or SAML SSO authorization issues (403), the plugin previously logged the errors server-side but gave users no indication they needed to reconnect. This routes those failures through the existing handleRevokedToken flow, which force-disconnects the account and sends the bot DM telling the user to run /github connect again.

Changes:

  • Add isGitHubAuthFailure to detect 401 and SAML-specific 403 errors from both go-github (REST) and githubv4 (GraphQL) error shapes.
  • Extend useGitHubClient and wire up getLHSData / getPrsDetails paths that previously bypassed it.
  • Bubble up the first per-org error from GetLHSData so SAML failures are not swallowed when other orgs succeed.
  • Add unit tests for error detection and notification behavior.

Ticket Link

https://mattermost.atlassian.net/browse/MM-69450

Checklist

  • make check-style
  • go test ./server/plugin/...
  • Stash regression check: SAML 403 test cases fail without the fix, pass with it

Surface hidden GitHub auth failures (401 and SAML 403) by routing them
through the existing handleRevokedToken path, which force-disconnects
the account and sends the bot DM prompting reconnect via /github connect.
@jgheithcock jgheithcock requested a review from a team as a code owner June 30, 2026 02:51
@jgheithcock

Copy link
Copy Markdown
Contributor Author

@coderabbitai

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mm-69450-surface-auth-errors

Comment @coderabbitai help to get the list of available commands.

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.

1 participant