Skip to content

fix(desktop): accept self-signed certs from configured external goosed host#8400

Open
Gandalf-Le-Dev wants to merge 1 commit intoaaif-goose:mainfrom
Gandalf-Le-Dev:fix/remote-connection-self-signed-cert
Open

fix(desktop): accept self-signed certs from configured external goosed host#8400
Gandalf-Le-Dev wants to merge 1 commit intoaaif-goose:mainfrom
Gandalf-Le-Dev:fix/remote-connection-self-signed-cert

Conversation

@Gandalf-Le-Dev
Copy link
Copy Markdown

@Gandalf-Le-Dev Gandalf-Le-Dev commented Apr 8, 2026

Summary

  • The certificate-error and setCertificateVerifyProc handlers in main.ts only accepted self-signed certificates from localhost, rejecting all other hosts
  • This makes remote connection to an external goosed server impossible over HTTPS, since goosed generates a self-signed cert
  • Combined with the CSP blocking plain HTTP to non-localhost hosts, this creates a catch-22 where no protocol works for remote backends
  • Add isTrustedHost() that also trusts the user-configured externalGoosed host, so remote backends work with self-signed certs

Test plan

  • Configure an external goosed server on a remote host with GOOSE_SERVER__SECRET_KEY
  • In Goose Desktop, set remote connection URL to https://<remote-host>:<port> with the secret key
  • Verify connection succeeds (previously failed with "Could not connect to external backend")
  • Verify localhost connections still work as before
  • Verify untrusted hosts are still rejected

fixes #8376

…d host

The certificate-error and setCertificateVerifyProc handlers only accepted
self-signed certificates from localhost, making remote connection to an
external goosed server impossible over HTTPS with its self-signed cert.

Add isTrustedHost() that also trusts the user-configured externalGoosed
host, so remote backends work without requiring a valid CA-signed cert.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b491b7b621

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +180 to 183
if (!isTrustedHost(request.hostname)) {
callback(-3);
return;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve certificate validation for external backends

Extending the trust check to isTrustedHost() means external backends now enter this verifier path, but external mode never sets pinnedCertFingerprint (startGoosed returns certFingerprint: null for externalGoosed), so this branch calls callback(0) on every TLS handshake and disables certificate validation indefinitely for that host. In practice, any cert (expired, wrong chain, or MITM-presented) is accepted as long as the hostname matches the configured external URL, which is broader than “accept self-signed certs” and weakens transport security for remote connections.

Useful? React with 👍 / 👎.

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.

Remote connection fails: self-signed cert rejected for non-localhost hosts + CSP blocks plain HTTP

1 participant