Repository navigation
fix(pe): reject surrogate code units in BMPString names - #7817
Merged
morluto merged 3 commits intoOct 29, 2026
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The reviewed changes appear safe to merge. SummaryRejects surrogate code units in PE certificate BMPString names at the shared decoder.
Reviews (2) · Last reviewed commit: "chore: preserve base browser imports" · Reviewed by Greptile |
# Conflicts: # tests/acceptance/peCertificatesCli.test.ts
8 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and outcome
PE certificate BMPString names are currently decoded as unrestricted UTF-16. A lone
D800orDFFFis published as a surrogate, andD800 DC00is combined into U+10000 even though that character is outside the Basic Multilingual Plane.Reject surrogate code units at the BMPString decoder, using the existing typed ASN.1 failure and public
invalid_requestmapping. Rename the private helper to identify its actual UCS-2 owner. This follows the BMPString distinction described in Go's X.509 decoder; that reference is source-derived, not a Go runtime test. Valid BMP characters, literal BOMs, existing UTF-8/UniversalString handling and the decoded-name budget are preserved. No new format, dependency, target execution or cryptographic trust-verification capability is introduced. No separate issue: executable regressions below capture the defect.Evidence and validation
Executed on Windows, Node 24.22.1 / npm 11.16.0, fixed base
6c895eeb:npm run test:focused -- src/native/pe/PeCertificateParser.test.ts tests/acceptance/peCertificatesCli.test.ts tests/boundary/mcp/peCertificatesMcp.test.ts— 44/44 passed, including required build tasks. Covers isolated high/low surrogates, valid U+D7FF/U+E000/U+FEFF, existing name budgets and supplementary UniversalString, actual CLI rejection of a surrogate pair, successful CLI reading of the corrected neighboring code units, and existing MCP delivery.invalid_request, operationinspect_pe_certificates. The positive control verifies the decoded issuer name through the advertised output schema.tests/boundary/filesystem/peCertificates.test.tswas 45 passed / 1 failed: an existing test hit WindowsEPERMwhile creating a file symlink, before constructing the service or reaching parsing. This extra command is not reported as green; its assertions were not changed or skipped.npm run check:fast— typecheck/lint 2/2 passed. Normal precommit and prepush passed on the final commit; working tree clean.npm run check— not fully green: three of six tasks completed before ordinary Knip's sole unchangedHexRecordRegionMetadataerror (src/domain/artifactFormatMetadata.ts:200). Temporarily restored all three changed files to exact clean6c895eeb, reproduced the same sole diagnostic, then restored every working byte infinally. Later architecture/production-Knip/typed-lint stages did not execute.Inputs are synthetic encoded certificates, with real local production parsers and compiled CLI/MCP adapters. No external certificate verifier or signature-trust validation was run or claimed. Hosted CI is pending for this new head.
Author readiness
Human owner: @ShuaixinHuang
Before merge
type(scope): outcome.