Skip to content

Conversation

@zhao-oai
Copy link
Contributor

@zhao-oai zhao-oai commented Dec 3, 2025

Refactor of the execpolicy crate

To illustrate why we need this refactor, consider an agent attempting to run apple | rm -rf ./. Suppose apple is allowed by execpolicy. Before this PR, execpolicy would consider apple and pear and only render one rule match: Allow. We would skip any heuristics checks on rm -rf ./ and immediately approve apple | rm -rf ./ to run.

To fix this, we now thread a fallback evaluation function into execpolicy that runs when no execpolicy rules match a given command. In our example, we would run fallback on rm -rf ./ and prevent apple | rm -rf ./ from being run without approval.

@zhao-oai zhao-oai force-pushed the dev/zhao/execpolicy-refactor branch 4 times, most recently from 00d6382 to 505b845 Compare December 3, 2025 19:25
@zhao-oai zhao-oai requested a review from bolinfest December 3, 2025 19:33
@zhao-oai zhao-oai force-pushed the pr7033 branch 2 times, most recently from 65b6984 to 0d121de Compare December 3, 2025 21:31
@zhao-oai zhao-oai force-pushed the dev/zhao/execpolicy-refactor branch from 505b845 to 09a1786 Compare December 3, 2025 22:23
@zhao-oai zhao-oai force-pushed the dev/zhao/execpolicy-refactor branch from 09a1786 to d49a447 Compare December 3, 2025 22:28
@zhao-oai zhao-oai force-pushed the pr7033 branch 3 times, most recently from 86b1d98 to 31c5e11 Compare December 3, 2025 23:14
@zhao-oai zhao-oai force-pushed the dev/zhao/execpolicy-refactor branch from d49a447 to 01a8814 Compare December 4, 2025 00:12
@zhao-oai zhao-oai force-pushed the dev/zhao/execpolicy-refactor branch 2 times, most recently from 1cc4c2d to 27804c3 Compare December 4, 2025 05:42
Base automatically changed from pr7033 to main December 4, 2025 07:17
Add explicit prefix-approval decision and wire it through execpolicy/UI snapshots

update doc

mutating in memory policy instead of reloading

using RW locks

clippy

refactor: adding allow_prefix into ApprovedAllowPrefix

fmt

do not send allow_prefix if execpolicy is disabled

moving args around

cleanup exec_policy getters

undo diff

fixing rw lock bug causing tui to hang

updating phrasing

integration test

.

fix compile

fix flaky test

fix compile error

running test with single thread

fixup allow_prefix_if_applicable

fix formatting

fix approvals test

only cloning when needed

docs

add docstring

fix rebase bug

fixing rebase issues

Revert "fixing rebase issues"

This reverts commit 79ce7e1.

fix rebase errors
@zhao-oai zhao-oai force-pushed the dev/zhao/execpolicy-refactor branch from c12dd09 to 4488061 Compare December 4, 2025 07:25
@zhao-oai zhao-oai merged commit 3d35cb4 into main Dec 4, 2025
52 checks passed
@zhao-oai zhao-oai deleted the dev/zhao/execpolicy-refactor branch December 4, 2025 07:39
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants