Skip to content

fix: lenient mTLS cert reload#279

Merged
fioan89 merged 8 commits intomainfrom
trigger-ca-reload-even-when-cert-refresh-faild
Mar 4, 2026
Merged

fix: lenient mTLS cert reload#279
fioan89 merged 8 commits intomainfrom
trigger-ca-reload-even-when-cert-refresh-faild

Conversation

@fioan89
Copy link
Collaborator

@fioan89 fioan89 commented Mar 2, 2026

A Coder customer reported that the cert refresh command can return 1 while still generating new certs. Right now Coder Toolbox does not reload the certs if the refresh command exits with a status other than 0.

A Coder customer reported that the cert refresh command can return 1
while still generating new certs. Right now Coder Toolbox does not reload
the certs if the refresh command exits with a status other than 0.

- resolves #276
@fioan89 fioan89 requested review from f0ssel and jcjiang March 2, 2026 22:03
Co-authored-by: Zach <3724288+zedkipp@users.noreply.github.com>
@fioan89
Copy link
Collaborator Author

fioan89 commented Mar 2, 2026

Small update and context, we had a private chat about the issue and the discussion clarified a change in the control flow of callWithRetry related to expired certificates. Previously, if a certificate was expired and the refresh succeeded, the function would proceed to execute the provided lambda block; otherwise, it would throw an exception. After the change, if a certificate is expired, the function will always execute the lambda block, removing the possibility of throwing when the refresh fails. This raised a concern that some upstream logic might depend on that exception for its own control flow.

The upstream system polls every five seconds, and a client had reported cases where their certificate refresh command successfully updated certificates but still returned a non-zero error code. Originally, refreshes were only considered valid when the return code was 0, and any other result caused the polling loop to stop and show a login screen. With new requirements, the return code can no longer be trusted, so the polling loop should not be terminated based on it.

As a potential improvement, it was suggested that instead of relying on the return code, the code could detect whether the CA files actually changed and use that information to preserve the earlier control flow if needed.

fioan89 added 3 commits March 4, 2026 00:09
Instead of relying on the refresh command return code to report the issue upstream (which most of the time
means breaking the poll loop and go back to the login scree), the code could detect whether the CA files actually
changed and use that information to preserve the earlier control flow if needed.
Using a buffer instead of reading byte-by-byte is a more efficient mechanism.
…ub.com:coder/coder-jetbrains-toolbox-plugin into trigger-ca-reload-even-when-cert-refresh-faild
@fioan89 fioan89 merged commit 29c94c6 into main Mar 4, 2026
6 checks passed
@fioan89 fioan89 deleted the trigger-ca-reload-even-when-cert-refresh-faild branch March 4, 2026 20:49
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.

IDE fails to launch via Coder URL due to expired certificate when refresh command exits with non-zero code

2 participants