Skip to content

feat(native): carry the value of each fixed structural decoding allowance - #11651

Merged
morluto merged 2 commits into
mainfrom
feat/native-structural-allowance-limits
Nov 16, 2026
Merged

morluto merged 2 commits into
mainfrom
feat/native-structural-allowance-limits

Conversation

@morluto

@morluto morluto commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Refs #10508 (item 4, native structural slice). The twelve native structural fixed-allowance calls (ELF notes, unwind, kernel modules, native exports, binary hardening, initializers, PE certificates, imports and load config) named no value, so details.refusal had no limit or unit. Each now carries the value its producer enforced, or stops claiming a ceiling no producer names. After this and #11641, the only calls without a value are the three W4 sites (src/adb ×2, src/process/ArtifactAnalysisResources.ts).

Problem and expected behavior

Before: inspect_pe_certificates refusing a PKCS#7 payload with more than 16,384 ASN.1 values returned an allowance named "The PE certificate ASN.1 allowance of 16384 values per PKCS#7 payload (this release has no runtime override)" and no details.refusal.limit.

After: details.refusal = { kind: "fixed_ceiling", allowance: "The PE certificate ASN.1 value allowance", allowance_kind: "parser", limit: 16384, unit: "values per PKCS#7 payload" }, and the remediation states the value.

Change and scope

  • BinaryResourceFailure structural refusals (ELF structural decoding in kernel modules and unwind, binary hardening, native initializers, native exports, PE imports and load config, and the Go provider): binaryResourceCeiling(failure) gives limit and the unit the producer counts. BinaryResourceFailure gains an optional unit; the hardening entry budget says entries, and the ELF dynamic directory, binary-container table and section-directory budgets say bytes. A producer that names no unit gives no unit. PeBinaryFailure's limitRecovery receives that ceiling. The unwind allowance no longer embeds "16 MiB" in its name.
  • Native initializer relocation-index refusal: the failure's limit.maximum and its own unit (entries or bytes).
  • PE certificate decoder allowances (ASN.1 values and nesting, decoded text, OID bytes and arc bytes): names without the value; limit and a per-payload/per-OID unit.
  • ELF notes: the note parser's two text-budget refusals carry their ceiling (fixedAllowance with the enforced budget.limit); the provider keeps that reader-named ceiling instead of a provider string.
  • Kernel modules and unwind ranges: their memory-boundary branches claimed a fixed text or structural allowance, but neither parser produces a memory-boundary reader limit (their limits are file-size from readStableArtifact and capacity from the parsers). Those branches now keep only a reader-named ceiling, and the unused TEXT_BUDGET string is removed.

Not included: the three W4 sites; the Flutter sites are in #11641.

Contribution scope: within existing boundaries.

Contract and boundary impact

  • Semantic owner and earliest changed stage: each producer's ceiling (BinaryResourceFailure, ElfPointerRelocationFailure, the ELF note parser, the PE certificate decoder table); providers project it unchanged.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: additive details.refusal.limit/unit for these refusals; the PE certificate, unwind and ELF note allowance names change; the remediation states the value. code, retryable and reported_limits are unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • src/native/elf/ElfNotesProvider.test.ts: the note-text refusal asserts details.refusal with the enforced value and compares the remediation with analysisRefusalRemediation instead of matching sentences.
  • src/native/pe/PeCertificatesProvider.test.ts: the depth, values, text, OID bytes and OID arc cases assert limit and unit instead of the value inside the name.
  • With main's ElfNoteParser.ts, ElfNotesProvider.ts and PeCertificatesProvider.ts, those 6 cases fail.
  • Remaining proof gaps: no test reaches the BinaryResourceFailure structural refusals of hardening, initializers, exports, PE imports and load config, kernel modules and unwind (each needs a >16 MiB structure); their values come from the failure's own maximum_bytes. The kernel-module and unwind memory branches are unreachable today, so their change is source-derived.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- 20 native files (ELF notes parser and provider, unwind tables, kernel modules, hardening, initializers, PE certificates, imports and load config, the matching tests/boundary/filesystem files, binaryDiagnosticsMcp, peCertificatesCli): 569 passed, 1 skipped (8.9 s, 1.2 GB peak).
  • The 2 asserting files with main's sources: 6 failed.
  • npm run check:fast: passed. npx oxfmt on the changed files.
  • After the Greptile round (cb99411): BinaryResourceFailure carries its producer's unit (hardening entries, structural bytes) through binaryResourceCeiling; new parser and provider cases (65,537 dynamic entries) fail with the previous ElfHardening.ts; 21 native and Go files 748 passed, 1 skipped; npm run check:fast passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; the refusal fields are additive. Callers that matched the old allowance names see new wording.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

…ance

BinaryResourceFailure and relocation-index refusals pass their maximum as limit and unit; the PE certificate decoder allowances drop the value from their names and pass it with a per-payload unit; the ELF note parser names its text ceiling with the enforced value. Kernel-module and unwind providers no longer claim a fixed text or structural allowance for a memory limit that names no ceiling (no parser produces one).
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T01:52:35.496440Z
We couldn’t complete this review. Comment @codex review to try again.
a9ff741 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; both previous findings are fixed and no new blocking issue was found.

Summary

This PR adds producer-owned ceiling values and units to native decoding refusals.

  • Native binary refusals show the exact structural ceiling and unit.
  • PE certificate refusals show each decoder limit and unit.
  • ELF note refusals carry the text budget in bytes.

Reviews (3) · Last reviewed commit: "fix(native): report a binary resource ce..." · Reviewed by Greptile

Comment thread src/native/elf/ElfNotesProvider.test.ts Resolved
…r counts

BinaryResourceFailure carries an optional unit; the ELF hardening entry budget says entries and the structural byte budgets say bytes. binaryResourceCeiling reports the unit only when the producer named it, so an entry count is no longer labelled as bytes. The ELF note test takes its expected ceiling from the fixture length instead of the message.
@morluto
morluto merged commit f060967 into main Nov 16, 2026
14 of 18 checks passed
@morluto
morluto deleted the feat/native-structural-allowance-limits branch November 16, 2026 02:25
Plastic-time added a commit to Plastic-time/rea that referenced this pull request Nov 16, 2026
- Move PeRichHeaderPort to src/ports/binaryDiagnostics (morluto#11208). The
  provider now implements it, like the other PE providers.
- Import the artifact toolkit from src/resources, BinaryContainer from
  src/domain/binaryContainer and readPeHeaders from src/domain/pe.
- List PeRichHeaderProvider among native's entry files.
- Map failures with projectPeBinaryFailure, as PeImportsProvider and
  PeLoadConfigProvider do. The new guards forbid a hand-built
  resource-constraint refusal and an inline error message; the shared
  PE projection already owns both, so the provider adds neither. The
  structural allowance's recovery now carries its ceiling (morluto#11651).
- Tests: the Evidence subject names its target identity (morluto#11416), and
  readPeHeaders now throws a malformed ParseFailureError (morluto#11550).
- Re-record the advertised schema summary: the output hash now matches
  inspect_pe_imports after Evidence format revision 2.
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant