@@ -11,7 +11,7 @@ prefix_rule(
1111 pattern = ["rm", "-rf"],
1212 decision = "forbidden",
1313 justification = "Use a scoped non-destructive command, or ask the user for an explicit cleanup plan.",
14- match = ["rm -rf build "],
14+ match = ["rm -rf"],
1515)
1616prefix_rule(
1717 pattern = ["git", "reset", "--hard"],
@@ -25,21 +25,92 @@ prefix_rule(
2525 justification = "Use git status and ask the user before removing untracked files.",
2626 match = ["git clean -fdx"],
2727)
28+ prefix_rule(
29+ pattern = ["git", "clean", "-f"],
30+ decision = "forbidden",
31+ justification = "Use git status and ask the user before removing untracked files.",
32+ match = ["git clean -f"],
33+ )
34+ prefix_rule(
35+ pattern = ["git", "clean", "-fd"],
36+ decision = "forbidden",
37+ justification = "Use git status and ask the user before removing untracked files.",
38+ match = ["git clean -fd"],
39+ )
40+ prefix_rule(
41+ pattern = ["git", "clean", "-fx"],
42+ decision = "forbidden",
43+ justification = "Use git status and ask the user before removing untracked files.",
44+ match = ["git clean -fx"],
45+ )
2846prefix_rule(
2947 pattern = ["git", "push", "--force"],
3048 decision = "forbidden",
3149 justification = "Do not force push or rewrite remote history without explicit user approval.",
3250 match = ["git push --force"],
3351)
52+ prefix_rule(
53+ pattern = ["git", "push", "-f"],
54+ decision = "forbidden",
55+ justification = "Do not force push or rewrite remote history without explicit user approval.",
56+ match = ["git push -f"],
57+ )
58+ prefix_rule(
59+ pattern = ["sudo"],
60+ decision = "forbidden",
61+ justification = "Do not escalate privileges from project automation.",
62+ match = ["sudo"],
63+ )
64+ prefix_rule(
65+ pattern = ["chmod", "777"],
66+ decision = "forbidden",
67+ justification = "Use the narrowest file mode required instead of world-writable permissions.",
68+ match = ["chmod 777"],
69+ )
3470prefix_rule(
3571 pattern = ["cat", "~/.ssh"],
3672 decision = "forbidden",
3773 justification = "Do not read local SSH secrets.",
3874 match = ["cat ~/.ssh"],
3975)
76+
77+ # Prefix rules can cover direct tokenized .env reads, including the literal
78+ # shell glob token users type before expansion. Upstream .env redirection or
79+ # write patterns are outside this syntax and must stay handled by prompts,
80+ # hooks, or manual review rather than unsupported redirection rules.
81+ prefix_rule(
82+ pattern = ["cat", ".env"],
83+ decision = "forbidden",
84+ justification = "Do not read local environment secret files.",
85+ match = ["cat .env"],
86+ )
87+ prefix_rule(
88+ pattern = ["cat", "*.env"],
89+ decision = "forbidden",
90+ justification = "Do not read local environment secret files.",
91+ match = ["cat *.env"],
92+ )
4093prefix_rule(
4194 pattern = ["cat", "~/.env"],
4295 decision = "forbidden",
4396 justification = "Do not read local environment secret files.",
4497 match = ["cat ~/.env"],
4598)
99+ prefix_rule(
100+ pattern = ["type", ".env"],
101+ decision = "forbidden",
102+ justification = "Do not read local environment secret files.",
103+ match = ["type .env"],
104+ )
105+ prefix_rule(
106+ pattern = ["type", "*.env"],
107+ decision = "forbidden",
108+ justification = "Do not read local environment secret files.",
109+ match = ["type *.env"],
110+ )
111+ prefix_rule(
112+ pattern = ["type", "~/.env"],
113+ decision = "forbidden",
114+ justification = "Do not read local environment secret files.",
115+ match = ["type ~/.env"],
116+ )
0 commit comments