Repository navigation
Commit 9c673bb
committed
fix(wizard): stop the agent guard from blocking .env.example
Completes the review fix on #594. The doctrine now says `.env.example` is
exempt from the secrets read-ban; the wizard's runtime guard still blocked it.
`SENSITIVE_FILE_PATTERNS` matched `/\.env($|\.)/`, which tests true against
`.env.example`. Because `wizardCanUseTool` applies that guard to `Edit` and
`Write` as well as `Read`, the agent could not create or edit the one file the
doctrine explicitly instructs it to write. Committed env templates carry
placeholder key names, not values.
Narrow the rule with an anchored negative lookahead so `.env.example`,
`.env.sample` and `.env.template` are reachable, while `.env`, `.env.local`,
`.env.production` and near-miss names that do carry values
(`.env.example.local`, `.env.example.bak`) stay blocked. `auth.json`,
`secretkey.json` and credential files are untouched.
Bash remains deliberately stricter: no env file, template or not, is reachable
from a shell. `cat` isn't in the bash allowlist anyway, and Read/Write is the
sanctioned path -- so there's no reason to widen the riskiest surface. Noted
inline.
Adds five cases covering the exemption, the near-miss names, and the Bash
asymmetry. `pnpm --filter @cipherstash/wizard test` passes (150).1 parent aad9164 commit 9c673bb
3 files changed
Lines changed: 68 additions & 2 deletions
File tree
- .changeset
- packages/wizard/src
- __tests__
- agent
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
75 | 111 | | |
76 | 112 | | |
77 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
| |||
178 | 188 | | |
179 | 189 | | |
180 | 190 | | |
181 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
182 | 194 | | |
183 | 195 | | |
184 | 196 | | |
| |||
0 commit comments