Skip to content

x509: reject ambiguous leading-zero IPv4 references - #12609

Open
ripatel-fd wants to merge 1 commit into
mainfrom
ripatel/iptls
Open

ripatel-fd wants to merge 1 commit into
mainfrom
ripatel/iptls

Conversation

@ripatel-fd

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 21:54
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
 ┌─ ⚡ PERF · 10dbc2e vs main@43ef974 ─────────────────────────────────
 │ SUITE                               BASELINE          NEW         Δ
 │ replay tps, mainnet               13,849 tps   13,744 tps  ·  -0.75%
 │ bench tps, localnet              888,944 tps  894,248 tps  ·  +0.60%
 │ snapshot load, testnet                4.91 s       4.90 s  ·  -0.16%
 │ epoch boundary, mainnet             146.4 ms     145.9 ms  ·  -0.33%
 │ mem total, mainnet                147.34 GiB   147.34 GiB  ·   0.00%
 │ mem total, testnet                 84.66 GiB    84.66 GiB  ·   0.00%
 │ clean compile, firedancer             3.14 s       3.12 s  ·  -0.64%
 │ binary size, firedancer             57.95 MB     57.95 MB  ·   0.00%
 ├─────────────────────────────────────────────────────────────────────
@@ 0 REGRESSIONS · 0 WARNINGS · 0 IMPROVED · 8 NOISE @@
 └─────────────────────────────────────────────────────────────────────

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical validation bypass remains because leading-zero IP references can still match dNSName SANs when they fall outside the decimal-parsing or length checks that gate rejection.

1 open issue
What changed in this PR

This PR hardens X.509 certificate hostname verification against leading-zero IPv4 references that resolvers may interpret as octal.

Changes:

  • Adds leading-zero octet rejection after successful IPv4 parsing.
  • Adds tests for ambiguous references, canonical IPv4 addresses, and DNS names with leading-zero labels.
File Description
src/​ballet/​x509/​test_x509_verify.c Adds regression cases for IPv4 ambiguity and valid reference names.
src/​ballet/​x509/​fd_x509.c Adds a leading-zero check to IPv4 SAN matching.

Review effort: Balanced

Comment thread src/ballet/x509/fd_x509.c
Comment on lines +1209 to +1211
for( ulong i=0UL; i<hostname_len; i++ ) {
if( ( !i || hostname[ i-1UL ]=='.' ) && hostname[ i ]=='0' &&
i+1UL<hostname_len && hostname[ i+1UL ]!='.' ) return 0;

This branch has not been deployed

No deployments
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.

3 participants