Repository navigation
fix(cli): approval listings no longer execute stored terminal escapes - #123671
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 14, 2026, 9:41 AM ET / 13:41 UTC. ClawSweeper reviewWhat this changesThe PR adds a terminal-safe table renderer and uses it for human-readable exec-approval CLI tables while leaving JSON output unchanged. Merge readinessKeep this maintainer-labelled PR open: it closes a real terminal-safety gap, but its safe-table wrapper also flattens the Effective Policy table’s intentional multiline cells into literal escapes. Priority: P2 Review scores
Verification
How this fits togetherThe exec-approval CLI reads local, gateway, or node approval policies and renders them for operators. Its table layer turns policy fields into terminal output, while JSON remains the machine-readable path. flowchart LR
A[Stored approval policy] --> B[Exec approvals CLI]
B --> C{Output mode}
C -->|Human| D[Terminal table renderer]
C -->|JSON| E[Exact JSON output]
D --> F[Operator terminal]
E --> G[Automation client]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +20, Tests +32. Total +52 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Sanitize approval-derived fields before rendering, or represent safe versus trusted cells explicitly, while retaining Do we have a high-confidence way to reproduce the issue? Yes, from source: running the human Effective Policy path with a resolved policy produces cells containing intentional newlines, and the proposed sanitizer converts them to visible Is this the best way to solve the issue? No. The table-wide single-line sanitizer is too broad because it also transforms trusted layout; sanitizing untrusted approval-derived fields is the narrower compatible repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5523f8a334c9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…openclaw#123671) * fix(cli): sanitize approval table values * test(cli): avoid control regex in approval safety check
What Problem This Solves
Fixes an issue where operators inspecting stored exec approval policies could execute terminal control sequences when an allowlist pattern, agent key, path, or native-rule field contained ANSI or C0/C1 control characters.
The supported
approvals allowlist addpath accepted these values and both its confirmation output andapprovals getrendered them through the trusted-ANSI table primitive. JSON output correctly preserved and escaped the stored values.Why This Change Was Made
Adds an explicit terminal-safe table entry point that sanitizes every header and cell before delegating to the existing layout engine. All approval tables now use that boundary, while the low-level table renderer keeps its deliberate trusted styling, hyperlink, and multiline contract.
User Impact
Approval listings now display hostile newlines, tabs, and carriage returns as visible escapes, remove terminal escape/control sequences, and preserve printable Unicode such as 🦞. Machine-readable JSON remains exact.
Evidence
\n,\t, and\rremained visible; 🦞 remained intact.node scripts/check-changed.mjs: passed formatting, typechecks, lint, dead-code, dependency, database, import-cycle, and architecture guards on the rebased head.