Skip to content

Commit a7b8253

Browse files
aksOpsclaude
andcommitted
fix: allow read-only CALL db.* Cypher queries + fix egg-info exclusion
McpTools run_cypher: - \bCALL\b blocked ALL Cypher CALL statements including read-only fulltext search (CALL db.index.fulltext.queryNodes) - Changed to \bCALL\s+(?!db\.)\b — blocks mutation procedures while allowing CALL db.* (indexes, schema, fulltext search) FileDiscovery: - "*.egg-info" in DEFAULT_EXCLUDES never matched because Set.contains() does exact match, not glob. Real dirs are named like "mypackage.egg-info" - Removed glob from set, added suffix match in isExcluded() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a3f141e commit a7b8253

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/main/java/io/github/randomcodespace/iq/analyzer/FileDiscovery.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class FileDiscovery {
3838
".git", ".svn", ".idea", ".vscode", ".eclipse", ".settings",
3939
// Python
4040
"__pycache__", "venv", ".venv", ".tox", ".mypy_cache", ".pytest_cache",
41-
".eggs", "*.egg-info",
41+
".eggs",
4242
// Java / Gradle
4343
".gradle", ".mvn",
4444
// JS / Frontend
@@ -230,7 +230,12 @@ public FileVisitResult visitFileFailed(Path file, IOException exc) {
230230

231231
private boolean isExcluded(Path relPath) {
232232
for (Path component : relPath) {
233-
if (DEFAULT_EXCLUDES.contains(component.toString())) {
233+
String name = component.toString();
234+
if (DEFAULT_EXCLUDES.contains(name)) {
235+
return true;
236+
}
237+
// Suffix match for patterns like *.egg-info
238+
if (name.endsWith(".egg-info")) {
234239
return true;
235240
}
236241
}

src/main/java/io/github/randomcodespace/iq/mcp/McpTools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public String runCypher(
273273
List<String> BLOCKED_PATTERNS = List.of(
274274
"\\bCREATE\\b", "\\bDELETE\\b", "\\bDETACH\\b", "\\bSET\\b",
275275
"\\bREMOVE\\b", "\\bMERGE\\b", "\\bDROP\\b", "\\bFOREACH\\b",
276-
"\\bLOAD\\s+CSV\\b", "\\bCALL\\b");
276+
"\\bLOAD\\s+CSV\\b", "\\bCALL\\s+(?!db\\.)\\b");
277277
for (String pattern : BLOCKED_PATTERNS) {
278278
if (java.util.regex.Pattern.compile(pattern).matcher(upper).find()) {
279279
String keyword = pattern.replace("\\b", "").replace("\\s+", " ");

0 commit comments

Comments
 (0)