[PR #2676] [CLOSED] fix(native): support configurable REA_PWNTOOLS_MAX_INPUT_BYTES for large artifacts #5305

Closed
opened 2026-10-31 01:05:35 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2676
Author: @chengwudi1
Created: 10/13/2026
Status: ❌ Closed

Base: main ← Head: fix/pwntools-input-bytes-limit


📝 Commits (8)

  • bb11f5c fix(native): support configurable REA_PWNTOOLS_MAX_INPUT_BYTES for large artifacts
  • 395e600 fix(config): permit empty REA_PWNTOOLS_MAX_INPUT_BYTES and cover decoder budget
  • 5fc8c77 fix(native): bound pwntools input admission and isolate provider regressions
  • 58fd5bb test(native): assert input snapshot size outside launcher
  • 07e8815 chore: sync captured main for PR 2676
  • d49a26f test: match pwntools input limit diagnostic
  • de3413a chore: merge current main into PR #2676
  • 9a67ed0 Merge branch 'main' into fix/pwntools-input-bytes-limit

📊 Changes

11 files changed (+360 additions, -145 deletions)

View changed files

📝 docs/binary-diagnostics.md (+10 -1)
📝 docs/recorded-crashes.md (+7 -2)
📝 src/config/environment.ts (+2 -0)
➕ src/config/pwntoolsMaxInputBytes.ts (+54 -0)
📝 src/native/pwntools/PwntoolsDecoder.ts (+7 -5)
➕ src/native/pwntools/PwntoolsFailures.test.ts (+29 -0)
➖ src/native/pwntools/PwntoolsInputLimit.test.ts (+0 -96)
➖ src/native/pwntools/PwntoolsInputLimit.ts (+0 -40)
📝 tests/boundary/binaryDiagnostics/pwntoolsInputBoundAdmission.test.ts (+3 -1)
➕ tests/conformance/contracts/pwntoolsMaxInputBytes.test.ts (+137 -0)
➕ tests/process-global/pwntoolsInputBudget.test.ts (+111 -0)

📄 Description

Problem

The pwntools-elf adapter rejected any ELF or core dump artifact larger than 32 MiB with an invalid_request / out_of_range error before analysis ran, due to a hardcoded bound in PWNTOOLS_LIMITS.inputBytes = 32 * 1024 * 1024.

Real-world Linux ELF core dumps routinely reach 100 MiB to several GiB, excluding most genuine crash artifacts from being analyzed by rea inspect-recorded-crash or rea inspect-binary-layout.

Solution

  1. Configurable input limit parser:
    • Implemented parsePwntoolsMaxInputBytes in src/config/pwntoolsMaxInputBytes.ts.
    • When REA_PWNTOOLS_MAX_INPUT_BYTES is unset or empty, it preserves the default 32 MiB bound (PWNTOOLS_LIMITS.inputBytes).
    • When set, it validates that the value is a positive decimal safe integer.
  2. Environment registration:
    • Registered REA_PWNTOOLS_MAX_INPUT_BYTES in environmentSchema (src/config/environment.ts) for unified configuration validation.
  3. Dynamic limit consumption:
    • PwntoolsDecoder resolves REA_PWNTOOLS_MAX_INPUT_BYTES from its environment before invoking readStableArtifact(input.path, limit, options?.signal).
    • Invalid configuration values raise an AnalysisInputError at the configuration path.
  4. Documentation & Testing:
    • Updated docs/recorded-crashes.md and docs/binary-diagnostics.md.
    • Added unit test suite in tests/conformance/contracts/pwntoolsMaxInputBytes.test.ts covering defaults, valid limits, malformed/unsafe values, and environment/config integration.

Closes #2446


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2676 **Author:** [@chengwudi1](https://github.com/chengwudi1) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/pwntools-input-bytes-limit` --- ### 📝 Commits (8) - [`bb11f5c`](https://github.com/morluto/rea/commit/bb11f5c4c3d692fdaabb784d4c54193b792eb035) fix(native): support configurable REA_PWNTOOLS_MAX_INPUT_BYTES for large artifacts - [`395e600`](https://github.com/morluto/rea/commit/395e60032f021442faee6e22509a6cec24245d3e) fix(config): permit empty REA_PWNTOOLS_MAX_INPUT_BYTES and cover decoder budget - [`5fc8c77`](https://github.com/morluto/rea/commit/5fc8c77a1566d7db604eda5124d9222993c65181) fix(native): bound pwntools input admission and isolate provider regressions - [`58fd5bb`](https://github.com/morluto/rea/commit/58fd5bb0ee18d0c206226dc5abcb75623922eeb9) test(native): assert input snapshot size outside launcher - [`07e8815`](https://github.com/morluto/rea/commit/07e8815fabc971c121ba7c74a2a6a0d48a58142b) chore: sync captured main for PR 2676 - [`d49a26f`](https://github.com/morluto/rea/commit/d49a26fd85cc7316a8a55d4b19ff2043b4fcf8aa) test: match pwntools input limit diagnostic - [`de3413a`](https://github.com/morluto/rea/commit/de3413a26a8f658ef88c9f7517904d27b3bd1951) chore: merge current main into PR #2676 - [`9a67ed0`](https://github.com/morluto/rea/commit/9a67ed027e4e7381748cdcb0c4d93ad4efd6395c) Merge branch 'main' into fix/pwntools-input-bytes-limit ### 📊 Changes **11 files changed** (+360 additions, -145 deletions) <details> <summary>View changed files</summary> 📝 `docs/binary-diagnostics.md` (+10 -1) 📝 `docs/recorded-crashes.md` (+7 -2) 📝 `src/config/environment.ts` (+2 -0) ➕ `src/config/pwntoolsMaxInputBytes.ts` (+54 -0) 📝 `src/native/pwntools/PwntoolsDecoder.ts` (+7 -5) ➕ `src/native/pwntools/PwntoolsFailures.test.ts` (+29 -0) ➖ `src/native/pwntools/PwntoolsInputLimit.test.ts` (+0 -96) ➖ `src/native/pwntools/PwntoolsInputLimit.ts` (+0 -40) 📝 `tests/boundary/binaryDiagnostics/pwntoolsInputBoundAdmission.test.ts` (+3 -1) ➕ `tests/conformance/contracts/pwntoolsMaxInputBytes.test.ts` (+137 -0) ➕ `tests/process-global/pwntoolsInputBudget.test.ts` (+111 -0) </details> ### 📄 Description ### Problem The `pwntools-elf` adapter rejected any ELF or core dump artifact larger than 32 MiB with an `invalid_request` / `out_of_range` error before analysis ran, due to a hardcoded bound in `PWNTOOLS_LIMITS.inputBytes = 32 * 1024 * 1024`. Real-world Linux ELF core dumps routinely reach 100 MiB to several GiB, excluding most genuine crash artifacts from being analyzed by `rea inspect-recorded-crash` or `rea inspect-binary-layout`. ### Solution 1. **Configurable input limit parser**: - Implemented `parsePwntoolsMaxInputBytes` in `src/config/pwntoolsMaxInputBytes.ts`. - When `REA_PWNTOOLS_MAX_INPUT_BYTES` is unset or empty, it preserves the default 32 MiB bound (`PWNTOOLS_LIMITS.inputBytes`). - When set, it validates that the value is a positive decimal safe integer. 2. **Environment registration**: - Registered `REA_PWNTOOLS_MAX_INPUT_BYTES` in `environmentSchema` (`src/config/environment.ts`) for unified configuration validation. 3. **Dynamic limit consumption**: - `PwntoolsDecoder` resolves `REA_PWNTOOLS_MAX_INPUT_BYTES` from its `environment` before invoking `readStableArtifact(input.path, limit, options?.signal)`. - Invalid configuration values raise an `AnalysisInputError` at the configuration path. 4. **Documentation & Testing**: - Updated `docs/recorded-crashes.md` and `docs/binary-diagnostics.md`. - Added unit test suite in `tests/conformance/contracts/pwntoolsMaxInputBytes.test.ts` covering defaults, valid limits, malformed/unsafe values, and environment/config integration. Closes #2446 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:05:35 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5305
No description provided.