@memberjunction/global 6.1.0-edge.2 → 6.1.0-edge.3
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/LICENSE +180 -4
- package/README.md +2 -2
- package/dist/SQLExpressionValidator.d.ts +28 -1
- package/dist/SQLExpressionValidator.d.ts.map +1 -1
- package/dist/SQLExpressionValidator.js +42 -4
- package/dist/SQLExpressionValidator.js.map +1 -1
- package/dist/SafeExpressionEvaluator.d.ts +131 -6
- package/dist/SafeExpressionEvaluator.d.ts.map +1 -1
- package/dist/SafeExpressionEvaluator.js +344 -41
- package/dist/SafeExpressionEvaluator.js.map +1 -1
- package/dist/__tests__/DeepDiff.test.d.ts +2 -0
- package/dist/__tests__/DeepDiff.test.d.ts.map +1 -0
- package/dist/__tests__/DeepDiff.test.js +229 -0
- package/dist/__tests__/DeepDiff.test.js.map +1 -0
- package/dist/__tests__/JSONValidator.test.d.ts +2 -0
- package/dist/__tests__/JSONValidator.test.d.ts.map +1 -0
- package/dist/__tests__/JSONValidator.test.js +221 -0
- package/dist/__tests__/JSONValidator.test.js.map +1 -0
- package/dist/__tests__/MJGlobal.test.js +8 -6
- package/dist/__tests__/MJGlobal.test.js.map +1 -1
- package/dist/__tests__/ResourcePatternUtils.test.d.ts +2 -0
- package/dist/__tests__/ResourcePatternUtils.test.d.ts.map +1 -0
- package/dist/__tests__/ResourcePatternUtils.test.js +50 -0
- package/dist/__tests__/ResourcePatternUtils.test.js.map +1 -0
- package/dist/__tests__/SQLExpressionValidator.security.test.js +62 -1
- package/dist/__tests__/SQLExpressionValidator.security.test.js.map +1 -1
- package/dist/__tests__/SafeExpressionEvaluator.security.test.d.ts +2 -0
- package/dist/__tests__/SafeExpressionEvaluator.security.test.d.ts.map +1 -0
- package/dist/__tests__/SafeExpressionEvaluator.security.test.js +284 -0
- package/dist/__tests__/SafeExpressionEvaluator.security.test.js.map +1 -0
- package/dist/__tests__/SafeExpressionEvaluator.test.d.ts +2 -0
- package/dist/__tests__/SafeExpressionEvaluator.test.d.ts.map +1 -0
- package/dist/__tests__/SafeExpressionEvaluator.test.js +355 -0
- package/dist/__tests__/SafeExpressionEvaluator.test.js.map +1 -0
- package/dist/__tests__/SafeExpressionEvaluator.validateSyntax.test.d.ts +2 -0
- package/dist/__tests__/SafeExpressionEvaluator.validateSyntax.test.d.ts.map +1 -0
- package/dist/__tests__/SafeExpressionEvaluator.validateSyntax.test.js +62 -0
- package/dist/__tests__/SafeExpressionEvaluator.validateSyntax.test.js.map +1 -0
- package/dist/__tests__/util.toEpochMs.test.d.ts +2 -0
- package/dist/__tests__/util.toEpochMs.test.d.ts.map +1 -0
- package/dist/__tests__/util.toEpochMs.test.js +57 -0
- package/dist/__tests__/util.toEpochMs.test.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/util/ResourcePatternUtils.d.ts +35 -0
- package/dist/util/ResourcePatternUtils.d.ts.map +1 -0
- package/dist/util/ResourcePatternUtils.js +56 -0
- package/dist/util/ResourcePatternUtils.js.map +1 -0
- package/dist/util.d.ts +11 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +16 -0
- package/dist/util.js.map +1 -1
- package/package.json +3 -2
package/LICENSE
CHANGED
|
@@ -1,7 +1,183 @@
|
|
|
1
|
-
|
|
1
|
+
Business Source License 1.1
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB plc.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
-----------------------------------------------------------------------------
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Parameters
|
|
9
|
+
|
|
10
|
+
Licensor: Blue Cypress, Inc.
|
|
11
|
+
|
|
12
|
+
Licensed Work: MemberJunction.
|
|
13
|
+
The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
|
|
14
|
+
|
|
15
|
+
Additional Use Grant: Subject to the terms of this License, Licensor grants
|
|
16
|
+
you the following additional rights to make Production
|
|
17
|
+
Use of the Licensed Work.
|
|
18
|
+
|
|
19
|
+
1. Internal Use
|
|
20
|
+
|
|
21
|
+
You may make production use of the Licensed Work for
|
|
22
|
+
your own internal business or organizational operations.
|
|
23
|
+
|
|
24
|
+
2. Nonprofit Use
|
|
25
|
+
|
|
26
|
+
If you are a Nonprofit, you may make production use of
|
|
27
|
+
the Licensed Work for the operations and activities of
|
|
28
|
+
your Organizational Family.
|
|
29
|
+
|
|
30
|
+
3. MemberJunction Certified Program Use
|
|
31
|
+
|
|
32
|
+
If you are authorized by Licensor under the
|
|
33
|
+
MemberJunction Certified Program to provide professional
|
|
34
|
+
services using the Licensed Work, you may make
|
|
35
|
+
production use of the Licensed Work in providing such
|
|
36
|
+
professional services to a client, provided that:
|
|
37
|
+
|
|
38
|
+
(a) the Licensed Work is deployed in, and the applicable
|
|
39
|
+
production use occurs within, an environment owned,
|
|
40
|
+
leased, licensed, subscribed to, or otherwise controlled
|
|
41
|
+
by that client; and
|
|
42
|
+
|
|
43
|
+
(b) the production use is for that client's own internal
|
|
44
|
+
business or organizational operations or is otherwise
|
|
45
|
+
independently permitted to that client under this
|
|
46
|
+
Additional Use Grant.
|
|
47
|
+
|
|
48
|
+
4. Definitions Applicable to the Additional Use Grant
|
|
49
|
+
|
|
50
|
+
"Affiliate" means, with respect to a specified Person,
|
|
51
|
+
any other Person that directly or indirectly Controls,
|
|
52
|
+
is Controlled by, or is under common Control with such
|
|
53
|
+
specified Person.
|
|
54
|
+
|
|
55
|
+
"Control" (including the terms "Controls," "Controlled
|
|
56
|
+
by," and "under common Control with") means the direct
|
|
57
|
+
or indirect possession of the power to direct or cause
|
|
58
|
+
the direction of the management and policies of a
|
|
59
|
+
Person, whether through ownership of voting interests,
|
|
60
|
+
by contract, or otherwise.
|
|
61
|
+
|
|
62
|
+
"Organizational Family" means, with respect to a Person,
|
|
63
|
+
(a) such Person and its Affiliates, and (b) any
|
|
64
|
+
nonprofit organization, governmental entity, chapter,
|
|
65
|
+
division, local affiliate, regional affiliate, state
|
|
66
|
+
affiliate, national affiliate, or other entity that is
|
|
67
|
+
formally affiliated with such Person through governing
|
|
68
|
+
documents, a charter, bylaws, a membership agreement, or
|
|
69
|
+
another written organizational instrument, and is
|
|
70
|
+
recognized under such documents as part of the same
|
|
71
|
+
organizational structure.
|
|
72
|
+
|
|
73
|
+
"Nonprofit" means a Person recognized by the Internal
|
|
74
|
+
Revenue Service as exempt from federal income taxation
|
|
75
|
+
under Section 501(c)(3), 501(c)(4), 501(c)(5), or
|
|
76
|
+
501(c)(6) of the Internal Revenue Code, or a foreign
|
|
77
|
+
organization recognized under substantially equivalent
|
|
78
|
+
laws.
|
|
79
|
+
|
|
80
|
+
A Person claiming eligibility as a Nonprofit shall, upon
|
|
81
|
+
Licensor's reasonable request, provide documentation
|
|
82
|
+
reasonably sufficient to demonstrate that it qualifies
|
|
83
|
+
as a Nonprofit. If such Person materially misrepresents,
|
|
84
|
+
or is unable to demonstrate, its qualification as a
|
|
85
|
+
Nonprofit, the rights granted to such Person under
|
|
86
|
+
Section 2 of this Additional Use Grant shall terminate.
|
|
87
|
+
|
|
88
|
+
"MemberJunction Certified Program" means Licensor's
|
|
89
|
+
then-current program for certifying and authorizing a
|
|
90
|
+
Person to provide professional services using the
|
|
91
|
+
Licensed Work.
|
|
92
|
+
|
|
93
|
+
"Person" means any individual, corporation, limited
|
|
94
|
+
liability company, partnership, association, nonprofit
|
|
95
|
+
organization, governmental entity, or other legal or
|
|
96
|
+
organizational entity.
|
|
97
|
+
|
|
98
|
+
Change Date: Four (4) years from the date the Licensed Work is first
|
|
99
|
+
made available.
|
|
100
|
+
|
|
101
|
+
Change License: MIT License.
|
|
102
|
+
|
|
103
|
+
For information about alternative licensing arrangements for the Licensed
|
|
104
|
+
Work, please contact Blue Cypress, Inc.
|
|
105
|
+
|
|
106
|
+
-----------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
Terms
|
|
109
|
+
|
|
110
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
111
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
112
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
113
|
+
production use.
|
|
114
|
+
|
|
115
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
116
|
+
available distribution of a specific version of the Licensed Work under this
|
|
117
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
118
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
119
|
+
above terminate.
|
|
120
|
+
|
|
121
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
122
|
+
currently in effect as described in this License, you must purchase a
|
|
123
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
124
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
125
|
+
|
|
126
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
127
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
128
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
129
|
+
for each version of the Licensed Work released by Licensor.
|
|
130
|
+
|
|
131
|
+
You must conspicuously display this License on each original or modified copy
|
|
132
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
133
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
134
|
+
License apply to your use of that work.
|
|
135
|
+
|
|
136
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
137
|
+
terminate your rights under this License for the current and all other
|
|
138
|
+
versions of the Licensed Work.
|
|
139
|
+
|
|
140
|
+
This License does not grant you any right in any trademark or logo of
|
|
141
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
142
|
+
Licensor as expressly required by this License).
|
|
143
|
+
|
|
144
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
145
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
146
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
147
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
148
|
+
TITLE.
|
|
149
|
+
|
|
150
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
151
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
152
|
+
as long as you comply with the Covenants of Licensor below.
|
|
153
|
+
|
|
154
|
+
-----------------------------------------------------------------------------
|
|
155
|
+
|
|
156
|
+
Covenants of Licensor
|
|
157
|
+
|
|
158
|
+
In consideration of the right to use this License's text and the "Business
|
|
159
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
160
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
161
|
+
|
|
162
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
163
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
164
|
+
where "compatible" means that software provided under the Change License
|
|
165
|
+
can be included in a program with software provided under GPL Version 2.0
|
|
166
|
+
or a later version. Licensor may specify additional Change Licenses without
|
|
167
|
+
limitation.
|
|
168
|
+
|
|
169
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
170
|
+
impose any additional restriction on the right granted in this License, as
|
|
171
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
172
|
+
|
|
173
|
+
3. To specify a Change Date.
|
|
174
|
+
|
|
175
|
+
4. Not to modify this License in any other way.
|
|
176
|
+
|
|
177
|
+
-----------------------------------------------------------------------------
|
|
178
|
+
|
|
179
|
+
Notice
|
|
180
|
+
|
|
181
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
182
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
183
|
+
under an Open Source License, as stated in this License.
|
package/README.md
CHANGED
|
@@ -343,7 +343,7 @@ if (!result.Success) {
|
|
|
343
343
|
|
|
344
344
|
### SafeExpressionEvaluator
|
|
345
345
|
|
|
346
|
-
Evaluates boolean expressions against context objects securely,
|
|
346
|
+
Evaluates boolean expressions against context objects securely. The expression is parsed and every AST node checked against an **allowlist** before it is compiled, so constructs outside the supported grammar — `eval()`, `require()`, `.constructor`, computed member keys built at runtime, calls to anything unlisted — are refused at validation time and never reach the compiler.
|
|
347
347
|
|
|
348
348
|
```typescript
|
|
349
349
|
import { SafeExpressionEvaluator } from '@memberjunction/global';
|
|
@@ -363,7 +363,7 @@ if (result.success) {
|
|
|
363
363
|
}
|
|
364
364
|
```
|
|
365
365
|
|
|
366
|
-
Supports comparisons (`==`, `!=`, `<`, `>`, `<=`, `>=`), logical operators (`&&`, `||`, `!`), dot-notation property access, bracket-notation
|
|
366
|
+
Supports comparisons (`==`, `!=`, `<`, `>`, `<=`, `>=`), logical operators (`&&`, `||`, `!`), `typeof`, dot-notation property access including optional chaining (`payload?.customer?.tier`), bracket-notation access with a **literal** index/key, safe string/array methods (`.includes()`, `.startsWith()`, `.some()`, `.every()`, etc.), and the safe globals exported as `SAFE_EXPRESSION_GLOBALS` — `Math`, `Number`, `String`, `Boolean`, `Array`, `Object`, `JSON`, `Date`, `parseInt`, `parseFloat`, `isNaN`, `isFinite` — callable as namespace methods (`Math.abs(x)`, `Object.keys(x)`) or bare functions (`Number(x)`). Regex literals, `in`/`instanceof`, and methods outside the safe list are not supported.
|
|
367
367
|
|
|
368
368
|
### SQLExpressionValidator
|
|
369
369
|
|
|
@@ -29,6 +29,31 @@ export declare const FULL_QUERY_ALLOWED_KEYWORDS: readonly ["EXISTS", "ANY", "AL
|
|
|
29
29
|
* String literals are stripped before this check runs, so a literal value like `'sys.x'` is safe.
|
|
30
30
|
*/
|
|
31
31
|
export declare const BLOCKED_SYSTEM_OBJECT_PATTERNS: RegExp[];
|
|
32
|
+
/**
|
|
33
|
+
* Removes SQL string literals from a clause or expression so that a keyword denylist can be
|
|
34
|
+
* applied to the *code* portion without tripping over keywords that appear inside quoted data
|
|
35
|
+
* (e.g. `Comments LIKE '%--%'`).
|
|
36
|
+
*
|
|
37
|
+
* 🚨 SECURITY — this is the single implementation of literal-stripping for MJ's SQL screens, and
|
|
38
|
+
* it MUST stay byte-for-byte consistent with how the database parses literals. If the stripper
|
|
39
|
+
* removes a span the database does NOT treat as a literal, everything hidden inside that span
|
|
40
|
+
* bypasses the denylist while the database still executes it.
|
|
41
|
+
*
|
|
42
|
+
* An earlier version of this logic (duplicated in two places, which is how it survived) honored
|
|
43
|
+
* **backslash escaping** — `/(['"])(?:(?=(\\?))\2[\s\S])*?\1/g`. SQL Server and PostgreSQL do not
|
|
44
|
+
* treat `\` as an escape character, so `x = 'a\') ; DROP TABLE Users; --'` was swallowed whole as
|
|
45
|
+
* one "literal" and stripped to `x = `, which passed every denylist — while the database closed
|
|
46
|
+
* the literal at the real quote and executed the stacked statement.
|
|
47
|
+
*
|
|
48
|
+
* **Do NOT reintroduce backslash-escape handling here, and do NOT inline a second copy of this
|
|
49
|
+
* regex anywhere else — call this function.**
|
|
50
|
+
*
|
|
51
|
+
* @param sql The clause, expression, or query to strip literals from
|
|
52
|
+
* @returns The input with every complete string literal removed. An UNTERMINATED literal is left
|
|
53
|
+
* in place on purpose: the stray quote and everything after it stay visible to the
|
|
54
|
+
* denylist rather than being silently swallowed.
|
|
55
|
+
*/
|
|
56
|
+
export declare function StripSQLStringLiterals(sql: string): string;
|
|
32
57
|
/**
|
|
33
58
|
* Safe SQL functions allowed in expressions, organized by category
|
|
34
59
|
*/
|
|
@@ -117,7 +142,9 @@ export declare class SQLExpressionValidator extends BaseSingleton<SQLExpressionV
|
|
|
117
142
|
validate(expression: string, options: SQLValidationOptions): SQLValidationResult;
|
|
118
143
|
/**
|
|
119
144
|
* Remove string literals to avoid false positives in keyword detection.
|
|
120
|
-
*
|
|
145
|
+
*
|
|
146
|
+
* 🚨 SECURITY: delegates to {@link StripSQLStringLiterals} — read the warning there before
|
|
147
|
+
* changing anything about how literals are matched. This must never grow its own regex again.
|
|
121
148
|
*/
|
|
122
149
|
private removeStringLiterals;
|
|
123
150
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLExpressionValidator.d.ts","sourceRoot":"","sources":["../src/SQLExpressionValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,sBAAsB,2gBA0CzB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,2BAA2B,wFAe9B,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAE,MAAM,EAMlD,CAAC;
|
|
1
|
+
{"version":3,"file":"SQLExpressionValidator.d.ts","sourceRoot":"","sources":["../src/SQLExpressionValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,sBAAsB,2gBA0CzB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,2BAA2B,wFAe9B,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAE,MAAM,EAMlD,CAAC;AAcF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;CA2BxB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,cAAc,GACd,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,KAAK,EAAE,OAAO,CAAC;IACf,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,UAAU,CAAC,EA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greSQL credential / role catalogs
|
|
78
78
|
];
|
|
79
|
+
/**
|
|
80
|
+
* Matches SQL string literals the way SQL Server and PostgreSQL (with the default
|
|
81
|
+
* `standard_conforming_strings=on`) actually parse them: a literal is closed by the next
|
|
82
|
+
* single quote, `''` is an embedded quote, and a backslash is an ORDINARY character that
|
|
83
|
+
* does NOT escape the closing quote. Double-quoted runs are matched with the same doubling
|
|
84
|
+
* rule so a delimited identifier can't hide a payload either.
|
|
85
|
+
*
|
|
86
|
+
* @see StripSQLStringLiterals — use that, not this constant, so every caller gets the
|
|
87
|
+
* documented semantics and the two validators in MJ can never drift apart again.
|
|
88
|
+
*/
|
|
89
|
+
const SQL_STRING_LITERAL_PATTERN = /'(?:[^']|'')*'|"(?:[^"]|"")*"/g;
|
|
90
|
+
/**
|
|
91
|
+
* Removes SQL string literals from a clause or expression so that a keyword denylist can be
|
|
92
|
+
* applied to the *code* portion without tripping over keywords that appear inside quoted data
|
|
93
|
+
* (e.g. `Comments LIKE '%--%'`).
|
|
94
|
+
*
|
|
95
|
+
* 🚨 SECURITY — this is the single implementation of literal-stripping for MJ's SQL screens, and
|
|
96
|
+
* it MUST stay byte-for-byte consistent with how the database parses literals. If the stripper
|
|
97
|
+
* removes a span the database does NOT treat as a literal, everything hidden inside that span
|
|
98
|
+
* bypasses the denylist while the database still executes it.
|
|
99
|
+
*
|
|
100
|
+
* An earlier version of this logic (duplicated in two places, which is how it survived) honored
|
|
101
|
+
* **backslash escaping** — `/(['"])(?:(?=(\\?))\2[\s\S])*?\1/g`. SQL Server and PostgreSQL do not
|
|
102
|
+
* treat `\` as an escape character, so `x = 'a\') ; DROP TABLE Users; --'` was swallowed whole as
|
|
103
|
+
* one "literal" and stripped to `x = `, which passed every denylist — while the database closed
|
|
104
|
+
* the literal at the real quote and executed the stacked statement.
|
|
105
|
+
*
|
|
106
|
+
* **Do NOT reintroduce backslash-escape handling here, and do NOT inline a second copy of this
|
|
107
|
+
* regex anywhere else — call this function.**
|
|
108
|
+
*
|
|
109
|
+
* @param sql The clause, expression, or query to strip literals from
|
|
110
|
+
* @returns The input with every complete string literal removed. An UNTERMINATED literal is left
|
|
111
|
+
* in place on purpose: the stray quote and everything after it stay visible to the
|
|
112
|
+
* denylist rather than being silently swallowed.
|
|
113
|
+
*/
|
|
114
|
+
export function StripSQLStringLiterals(sql) {
|
|
115
|
+
return sql.replace(SQL_STRING_LITERAL_PATTERN, '');
|
|
116
|
+
}
|
|
79
117
|
/**
|
|
80
118
|
* Safe SQL functions allowed in expressions, organized by category
|
|
81
119
|
*/
|
|
@@ -173,12 +211,12 @@ export class SQLExpressionValidator extends BaseSingleton {
|
|
|
173
211
|
}
|
|
174
212
|
/**
|
|
175
213
|
* Remove string literals to avoid false positives in keyword detection.
|
|
176
|
-
*
|
|
214
|
+
*
|
|
215
|
+
* 🚨 SECURITY: delegates to {@link StripSQLStringLiterals} — read the warning there before
|
|
216
|
+
* changing anything about how literals are matched. This must never grow its own regex again.
|
|
177
217
|
*/
|
|
178
218
|
removeStringLiterals(expression) {
|
|
179
|
-
|
|
180
|
-
const stringPattern = /(['"])(?:(?=(\\?))\2[\s\S])*?\1/g;
|
|
181
|
-
return expression.replace(stringPattern, '');
|
|
219
|
+
return StripSQLStringLiterals(expression);
|
|
182
220
|
}
|
|
183
221
|
/**
|
|
184
222
|
* Check for dangerous SQL patterns that indicate injection attempts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLExpressionValidator.js","sourceRoot":"","sources":["../src/SQLExpressionValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,iCAAiC;IACjC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ;IAE/C,mCAAmC;IACnC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EA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C,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,yDAAyD;QACzD,0EAA0E;QAC1E,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,0DAA0D;YAC1D,+BAA+B;QACjC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAC,GAAW;QAClC,OAAO,GAAG;aACP,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAU,uBAAuB;aACzD,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB;IACxD,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,GAAW;QAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;OAOG;IACK,sBAAsB,CAAC,GAAW;QACxC,OAAO,GAAG;aACP,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAE,yBAAyB;aACnD,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAK,uBAAuB;aACjD,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAK,+BAA+B;aACzD,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAI,mBAAmB;IAClD,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,GAAW;QAClC,yEAAyE;QACzE,wEAAwE;QACxE,4DAA4D;QAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -9,6 +9,33 @@
|
|
|
9
9
|
* @author MemberJunction.com
|
|
10
10
|
* @since 2.76.0
|
|
11
11
|
*/
|
|
12
|
+
/**
|
|
13
|
+
* Namespace globals whose listed methods a condition may CALL, keyed by namespace name.
|
|
14
|
+
*
|
|
15
|
+
* Both halves of `Math.abs(x)` are fixed identifiers in the AST, so admitting them adds no dynamic
|
|
16
|
+
* lookup: the four invariants that close the sandbox escape — literal-only computed keys, no
|
|
17
|
+
* `constructor`/`__proto__`/`prototype`, a closed non-computed call surface with no
|
|
18
|
+
* `call`/`apply`/`bind`, and screened free identifiers — are all untouched by this list.
|
|
19
|
+
*
|
|
20
|
+
* Every entry is a pure value function. `Math.random` is deliberately absent (a condition that
|
|
21
|
+
* evaluates differently on each run is not a guard), as are `Object.assign`,
|
|
22
|
+
* `Object.defineProperty` and `Object.setPrototypeOf`, which mutate.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SAFE_GLOBAL_NAMESPACE_METHODS: ReadonlyMap<string, ReadonlySet<string>>;
|
|
25
|
+
/**
|
|
26
|
+
* Global functions a condition may call by bare name — the coercions and numeric predicates that
|
|
27
|
+
* authored specs use (`Number(payload.count) > 3`, `isNaN(payload.count)`).
|
|
28
|
+
*/
|
|
29
|
+
export declare const SAFE_GLOBAL_CALLABLES: ReadonlySet<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Every global name a condition may reference, as a namespace or as a bare callable.
|
|
32
|
+
*
|
|
33
|
+
* **This is the single source of truth for the ambient globals of the condition dialect.** It lives
|
|
34
|
+
* beside the policy screen that enforces it so a caller validating conditions ahead of evaluation
|
|
35
|
+
* (`ai-core-plus`'s task-graph door) cannot bless a name the runtime would refuse — the failure mode
|
|
36
|
+
* that shipped once already, where the door's own list and the evaluator disagreed silently.
|
|
37
|
+
*/
|
|
38
|
+
export declare const SAFE_EXPRESSION_GLOBALS: ReadonlySet<string>;
|
|
12
39
|
/**
|
|
13
40
|
* Result of expression evaluation including success status and diagnostics
|
|
14
41
|
*/
|
|
@@ -29,11 +56,22 @@ export interface ExpressionEvaluationResult {
|
|
|
29
56
|
* Supported operations:
|
|
30
57
|
* - Comparison: ==, ===, !=, !==, <, >, <=, >=
|
|
31
58
|
* - Logical: &&, ||, !
|
|
32
|
-
* - Property access: dot notation (e.g., payload.customer.name)
|
|
33
|
-
* - Array access: bracket notation (e.g., items[0])
|
|
59
|
+
* - Property access: dot notation (e.g., payload.customer.name), including optional chaining (`?.`)
|
|
60
|
+
* - Array access: bracket notation with a literal index/key (e.g., items[0])
|
|
34
61
|
* - Safe methods: .length, .includes(), .startsWith(), .endsWith()
|
|
35
62
|
* - Array methods: .some(), .every(), .find(), .filter()
|
|
36
|
-
* -
|
|
63
|
+
* - Safe globals: the namespaces and bare callables in {@link SAFE_EXPRESSION_GLOBALS}
|
|
64
|
+
* (e.g. `Math.abs(output.delta) < 5`, `Number(payload.count) > 3`, `Object.keys(payload).length`)
|
|
65
|
+
* - Type checking: typeof
|
|
66
|
+
*
|
|
67
|
+
* Safety is enforced by parsing the expression to an AST and walking it against
|
|
68
|
+
* an ALLOWLIST of node types before it is compiled — an unlisted construct
|
|
69
|
+
* (computed member access with a non-literal key, `.constructor`/`__proto__`
|
|
70
|
+
* access, any call outside the safe-method and safe-global lists, host-global
|
|
71
|
+
* identifiers, etc.) is rejected at validation time and never reaches the compiler. A structural
|
|
72
|
+
* allowlist cannot be defeated by string concatenation the way a textual
|
|
73
|
+
* denylist can, and it does not over-reject data that merely mentions a reserved
|
|
74
|
+
* word (e.g. `name == 'constructor'` is a legal comparison).
|
|
37
75
|
*
|
|
38
76
|
* @class SafeExpressionEvaluator
|
|
39
77
|
*
|
|
@@ -62,10 +100,24 @@ export interface ExpressionEvaluationResult {
|
|
|
62
100
|
*/
|
|
63
101
|
export declare class SafeExpressionEvaluator {
|
|
64
102
|
/**
|
|
65
|
-
*
|
|
103
|
+
* Identifiers that must never resolve to a host global. Because the compiled
|
|
104
|
+
* function runs in global scope, a bare `process`/`Function`/`globalThis`/…
|
|
105
|
+
* would reach the real global object; identifiers are atomic AST tokens, so a
|
|
106
|
+
* name that is split with string concatenation parses as separate identifiers
|
|
107
|
+
* or an operator and is caught by the structural rules instead.
|
|
66
108
|
* @private
|
|
67
109
|
*/
|
|
68
|
-
private static readonly
|
|
110
|
+
private static readonly DANGEROUS_IDENTIFIERS;
|
|
111
|
+
/**
|
|
112
|
+
* Property names that open the prototype chain / constructor climb. Denied on
|
|
113
|
+
* both dotted (`x.constructor`) and literal-bracket (`x["constructor"]`) access.
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
116
|
+
private static readonly DANGEROUS_PROPERTY_NAMES;
|
|
117
|
+
/** Binary operators the evaluator permits. `instanceof`/`in`/bitwise are excluded. @private */
|
|
118
|
+
private static readonly ALLOWED_BINARY_OPERATORS;
|
|
119
|
+
/** Unary operators the evaluator permits. `delete`/`void` are excluded. @private */
|
|
120
|
+
private static readonly ALLOWED_UNARY_OPERATORS;
|
|
69
121
|
/**
|
|
70
122
|
* Cache for compiled expressions to improve performance on repeated evaluations
|
|
71
123
|
* @private
|
|
@@ -87,7 +139,8 @@ export declare class SafeExpressionEvaluator {
|
|
|
87
139
|
*/
|
|
88
140
|
evaluate(expression: string, context: Record<string, any>, enableDiagnostics?: boolean): ExpressionEvaluationResult;
|
|
89
141
|
/**
|
|
90
|
-
* Validates an expression for safety
|
|
142
|
+
* Validates an expression for safety by parsing it and walking the AST against
|
|
143
|
+
* an allowlist. Returns an error message if any construct is not permitted.
|
|
91
144
|
*
|
|
92
145
|
* @param {string} expression - The expression to validate
|
|
93
146
|
*
|
|
@@ -96,6 +149,44 @@ export declare class SafeExpressionEvaluator {
|
|
|
96
149
|
* @private
|
|
97
150
|
*/
|
|
98
151
|
private validateExpression;
|
|
152
|
+
/** Builds the standard rejection message. @private */
|
|
153
|
+
private forbidden;
|
|
154
|
+
/**
|
|
155
|
+
* Walks an AST node against the allowlist. Returns an error message on the first
|
|
156
|
+
* disallowed construct, or null if the entire subtree is permitted.
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
private checkNode;
|
|
160
|
+
/**
|
|
161
|
+
* Member access is allowed for dotted property reads and literal-key bracket
|
|
162
|
+
* reads, but never for a computed key built at runtime (the string-concat
|
|
163
|
+
* escape route) or a prototype-chain property.
|
|
164
|
+
* @private
|
|
165
|
+
*/
|
|
166
|
+
private checkMemberExpression;
|
|
167
|
+
/**
|
|
168
|
+
* A call is admitted only when its callee is a FIXED name on one of two allowlists: a bare
|
|
169
|
+
* safe global (`parseInt(...)`) or a dotted method that is either a safe instance method or a
|
|
170
|
+
* method of a safe global namespace (`Math.abs(...)`). Everything else — a computed callee, an
|
|
171
|
+
* unlisted bare identifier (`eval(...)`, `Function(...)`), a call on a call's result that is
|
|
172
|
+
* not itself a safe method — is rejected.
|
|
173
|
+
* @private
|
|
174
|
+
*/
|
|
175
|
+
private checkCallExpression;
|
|
176
|
+
/**
|
|
177
|
+
* Whether `<receiver>.<method>()` names a permitted call: a safe instance method on any value,
|
|
178
|
+
* or a method of a safe global namespace when the receiver is that namespace by bare name.
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
private isCallableMethod;
|
|
182
|
+
/** Walks a call's arguments; spreads are rejected outright. @private */
|
|
183
|
+
private checkCallArguments;
|
|
184
|
+
/**
|
|
185
|
+
* Arrow functions are permitted only as callback arguments to the safe array
|
|
186
|
+
* methods; parameters must be simple identifiers and the body an expression.
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
private checkArrowFunction;
|
|
99
190
|
/**
|
|
100
191
|
* Creates a safe context object with only allowed properties
|
|
101
192
|
*
|
|
@@ -126,6 +217,40 @@ export declare class SafeExpressionEvaluator {
|
|
|
126
217
|
* @private
|
|
127
218
|
*/
|
|
128
219
|
private cloneValue;
|
|
220
|
+
/**
|
|
221
|
+
* Checks whether an expression *could* be evaluated, without evaluating it.
|
|
222
|
+
*
|
|
223
|
+
* The difference matters because `evaluate` reports two unrelated problems the same way. Given
|
|
224
|
+
* a condition authored against a runtime envelope, an empty context makes `payload.x > 1` fail
|
|
225
|
+
* with `payload is not defined` — indistinguishable, by result shape, from `payload.x >` failing
|
|
226
|
+
* with `Unexpected token`. One is a typo the author should be told about at the door; the other
|
|
227
|
+
* is a perfectly good condition that simply has no data yet. A submit-time check built on
|
|
228
|
+
* `evaluate` therefore refuses every legitimate condition.
|
|
229
|
+
*
|
|
230
|
+
* So this compiles and never runs. The expression goes through the same policy screen
|
|
231
|
+
* `evaluate` applies (the AST allowlist), then the same function body is BUILT and discarded —
|
|
232
|
+
* never invoked. Values are never consulted, which is precisely the property wanted: unknown
|
|
233
|
+
* identifiers, absent properties and undefined chains all PASS, because none of them is a syntax
|
|
234
|
+
* error and whether they resolve is a question about a run that has not happened yet.
|
|
235
|
+
*
|
|
236
|
+
* **Compilation is not evaluation**, and the distinction is load-bearing for safety: `Function`
|
|
237
|
+
* parses the body and returns; nothing in the expression executes. The policy screen still runs
|
|
238
|
+
* first, so the constructs `evaluate` refuses are refused here too — those produce a permanent
|
|
239
|
+
* runtime refusal, and an author is better told now.
|
|
240
|
+
*
|
|
241
|
+
* `Undecidable` is the honest third answer. A host that forbids dynamic compilation (a strict
|
|
242
|
+
* CSP without `unsafe-eval`) cannot answer the question at all, and a validator that read that
|
|
243
|
+
* as "invalid" would refuse every condition in the browser. Callers should treat it as a pass.
|
|
244
|
+
*
|
|
245
|
+
* @param expression the expression to check
|
|
246
|
+
* @returns `Valid: true` when it parses; `Valid: false` with `Error` when it definitely does
|
|
247
|
+
* not; `Valid: true` with `Undecidable: true` when this environment cannot compile
|
|
248
|
+
*/
|
|
249
|
+
validateSyntax(expression: string): {
|
|
250
|
+
Valid: boolean;
|
|
251
|
+
Error?: string;
|
|
252
|
+
Undecidable?: boolean;
|
|
253
|
+
};
|
|
129
254
|
/**
|
|
130
255
|
* Evaluates multiple expressions and returns all results
|
|
131
256
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeExpressionEvaluator.d.ts","sourceRoot":"","sources":["../src/SafeExpressionEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"SafeExpressionEvaluator.d.ts","sourceRoot":"","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