Skip to content

fix: keep inline eval approvals one-shot [AI] - #112956

Merged
pgondhi987 merged 10 commits into
openclaw:mainfrom
pgondhi987:fix/fix-879
Jul 24, 2026
Merged

pgondhi987 merged 10 commits into
openclaw:mainfrom
pgondhi987:fix/fix-879

Conversation

@pgondhi987

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users who chose an always-allow exec approval for some inline interpreter commands could have that approval reused for a later command with different inline code.

Why This Change Was Made

The inline-command classifier now recognizes additional interpreter entry points that evaluate code passed on the command line. This keeps broad persistent approvals from being created for those interpreter invocations while leaving ordinary script execution and existing shell/package-manager behavior unchanged.

User Impact

Users continue to see the normal prompt for changed inline interpreter payloads instead of having a previous broad approval reused. Script-file invocations for these tools can still follow the existing approval paths.

Evidence

  • Focused tests: node scripts/run-vitest.mjs src/infra/command-analysis/inline-eval.test.ts src/infra/exec-approvals-allow-always.test.ts
  • Result: 2 Vitest shards passed, covering parser detection and allow-always reuse denial.

AI-assisted: yes.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 23, 2026
@pgondhi987

Copy link
Copy Markdown
Contributor Author

ClawSweeper proof for current head 39a64e1

Behavior proved: persistent allow-always approval does not become reusable for interpreter inline program text, while normal file/script-style command paths still classify as intended.
Environment and entry point: local checkout on the exact head above, exercising OpenClaw runtime approval entry points evaluateShellAllowlistWithAuthorization and resolveAllowAlwaysPersistenceDecision; GitHub Actions CI also ran for the same head.
Command/artifact:

  • node scripts/run-vitest.mjs src/infra/command-analysis/inline-eval.test.ts src/infra/exec-approvals-allow-always.test.ts
  • local validation result: unit-fast shard passed 145 tests; infra shard passed 103 tests; git diff --check passed.
  • CI: current PR run includes the same command-analysis and approval tests in the compact Node shards for this head; CI monitoring is tracked separately.
    Evidence:
  • denied scenario: first approval attempts using interpreter inline program text for Julia, Elixir/IEx, Guile, Groovy, Scala/Scala CLI, Clojure/Clj, Raku/Perl6, GHC/GHCI, Erl/Werl, GDB, and Expect produce no reusable persisted approval pattern. A later different inline payload is not allowlist-satisfied and still requires approval. Protected sink/source result: no approval persistence mutation occurs for those interpreter inline payloads, and no broad interpreter approval pattern is persisted.
  • control: normal script/file-style invocations such as julia script.jl, elixir script.exs, guile script.scm, groovy script.groovy, scala script.scala, clojure -M -m app.main, ghc Main.hs, GDB command-file/program options, and expect script.exp are ignored by inline-program detection; direct executable and shell-script approval path succeeds in the same approval test file.
    Compatibility/operator note: no new configuration, prompts, storage shape, or operator action is required. The change tightens which interpreter forms can be persisted as reusable approval patterns.
    Live gaps: no external interpreter process was launched. The protected boundary here is OpenClaw's approval persistence decision, so the proof uses the production approval analyzer and persistence decision code with mocked filesystem executables only at the unsafe external boundary.

@pgondhi987

Copy link
Copy Markdown
Contributor Author

Codex review: needs maintainer review before merge. Reviewed July 23, 2026, 3:37 PM UTC.

Summary
Keep this PR open: current main and the latest release lack the added interpreter classifications, the patch uses the central exec approval boundary with focused regression coverage, and I found no blocking line-level defect; merge should stay with maintainer/security-owner review because it changes approval reuse behavior.

PR surface: Source +137, Tests +370. Total +507 across 3 files.

Reproducibility: Yes from source inspection: current main lacks these interpreter aliases, and the allow-always persistence path depends on inline-eval detection to keep inline payloads one-shot. I did not run tests because this review is read-only, but the PR body and follow-up comment report focused exact-head validation.

Review metrics:

  • Interpreter aliases classified: 17 aliases added - Each alias can change whether allow-always approval patterns are reusable for existing command workflows.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P0] Merging intentionally makes allow-always approvals one-shot for additional interpreter inline payloads, so existing users may see more approval prompts after upgrade; maintainer/security owner should accept that tradeoff.

Maintainer decision needed

  • Question: Should OpenClaw accept the expanded interpreter inline-eval classification as the intended approval-boundary hardening for this PR?
  • Rationale: The patch deliberately changes which persisted exec approvals can be reused and is tied to a security boundary, so owner intent is needed even though the implementation path looks sound.
  • Likely owner: pgondhi987 - They have the most recent concrete history in this classifier area and own the current security-boundary patch.
    Options:
  1. Accept Expanded Boundary (recommended)
    Land after exact-head gates remain green and treat the extra approval prompts for these inline payloads as the intended security tradeoff.
  2. Narrow The Flag Set
    Remove any interpreter or flag forms maintainers are not ready to classify, then keep tests aligned with the accepted contract.
  3. Pause For Security Design
    Hold the PR if maintainers want a broader approval-policy redesign instead of extending the current classifier table.

Next step before merge

  • Confirm maintainer/security-owner acceptance of the expanded one-shot approval behavior before merge.

Security
Cleared: The diff narrows exec approval persistence behavior and changes only classifier/tests; I found no introduced dependency, workflow, secret, or supply-chain concern.

Review details

Best possible solution:

Land the centralized classifier hardening after maintainer/security-owner acceptance of the stricter one-shot approval behavior for the newly covered interpreter forms.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection: current main lacks these interpreter aliases, and the allow-always persistence path depends on inline-eval detection to keep inline payloads one-shot. I did not run tests because this review is read-only, but the PR body and follow-up comment report focused exact-head validation.

Is this the best way to solve the issue?

Yes: the PR extends the existing centralized classifier that feeds approval persistence rather than duplicating policy in callers. The remaining question is owner acceptance of the stricter approval boundary, not a better implementation layer.

AGENTS.md: found_applied

Codex review notes: model internal, reasoning high; reviewed against 4f4d895.

Label details

Label justifications:

  • P0: The PR addresses an exec approval security bypass class where changed inline interpreter payloads could reuse a broad persistent approval.
  • merge-risk: 🚨 compatibility: Merging changes persistent approval reuse for additional interpreter executables, which can add prompts for existing users after upgrade.
Evidence reviewed

PR surface:

Area Files Added Removed Net
Source 1 139 2 +137
Tests 2 370 0 +370
Docs 0 0 0 +0
Config 0 0 0 +0
Generated 0 0 0 +0
Other 0 0 0 +0
Total 3 509 2 +507
  • Repository policy read: Read the full root AGENTS.md; its ClawSweeper review guidance treats approval/security boundaries and compatibility-impacting approval behavior as requiring deeper review and maintainer visibility.
  • Changed classifier surface: The PR adds inline-eval specs for Julia, Elixir/IEx, Guile, Groovy, Scala/Scala CLI, Clojure, Raku, GHC/GHCI, Erlang, GDB, and Expect in the existing central classifier.
  • Approval persistence boundary: Allow-always persistence already withholds durable patterns for interpreter-like executables when strict inline-eval detection finds an inline payload, so the PR extends the existing boundary rather than adding a parallel policy path.
  • Regression coverage: The added approval test table exercises the new interpreters and asserts that a first benign inline command does not persist a reusable pattern that authorizes a later changed payload.
  • Current main gap: Current main does not contain the new interpreter names; the central user/security problem is not already implemented on main.
  • Release gap: The latest release tag v2026.7.1 also lacks these new interpreter classifications, so the PR is not obsolete in shipped code.
  • Dependency contract spot-check: Official/current docs support the key eval-flag contracts used by the patch, including Julia -e/--eval/-E, Groovy -e, GDB eval/init-eval command options, Elixir --eval/--rpc-eval, Scala CLI snippet aliases, Raku -e with -n/-p, GHC -e, Guile -c/-e, Erlang -eval/-run/-s, and Expect -c.
    • command: web search_query for official interpreter command-line option documentation
  • Area history: Recent history shows the same classifier area was introduced and extended by focused inline-eval approval security work before this PR.
  • Boundary provenance: The strict inline-eval allow-always persistence guard in the approval allowlist path is traced by blame to prior security-boundary work, confirming the touched classifier feeds an existing authorization boundary.
  • PR proof context: The PR follow-up comment reports exact-head focused tests, git diff --check, and CI coverage for the production approval analyzer and persistence decision path on head 39a64e1.

@pgondhi987

Copy link
Copy Markdown
Contributor Author

Verification before merge

Current head: 39a64e192314ccddac608de44f62be78722bd0ba

  • Validation dry-run: passed for the current head with fix verdict SOLVES and compatibility verdict PASS.
  • review-pr: passed for the current head; no blocker or important findings.
  • autoreview: passed for the current head with the Codex engine; no accepted/actionable findings.
  • ClawSweeper source feedback: local review clean for the current head; no source findings.
  • Local validation: node scripts/run-vitest.mjs src/infra/command-analysis/inline-eval.test.ts src/infra/exec-approvals-allow-always.test.ts passed; git diff --check passed.
  • CI: clean for the current head after rerunning one unrelated compact shard; final rollup had no pending or failing checks.
  • Behavior proof: current-head proof was posted and the local ClawSweeper proof review completed clean.
  • Final validation gate: passed with no blocking reasons.

@pgondhi987
pgondhi987 merged commit dc4c588 into openclaw:main Jul 24, 2026
27 checks passed
vincentkoc added a commit that referenced this pull request Jul 24, 2026
…omic-publication-20260724

* origin/main:
  refactor(memory-lancedb): remove dead legacy path scan (#113299)
  fix(test): satisfy no-map-spread in exec approvals (#113303)
  fix: keep OAuth refresh failures terminal [AI] (#112957)
  fix: reusable exec approvals apply to approved arguments (#112946)
  refactor(agents): split tool search internals (#113296)
  fix: keep inline eval approvals one-shot [AI] (#112956)
  refactor(normalization): reuse trimmed list helpers (#113295)
  fix(openai): fail fast on invalid TLS certificates (#111818)
  fix: recognize more shell wrappers [AI] (#112955)
  fix(i18n): correct Indonesian seconds labels
  chore(i18n): refresh native locales
  fix: block opaque exec dispatch wrappers (#112953)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 25, 2026
* fix: classify inline eval interpreters

* fix: cover inline eval flag variants

* fix: handle snippet eval option aliases

* fix: classify debugger and runtime callbacks

* fix: tighten interpreter eval matching

* fix: cover gdb early init eval flags

* fix: cover bundled eval option forms

* fix: cover gdb eval abbreviations

* fix: cover iex and guile eval forms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant