Skip to content

fix(cli): reject non-decimal byte-entropy window options - #8919

Merged
morluto merged 3 commits into
morluto:mainfrom
Plastic-time:rrfz/decimal-byte-entropy-window
Nov 5, 2026
Merged

morluto merged 3 commits into
morluto:mainfrom
Plastic-time:rrfz/decimal-byte-entropy-window

Conversation

@Plastic-time

@Plastic-time Plastic-time commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7376. inspect-byte-entropy coerces CLI tokens before validation. These calls all return a successful inspection:

  • --length= selects an empty window.
  • --offset=0x10 selects offset 16.
  • --offset=1e2 selects offset 100.

The options are documented as decimal byte counts.

Problem and expected behavior

--offset, --length and --block-size should accept decimal tokens only. Empty and non-decimal tokens should fail argument validation and name the option.

Change and scope

  • A new cliDecimalField helper in src/cli/options.ts checks the decimal token first.
  • It then validates the number with the canonical inspectByteEntropyInputSchema field and keeps that field's default or optionality, so the CLI copies no limits.
  • The three options use it. Empty and non-decimal tokens return VALIDATION_ERROR naming the option.
  • Unchanged: omitted defaults, leading-zero decimal tokens and an explicit --length=0 still work. A decimal block size that is not a power of two, such as 384, is still refused during argument validation.
  • cliIntegerArgument is unchanged. MCP inputs and provider behavior are unchanged.

#8386 also adds a decimal helper to src/cli/options.ts for other commands. It does not touch inspect-byte-entropy. Whichever lands second resolves a small conflict in that file.

Follow the contribution scope. Ordinary fix within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: CLI argument admission for inspect-byte-entropy.
  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable.
  • CLI and MCP/tool-catalog contract: CLI refuses tokens it used to coerce. rea inspect-byte-entropy --schema --format json is unchanged. MCP is 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: 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

  • Tests added or updated: tests/boundary/cli/cliIntegerArguments.test.ts. --offset runs every malformed spelling (empty, whitespace, newline, hexadecimal, binary, exponent, signed, fractional, unsafe, -0). --length and --block-size share the parser and run one representative token each, plus --block-size=384.
  • Base reproduction: with only src/cli/binaryDiagnosticsCommands.ts and src/cli/options.ts reset to main (89317a3), the file gives 12 failed / 59 passed. On this branch, 71/71 passed.
  • User-visible CLI/MCP output: --offset=0x10 now fails with VALIDATION_ERROR on offset instead of inspecting offset 16.
  • Remaining proof gaps: Windows only, synthetic input.

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

Windows 11 x64 (10.0.26200), Node 24.22.1, base main 89317a3.

  • npm run test:focused -- tests/boundary/cli/cliIntegerArguments.test.ts — 71/71 passed. With the two source files reset to main: 12 failed / 59 passed.
  • npm run check:fast (typecheck and lint) — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for decimal tokens. Hexadecimal, exponent and empty tokens are now refused instead of coerced.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; Windows only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: argument parsing only.

Prepared with AI assistance.

Author readiness

Human owner: @Plastic-time

  • 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.

@chatgpt-codex-connector

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 ⚠️ Failed 2026-11-04T15:54:49.861806Z
We couldn’t complete this review. Comment @codex review to try again.
8b08785 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

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; no actionable defects or new security issues were found in the changed paths.

Summary

Adds cliDecimalField to reject empty and non-decimal CLI options before converting them to numbers.

  • Analysis command options accept decimal numbers only.

Reviews (3) · Last reviewed commit: "Merge branch 'main' into rrfz/decimal-by..." · Reviewed by Greptile

Keyed-archive offset and limit, asset-catalog paging, and interface-builder budgets use the same decimal token check as byte-entropy windows. Defaulted fields stay numbers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Byte-entropy CLI accepts empty and non-decimal window options

3 participants