Files
codex/codex-rs/execpolicy2/src/default.policy
2025-11-13 22:07:38 -05:00

132 lines
2.1 KiB
Plaintext

prefix_rule(
id = "git_status",
pattern = ["git", "status"],
match = [
["git", "status"],
["git", "status", "--", "path/to/file"],
],
not_match = [
["git", "statusx"],
["git", "reset", "--hard"],
],
)
prefix_rule(
id = "git_reset_hard",
pattern = ["git", "reset", "--hard"],
decision = "forbidden",
match = [
["git", "reset", "--hard"],
],
)
prefix_rule(
id = "ls",
pattern = ["ls"],
match = [
["ls"],
["ls", "-l"],
["ls", "-a", "."],
],
not_match = [
["lsl"],
],
)
prefix_rule(
id = "cat",
pattern = ["cat"],
match = [
["cat", "file.txt"],
["cat", "-n", "README.md"],
],
not_match = [
["catx"],
],
)
prefix_rule(
id = "cp_prompt",
pattern = ["cp"],
decision = "prompt",
match = [
["cp", "foo", "bar"],
["cp", "-r", "src", "dest"],
],
not_match = [
["cpp"],
],
)
prefix_rule(
id = "head",
pattern = ["head"],
match = [
["head", "README.md"],
["head", "-n", "5", "CHANGELOG.md"],
],
not_match = [
["headx"],
],
)
prefix_rule(
id = "printenv",
pattern = ["printenv"],
match = [
["printenv"],
["printenv", "PATH"],
],
not_match = [
["printenvx"],
],
)
prefix_rule(
id = "pwd",
pattern = ["pwd"],
match = [
["pwd"],
],
not_match = [
["pwdx"],
],
)
prefix_rule(
id = "rg",
pattern = ["rg"],
match = [
["rg", "-n", "init"],
["rg", "--files", "--max-depth", "2", "."],
],
not_match = [
["rgx"],
],
)
prefix_rule(
id = "sed_prompt",
pattern = ["sed"],
decision = "prompt",
match = [
["sed", "-n", "s/a/b/", "file.txt"],
["sed", "s/foo/bar/g", "file.txt"],
],
not_match = [
["sedx"],
],
)
prefix_rule(
id = "which",
pattern = ["which"],
match = [
["which", "python3"],
["which", "-a", "python3"],
],
not_match = [
["whichx"],
],
)