Skip to content

fix(net): backport bounded certificate and path parsing - #6349

Merged
kixelated merged 1 commit into
releasefrom
backport/js-bounded-parsing
Oct 22, 2026
Merged

kixelated merged 1 commit into
releasefrom
backport/js-bounded-parsing

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

Release's certificate-hash setup rescans every unmatched PEM BEGIN marker, and outgoing path validation allocates all components before enforcing the existing 32-part limit. These are the JS fixes already landed in #6084.

Approach

Port the linear PEM delimiter search and early separator count. Add behavioral edge cases and just js bench parsing, wired into the nightly workflow. Unit tests do not assert wall time or process memory.

On the same Bun 1.4.2 host, repeated BEGIN inputs from 7,168 to 458,752 bytes took 0.51 ms to 3.81 s before, versus 0.014 ms to 0.45 ms after. Path rejection from 512 to 32,768 bytes took 19 to 295 microseconds before, versus roughly 2 to 3 microseconds after. These are best-of-five samples on a shared host, not performance gates.

Validation: just ci check, just ci test, 50 focused certificate/path tests, and the malformed-input benchmark passed in the active Nix development shell. The shell's Bun 1.4.2 matches release.

Impact

  • No public API or wire-format changes; valid certificate hashes, first-certificate selection, path normalization, and the published part limit are preserved.
  • Empty or whitespace-only PEM bodies now reject as malformed instead of hashing empty bytes, matching the main fix.
  • Consumers: certificate-hash connection setup and outgoing path encoding in @moq/net.

Alternatives

A cherry-pick of the whole upstream commit would also carry unrelated publishing workflow changes. Those protections already run from main and need no backport.

Follow-ups

Quest tracking remains on main in #6343 until this release backport lands. No version bump or publication is included.

(written by GPT-6)

Port the JavaScript parser hardening from #6084 with behavioral edge cases and a malformed-input benchmark.

Co-Authored-By: GPT-6 <noreply@openai.com>
@kixelated
kixelated marked this pull request as ready for review October 22, 2026 16:40
@kixelated

Copy link
Copy Markdown
Collaborator Author

The focused backport is complete: parser fixes, behavioral edge cases, and a malformed-input size sweep. Local CI check/test halves and the 50 focused tests passed. API and wire formats are unchanged; malformed empty PEM bodies reject as on main. No open design decisions or additional follow-ups were identified. Merge and publication remain with the maintainer.

(written by GPT-6)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T16:42:25.877613Z 5a645ec Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated
kixelated merged commit 788ef34 into release Oct 22, 2026
6 checks passed
@kixelated
kixelated deleted the backport/js-bounded-parsing branch October 22, 2026 18:19
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merged into release after a clean Codex review of this head and green release checks; maintainer picked the merge in the quest-complete run.

(Written by Claude Opus 5.5)

kixelated added a commit that referenced this pull request Oct 22, 2026
#6349 merged into release, so the quest is complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated added a commit that referenced this pull request Oct 22, 2026
All three children landed on release (#6347, #6349, #6355) with
green release CI, and the release-plz PR carries them, so the epic's
reconciliation work is done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated added a commit that referenced this pull request Oct 23, 2026
@moq/watch 0.6.4: buffered audio backpressure (#6500), fixed playback delay.
@moq/json 0.4.3: bound compressed snapshot state from a peer (#6360).
@moq/net 0.4.5: bounded certificate and path parsing (#6349).
@moq/hang 0.5.4: accept the cml-utils version cml-iso-bmff 1.0.7 peers on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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