Skip to content

feat(cli): suggest DENO_TLS_CA_STORE on untrusted TLS certificate#34756

Merged
bartlomieju merged 2 commits into
mainfrom
feat/tls-untrusted-cert-hint
Jun 5, 2026
Merged

feat(cli): suggest DENO_TLS_CA_STORE on untrusted TLS certificate#34756
bartlomieju merged 2 commits into
mainfrom
feat/tls-untrusted-cert-hint

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

When a TLS connection fails because the certificate chain isn't trusted
(rustls reports UnknownIssuer), the error pointed only at the insecure
--unsafely-ignore-certificate-errors bypass and gave no hint toward the
secure fix. This trips up people using mkcert dev certificates or behind
a corporate TLS proxy, whose root CA lives in the operating system trust
store but not in Deno's default Mozilla bundle, and the
DENO_TLS_CA_STORE=mozilla,system workaround is hard to discover.

This adds a terminal-error hint for the UnknownIssuer case that suggests
running with DENO_TLS_CA_STORE=mozilla,system, keeping the insecure
bypass as a fallback. It is matched specifically on UnknownIssuer so that
other certificate failures (expired, hostname mismatch), where the CA store
wouldn't help, keep the existing bypass-only hint.

Closes #25366

When a TLS connection fails with an untrusted certificate chain
(rustls `UnknownIssuer`), the error gave no guidance toward the secure
fix. This is common with mkcert dev certs or a corporate TLS proxy whose
root is in the OS trust store but not Deno's default Mozilla bundle.

Add a terminal-error hint for the `UnknownIssuer` case suggesting
`DENO_TLS_CA_STORE=mozilla,system` (with --unsafely-ignore-certificate-errors
as an insecure fallback). The existing broad cert-error hint still covers
other failures like expired or hostname-mismatch certs, where the CA
store wouldn't help.

Closes #25366
@bartlomieju
bartlomieju enabled auto-merge (squash) June 5, 2026 14:36
@bartlomieju
bartlomieju merged commit cdb2623 into main Jun 5, 2026
136 checks passed
@bartlomieju
bartlomieju deleted the feat/tls-untrusted-cert-hint branch June 5, 2026 16:37
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.

Improve error message when TLS certificate is not trusted to suggest running with DENO_TLS_CA_STORE=mozilla,system

1 participant