Commit 1ef97f3
fix: run_cypher guard now correctly allows CALL db.* read-only procedures
Bug: query was uppercased but regex exemption checked lowercase db. —
CALL db.* was still blocked despite the intended allowlist.
Fix:
- Use case-insensitive regex (Pattern.CASE_INSENSITIVE) instead of
uppercasing the query — preserves original casing for Neo4j execution
- CALL db.* explicitly allowed (fulltext search, indexes, schema)
- All other CALL forms blocked (apoc.create, custom procedures)
Tests updated:
- Removed test expecting CALL db.indexes() to be blocked
- Added: runCypherShouldAllowCallDbIndexes (positive)
- Added: runCypherShouldAllowCallDbFulltextSearch (positive)
- Added: runCypherShouldBlockNonDbCall (negative - apoc.create)
- Added: runCypherShouldBlockCallCustomProcedure (negative - custom.mutate)
- Existing mutation keyword tests still pass (CREATE, DELETE, SET, etc.)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent a7b8253 commit 1ef97f3
2 files changed
Lines changed: 59 additions & 12 deletions
File tree
- src
- main/java/io/github/randomcodespace/iq/mcp
- test/java/io/github/randomcodespace/iq/mcp
Lines changed: 20 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
281 | 291 | | |
282 | 292 | | |
283 | 293 | | |
| |||
Lines changed: 39 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
187 | 210 | | |
188 | 211 | | |
189 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
190 | 227 | | |
191 | 228 | | |
192 | 229 | | |
| |||
0 commit comments