/** * Lightweight read-only Cypher guard. * * Mirrors {@link ./sql-guard.ts} but for the Cypher dialect the graph-db * backend accepts. The guard's job is to reject obvious write verbs before * they reach the native binding — the native engine does enforce its own * read-only mode when the connection is opened read-only, but we want a * typed rejection earlier in the stack plus a consistent user-facing * message regardless of backend. * * Scope: * - Allowlist of reader clauses: MATCH, RETURN, WITH, WHERE, ORDER BY, * LIMIT, SKIP, UNWIND. * - `CALL` is rejected unless the invocation is exactly one of the two * known read-only index procedures the FTS / vector surfaces need: * `QUERY_FTS_INDEX(...)` or `QUERY_VECTOR_INDEX(...)`. * - Writes are rejected: CREATE, DELETE, SET, MERGE, REMOVE, DROP (plus * the DDL / DML verbs the native binding documents even if they are * not technically Cypher — ALTER, COPY, IMPORT, EXPORT, CHECKPOINT, * INSTALL, LOAD EXTENSION). * * Tokenization is lexical (regex over the un-commented query text) — this * is a defense-in-depth check, not a full Cypher parser. Strings in which * a banned keyword legitimately appears (e.g. a node property literal * containing the word "DELETE") are correctly ignored because the string- * stripping pass drops them before the keyword sweep. * * Known limitation: the string-stripper walks the raw source character by * character and does not understand Cypher's full quoting grammar (no * backtick-delimited identifier handling, no multi-line triple-quotes). * That is acceptable for v1 — the allowlist-first leading-keyword check * provides the load-bearing guarantee and the string stripper is only * responsible for the "banned keyword inside a string literal" edge case * on the single/double-quoted forms we actually use in practice. */ export declare class CypherGuardError extends Error { constructor(message: string); } /** * Reject any Cypher that is not a single read-only statement. Call before * handing the text to the graph-db backend. * * Contract: * - Input must be a non-empty string. * - Statement must start with one of ALLOWED_LEADING_KEYWORDS, or be a * CALL to one of ALLOWED_CALL_PROCEDURES. * - No banned write verb may appear anywhere in the statement body (after * comments + string literals are stripped). * * Throws {@link CypherGuardError} on any violation. */ export declare function assertReadOnlyCypher(cypher: string): void; //# sourceMappingURL=cypher-guard.d.ts.map