Skip to content

fix(security): redact fatal diagnostics at process boundaries - #11674

Merged
cv merged 2 commits into
mainfrom
codex/redact-fatal-diagnostics
Sep 13, 2026
Merged

cv merged 2 commits into
mainfrom
codex/redact-fatal-diagnostics

Conversation

@prekshivyas

@prekshivyas prekshivyas commented Sep 13, 2026 •

Copy link
Copy Markdown
Collaborator

Outcome

Standalone messaging build, reviewed npm audit, and OpenClaw npm remediation failures no longer print environment-derived error text. Failing messaging child-process output is contained before it reaches terminal or CI streams, existing nonzero exit codes remain unchanged, and stderr contains only fixed operation-specific or failure-class diagnostics.

Reason

Three direct process-boundary sinks allowed environment-controlled plan fields, paths, or child-process output to reach fatal stderr. CodeQL reported these flows as clear-text logging alerts 2025, 2026, and 2027. Review of the first candidate also showed that inherited child streams could bypass the outer messaging diagnostic.

Related issues

Fixes #11673

Changes

  • Replace raw caught-error output in the messaging build, reviewed npm audit, and remediation entrypoints with fixed diagnostics.
  • Classify expected messaging, audit, remediation, invalid-input, child-command, archive, working-file, and reviewed-package failures without copying dynamic values into logs.
  • Capture messaging child stdout/stderr; replay it only after success and discard it on failure so the fixed process-boundary diagnostic cannot be bypassed.
  • Add five real-process regressions that inject credential-shaped canaries through a messaging plan, a failing messaging child, an audit path, and inherited remediation child output, plus a missing-argument classification check.
  • Update existing tests to prove unsafe path details are omitted while exit behavior and mutation-denial evidence remain intact.

Verification

  • Before-fix regression run — all 3 original process tests failed and each credential-shaped canary reached stderr.
  • npx vitest run --project integration test/security/fatal-process-diagnostics.test.ts test/runtime/messaging/messaging-build-applier.test.ts test/runtime/messaging/messaging-build-applier-credential-env.test.ts test/runtime/messaging/messaging-build-applier-inactive-channel.test.ts test/runtime/messaging/messaging-build-applier-integrity.test.ts test/runtime/messaging/messaging-build-applier-render-safety.test.ts test/automation/releases/reviewed-npm-audit-entrypoint.test.ts test/automation/releases/reviewed-npm-audit-workflow.test.ts test/agents/openclaw/openclaw-npm-remediation.test.ts test/agents/openclaw/openclaw-2026-6-npm-remediation.test.ts test/agents/openclaw/openclaw-diagnostics-npm-remediation.test.ts test/agents/openclaw/openclaw-diagnostics-jaeger-runtime.test.ts --coverage=false --maxWorkers=2 — 134 passed, 1 skipped.
  • npm run test:changed — 7 growth guardrails and 15 changed CLI/plugin/e2e tests passed.
  • npm run test:projects:check — passed; all 2,697 test files have exact project membership.
  • npm run checks:repository — all 19 selected repository checks passed.
  • NODE_OPTIONS=--max-old-space-size=8192 npm run typecheck:cli — passed.
  • NODE_OPTIONS=--max-old-space-size=8192 npm run validate:pr — passed, including formatting, lint, secret scan, CLI/plugin builds, and selected TypeScript checks.
  • Normal guarded push hook — publication validation and CLI TypeScript passed.
  • git diff --check — passed.
  • Reviewed the complete diff; it contains no real secrets, API keys, or credentials. Canary values are synthetic test fixtures.

Review notes

This change touches sensitive scripts/** and src/lib/messaging/** paths. On commit 4f8248323b262c581118a845c50ea37ffd4f1ae9, CodeRabbit reported no actionable comments and 64 CI checks—including both JavaScript CodeQL systems—passed. Advisor findings about inherited messaging child output and overly generic recovery diagnostics were reproduced and repaired in fa0e42403c01f144df8ce426a74099be723a7bb8. The Advisor audit-entrypoint finding was a false positive: the child eval assigns the filesystem path to process.argv[1], uses the file URL only for import(), and the real-process status/diagnostic assertions pass. The prior Reduction and simplification specialist failed after emitting non-submit activity following its findings submission, so its expected artifact was missing. The current commit awaits its replacement CI and automated-review cycle; no independent human approval is claimed.


Signed-off-by: Prekshi Vyas [email protected]

Summary by CodeRabbit

  • Bug Fixes
    • Improved npm audit failure messages for version mismatches, archive-packing failures, controlled configuration, and unreviewed packages.
    • Added clearer remediation failure messages for missing inputs, command failures, invalid archives, unreviewed packages, and filesystem errors.
    • Replaced detailed messaging build errors with concise generic failure notices.
    • Prevented credentials, sensitive information, unsafe file paths, and command details from appearing in output.
  • Tests
    • Added coverage confirming diagnostic accuracy and sensitive-data redaction across affected workflows.

@prekshivyas prekshivyas self-assigned this Sep 13, 2026
@copy-pr-bot

copy-pr-bot Bot commented Sep 13, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 79b108a1-3c07-4c27-8c9d-c4f6290cb062

📥 Commits

Reviewing files that changed from the base of the PR and between 4f82483 and fa0e424.

📒 Files selected for processing (3)
  • scripts/lib/openclaw-npm-remediation.mts
  • src/lib/messaging/applier/build/messaging-build-applier.mts
  • test/security/fatal-process-diagnostics.test.ts

Included review availability: Your plan provides up to 12 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change sanitizes fatal diagnostics from messaging build, reviewed npm audit, and OpenClaw npm remediation entry points. Tests verify revised messages, preserved exit statuses, unsafe-path omission, and credential omission.

Changes

Fatal diagnostic redaction

Layer / File(s) Summary
Diagnostic handlers
scripts/audit-reviewed-npm-graph.mts, scripts/lib/openclaw-npm-remediation.mts, src/lib/messaging/applier/build/messaging-build-applier.mts
The three entry points classify failures and emit fixed diagnostics. Existing nonzero exit statuses remain unchanged. Messaging command execution now captures output and reports command failures through an internal error type.
Diagnostic regression coverage
test/automation/releases/reviewed-npm-audit-workflow.test.ts, test/runtime/messaging/messaging-build-applier-integrity.test.ts, test/security/fatal-process-diagnostics.test.ts
Tests validate revised audit messages, generic messaging-build errors, unsafe-path omission, exit statuses, and credential omission from stdout and stderr.

Priority: ⬆️ High

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: High

Suggested reviewers: cv, jyaunches

Merge Risk: ⚪ Minimal · up to fa0e4

Fatal failures now return sanitized operation-specific diagnostics without exposing environment-derived or child-process details. The revised behavior is covered by real-process regression tests and is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: redacting fatal diagnostics at process boundaries to address a security issue.
Linked Issues check ✅ Passed The changes satisfy the coding requirements in [#11673]. The three reported process boundaries now emit fixed diagnostics instead of raw caught-error details. Messaging failures retain status 2. Both …
Out of Scope Changes check ✅ Passed The changes stay within [#11673]. Source changes modify the three reported fatal diagnostic boundaries. Test changes update affected expectations and add real-process redaction and exit-status coverag…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/redact-fatal-diagnostics

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall line coverage in commit fa0e424 in the codex/redact-fatal-d... branch remains at 96%, unchanged from commit 475a20e in the main branch.


Updated September 13, 2026 19:13 UTC

@prekshivyas
prekshivyas marked this pull request as ready for review September 13, 2026 18:40
@cv
cv merged commit 02d9198 into main Sep 13, 2026
99 of 102 checks passed
@cv
cv deleted the codex/redact-fatal-diagnostics branch September 13, 2026 19:54
jyaunches added a commit that referenced this pull request Sep 13, 2026
<!-- markdownlint-disable MD041 -->
## Outcome

PR Review Advisor specialists now retain a successful findings
submission when the harness adds its configured tool-disabled prose
repair. Model-emitted post-submit prose and tool activity remain
rejected.

## Reason

The harness asked for a prose-only repair when a specialist submitted
its findings without required analysis. It then treated its own repair
prose as forbidden activity after the successful submission. This
contradiction caused specialist and artifact failures on PRs #11645,
#11668, and #11674.

## Changes

- Preserve the original model-turn flow for terminal-submit validation
when the harness starts a tool-disabled assistant-text repair.
- Clarify that the controlled repair continuation is separate from model
activity in the terminal-submit contract.
- Add a session regression test that submits successfully without prose
and verifies that the controlled prose repair completes without a second
submission.

## Verification

- `npm exec -- vitest run --project integration
test/automation/pull-requests/advisor-session-runner.test.ts
test/automation/pull-requests/advisor-session-context-tools.test.ts` —
76 tests passed.
- `npm run test:changed` — seven growth-guardrail tests passed; no
changed CLI, plugin, or E2E-support tests were selected.
- `npm run build:cli` — passed.
- `npm --prefix nemoclaw run build` — passed.
- `node --max-old-space-size=8192 node_modules/typescript/bin/tsc -p
tsconfig.cli.json` — passed after required build artifacts were
generated.
- The installed pre-push hook passed publication validation and the
plugin, JavaScript-config, and CLI TypeScript checks for commit
`e1c82b5f309b4275235c6a594a2c908756a8d182`.
- The diff contains no secrets, API keys, or credentials.

---
Signed-off-by: Julie Yaunches <[email protected]>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Fixed terminal submission validation when required assistant analysis
is missing after a successful submission.
- Prevented assistant-text repair content from being incorrectly
included in terminal-submit validation.
- Ensured analysis repair runs without unnecessary terminal-submit
repair actions.

- **Documentation**
- Clarified when assistant-text repair may follow a successful terminal
submission.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Julie Yaunches <[email protected]>
@wscurran wscurran added area: observability Logging, metrics, tracing, diagnostics, or debug output area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior labels Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: observability Logging, metrics, tracing, diagnostics, or debug output area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Redact environment-derived fatal diagnostics at process boundaries

3 participants