Skip to content

fix: three scan-correctness bugs in transport checks and version ladder - #7

Open
hannanmax wants to merge 1 commit into
hackwither:mainfrom
hannanmax:fix/transport-checks
Open

hannanmax wants to merge 1 commit into
hackwither:mainfrom
hannanmax:fix/transport-checks

Conversation

@hannanmax

@hannanmax hannanmax commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Three bugs fixed in one PR

1. tls-cert-health: self-signed cert detection missed most real-world certs

The check was gated on cert.IsCA == true, but the Basic Constraints CA flag is only set when the cert is a CA cert. Plain self-signed leaf certs generated with openssl req -x509 or nginx have IsCA = false, so the check silently passed them.

Fix: Compare Issuer.String() == Subject.String() — a cert that signed itself has identical issuer and subject DNs.

2. http-cors-wildcard: credentials detail dropped when origin is reflected

IsCORSWildcard only sets credentialed = true when Access-Control-Allow-Origin is literally "*". When the origin is reflected instead, credentialed stays false even if the server also sends Access-Control-Allow-Credentials: true — so the finding description omitted that detail entirely.

Fix: In the reflected-origin branch, check the Access-Control-Allow-Credentials header independently and append the detail to the description.

3. Version negotiation ladder stops on 405/501 without "version" in body

isVersionRejection requires the word "version" somewhere in the response body before it continues to the next rung. A server returning 405 Method Not Allowed or 501 Not Implemented with a plain error body (e.g. "Method Not Allowed") aborted the ladder instead of trying the next protocol version.

Fix: Continue on 405/501 unconditionally, before the body-text heuristic. The ladder is only 3 entries deep so the extra retries are negligible.

1. tls-cert-health: self-signed cert detection missed most real-world
   certs because it required cert.IsCA==true before checking the
   signature. Plain openssl/nginx self-signed leaf certs set IsCA=false.
   Fix: compare Issuer and Subject DNs — equality means self-issued.

2. http-cors-wildcard: when an origin is reflected (not *), the
   finding omitted the Access-Control-Allow-Credentials detail because
   IsCORSWildcard only sets credentialed when acao==*. Fix: check the
   header independently in the reflected branch.

3. version-ladder (mcp): a server responding HTTP 405 or 501 without
   the word "version" in the body stopped the negotiation ladder
   instead of trying the next protocol revision. Fix: continue on
   405/501 unconditionally before the existing body-text heuristic.
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.

1 participant