Skip to content

fix: log OAuth code-exchange failures, show a refused sign-in on the invitation page - #974

Merged
fclairamb merged 5 commits into
mainfrom
feat/todos-2026-11-21-2
Nov 21, 2026
Merged

fclairamb merged 5 commits into
mainfrom
feat/todos-2026-11-21-2

Conversation

@fclairamb

Copy link
Copy Markdown
Owner

Stacked on #973: merge it first.

Closes fclairamb/solidping-business#103

What changes

  • Server: every OAuth provider (Google, GitHub, GitLab, Microsoft, Discord, Slack, OIDC) now logs a WARN OAuth token exchange failed with the provider and its answer when the authorization code exchange fails. The message shown to the user is unchanged. Until now the provider's reason (code already used, expired, redirect_uri mismatch) was dropped, so a TOKEN_EXCHANGE_FAILED could not be diagnosed.
  • Dashboard: the invitation page shows a refused sign-in (error_description in the URL) in a banner (data-testid="invite-oauth-error"), so a sign-in started from an invitation that fails comes back to it with a visible error.

The error hidden inside returnTo was already fixed by dda98b7 (login page lifts it out and strips it from the retry destination).

Tests

  • TestTokenExchangeFailureIsLogged (fails on the old code).
  • web/dash0/e2e/invitations.spec.ts: new case for the error banner.

🤖 Generated with Claude Code

fclairamb and others added 4 commits November 21, 2026 21:11
…clairamb/solidping-business#100)

A "452 4.4.5 rate limit" reply to RCPT TO failed the notification job for
good: IsRetryableSendError (internal/email/sender.go) only read the code
from a *textproto.Error, and go-mail returns its own SendError. It now uses
smtpReply(), so any 4xx is retryable; the email notification sender wraps it
in a RetryableError, which the notification job retries after its backoff
(job_notification.go also honours RetryableError now), as does the email job.
go-mail's ", affected recipient(s): ..." suffix is stripped from the logged
and returned error. TestSend_RateLimitReplyIsRetryableAndRedacted fails
before the fix.

Closes fclairamb/solidping-business#100

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iramb/solidping-business#101)

During a database outage every agent reconnect got a 401: serveReconnect
(internal/handlers/agentws/handler.go) answered "Unknown agent" to any
GetAgent error and "Nonce already used" to any nonce store error, and
serveEnrollment read any token lookup error as a bad token (the DB layer
mapped every error to ErrEnrollmentTokenInvalid). Only not found, a bad
signature or a replayed nonce now give 401 (a malformed agent UID is
rejected before the lookup); other errors give 503 with Retry-After, logged
at WARN. The agent treats a 5xx handshake as a lost connection (WARN once,
re-claim). TestAgentAuthDatabaseDownIs503, TestReconnectNonceStoreFailureIs503
and TestWSBackendDial5xxIsConnLoss fail before the fix.

Closes fclairamb/solidping-business#101

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… clone (fclairamb/solidping-business#102)

A group slug passed as checkGroupUid (the MCP tools document "UID or
slug") reached Postgres as is and failed as an invalid uuid (22P02): the
caller got an internal error. CreateCheck, UpdateCheck and CloneCheck
(internal/handlers/checks/service.go) copied the value without a lookup,
so another org's group UID was accepted too. They now resolve it with
GetCheckGroupByUidOrSlug in the caller's org and return
ErrCheckGroupNotFound (400) otherwise; "" still ungroups. Upsert goes
through update/create, import already resolves groups by name.
TestCheckGroupUIDResolvedWithinOrg fails before the fix.

Closes fclairamb/solidping-business#102

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-in on the invitation page (fclairamb/solidping-business#103)

A federated sign-in failing with TOKEN_EXCHANGE_FAILED could not be
diagnosed: every provider's handleOAuthError (google.go, github.go, ...)
mapped the token-exchange error to the fixed "Failed to exchange
authorization code" without logging the provider's answer (used or expired
code, redirect_uri mismatch). It is now logged at WARN with the provider
(logOAuthTokenExchangeFailure, handler.go). A sign-in started from an
invitation comes back to the invitation page on failure, which ignored the
error: invite.$token.tsx now shows error_description (invite-oauth-error),
and its sign-in link still targets the bare invitation. The nested-returnTo
case on the login page was already fixed for fclairamb/solidping-business#99.

Tests: TestTokenExchangeFailureIsLogged fails on the previous code (nothing
logged); the e2e invitations.spec.ts case fails on the previous build (no
invite-oauth-error element).

Closes fclairamb/solidping-business#103

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fclairamb fclairamb added autopilot frozen Batch PR under review: takes only its own fixes, new work goes to the next batch labels Nov 21, 2026
Base automatically changed from feat/todos-2026-11-21 to main November 21, 2026 22:20
@fclairamb
fclairamb enabled auto-merge (squash) November 21, 2026 22:20
@fclairamb
fclairamb merged commit c4a8dca into main Nov 21, 2026
37 checks passed
@fclairamb
fclairamb deleted the feat/todos-2026-11-21-2 branch November 21, 2026 22:41
@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.89%. Comparing base (88179aa) to head (6b8384e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #974      +/-   ##
==========================================
- Coverage   90.89%   90.89%   -0.01%     
==========================================
  Files        1405     1405              
  Lines      145270   145273       +3     
==========================================
+ Hits       132039   132041       +2     
- Misses      13223    13224       +1     
  Partials        8        8              
Files with missing lines Coverage Δ
server/internal/handlers/auth/discord.go 100.00% <100.00%> (ø)
server/internal/handlers/auth/github.go 100.00% <100.00%> (ø)
server/internal/handlers/auth/gitlab.go 100.00% <100.00%> (ø)
server/internal/handlers/auth/google.go 100.00% <100.00%> (ø)
server/internal/handlers/auth/handler.go 99.10% <100.00%> (+<0.01%) ⬆️
server/internal/handlers/auth/microsoft.go 100.00% <100.00%> (ø)
server/internal/handlers/auth/oidc.go 100.00% <100.00%> (ø)
server/internal/handlers/auth/slack.go 100.00% <100.00%> (ø)

... and 18 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

fclairamb added a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.53.0](v0.52.0...v0.53.0)
(2026-11-22)


### Features

* **auth:** OIDC-only mode with IdP group admin roles
([#966](#966))
([1b51f89](1b51f89))
* **service:** install writes config.env, unit loads it via
EnvironmentFile
([#948](#948))
([e4b7fc4](e4b7fc4))


### Bug Fixes

* **aggregation:** drain the raw backlog in one run and log lag
([#978](#978))
([26b93cd](26b93cd))
* **deps:** update github.com/dop251/goja digest to 79d6ad3
([#972](#972))
([02c6821](02c6821))
* **deps:** update go dependencies (non-major)
([#955](#955))
([7dfbcd6](7dfbcd6))
* **deps:** update go dependencies (non-major)
([#968](#968))
([6c09bae](6c09bae))
* **deps:** update go dependencies (non-major)
([#979](#979))
([ee088b6](ee088b6))
* **deps:** update module github.com/oapi-codegen/oapi-codegen/v2 to
v2.9.0 ([#975](#975))
([1121e2e](1121e2e))
* **deps:** update module go.mongodb.org/mongo-driver/v2 to v2.10.1
([#950](#950))
([9e684c4](9e684c4))
* email validation, OAuth error display, translator crash guard, clone
slugs, watchdog pauses
([#959](#959))
([a20f951](a20f951))
* log OAuth code-exchange failures, show a refused sign-in on the
invitation page
([#974](#974))
([c4a8dca](c4a8dca))
* retry SMTP 4xx, 503 on agent auth DB errors, scope checkGroupUid to
the org ([#973](#973))
([88179aa](88179aa))
* **security:** block WebRTC around the browser egress proxy, survive an
invalid status page ?lang=
([#957](#957))
([79bdc82](79bdc82))
* **security:** keep OIDC-group admin grants revocable, mask resolved
channel references, contain browser popups
([#976](#976))
([6e0f09e](6e0f09e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge autopilot frozen Batch PR under review: takes only its own fixes, new work goes to the next batch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant