[PR #3827] [CLOSED] fix(process): preserve __proto__ environment overrides #5929

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3827
Author: @dayvison2b
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: fix/3338-process-proto-environment


📝 Commits (1)

  • 842d9bb fix(process): preserve proto environment overrides

📊 Changes

4 files changed (+63 additions, -3 deletions)

View changed files

📝 src/domain/process/processScenario.test.ts (+12 -0)
📝 src/domain/process/processScenario.ts (+9 -1)
📝 tests/boundary/process/ProcessEvidence.test.ts (+18 -2)
📝 tests/boundary/process/processPreparation.test.ts (+24 -0)

📄 Description

Summary

Withdrawn in favor of #3834. This change preserves __proto__ through scenario parsing, but it does not fix delivery through the actual PTY capture backend. The original completion claim was too broad.

Related to #3338; this PR does not fully resolve it.

Problem and expected behavior

A JSON scenario may contain environment: { "__proto__": "literal" }. Zod’s z.record skips that key, so the child misses the requested override and the Evidence projection loses it too.

Change and scope

Validate environment entries as key/value tuples and rebuild them with Object.fromEntries. This keeps a normal object prototype while retaining __proto__ as an own property. This is a focused fix within the existing process capture scope.

Follow the contribution scope. This routine fix does not need a maintainer scope decision.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/domain/process/processScenario.ts, scenario input parsing.
  • Contribution scope fit and linked maintainer decision: existing bounded process capture; decision not applicable.
  • CLI and MCP/tool-catalog contract: no schema shape change; valid environment names now survive parsing.
  • Provider, bridge, target-format, or platform compatibility: no provider change; environment key handling is platform-neutral within the existing validation rules.
  • Evidence, artifact, provenance, or reconstruction contract: selected environment values remain in the scenario commitment and Evidence.
  • Target selection, authority, upstream behavior, and cleanup details: no authority change; the existing capture flow still runs the caller-selected executable.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • 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: parser retains the own key; a direct Node spawnSync test confirms a child receives the literal value, bypassing the actual node-pty backend; Evidence test confirms it remains serialized.

  • Base reproduction: before the fix, direct z.record parsing returned no keys for an input containing __proto__ (ownProto: false). The new child-process test would return missing on the base revision and now returns literal.

  • User-visible CLI/MCP output: the reported capture reproduction was not run. The real PTY path still drops the key.

  • Known blocking gap: node-pty copies the environment with utils.assign({}, opt.env), losing the key again. Confirmed by inspecting the installed dependency and executing its assign helper. The direct Node child-process test does not cover this path, so passing tests do not establish a complete fix.

  • 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 -- src/domain/process/processScenario.test.ts tests/boundary/process/processPreparation.test.ts tests/boundary/process/ProcessEvidence.test.ts — 22 tests passed.
  • npm run check:fast — typecheck and lint passed.
  • The checkout used Node.js 24.17.0; the repository pins 24.18.0, and its supported 24.x floor is 24.11.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real OS capture coverage: not run on Linux/macOS. The Windows Node child-process test bypasses the PTY backend.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the special key is retained as data without changing the object prototype; process authority is unchanged.

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.

🔄 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/3827 **Author:** [@dayvison2b](https://github.com/dayvison2b) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/3338-process-proto-environment` --- ### 📝 Commits (1) - [`842d9bb`](https://github.com/morluto/rea/commit/842d9bb31a7795f4455d3ba8d4e5edcd9500cafe) fix(process): preserve __proto__ environment overrides ### 📊 Changes **4 files changed** (+63 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/process/processScenario.test.ts` (+12 -0) 📝 `src/domain/process/processScenario.ts` (+9 -1) 📝 `tests/boundary/process/ProcessEvidence.test.ts` (+18 -2) 📝 `tests/boundary/process/processPreparation.test.ts` (+24 -0) </details> ### 📄 Description ## Summary **Withdrawn in favor of #3834.** This change preserves `__proto__` through scenario parsing, but it does not fix delivery through the actual PTY capture backend. The original completion claim was too broad. Related to #3338; this PR does not fully resolve it. ## Problem and expected behavior A JSON scenario may contain `environment: { "__proto__": "literal" }`. Zod’s `z.record` skips that key, so the child misses the requested override and the Evidence projection loses it too. ## Change and scope Validate environment entries as key/value tuples and rebuild them with `Object.fromEntries`. This keeps a normal object prototype while retaining `__proto__` as an own property. This is a focused fix within the existing process capture scope. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). This routine fix does not need a maintainer scope decision. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/domain/process/processScenario.ts`, scenario input parsing. - Contribution scope fit and linked maintainer decision: existing bounded process capture; decision not applicable. - CLI and MCP/tool-catalog contract: no schema shape change; valid environment names now survive parsing. - Provider, bridge, target-format, or platform compatibility: no provider change; environment key handling is platform-neutral within the existing validation rules. - Evidence, artifact, provenance, or reconstruction contract: selected environment values remain in the scenario commitment and Evidence. - Target selection, authority, upstream behavior, and cleanup details: no authority change; the existing capture flow still runs the caller-selected executable. - Generated metadata, package, or installation impact: none. Expected effects: - [ ] Read existing files or captured data. - [x] 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: parser retains the own key; a direct Node `spawnSync` test confirms a child receives the literal value, bypassing the actual `node-pty` backend; Evidence test confirms it remains serialized. - Base reproduction: before the fix, direct `z.record` parsing returned no keys for an input containing `__proto__` (`ownProto: false`). The new child-process test would return `missing` on the base revision and now returns `literal`. - User-visible CLI/MCP output: the reported capture reproduction was not run. The real PTY path still drops the key. - Known blocking gap: `node-pty` copies the environment with `utils.assign({}, opt.env)`, losing the key again. Confirmed by inspecting the installed dependency and executing its assign helper. The direct Node child-process test does not cover this path, so passing tests do not establish a complete fix. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- src/domain/process/processScenario.test.ts tests/boundary/process/processPreparation.test.ts tests/boundary/process/ProcessEvidence.test.ts` — 22 tests passed. - `npm run check:fast` — typecheck and lint passed. - The checkout used Node.js 24.17.0; the repository pins 24.18.0, and its supported 24.x floor is 24.11. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real OS capture coverage: not run on Linux/macOS. The Windows Node child-process test bypasses the PTY backend. - Package or release metadata impact: none. - Security, privacy, process, or containment review: the special key is retained as data without changing the object prototype; process authority is unchanged. ## Author readiness Human owner: <!-- @GitHub-handle --> - [ ] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:10:31 +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#5929
No description provided.