Skip to content

fix(auth): retry a 401 on a fresh connection and name it apart - #108

Merged
Bugs5382 merged 1 commit into
mainfrom
fix/107-certless-connection-retry
Sep 25, 2026
Merged

Bugs5382 merged 1 commit into
mainfrom
fix/107-certless-connection-retry

Conversation

@Bugs5382

@Bugs5382 Bugs5382 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What and why

The page load can open its connection without a client certificate, and HTTP/2 then reuses it for WhoAmI, which the manager refuses with 401 (CryptOS-PKI/cryptos-manager#77). The companion manager change, CryptOS-PKI/cryptos-manager#94, makes the manager close a connection it refuses for that reason.

  • Retry once on 401. Log in now retries WhoAmI a single time after Unauthenticated. Because the manager has closed the refused connection, the retry performs a fresh handshake where the browser can offer the certificate it holds. Any other failure is not retried, and a 403 is never retried.
  • Separate the two "no certificate" cases. A 401 that survives the retry means a handshake that completed without the browser sending a certificate. It was mapped to no-certificate, the same as an aborted handshake (Unknown), which told an operator with a certificate installed to install one. It is now certificate-not-sent, with copy saying a browser holding a certificate has likely remembered not to send it to this site and a full restart clears that, and it still shows the install instructions for the case where there is none.

Authorization is unchanged: the SPA only reports what the API answered.

Merge order: independent of CryptOS-PKI/cryptos-manager#94. The retry only helps once that manager change is deployed; against an older manager it costs one extra refused request.

Closes #107
Refs: CryptOS-PKI/cryptos-manager#77

Verification

  • Lint clean
  • Tests pass
  • Build succeeds

How this was verified

  • New tests: a 401 followed by success signs in with two WhoAmI calls; a 401 on both attempts reports certificate-not-sent with two calls; a permission denial is not retried; the gate renders "Certificate not sent" with the restart advice and the install instructions. The existing retry-after-denial test was updated for the second attempt.
  • npm run lint (eslint + prettier check), npm test (291 passed), npm run build (includes tsc -b) all clean.
  • Not verified in a real browser against a deployment.

The page load can open its connection without a client certificate and
HTTP/2 then reuses it for WhoAmI, which the manager refuses with 401.
The manager now closes a connection it refuses for that reason, so Log
in retries WhoAmI once to get a fresh handshake where the browser can
offer the certificate it holds.

A 401 that survives the retry means a completed handshake in which the
browser chose not to send a certificate. That was reported as
no-certificate, the same as an aborted handshake, which told an operator
with a certificate installed to install one. It is now its own reason
with its own advice: restart the browser to clear a remembered refusal,
or install a certificate if there is none.

Closes #107
Refs: CryptOS-PKI/cryptos-manager#77
@Bugs5382 Bugs5382 added the bug Something isn't working. label Sep 25, 2026
@Bugs5382 Bugs5382 self-assigned this Sep 25, 2026
@github-actions github-actions Bot added the fix Bug fix (fix). Patch. label Sep 25, 2026
@Bugs5382
Bugs5382 merged commit 4a4774c into main Sep 25, 2026
17 of 18 checks passed
@Bugs5382
Bugs5382 deleted the fix/107-certless-connection-retry branch September 25, 2026 13:55
Bugs5382 added a commit that referenced this pull request Sep 25, 2026
The page load can open its connection without a client certificate and
HTTP/2 then reuses it for WhoAmI, which the manager refuses with 401.
The manager now closes a connection it refuses for that reason, so Log
in retries WhoAmI once to get a fresh handshake where the browser can
offer the certificate it holds.

A 401 that survives the retry means a completed handshake in which the
browser chose not to send a certificate. That was reported as
no-certificate, the same as an aborted handshake, which told an operator
with a certificate installed to install one. It is now its own reason
with its own advice: restart the browser to clear a remembered refusal,
or install a certificate if there is none.

Closes #107
Refs: CryptOS-PKI/cryptos-manager#77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. fix Bug fix (fix). Patch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(auth): a 401 from a reused certless connection sends the operator to install a certificate they already have

1 participant