grafeo-ogm 1.7.2 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/README.md +2 -0
- package/dist/cjs/compilers/fulltext.compiler.d.ts.map +1 -1
- package/dist/cjs/compilers/fulltext.compiler.js +30 -7
- package/dist/cjs/compilers/fulltext.compiler.js.map +1 -1
- package/dist/cjs/compilers/mutation.compiler.d.ts.map +1 -1
- package/dist/cjs/compilers/mutation.compiler.js +80 -1
- package/dist/cjs/compilers/mutation.compiler.js.map +1 -1
- package/dist/cjs/compilers/vector.compiler.js +13 -1
- package/dist/cjs/compilers/vector.compiler.js.map +1 -1
- package/dist/cjs/execution/result-mapper.d.ts.map +1 -1
- package/dist/cjs/execution/result-mapper.js +8 -2
- package/dist/cjs/execution/result-mapper.js.map +1 -1
- package/dist/cjs/interface-model.d.ts.map +1 -1
- package/dist/cjs/interface-model.js +58 -7
- package/dist/cjs/interface-model.js.map +1 -1
- package/dist/cjs/model.d.ts.map +1 -1
- package/dist/cjs/model.js +37 -6
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/utils/lucene.d.ts +12 -3
- package/dist/cjs/utils/lucene.d.ts.map +1 -1
- package/dist/cjs/utils/lucene.js +28 -13
- package/dist/cjs/utils/lucene.js.map +1 -1
- package/dist/esm/compilers/fulltext.compiler.d.ts.map +1 -1
- package/dist/esm/compilers/fulltext.compiler.js +30 -7
- package/dist/esm/compilers/fulltext.compiler.js.map +1 -1
- package/dist/esm/compilers/mutation.compiler.d.ts.map +1 -1
- package/dist/esm/compilers/mutation.compiler.js +80 -1
- package/dist/esm/compilers/mutation.compiler.js.map +1 -1
- package/dist/esm/compilers/vector.compiler.js +13 -1
- package/dist/esm/compilers/vector.compiler.js.map +1 -1
- package/dist/esm/execution/result-mapper.d.ts.map +1 -1
- package/dist/esm/execution/result-mapper.js +8 -2
- package/dist/esm/execution/result-mapper.js.map +1 -1
- package/dist/esm/interface-model.d.ts.map +1 -1
- package/dist/esm/interface-model.js +59 -8
- package/dist/esm/interface-model.js.map +1 -1
- package/dist/esm/model.d.ts.map +1 -1
- package/dist/esm/model.js +37 -6
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/utils/lucene.d.ts +12 -3
- package/dist/esm/utils/lucene.d.ts.map +1 -1
- package/dist/esm/utils/lucene.js +28 -13
- package/dist/esm/utils/lucene.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Escapes special Lucene characters in a query string.
|
|
3
|
-
* Special characters: + - && || ! ( ) { } [ ] ^ " ~ * ? : \ /
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Symbol-form operators escaped:
|
|
5
|
+
* + - && || ! ( ) { } [ ] ^ " ~ * ? : \ /
|
|
6
|
+
*
|
|
7
|
+
* Bareword booleans (`AND`, `OR`, `NOT`, `TO`) are also neutralised. Pre-
|
|
8
|
+
* 1.7.3 they survived sanitisation, letting an attacker inject a boolean
|
|
9
|
+
* query (e.g. `foo AND _exists_:adminFlag`) even after symbol escaping.
|
|
10
|
+
* The standard Lucene analyser lowercases tokens during indexing, so
|
|
11
|
+
* lowercasing the bareword turns it into a literal-word match — which
|
|
12
|
+
* is what callers of `sanitizeLuceneQuery` expect (the function exists
|
|
13
|
+
* to make untrusted user input safe to pass to Lucene). Range-modifier
|
|
14
|
+
* boost/fuzzy (`^N`, `~N`) are already disarmed because `^` and `~`
|
|
15
|
+
* get backslash-escaped in the symbol pass.
|
|
7
16
|
*/
|
|
8
17
|
export declare function sanitizeLuceneQuery(query: string): string;
|
|
9
18
|
//# sourceMappingURL=lucene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lucene.d.ts","sourceRoot":"","sources":["../../../src/utils/lucene.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lucene.d.ts","sourceRoot":"","sources":["../../../src/utils/lucene.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyBzD"}
|
package/dist/esm/utils/lucene.js
CHANGED
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Escapes special Lucene characters in a query string.
|
|
3
|
-
* Special characters: + - && || ! ( ) { } [ ] ^ " ~ * ? : \ /
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Symbol-form operators escaped:
|
|
5
|
+
* + - && || ! ( ) { } [ ] ^ " ~ * ? : \ /
|
|
6
|
+
*
|
|
7
|
+
* Bareword booleans (`AND`, `OR`, `NOT`, `TO`) are also neutralised. Pre-
|
|
8
|
+
* 1.7.3 they survived sanitisation, letting an attacker inject a boolean
|
|
9
|
+
* query (e.g. `foo AND _exists_:adminFlag`) even after symbol escaping.
|
|
10
|
+
* The standard Lucene analyser lowercases tokens during indexing, so
|
|
11
|
+
* lowercasing the bareword turns it into a literal-word match — which
|
|
12
|
+
* is what callers of `sanitizeLuceneQuery` expect (the function exists
|
|
13
|
+
* to make untrusted user input safe to pass to Lucene). Range-modifier
|
|
14
|
+
* boost/fuzzy (`^N`, `~N`) are already disarmed because `^` and `~`
|
|
15
|
+
* get backslash-escaped in the symbol pass.
|
|
7
16
|
*/
|
|
8
17
|
export function sanitizeLuceneQuery(query) {
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
18
|
+
// FIRST pass: neutralise bareword booleans BEFORE the placeholder dance
|
|
19
|
+
// below. Running this last would let user-typed " AND " / " OR " collide
|
|
20
|
+
// with the restoration regex (which matches those exact tokens) and
|
|
21
|
+
// wrongly rewrite literal user words to escaped `\&\&` / `\|\|`. Running
|
|
22
|
+
// this first turns user `foo AND bar` into `foo and bar` (literal-word
|
|
23
|
+
// match) before any other pass sees it. Word boundaries (`\b`) keep us
|
|
24
|
+
// from touching middle-of-word matches like `BAND` or `STOP`.
|
|
25
|
+
let result = query.replace(/\b(AND|OR|NOT|TO)\b/g, (match) => match.toLowerCase());
|
|
26
|
+
// Second pass: escape multi-char operators as atomic units. We use
|
|
27
|
+
// " AND " / " OR " as placeholders (rather than NULL bytes) because
|
|
28
|
+
// the lowercase pass above guarantees no user-typed uppercase " AND "
|
|
29
|
+
// / " OR " can survive to collide with the restoration regex below.
|
|
30
|
+
result = result.replace(/&&/g, ' AND ').replace(/\|\|/g, ' OR ');
|
|
31
|
+
// Third pass: escape individual special characters (& and | individually)
|
|
15
32
|
result = result.replace(/([+\-&|!(){}[\]^"~*?:\\/])/g, '\\$1');
|
|
16
|
-
//
|
|
17
|
-
result = result
|
|
18
|
-
.replace(/\u0000AND\u0000/g, '\\&\\&')
|
|
19
|
-
.replace(/\u0000OR\u0000/g, '\\|\\|');
|
|
33
|
+
// Fourth pass: restore multi-char operators with proper escaping
|
|
34
|
+
result = result.replace(/ AND /g, '\\&\\&').replace(/ OR /g, '\\|\\|');
|
|
20
35
|
return result;
|
|
21
36
|
}
|
|
22
37
|
//# sourceMappingURL=lucene.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lucene.js","sourceRoot":"","sources":["../../../src/utils/lucene.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lucene.js","sourceRoot":"","sources":["../../../src/utils/lucene.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,wEAAwE;IACxE,yEAAyE;IACzE,oEAAoE;IACpE,yEAAyE;IACzE,uEAAuE;IACvE,uEAAuE;IACvE,8DAA8D;IAC9D,IAAI,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC,KAAK,EAAE,EAAE,CAC3D,KAAK,CAAC,WAAW,EAAE,CACpB,CAAC;IAEF,mEAAmE;IACnE,oEAAoE;IACpE,sEAAsE;IACtE,oEAAoE;IACpE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAEjE,0EAA0E;IAC1E,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IAE/D,iEAAiE;IACjE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEvE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grafeo-ogm",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "Type-safe Neo4j ORM / OGM for TypeScript. Define your graph in GraphQL SDL, get fully typed Prisma-like CRUD, optimized Cypher, and zero-config code generation. Community successor to @neo4j/graphql-ogm.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alejandro Guzman",
|