Skip to content

Commit 6eb133f

Browse files
authored
docs: add list evaluator prefix and suffix modes (#34)
1 parent cec72c3 commit 6eb133f

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

concepts/evaluators/built-in-evaluators.mdx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,17 @@ Flexible value matching with multiple modes and logic options.
7979
| `values` | list | required | Values to match against |
8080
| `logic` | string | `"any"` | `"any"` = match any value, `"all"` = match all |
8181
| `match_on` | string | `"match"` | `"match"` = trigger when found, `"no_match"` = trigger when NOT found |
82-
| `match_mode` | string | `"exact"` | `"exact"` = full string match, `"contains"` = word-boundary match |
82+
| `match_mode` | string | `"exact"` | `"exact"` = full string match, `"contains"` = word-boundary match, `"starts_with"` = prefix match, `"ends_with"` = suffix match |
8383
| `case_sensitive` | bool | `false` | Case sensitivity |
8484

8585
<Note>
8686
`match_mode="contains"` uses word-boundary matching, not generic substring matching. For example, `"admin"` will match `"admin user"` but will NOT match `"sysadministrator"`.
8787
</Note>
8888

89+
<Note>
90+
`match_mode="starts_with"` and `match_mode="ends_with"` use literal string prefix/suffix matching. They are not path-boundary aware, so `"/safe"` will also match `"/safezone"` when using `starts_with`.
91+
</Note>
92+
8993
<Accordion title="Examples">
9094

9195
```json
@@ -110,6 +114,27 @@ Flexible value matching with multiple modes and logic options.
110114
}
111115
}
112116

117+
// Allowlist: only permit writes under approved prefixes
118+
{
119+
"name": "list",
120+
"config": {
121+
"values": ["/workspace/", "/tmp/scratch/"],
122+
"match_on": "no_match",
123+
"match_mode": "starts_with",
124+
"logic": "any"
125+
}
126+
}
127+
128+
// Block file types by suffix
129+
{
130+
"name": "list",
131+
"config": {
132+
"values": [".env", ".pem", ".key"],
133+
"match_mode": "ends_with",
134+
"logic": "any"
135+
}
136+
}
137+
113138
// Allowlist: only permit specific tools
114139
{
115140
"name": "list",

0 commit comments

Comments
 (0)