Commit 3d35cb4
authored
Refactor execpolicy fallback evaluation (openai#7544)
## 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.1 parent e925a38 commit 3d35cb4
File tree
27 files changed
+539
-258
lines changed- codex-rs
- app-server/src
- cli/tests
- core
- src
- tools
- runtimes
- tests/suite
- execpolicy
- src
- tests
- mcp-server/src
- protocol/src
- tui/src
- bottom_pane
- chatwidget
- docs
27 files changed
+539
-258
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
51 | 49 | | |
52 | | - | |
53 | | - | |
| 50 | + | |
| 51 | + | |
54 | 52 | | |
55 | 53 | | |
56 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
871 | 872 | | |
872 | 873 | | |
873 | 874 | | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
879 | 878 | | |
880 | | - | |
| 879 | + | |
881 | 880 | | |
882 | 881 | | |
883 | 882 | | |
| |||
897 | 896 | | |
898 | 897 | | |
899 | 898 | | |
900 | | - | |
| 899 | + | |
901 | 900 | | |
902 | 901 | | |
903 | | - | |
| 902 | + | |
904 | 903 | | |
905 | 904 | | |
906 | 905 | | |
| |||
921 | 920 | | |
922 | 921 | | |
923 | 922 | | |
924 | | - | |
| 923 | + | |
925 | 924 | | |
926 | 925 | | |
927 | 926 | | |
| |||
949 | 948 | | |
950 | 949 | | |
951 | 950 | | |
952 | | - | |
| 951 | + | |
953 | 952 | | |
954 | 953 | | |
955 | 954 | | |
| |||
1672 | 1671 | | |
1673 | 1672 | | |
1674 | 1673 | | |
1675 | | - | |
1676 | | - | |
| 1674 | + | |
| 1675 | + | |
1677 | 1676 | | |
1678 | | - | |
1679 | | - | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
1680 | 1683 | | |
1681 | | - | |
| 1684 | + | |
1682 | 1685 | | |
1683 | 1686 | | |
1684 | 1687 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| |||
0 commit comments