feat: add /trust and /untrust commands for temporary exec security elevation#805
Open
BingqingLyu wants to merge 16 commits into
Open
feat: add /trust and /untrust commands for temporary exec security elevation#805BingqingLyu wants to merge 16 commits into
BingqingLyu wants to merge 16 commits into
Conversation
…evation Add time-limited exec.security=full via /trust [minutes] (1-480, default 15). Anti-stacking prevents extension while active. /untrust for early revocation. In-memory only (fail-closed on restart). Single decision point for all surfaces. Trust scoped by sessionId so /new and /reset revoke trust automatically. Includes oxfmt formatting fixes for CI compliance. Closes openclaw#47695 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes slash-commands-doc.test.ts failure — the test checks that all registered command aliases appear in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/trust [minutes]and/untrustslash commands with in-memory-only state, auto-expiry, anti-stacking, and a single enforcement point for all surfaces. Doesn't touch the security model, just acts as a wrapper for existing exec_security setting./execbehavior, config schema, persistence layer, or approval flows. No per-surface wiring — uses existing command registryChange Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
/trust [minutes]command: temporarily setsexec.security=fullfor the current session (1-480 minutes, default 15)/untrustcommand: immediately revokes temporary trust/trustwhile already trusted is refused with remaining time shownSecurity Impact (required)
Yes— temporary exec escalation tosecurity=fullNoNoYes— two new slash commands that affect exec security resolutionNoRisk + mitigation:
rejectUnauthorizedCommand— same auth check as/execMapwithsetTimeout), never written to disk, lost on restart (fail-closed). Timer uses.unref()matching codebase conventionsessionKey, same scoping as all other session state/untrustthen/trust/exec security=fullwhich is permanent. Cycling requires explicit authorized user action each timeinline directive > trust > session entry, matching existing/execprecedence. Does not bypass agent-level exec ceilings inexec-approvals.jsonRepro + Verification
Environment
Steps
/trust 15/trust 30— observe anti-stacking refusal/untrust— observe revocation/trust 5— observe re-grant works after untrustExpected
Actual
Evidence
7/7 unit tests pass covering: default window, anti-stacking, auto-expiry, /untrust revocation, bounds validation, unauthorized rejection, numerical input scrubbing (0, -5, 15.5, 481, abc, 1e5).
Build (
pnpm build), typecheck (pnpm tsgo), and format all pass.Human Verification (required)
Review Conversations
Compatibility / Migration
Yes— no existing behavior changedNoNoFailure Recovery (if this breaks)
git revertof this commit removes the entire feature. Alternatively, delete 2 new files and revert 3 surgical edits (import line, 2 handler entries, 1 resolution chain call)commands-registry.data.ts,commands-core.ts,get-reply-directives.ts(remove added lines).unref()on timer)Risks and Mitigations
Mapstate grows unboundedsetTimeoutand are bounded by authorized sessions (not user-controllable). Each entry is one Map key + timer.unref()called on timer, matching 15+ codebase precedents for background timers