cloudflare-expression-lint 0.1.0
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/CLAUDE.md +57 -0
- package/LICENSE +21 -0
- package/README.md +375 -0
- package/dist/cli.d.ts +22 -0
- package/dist/cli.js +363 -0
- package/dist/cli.js.map +1 -0
- package/dist/eslint-plugin.d.ts +67 -0
- package/dist/eslint-plugin.js +211 -0
- package/dist/eslint-plugin.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lexer.d.ts +11 -0
- package/dist/lexer.js +416 -0
- package/dist/lexer.js.map +1 -0
- package/dist/parser.d.ts +16 -0
- package/dist/parser.js +320 -0
- package/dist/parser.js.map +1 -0
- package/dist/schemas/fields.d.ts +44 -0
- package/dist/schemas/fields.js +282 -0
- package/dist/schemas/fields.js.map +1 -0
- package/dist/schemas/functions.d.ts +33 -0
- package/dist/schemas/functions.js +261 -0
- package/dist/schemas/functions.js.map +1 -0
- package/dist/schemas/operators.d.ts +28 -0
- package/dist/schemas/operators.js +37 -0
- package/dist/schemas/operators.js.map +1 -0
- package/dist/types.d.ts +149 -0
- package/dist/types.js +38 -0
- package/dist/types.js.map +1 -0
- package/dist/validator.d.ts +18 -0
- package/dist/validator.js +420 -0
- package/dist/validator.js.map +1 -0
- package/dist/yaml-scanner.d.ts +97 -0
- package/dist/yaml-scanner.js +175 -0
- package/dist/yaml-scanner.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare expression fields registry.
|
|
3
|
+
*
|
|
4
|
+
* Reference: https://developers.cloudflare.com/ruleset-engine/rules-language/fields/reference/
|
|
5
|
+
*
|
|
6
|
+
* MAINTAINER NOTE: To add a new field, add it to the FIELDS array below.
|
|
7
|
+
* To deprecate a field, set `deprecated: true` and `replacement` to the new field name.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Master field registry.
|
|
11
|
+
*
|
|
12
|
+
* Phases key:
|
|
13
|
+
* - Empty phases array or undefined = available in all phases
|
|
14
|
+
* - Specific phase names = only available in those phases
|
|
15
|
+
*
|
|
16
|
+
* Response fields are only available in response phases.
|
|
17
|
+
*/
|
|
18
|
+
export const FIELDS = [
|
|
19
|
+
// ── HTTP Request URI Fields ──────────────────────────────────────────
|
|
20
|
+
{ name: 'http.request.uri', type: 'String' },
|
|
21
|
+
{ name: 'http.request.uri.path', type: 'String' },
|
|
22
|
+
{ name: 'http.request.uri.path.extension', type: 'String' },
|
|
23
|
+
{ name: 'http.request.uri.query', type: 'String' },
|
|
24
|
+
{ name: 'http.request.uri.args', type: 'Map' },
|
|
25
|
+
{ name: 'http.request.uri.args.names', type: 'Array' },
|
|
26
|
+
{ name: 'http.request.uri.args.values', type: 'Array' },
|
|
27
|
+
{ name: 'http.request.full_uri', type: 'String' },
|
|
28
|
+
{ name: 'http.request.method', type: 'String' },
|
|
29
|
+
{ name: 'http.request.version', type: 'String' },
|
|
30
|
+
// ── HTTP Request Header Fields ───────────────────────────────────────
|
|
31
|
+
{ name: 'http.request.headers', type: 'Map' },
|
|
32
|
+
{ name: 'http.request.headers.names', type: 'Array' },
|
|
33
|
+
{ name: 'http.request.headers.values', type: 'Array' },
|
|
34
|
+
{ name: 'http.request.headers.truncated', type: 'Boolean' },
|
|
35
|
+
{ name: 'http.request.accepted_languages', type: 'Array' },
|
|
36
|
+
// ── HTTP Request Cookie Fields ───────────────────────────────────────
|
|
37
|
+
{ name: 'http.request.cookies', type: 'Map' },
|
|
38
|
+
// ── HTTP Request Body Fields ─────────────────────────────────────────
|
|
39
|
+
{ name: 'http.request.body.raw', type: 'String' },
|
|
40
|
+
{ name: 'http.request.body.size', type: 'Integer' },
|
|
41
|
+
{ name: 'http.request.body.truncated', type: 'Boolean' },
|
|
42
|
+
{ name: 'http.request.body.mime', type: 'String' },
|
|
43
|
+
{ name: 'http.request.body.form', type: 'Map' },
|
|
44
|
+
{ name: 'http.request.body.form.names', type: 'Array' },
|
|
45
|
+
{ name: 'http.request.body.form.values', type: 'Array' },
|
|
46
|
+
{ name: 'http.request.body.multipart', type: 'Map' },
|
|
47
|
+
{ name: 'http.request.body.multipart.content_dispositions', type: 'Array' },
|
|
48
|
+
{ name: 'http.request.body.multipart.content_transfer_encodings', type: 'Array' },
|
|
49
|
+
{ name: 'http.request.body.multipart.content_types', type: 'Array' },
|
|
50
|
+
{ name: 'http.request.body.multipart.filenames', type: 'Array' },
|
|
51
|
+
{ name: 'http.request.body.multipart.names', type: 'Array' },
|
|
52
|
+
{ name: 'http.request.body.multipart.values', type: 'Array' },
|
|
53
|
+
// ── HTTP Request Timestamp Fields ────────────────────────────────────
|
|
54
|
+
{ name: 'http.request.timestamp.sec', type: 'Integer' },
|
|
55
|
+
{ name: 'http.request.timestamp.msec', type: 'Integer' },
|
|
56
|
+
// ── HTTP Request JWT Fields ──────────────────────────────────────────
|
|
57
|
+
{ name: 'http.request.jwt.claims.aud', type: 'Array' },
|
|
58
|
+
{ name: 'http.request.jwt.claims.aud.names', type: 'Array' },
|
|
59
|
+
{ name: 'http.request.jwt.claims.aud.values', type: 'Array' },
|
|
60
|
+
{ name: 'http.request.jwt.claims.iat.sec', type: 'Array' },
|
|
61
|
+
{ name: 'http.request.jwt.claims.iat.sec.names', type: 'Array' },
|
|
62
|
+
{ name: 'http.request.jwt.claims.iat.sec.values', type: 'Array' },
|
|
63
|
+
{ name: 'http.request.jwt.claims.iss', type: 'Array' },
|
|
64
|
+
{ name: 'http.request.jwt.claims.iss.names', type: 'Array' },
|
|
65
|
+
{ name: 'http.request.jwt.claims.iss.values', type: 'Array' },
|
|
66
|
+
{ name: 'http.request.jwt.claims.jti', type: 'Array' },
|
|
67
|
+
{ name: 'http.request.jwt.claims.jti.names', type: 'Array' },
|
|
68
|
+
{ name: 'http.request.jwt.claims.jti.values', type: 'Array' },
|
|
69
|
+
{ name: 'http.request.jwt.claims.nbf.sec', type: 'Array' },
|
|
70
|
+
{ name: 'http.request.jwt.claims.nbf.sec.names', type: 'Array' },
|
|
71
|
+
{ name: 'http.request.jwt.claims.nbf.sec.values', type: 'Array' },
|
|
72
|
+
{ name: 'http.request.jwt.claims.sub', type: 'Array' },
|
|
73
|
+
{ name: 'http.request.jwt.claims.sub.names', type: 'Array' },
|
|
74
|
+
{ name: 'http.request.jwt.claims.sub.values', type: 'Array' },
|
|
75
|
+
// ── HTTP Convenience Fields ──────────────────────────────────────────
|
|
76
|
+
{ name: 'http.cookie', type: 'String' },
|
|
77
|
+
{ name: 'http.host', type: 'String' },
|
|
78
|
+
{ name: 'http.referer', type: 'String' },
|
|
79
|
+
{ name: 'http.user_agent', type: 'String' },
|
|
80
|
+
{ name: 'http.x_forwarded_for', type: 'String' },
|
|
81
|
+
// ── HTTP Response Fields (response phases only) ──────────────────────
|
|
82
|
+
{ name: 'http.response.code', type: 'Integer', phases: [
|
|
83
|
+
'http_response_headers_transform', 'http_custom_errors',
|
|
84
|
+
'http_response_compression', 'http_response_firewall_managed',
|
|
85
|
+
'http_log_custom_fields',
|
|
86
|
+
] },
|
|
87
|
+
{ name: 'http.response.content_type.media_type', type: 'String', phases: [
|
|
88
|
+
'http_response_headers_transform', 'http_custom_errors',
|
|
89
|
+
'http_response_compression', 'http_response_firewall_managed',
|
|
90
|
+
'http_log_custom_fields',
|
|
91
|
+
] },
|
|
92
|
+
{ name: 'http.response.headers', type: 'Map', phases: [
|
|
93
|
+
'http_response_headers_transform', 'http_custom_errors',
|
|
94
|
+
'http_response_compression', 'http_response_firewall_managed',
|
|
95
|
+
'http_log_custom_fields',
|
|
96
|
+
] },
|
|
97
|
+
{ name: 'http.response.headers.names', type: 'Array', phases: [
|
|
98
|
+
'http_response_headers_transform', 'http_custom_errors',
|
|
99
|
+
'http_response_compression', 'http_response_firewall_managed',
|
|
100
|
+
'http_log_custom_fields',
|
|
101
|
+
] },
|
|
102
|
+
{ name: 'http.response.headers.values', type: 'Array', phases: [
|
|
103
|
+
'http_response_headers_transform', 'http_custom_errors',
|
|
104
|
+
'http_response_compression', 'http_response_firewall_managed',
|
|
105
|
+
'http_log_custom_fields',
|
|
106
|
+
] },
|
|
107
|
+
// ── IP / Geolocation Fields ──────────────────────────────────────────
|
|
108
|
+
{ name: 'ip.src', type: 'IP' },
|
|
109
|
+
{ name: 'ip.src.asnum', type: 'Integer' },
|
|
110
|
+
{ name: 'ip.src.city', type: 'String' },
|
|
111
|
+
{ name: 'ip.src.continent', type: 'String' },
|
|
112
|
+
{ name: 'ip.src.country', type: 'String' },
|
|
113
|
+
{ name: 'ip.src.is_in_european_union', type: 'Boolean' },
|
|
114
|
+
{ name: 'ip.src.lat', type: 'Float' },
|
|
115
|
+
{ name: 'ip.src.lon', type: 'Float' },
|
|
116
|
+
{ name: 'ip.src.metro_code', type: 'Integer' },
|
|
117
|
+
{ name: 'ip.src.postal_code', type: 'String' },
|
|
118
|
+
{ name: 'ip.src.region', type: 'String' },
|
|
119
|
+
{ name: 'ip.src.region_code', type: 'String' },
|
|
120
|
+
{ name: 'ip.src.subdivision_1_iso_code', type: 'String' },
|
|
121
|
+
{ name: 'ip.src.subdivision_2_iso_code', type: 'String' },
|
|
122
|
+
{ name: 'ip.src.timezone.name', type: 'String' },
|
|
123
|
+
// ── Deprecated ip.geoip.* aliases ────────────────────────────────────
|
|
124
|
+
{ name: 'ip.geoip.asnum', type: 'Integer', deprecated: true, replacement: 'ip.src.asnum' },
|
|
125
|
+
{ name: 'ip.geoip.city', type: 'String', deprecated: true, replacement: 'ip.src.city' },
|
|
126
|
+
{ name: 'ip.geoip.continent', type: 'String', deprecated: true, replacement: 'ip.src.continent' },
|
|
127
|
+
{ name: 'ip.geoip.country', type: 'String', deprecated: true, replacement: 'ip.src.country' },
|
|
128
|
+
{ name: 'ip.geoip.is_in_european_union', type: 'Boolean', deprecated: true, replacement: 'ip.src.is_in_european_union' },
|
|
129
|
+
{ name: 'ip.geoip.subdivision_1_iso_code', type: 'String', deprecated: true, replacement: 'ip.src.subdivision_1_iso_code' },
|
|
130
|
+
{ name: 'ip.geoip.subdivision_2_iso_code', type: 'String', deprecated: true, replacement: 'ip.src.subdivision_2_iso_code' },
|
|
131
|
+
// ── SSL/TLS Fields ───────────────────────────────────────────────────
|
|
132
|
+
{ name: 'ssl', type: 'Boolean' },
|
|
133
|
+
{ name: 'cf.tls_version', type: 'String' },
|
|
134
|
+
{ name: 'cf.tls_cipher', type: 'String' },
|
|
135
|
+
{ name: 'cf.tls_ciphers_sha1', type: 'String' },
|
|
136
|
+
{ name: 'cf.tls_client_hello_length', type: 'Integer' },
|
|
137
|
+
{ name: 'cf.tls_client_random', type: 'String' },
|
|
138
|
+
{ name: 'cf.tls_client_extensions_sha1', type: 'String' },
|
|
139
|
+
{ name: 'cf.tls_client_extensions_sha1_le', type: 'String' },
|
|
140
|
+
// ── mTLS Client Auth Fields ──────────────────────────────────────────
|
|
141
|
+
{ name: 'cf.tls_client_auth.cert_fingerprint_sha1', type: 'String' },
|
|
142
|
+
{ name: 'cf.tls_client_auth.cert_fingerprint_sha256', type: 'String' },
|
|
143
|
+
{ name: 'cf.tls_client_auth.cert_issuer_dn', type: 'String' },
|
|
144
|
+
{ name: 'cf.tls_client_auth.cert_issuer_dn_legacy', type: 'String' },
|
|
145
|
+
{ name: 'cf.tls_client_auth.cert_issuer_dn_rfc2253', type: 'String' },
|
|
146
|
+
{ name: 'cf.tls_client_auth.cert_issuer_serial', type: 'String' },
|
|
147
|
+
{ name: 'cf.tls_client_auth.cert_issuer_ski', type: 'String' },
|
|
148
|
+
{ name: 'cf.tls_client_auth.cert_not_after', type: 'String' },
|
|
149
|
+
{ name: 'cf.tls_client_auth.cert_not_before', type: 'String' },
|
|
150
|
+
{ name: 'cf.tls_client_auth.cert_presented', type: 'Boolean' },
|
|
151
|
+
{ name: 'cf.tls_client_auth.cert_revoked', type: 'Boolean' },
|
|
152
|
+
{ name: 'cf.tls_client_auth.cert_serial', type: 'String' },
|
|
153
|
+
{ name: 'cf.tls_client_auth.cert_ski', type: 'String' },
|
|
154
|
+
{ name: 'cf.tls_client_auth.cert_subject_dn', type: 'String' },
|
|
155
|
+
{ name: 'cf.tls_client_auth.cert_subject_dn_legacy', type: 'String' },
|
|
156
|
+
{ name: 'cf.tls_client_auth.cert_subject_dn_rfc2253', type: 'String' },
|
|
157
|
+
{ name: 'cf.tls_client_auth.cert_verified', type: 'Boolean' },
|
|
158
|
+
// ── Bot Management Fields ────────────────────────────────────────────
|
|
159
|
+
{ name: 'cf.bot_management.corporate_proxy', type: 'Boolean' },
|
|
160
|
+
{ name: 'cf.bot_management.detection_ids', type: 'Array' },
|
|
161
|
+
{ name: 'cf.bot_management.ja3_hash', type: 'String' },
|
|
162
|
+
{ name: 'cf.bot_management.ja4', type: 'String' },
|
|
163
|
+
{ name: 'cf.bot_management.js_detection.passed', type: 'Boolean' },
|
|
164
|
+
{ name: 'cf.bot_management.score', type: 'Integer' },
|
|
165
|
+
{ name: 'cf.bot_management.static_resource', type: 'Boolean' },
|
|
166
|
+
{ name: 'cf.bot_management.verified_bot', type: 'Boolean' },
|
|
167
|
+
{ name: 'cf.client.bot', type: 'Boolean' },
|
|
168
|
+
{ name: 'cf.verified_bot_category', type: 'String' },
|
|
169
|
+
// ── WAF Fields ───────────────────────────────────────────────────────
|
|
170
|
+
{ name: 'cf.waf.auth_detected', type: 'Boolean' },
|
|
171
|
+
{ name: 'cf.waf.content_scan.has_failed', type: 'Boolean' },
|
|
172
|
+
{ name: 'cf.waf.content_scan.has_malicious_obj', type: 'Boolean' },
|
|
173
|
+
{ name: 'cf.waf.content_scan.has_obj', type: 'Boolean' },
|
|
174
|
+
{ name: 'cf.waf.content_scan.num_malicious_obj', type: 'Integer' },
|
|
175
|
+
{ name: 'cf.waf.content_scan.num_obj', type: 'Integer' },
|
|
176
|
+
{ name: 'cf.waf.content_scan.obj_results', type: 'Array' },
|
|
177
|
+
{ name: 'cf.waf.content_scan.obj_sizes', type: 'Array' },
|
|
178
|
+
{ name: 'cf.waf.content_scan.obj_types', type: 'Array' },
|
|
179
|
+
{ name: 'cf.waf.credential_check.password_leaked', type: 'Boolean' },
|
|
180
|
+
{ name: 'cf.waf.credential_check.username_and_password_leaked', type: 'Boolean' },
|
|
181
|
+
{ name: 'cf.waf.credential_check.username_leaked', type: 'Boolean' },
|
|
182
|
+
{ name: 'cf.waf.credential_check.username_password_similar', type: 'Boolean' },
|
|
183
|
+
{ name: 'cf.waf.score', type: 'Integer' },
|
|
184
|
+
{ name: 'cf.waf.score.class', type: 'String' },
|
|
185
|
+
{ name: 'cf.waf.score.rce', type: 'Integer' },
|
|
186
|
+
{ name: 'cf.waf.score.sqli', type: 'Integer' },
|
|
187
|
+
{ name: 'cf.waf.score.xss', type: 'Integer' },
|
|
188
|
+
// ── Edge / Network Fields ────────────────────────────────────────────
|
|
189
|
+
{ name: 'cf.edge.server_ip', type: 'IP' },
|
|
190
|
+
{ name: 'cf.edge.server_port', type: 'Integer' },
|
|
191
|
+
{ name: 'cf.edge.client_port', type: 'Integer' },
|
|
192
|
+
{ name: 'cf.edge.client_tcp', type: 'Boolean' },
|
|
193
|
+
// ── Cloudflare Metadata Fields ───────────────────────────────────────
|
|
194
|
+
{ name: 'cf.hostname.metadata', type: 'String' },
|
|
195
|
+
{ name: 'cf.ray_id', type: 'String' },
|
|
196
|
+
{ name: 'cf.random_seed', type: 'Bytes' },
|
|
197
|
+
{ name: 'cf.zone.name', type: 'String' },
|
|
198
|
+
{ name: 'cf.zone.plan', type: 'String' },
|
|
199
|
+
{ name: 'cf.metal.id', type: 'String' },
|
|
200
|
+
// ── Threat / Timing Fields ───────────────────────────────────────────
|
|
201
|
+
{ name: 'cf.threat_score', type: 'Integer' },
|
|
202
|
+
{ name: 'cf.timings.client_tcp_rtt_msec', type: 'Integer' },
|
|
203
|
+
{ name: 'cf.timings.edge_msec', type: 'Integer' },
|
|
204
|
+
{ name: 'cf.timings.origin_ttfb_msec', type: 'Integer' },
|
|
205
|
+
// ── Response Error Fields ────────────────────────────────────────────
|
|
206
|
+
{ name: 'cf.response.1xxx_code', type: 'Integer', phases: [
|
|
207
|
+
'http_custom_errors', 'http_response_headers_transform',
|
|
208
|
+
] },
|
|
209
|
+
{ name: 'cf.response.error_type', type: 'String', phases: [
|
|
210
|
+
'http_custom_errors', 'http_response_headers_transform',
|
|
211
|
+
] },
|
|
212
|
+
// ── API Gateway Fields ───────────────────────────────────────────────
|
|
213
|
+
{ name: 'cf.api_gateway.auth_id_present', type: 'Boolean' },
|
|
214
|
+
{ name: 'cf.api_gateway.fallthrough_detected', type: 'Boolean' },
|
|
215
|
+
{ name: 'cf.api_gateway.request_violates_schema', type: 'Boolean' },
|
|
216
|
+
// ── LLM Security Fields ──────────────────────────────────────────────
|
|
217
|
+
{ name: 'cf.llm.prompt.custom_topic_categories', type: 'Map' },
|
|
218
|
+
{ name: 'cf.llm.prompt.detected', type: 'Boolean' },
|
|
219
|
+
{ name: 'cf.llm.prompt.injection_score', type: 'Integer' },
|
|
220
|
+
{ name: 'cf.llm.prompt.pii_categories', type: 'Array' },
|
|
221
|
+
{ name: 'cf.llm.prompt.pii_detected', type: 'Boolean' },
|
|
222
|
+
{ name: 'cf.llm.prompt.token_count', type: 'Integer' },
|
|
223
|
+
{ name: 'cf.llm.prompt.unsafe_topic_categories', type: 'Array' },
|
|
224
|
+
{ name: 'cf.llm.prompt.unsafe_topic_detected', type: 'Boolean' },
|
|
225
|
+
// ── Worker Fields ────────────────────────────────────────────────────
|
|
226
|
+
{ name: 'cf.worker.upstream_zone', type: 'Boolean' },
|
|
227
|
+
// ── Raw (untransformed) Fields ───────────────────────────────────────
|
|
228
|
+
{ name: 'raw.http.request.full_uri', type: 'String' },
|
|
229
|
+
{ name: 'raw.http.request.uri', type: 'String' },
|
|
230
|
+
{ name: 'raw.http.request.uri.path', type: 'String' },
|
|
231
|
+
{ name: 'raw.http.request.uri.path.extension', type: 'String' },
|
|
232
|
+
{ name: 'raw.http.request.uri.query', type: 'String' },
|
|
233
|
+
{ name: 'raw.http.request.uri.args', type: 'Map' },
|
|
234
|
+
{ name: 'raw.http.request.uri.args.names', type: 'Array' },
|
|
235
|
+
{ name: 'raw.http.request.uri.args.values', type: 'Array' },
|
|
236
|
+
{ name: 'raw.http.request.headers', type: 'Map' },
|
|
237
|
+
{ name: 'raw.http.request.headers.names', type: 'Array' },
|
|
238
|
+
{ name: 'raw.http.request.headers.values', type: 'Array' },
|
|
239
|
+
{ name: 'raw.http.response.headers', type: 'Map', phases: [
|
|
240
|
+
'http_response_headers_transform',
|
|
241
|
+
] },
|
|
242
|
+
{ name: 'raw.http.response.headers.names', type: 'Array', phases: [
|
|
243
|
+
'http_response_headers_transform',
|
|
244
|
+
] },
|
|
245
|
+
{ name: 'raw.http.response.headers.values', type: 'Array', phases: [
|
|
246
|
+
'http_response_headers_transform',
|
|
247
|
+
] },
|
|
248
|
+
];
|
|
249
|
+
/** Build a lookup map for fast field resolution */
|
|
250
|
+
const fieldMap = new Map();
|
|
251
|
+
for (const field of FIELDS) {
|
|
252
|
+
fieldMap.set(field.name, field);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Look up a field by name.
|
|
256
|
+
* Returns undefined if the field is not recognized.
|
|
257
|
+
*/
|
|
258
|
+
export function findField(name) {
|
|
259
|
+
return fieldMap.get(name);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Check if a field name could be a dynamic map/array access.
|
|
263
|
+
* E.g., "http.request.headers" is a Map field, so "http.request.headers["host"]" is valid.
|
|
264
|
+
* Returns the base field if found.
|
|
265
|
+
*/
|
|
266
|
+
export function findBaseField(name) {
|
|
267
|
+
// Direct match first
|
|
268
|
+
const direct = fieldMap.get(name);
|
|
269
|
+
if (direct)
|
|
270
|
+
return direct;
|
|
271
|
+
// Try progressively shorter prefixes for map/array access
|
|
272
|
+
const parts = name.split('.');
|
|
273
|
+
for (let i = parts.length - 1; i >= 1; i--) {
|
|
274
|
+
const prefix = parts.slice(0, i).join('.');
|
|
275
|
+
const field = fieldMap.get(prefix);
|
|
276
|
+
if (field && (field.type === 'Map' || field.type === 'Array')) {
|
|
277
|
+
return field;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return undefined;
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/schemas/fields.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAmBH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,MAAM,GAAe;IAChC,wEAAwE;IACxE,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC5C,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,QAAQ,EAAE;IACjD,EAAE,IAAI,EAAE,iCAAiC,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC3D,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClD,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,KAAK,EAAE;IAC9C,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,EAAE,OAAO,EAAE;IACtD,EAAE,IAAI,EAAE,8BAA8B,EAAE,IAAI,EAAE,OAAO,EAAE;IACvD,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,QAAQ,EAAE;IACjD,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC/C,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,QAAQ,EAAE;IAEhD,wEAAwE;IACxE,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,KAAK,EAAE;IAC7C,EAAE,IAAI,EAAE,4BAA4B,EAAE,IAAI,EAAE,OAAO,EAAE;IACrD,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,EAAE,OAAO,EA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AC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,CAAC;YAC9D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare expression functions registry.
|
|
3
|
+
*
|
|
4
|
+
* Reference: https://developers.cloudflare.com/ruleset-engine/rules-language/functions/
|
|
5
|
+
*
|
|
6
|
+
* MAINTAINER NOTE: To add a new function, add it to the FUNCTIONS array below.
|
|
7
|
+
*/
|
|
8
|
+
import type { FieldType } from './operators.js';
|
|
9
|
+
export type ExpressionContext = 'filter' | 'rewrite_url' | 'rewrite_header' | 'redirect_target' | 'all';
|
|
10
|
+
export interface FunctionParam {
|
|
11
|
+
name: string;
|
|
12
|
+
type: FieldType | 'Any';
|
|
13
|
+
optional?: boolean;
|
|
14
|
+
variadic?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface FunctionDef {
|
|
17
|
+
/** Function name (e.g., "lower") */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Parameter definitions */
|
|
20
|
+
params: FunctionParam[];
|
|
21
|
+
/** Return type */
|
|
22
|
+
returnType: FieldType;
|
|
23
|
+
/** Which expression contexts this function is available in */
|
|
24
|
+
contexts: ExpressionContext[];
|
|
25
|
+
/** Maximum number of times this function can appear in a single expression */
|
|
26
|
+
maxPerExpression?: number;
|
|
27
|
+
/** Whether this function cannot be nested inside certain other functions */
|
|
28
|
+
noNestIn?: string[];
|
|
29
|
+
/** Human-readable notes */
|
|
30
|
+
notes?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const FUNCTIONS: FunctionDef[];
|
|
33
|
+
export declare function findFunction(name: string): FunctionDef | undefined;
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare expression functions registry.
|
|
3
|
+
*
|
|
4
|
+
* Reference: https://developers.cloudflare.com/ruleset-engine/rules-language/functions/
|
|
5
|
+
*
|
|
6
|
+
* MAINTAINER NOTE: To add a new function, add it to the FUNCTIONS array below.
|
|
7
|
+
*/
|
|
8
|
+
export const FUNCTIONS = [
|
|
9
|
+
// ── Universally Available Functions ──────────────────────────────────
|
|
10
|
+
{
|
|
11
|
+
name: 'any',
|
|
12
|
+
params: [{ name: 'values', type: 'Array' }],
|
|
13
|
+
returnType: 'Boolean',
|
|
14
|
+
contexts: ['all'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'all',
|
|
18
|
+
params: [{ name: 'values', type: 'Array' }],
|
|
19
|
+
returnType: 'Boolean',
|
|
20
|
+
contexts: ['all'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'concat',
|
|
24
|
+
params: [{ name: 'values', type: 'Any', variadic: true }],
|
|
25
|
+
returnType: 'String',
|
|
26
|
+
contexts: ['all'],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'ends_with',
|
|
30
|
+
params: [
|
|
31
|
+
{ name: 'source', type: 'String' },
|
|
32
|
+
{ name: 'substring', type: 'String' },
|
|
33
|
+
],
|
|
34
|
+
returnType: 'Boolean',
|
|
35
|
+
contexts: ['all'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'starts_with',
|
|
39
|
+
params: [
|
|
40
|
+
{ name: 'source', type: 'String' },
|
|
41
|
+
{ name: 'substring', type: 'String' },
|
|
42
|
+
],
|
|
43
|
+
returnType: 'Boolean',
|
|
44
|
+
contexts: ['all'],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'has_key',
|
|
48
|
+
params: [
|
|
49
|
+
{ name: 'map', type: 'Map' },
|
|
50
|
+
{ name: 'key', type: 'String' },
|
|
51
|
+
],
|
|
52
|
+
returnType: 'Boolean',
|
|
53
|
+
contexts: ['all'],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'has_value',
|
|
57
|
+
params: [
|
|
58
|
+
{ name: 'collection', type: 'Any' },
|
|
59
|
+
{ name: 'value', type: 'Any' },
|
|
60
|
+
],
|
|
61
|
+
returnType: 'Boolean',
|
|
62
|
+
contexts: ['all'],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'len',
|
|
66
|
+
params: [{ name: 'value', type: 'Any' }],
|
|
67
|
+
returnType: 'Integer',
|
|
68
|
+
contexts: ['all'],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'lookup_json_integer',
|
|
72
|
+
params: [
|
|
73
|
+
{ name: 'field', type: 'String' },
|
|
74
|
+
{ name: 'key', type: 'Any', variadic: true },
|
|
75
|
+
],
|
|
76
|
+
returnType: 'Integer',
|
|
77
|
+
contexts: ['all'],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'lookup_json_string',
|
|
81
|
+
params: [
|
|
82
|
+
{ name: 'field', type: 'String' },
|
|
83
|
+
{ name: 'key', type: 'Any', variadic: true },
|
|
84
|
+
],
|
|
85
|
+
returnType: 'String',
|
|
86
|
+
contexts: ['all'],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'lower',
|
|
90
|
+
params: [{ name: 'value', type: 'String' }],
|
|
91
|
+
returnType: 'String',
|
|
92
|
+
contexts: ['all'],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'upper',
|
|
96
|
+
params: [{ name: 'value', type: 'String' }],
|
|
97
|
+
returnType: 'String',
|
|
98
|
+
contexts: ['all'],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'remove_bytes',
|
|
102
|
+
params: [
|
|
103
|
+
{ name: 'value', type: 'Bytes' },
|
|
104
|
+
{ name: 'bytes_to_remove', type: 'Bytes' },
|
|
105
|
+
],
|
|
106
|
+
returnType: 'Bytes',
|
|
107
|
+
contexts: ['all'],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'substring',
|
|
111
|
+
params: [
|
|
112
|
+
{ name: 'value', type: 'String' },
|
|
113
|
+
{ name: 'start', type: 'Integer' },
|
|
114
|
+
{ name: 'end', type: 'Integer', optional: true },
|
|
115
|
+
],
|
|
116
|
+
returnType: 'String',
|
|
117
|
+
contexts: ['all'],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'url_decode',
|
|
121
|
+
params: [
|
|
122
|
+
{ name: 'source', type: 'String' },
|
|
123
|
+
{ name: 'options', type: 'String', optional: true },
|
|
124
|
+
],
|
|
125
|
+
returnType: 'String',
|
|
126
|
+
contexts: ['all'],
|
|
127
|
+
},
|
|
128
|
+
// ── Transform / Redirect-Only Functions ──────────────────────────────
|
|
129
|
+
{
|
|
130
|
+
name: 'regex_replace',
|
|
131
|
+
params: [
|
|
132
|
+
{ name: 'source', type: 'String' },
|
|
133
|
+
{ name: 'regex', type: 'String' },
|
|
134
|
+
{ name: 'replacement', type: 'String' },
|
|
135
|
+
],
|
|
136
|
+
returnType: 'String',
|
|
137
|
+
contexts: ['rewrite_url', 'rewrite_header', 'redirect_target'],
|
|
138
|
+
maxPerExpression: 1,
|
|
139
|
+
noNestIn: ['wildcard_replace'],
|
|
140
|
+
notes: 'Supports capture group references ${1} through ${8}',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'wildcard_replace',
|
|
144
|
+
params: [
|
|
145
|
+
{ name: 'source', type: 'String' },
|
|
146
|
+
{ name: 'pattern', type: 'String' },
|
|
147
|
+
{ name: 'replacement', type: 'String' },
|
|
148
|
+
{ name: 'flags', type: 'String', optional: true },
|
|
149
|
+
],
|
|
150
|
+
returnType: 'String',
|
|
151
|
+
contexts: ['rewrite_url', 'redirect_target'],
|
|
152
|
+
maxPerExpression: 1,
|
|
153
|
+
noNestIn: ['regex_replace'],
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'to_string',
|
|
157
|
+
params: [{ name: 'value', type: 'Any' }],
|
|
158
|
+
returnType: 'String',
|
|
159
|
+
contexts: ['rewrite_url', 'rewrite_header', 'redirect_target'],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'encode_base64',
|
|
163
|
+
params: [
|
|
164
|
+
{ name: 'input', type: 'Any' },
|
|
165
|
+
{ name: 'flags', type: 'String', optional: true },
|
|
166
|
+
],
|
|
167
|
+
returnType: 'String',
|
|
168
|
+
contexts: ['rewrite_header'],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'decode_base64',
|
|
172
|
+
params: [{ name: 'source', type: 'String' }],
|
|
173
|
+
returnType: 'String',
|
|
174
|
+
contexts: ['rewrite_url', 'rewrite_header', 'filter'],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'remove_query_args',
|
|
178
|
+
params: [
|
|
179
|
+
{ name: 'field', type: 'String' },
|
|
180
|
+
{ name: 'query_param', type: 'String', variadic: true },
|
|
181
|
+
],
|
|
182
|
+
returnType: 'String',
|
|
183
|
+
contexts: ['rewrite_url'],
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'sha256',
|
|
187
|
+
params: [{ name: 'input', type: 'Any' }],
|
|
188
|
+
returnType: 'Bytes',
|
|
189
|
+
contexts: ['rewrite_url', 'rewrite_header'],
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'uuidv4',
|
|
193
|
+
params: [{ name: 'source', type: 'Bytes' }],
|
|
194
|
+
returnType: 'String',
|
|
195
|
+
contexts: ['rewrite_url', 'rewrite_header'],
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'split',
|
|
199
|
+
params: [
|
|
200
|
+
{ name: 'input', type: 'String' },
|
|
201
|
+
{ name: 'separator', type: 'String' },
|
|
202
|
+
{ name: 'limit', type: 'Integer' },
|
|
203
|
+
],
|
|
204
|
+
returnType: 'Array',
|
|
205
|
+
contexts: ['rewrite_header'],
|
|
206
|
+
notes: 'Limit must be 1-128',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'join',
|
|
210
|
+
params: [
|
|
211
|
+
{ name: 'items', type: 'Array' },
|
|
212
|
+
{ name: 'separator', type: 'String' },
|
|
213
|
+
],
|
|
214
|
+
returnType: 'String',
|
|
215
|
+
contexts: ['rewrite_url', 'rewrite_header', 'filter'],
|
|
216
|
+
},
|
|
217
|
+
// ── Rate Limiting / Custom Rule Functions ────────────────────────────
|
|
218
|
+
{
|
|
219
|
+
name: 'cidr',
|
|
220
|
+
params: [
|
|
221
|
+
{ name: 'address', type: 'IP' },
|
|
222
|
+
{ name: 'ipv4_network_bits', type: 'Integer' },
|
|
223
|
+
{ name: 'ipv6_network_bits', type: 'Integer' },
|
|
224
|
+
],
|
|
225
|
+
returnType: 'IP',
|
|
226
|
+
contexts: ['filter'],
|
|
227
|
+
notes: 'IPv4 bits: 1-32, IPv6 bits: 1-128',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'cidr6',
|
|
231
|
+
params: [
|
|
232
|
+
{ name: 'address', type: 'IP' },
|
|
233
|
+
{ name: 'ipv6_network_bits', type: 'Integer' },
|
|
234
|
+
],
|
|
235
|
+
returnType: 'IP',
|
|
236
|
+
contexts: ['filter'],
|
|
237
|
+
},
|
|
238
|
+
// ── HMAC Validation ──────────────────────────────────────────────────
|
|
239
|
+
{
|
|
240
|
+
name: 'is_timed_hmac_valid_v0',
|
|
241
|
+
params: [
|
|
242
|
+
{ name: 'key', type: 'String' },
|
|
243
|
+
{ name: 'messageMac', type: 'String' },
|
|
244
|
+
{ name: 'ttl', type: 'Integer' },
|
|
245
|
+
{ name: 'timestamp', type: 'Integer' },
|
|
246
|
+
{ name: 'separator', type: 'Integer', optional: true },
|
|
247
|
+
{ name: 'flags', type: 'String', optional: true },
|
|
248
|
+
],
|
|
249
|
+
returnType: 'Boolean',
|
|
250
|
+
contexts: ['filter'],
|
|
251
|
+
},
|
|
252
|
+
];
|
|
253
|
+
/** Build lookup map */
|
|
254
|
+
const functionMap = new Map();
|
|
255
|
+
for (const fn of FUNCTIONS) {
|
|
256
|
+
functionMap.set(fn.name, fn);
|
|
257
|
+
}
|
|
258
|
+
export function findFunction(name) {
|
|
259
|
+
return functionMap.get(name);
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/schemas/functions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmCH,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,wEAAwE;IACxE;QACE,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC3C,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,CAAC,KAAK,CAAC;KAClB;IACD;QACE,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC3C,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,CAAC,KAAK,CAAC;KAClB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACzD,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,CAAC,KAAK,CAAC;KAClB;IACD;Q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AAI,EAAE,IAAI,EAAE;YAC/B,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE;SAC/C;QACD,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;IAED,wEAAwE;IACxE;QACE,IAAI,EAAE,wBAAwB;QAC9B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC/B,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE;YACtC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;YAChC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;YACtC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;YACtD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;SAClD;QACD,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;CACF,CAAC;AAEF,uBAAuB;AACvB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;AACnD,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;IAC3B,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare expression operators.
|
|
3
|
+
*
|
|
4
|
+
* Reference: https://developers.cloudflare.com/ruleset-engine/rules-language/operators/
|
|
5
|
+
*/
|
|
6
|
+
export type FieldType = 'String' | 'Integer' | 'Boolean' | 'IP' | 'Bytes' | 'Float' | 'Array' | 'Map';
|
|
7
|
+
export interface OperatorDef {
|
|
8
|
+
/** The canonical name (english notation) */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Symbol aliases (C-like notation) */
|
|
11
|
+
symbols: string[];
|
|
12
|
+
/** Which field types this operator supports */
|
|
13
|
+
supportedTypes: FieldType[];
|
|
14
|
+
/** Whether this is a logical operator */
|
|
15
|
+
isLogical?: boolean;
|
|
16
|
+
/** Operator precedence (lower = binds tighter). Only for logical operators. */
|
|
17
|
+
precedence?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Comparison operators */
|
|
20
|
+
export declare const COMPARISON_OPERATORS: OperatorDef[];
|
|
21
|
+
/** Logical operators with precedence */
|
|
22
|
+
export declare const LOGICAL_OPERATORS: OperatorDef[];
|
|
23
|
+
/** All operator names and symbols for quick lookup */
|
|
24
|
+
export declare const ALL_COMPARISON_NAMES: Set<string>;
|
|
25
|
+
export declare const ALL_LOGICAL_NAMES: Set<string>;
|
|
26
|
+
/** Look up operator def by name or symbol */
|
|
27
|
+
export declare function findComparisonOperator(nameOrSymbol: string): OperatorDef | undefined;
|
|
28
|
+
export declare function findLogicalOperator(nameOrSymbol: string): OperatorDef | undefined;
|