Skip to content

fix(process): prevent credential echoes in spawn validation errors - #751

Merged
stamp-build[bot] merged 1 commit into
mainfrom
agent/lookout/spawn-validation-secrets
Nov 12, 2026
Merged

stamp-build[bot] merged 1 commit into
mainfrom
agent/lookout/spawn-validation-secrets

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Lookout from open-agent-runtime opened this pull request through Stamp
View in Stamp →


A credential containing a NUL byte is rejected before Node starts a child, but Node quotes the escaped value in its validation error. Exact-value credential filtering cannot match that representation. This exposed the value through Cursor subprocess calls and several adapters' version probes.

Use the existing spawnChecked boundary before synchronous spawn errors reach errors, diagnostics or login details. Keep the native error code and the rejection; omit the quoted value and original stack/cause. The standalone watchdog uses a fixed-message boundary and exit 1, because it cannot import the host module graph.

Closes #750.

Spawn audit

Entry Environment/input provenance and handling
node-script.ts Caller-supplied session/call environment. Now guarded.
run.ts Explicit probe/query environment and arguments. Now guarded.
login.ts Login driver's environment and optional watchdog target. Now guarded.
isolated.ts Installer/updater environment, including a runtime updater's configured environment. Now guarded.
acp/terminal.ts Session environment plus ACP terminal request overrides. Now guarded.
shell-environment.ts Host environment, with caller-supplied capture command/args. Its public error was already private; the launch now follows the same guard convention.
process-table-command.ts Current callers use the host environment (POSIX adds LC_ALL=C), not a session override. Still guarded; the helper accepts an explicit environment.
host-watchdog.ts Inherits an already-launched environment, then restores ELECTRON_RUN_AS_NODE and decodes command/args from JSON. That second launch can receive NUL even when the outer launch succeeded. Guard it inside the standalone script.
process.ts Already used spawnChecked; unchanged.

No raw spawn was exempted. A source check scans package TypeScript and embedded String.raw scripts, including imported aliases, namespace calls and destructured aliases, for calls outside the direct spawnChecked(() => spawn(...)) convention. It is a development guard, not a sandbox for arbitrary dynamic code.

Validation

  • Thirteen new behavior regressions failed before the fix because the synthetic value escaped, then passed: Cursor session/models/status, version diagnostics, shared login/update/terminal/process-table/Node-script entries, direct invalid argv and both watchdog JSON paths. Hidden errors, stacks, causes and serialized results are checked. The first draft of the tests had two fixture API mistakes; those were corrected before recording the 13 failing regressions.
  • The source check identified all eight previously unguarded launch sites; its alias/embedded-script controls pass. With the fix, the focused suite passes 24 tests (including four existing Cursor cases).
  • The inspection's 19-entry adapter matrix was repeated against the built package: no synthetic credential echoes, no executable fixture started. This is native Node validation before SDK/CLI startup, not a native vendor behavior claim.
  • CI=1 pnpm run check: 3,985 tests and 18 mock behavior cases pass. Both package builds pass.
  • pnpm tsx sea-trial/all.ts: 14 locally available backends pass; DSH was absent and explicitly skipped. Follow-up with OAR_TEST_REQUIRE_AVAILABLE=1 and the CI versions passes CodeBuddy 2.179.3 (16 cases) and DSH 0.2.1-rc.5 (18 cases). The broad run used existing local binaries, including CodeBuddy 2.173.0, so it is not a claim that every CI-pinned vendor version was rerun locally.

Local checks ran on Linux x64, Node 24.19.0. No real login or paid model call was used for these checks.

@stamp-build
stamp-build Bot merged commit 183ca93 into main Nov 12, 2026
40 checks passed
@stamp-build
stamp-build Bot deleted the agent/lookout/spawn-validation-secrets branch November 12, 2026 12:02
@stamp-build stamp-build Bot mentioned this pull request Nov 12, 2026
stamp-build Bot added a commit that referenced this pull request Nov 12, 2026
<!-- stamp:review:v1 -->
<sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_ab238713ca1834e477cdf55ade43ffdb"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup>

---
<!-- /stamp:review:v1 -->

Claude limit resets through Claude Code's own interactive UI, and usage windows that say which model they count.

## Claude: limit resets (#752)
- New optional member `Runtime.inspectLimitResets(installation, options?)` (Claude only) lists the account's resets per kind: `weekly`, `fable`, `full`, and `five_hour` only with `includeFiveHour: true`. Each kind is `available` (with `resetsLeft` and `expiresText`), `none`, `not_offered`, `unknown` or `not_checked`; the result also carries the Claude Code `version`, and `program: "legacy"` / `fiveHourSpent: true` when the older program answered.
- `claudeRuntime` now has `redeemLimitReset(installation, { idempotencyKey, resetId })`; for Claude `resetId` is required and names the kind. Claude's `accountUsage` still reports no `limitResets`: list them with `inspectLimitResets`, not from the usage snapshot.
- Claude Code 2.1.322 has no `-p`, SDK or control-protocol form, so OAR drives the hidden `/limit-reset <kind>` command in a pseudo-terminal (the system `script`) and reads the screen. Every screen must match the recorded text word for word apart from dates, counts and percentages (the whole confirmation dialog included); anything else ends the attempt with Esc. Yes is sent at most once, never while inspecting.
- At the 5-hour limit, Claude's older reset program spends its reset as soon as any `/limit-reset` opens. Without `fiveHourLimitConsent: true`, OAR reads usage right before the first command and types nothing when the account is at the limit (`consent_required`) or the read fails (`not_attempted` / `usage_unread`). A `weekly`, `fable` or `full` redeem without consent also needs Claude Code's cached feature flags to show the newer reset program, and otherwise answers `consent_required`. A `five_hour` redeem is itself the consent.
- An idempotency key is remembered for the life of the process once its attempt typed a command: the same key gets the first answer, never a second Yes; the same key with another `resetId` rejects. An attempt that sent nothing is not remembered. Claude answers a timeout with `not_attempted` or `unknown` instead of rejecting (Codex still rejects).
- Each call starts Claude Code's UI, which sends one 1-token model request at startup; on a subscription it likely counts as usage. `inspectLimitResets` is not a passive read: call it on the account owner's request and never poll it.
- Linux only, with the system `script` (util-linux) available; anywhere else, or without it, the answer is `unsupported_platform`. (macOS's BSD `script` exits when its stdin is a socket, which Node pipes are there.)
- Evidence: the screen recognisers come from Raft's offline harness, which drove the real 2.1.322 UI against a fake backend; the real server's Fable and full screens are unverified, and no real account's reset has been spent through OAR.

**Source compatibility.** New exported types: `LimitResetInspection`, `LimitResetInspectOptions`, `LimitResetInspector`, `LimitResetKindStatus`, `LimitResetNotAttemptedReason`, `LimitResetUnsupportedReason`, `AccountUsageWindowScope`; new option `LimitResetOptions.fiveHourLimitConsent`. `LimitResetResult` gains `not_attempted` (`busy`, `deadline`, `usage_unread`, `startup_failed`) and `unknown` (optionally `fiveHourSpent`), and its `unsupported` reason is now typed `LimitResetUnsupportedReason` (the account-usage reasons plus `unsupported_platform`, `unsupported_version`, `reset_id_required`, `consent_required`). Codex's behavior is unchanged, but a host with an exhaustive `switch` over these unions, or one that assigns the reason to `AccountUsageUnsupportedReason`, needs updating. A host that offered redeem only where `redeemLimitReset` exists now sees it on Claude too. `oar list` gains an `inspectLimitResets` key.

## Account usage: window scope (#753)
- `AccountUsageWindow.scope`: `{ kind: "account" }` when the runtime reports the window as the account's, `{ kind: "model", name }` when it reports it as one model's, with the runtime's own name kept as given (Claude "Opus", "Sonnet", "Fable"; Codex `limitName`, which can be a quota alias such as `gpt-reserve`). Omitted, meaning unknown, where the runtime says neither (Claude's OAuth apps window, Codex's other unnamed buckets, Kimi's name-only rows).
- `scope` says what a window counts, not whether a full one stops work: extra usage can carry Claude, Grok and Kimi accounts past a full subscription window, which `rateLimited` already weighs.

Also in this release: spawn validation errors no longer echo a rejected argument or environment value (#751).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Cindy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(process): redact rejected environment values in Node child and version-probe errors

0 participants