Skip to content

fix(responses): tell TLS hostname mismatches apart from an unreachabl… - #798

Closed
batuchek68-ux wants to merge 1 commit into
lidge-jun:codex/260729-security-md-reporting-pathfrom
batuchek68-ux:codex/260728-tls-altname-diagnosis
Closed

fix(responses): tell TLS hostname mismatches apart from an unreachabl…#798
batuchek68-ux wants to merge 1 commit into
lidge-jun:codex/260729-security-md-reporting-pathfrom
batuchek68-ux:codex/260728-tls-altname-diagnosis

Conversation

@batuchek68-ux

Copy link
Copy Markdown

…e provider

A certificate that does not cover the host it was served for surfaced as Provider unreachable: ERR_TLS_CERT_ALTNAME_INVALID fetching https://..., which reads as if opencodex had built a wrong endpoint. Issue #553 was filed on that reading — the reporter concluded the adapter was mangling the Copilot URL, and a maintainer could not reproduce it because the URL was correct all along. That error almost always means TLS interception (corporate proxy, VPN, local MITM tooling) or a poisoned DNS answer, none of which the proxy can fix or is at fault for.

The message now names the host, says the proxy did not rewrite it, and gives the openssl s_client command that settles which certificate is actually being served.

The same three-line shape was duplicated at three catch sites in core.ts, so it moves into one helper. Sites 2 and 3 delegate entirely; site 1 keeps its own outcome ternary because that value also feeds recordCodexUpstreamOutcome. Verified byte-identical output against the old expression for TimeoutError, plain Error, empty-message Error, string, undefined, null, object and AbortError.

While rewriting the message, redact URL userinfo. A provider base URL can carry credentials as https://user:token@host/ and the runtime error echoes the URL it was fetching, so the old text handed that straight back to the caller. Both branches now strip it.

The code match is anchored to the head of the message rather than a bare substring, so text that merely quotes the code back keeps the generic wording.

Summary

  • Explain the user-visible or maintainer-facing change.

Verification

  • List the commands or checks you ran.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

…e provider

A certificate that does not cover the host it was served for surfaced as
`Provider unreachable: ERR_TLS_CERT_ALTNAME_INVALID fetching https://...`,
which reads as if opencodex had built a wrong endpoint. Issue lidge-jun#553 was
filed on that reading — the reporter concluded the adapter was mangling
the Copilot URL, and a maintainer could not reproduce it because the URL
was correct all along. That error almost always means TLS interception
(corporate proxy, VPN, local MITM tooling) or a poisoned DNS answer, none
of which the proxy can fix or is at fault for.

The message now names the host, says the proxy did not rewrite it, and
gives the openssl s_client command that settles which certificate is
actually being served.

The same three-line shape was duplicated at three catch sites in core.ts,
so it moves into one helper. Sites 2 and 3 delegate entirely; site 1
keeps its own `outcome` ternary because that value also feeds
recordCodexUpstreamOutcome. Verified byte-identical output against the
old expression for TimeoutError, plain Error, empty-message Error,
string, undefined, null, object and AbortError.

While rewriting the message, redact URL userinfo. A provider base URL can
carry credentials as `https://user:token@host/` and the runtime error
echoes the URL it was fetching, so the old text handed that straight back
to the caller. Both branches now strip it.

The code match is anchored to the head of the message rather than a bare
substring, so text that merely quotes the code back keeps the generic
wording.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^dev$
  • ^preview$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: de8a9377-db95-4b40-bb68-c5c194805bc5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Jul 31, 2026

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

Copy link
Copy Markdown

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: eef9a86da9

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return `Provider TLS certificate does not match ${target}: ${redactUrlUserinfo(detail)}. `
+ "opencodex did not rewrite this hostname — a certificate that does not cover it normally "
+ "means TLS interception (corporate proxy, VPN, or local MITM tooling) or a poisoned DNS "
+ `answer. Check with: openssl s_client -connect ${probe}:443 -servername ${probe} `

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Quote the hostname before embedding it in a shell command

When this TLS branch fires for a configured provider URL whose hostname contains shell metacharacters that new URL() accepts, the diagnostic emits that host unquoted inside a copy-pasteable pipeline. For example a host containing backticks or semicolons is expanded or splits the command before openssl runs, so the suggestion can execute unintended shell syntax; quote/escape the host (or avoid a ready-to-run shell pipeline) before including it here.

Useful? React with 👍 / 👎.

@lidge-jun

Copy link
Copy Markdown
Owner

Closing. This pull request contains no work by its author.

The head commit here is byte-identical to a branch that already exists in this repository and was authored by the maintainer. All six of these pull requests have the same shape: fork the repository, push the upstream branches back unchanged, and open them as incoming contributions.

PR head SHA identical upstream branch
#798 eef9a86d codex/260728-tls-altname-diagnosis
#799 d0763bf7 codex/260729-security-md-reporting-path
#800 d380b1b0 codex/260731-pr-merge-round
#802 a64aa585 codex/app-server-restart
#803 b0434ea5 codex/pr533-update-recovery-hardening
#804 f0acc36a stack/gui-dense-workspaces

Every listed SHA resolves to the same commit on the upstream branch of the same name. The commit authors inside them are lidge-jun, Wibias, ahmetb, aljjang95, hanbinnoh and other existing contributors. The descriptions are the unmodified pull request template with every checklist item unchecked, and #798 additionally carries the maintainer's own commit message pasted in as if it were a summary. Several target main, which AGENTS.md reserves for maintainer-controlled promotion, and two are chained onto each other's heads in a cycle.

This is not a rebase, a resubmission of stalled work, or a fork that drifted. It burns maintainer review time and CI minutes on a diff that is already in the tree, and it presents other people's commits under a new author's pull request. Repository access is being revoked for this account.

@lidge-jun lidge-jun closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants