@libreflare/worker-runtime 0.8.2 → 0.9.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.
Files changed (136) hide show
  1. package/README.md +234 -23
  2. package/dist/log-handler.d.ts.map +1 -1
  3. package/dist/log-handler.js +12 -6
  4. package/dist/log-handler.js.map +1 -1
  5. package/dist/rule-evaluator/access-values.d.ts +19 -6
  6. package/dist/rule-evaluator/access-values.d.ts.map +1 -1
  7. package/dist/rule-evaluator/access-values.js +33 -8
  8. package/dist/rule-evaluator/access-values.js.map +1 -1
  9. package/dist/rule-evaluator/analysis.d.ts +63 -11
  10. package/dist/rule-evaluator/analysis.d.ts.map +1 -1
  11. package/dist/rule-evaluator/analysis.js +60 -43
  12. package/dist/rule-evaluator/analysis.js.map +1 -1
  13. package/dist/rule-evaluator/ast.d.ts +31 -18
  14. package/dist/rule-evaluator/ast.d.ts.map +1 -1
  15. package/dist/rule-evaluator/ast.js +3 -4
  16. package/dist/rule-evaluator/ast.js.map +1 -1
  17. package/dist/rule-evaluator/constants.d.ts +1 -1
  18. package/dist/rule-evaluator/constants.d.ts.map +1 -1
  19. package/dist/rule-evaluator/constants.js +3 -0
  20. package/dist/rule-evaluator/constants.js.map +1 -1
  21. package/dist/rule-evaluator/country-codes.generated.js +1 -1
  22. package/dist/rule-evaluator/custom-lists.d.ts +0 -6
  23. package/dist/rule-evaluator/custom-lists.d.ts.map +1 -1
  24. package/dist/rule-evaluator/custom-lists.js +1 -12
  25. package/dist/rule-evaluator/custom-lists.js.map +1 -1
  26. package/dist/rule-evaluator/diagnostics.d.ts +1 -1
  27. package/dist/rule-evaluator/diagnostics.d.ts.map +1 -1
  28. package/dist/rule-evaluator/diagnostics.js +18 -0
  29. package/dist/rule-evaluator/diagnostics.js.map +1 -1
  30. package/dist/rule-evaluator/engine-observations.generated.d.ts +20 -0
  31. package/dist/rule-evaluator/engine-observations.generated.d.ts.map +1 -1
  32. package/dist/rule-evaluator/engine-observations.generated.js +5 -0
  33. package/dist/rule-evaluator/engine-observations.generated.js.map +1 -1
  34. package/dist/rule-evaluator/evaluator.d.ts +4 -2
  35. package/dist/rule-evaluator/evaluator.d.ts.map +1 -1
  36. package/dist/rule-evaluator/evaluator.js +5 -4
  37. package/dist/rule-evaluator/evaluator.js.map +1 -1
  38. package/dist/rule-evaluator/explain.d.ts +2 -1
  39. package/dist/rule-evaluator/explain.d.ts.map +1 -1
  40. package/dist/rule-evaluator/explain.js +49 -7
  41. package/dist/rule-evaluator/explain.js.map +1 -1
  42. package/dist/rule-evaluator/field-descriptions.generated.d.ts +13 -0
  43. package/dist/rule-evaluator/field-descriptions.generated.d.ts.map +1 -1
  44. package/dist/rule-evaluator/field-descriptions.generated.js +33 -0
  45. package/dist/rule-evaluator/field-descriptions.generated.js.map +1 -1
  46. package/dist/rule-evaluator/fields.d.ts +13 -1
  47. package/dist/rule-evaluator/fields.d.ts.map +1 -1
  48. package/dist/rule-evaluator/fields.js +71 -17
  49. package/dist/rule-evaluator/fields.js.map +1 -1
  50. package/dist/rule-evaluator/function-descriptions.d.ts +2 -0
  51. package/dist/rule-evaluator/function-descriptions.d.ts.map +1 -1
  52. package/dist/rule-evaluator/function-descriptions.generated.d.ts +66 -10
  53. package/dist/rule-evaluator/function-descriptions.generated.d.ts.map +1 -1
  54. package/dist/rule-evaluator/function-descriptions.generated.js +129 -11
  55. package/dist/rule-evaluator/function-descriptions.generated.js.map +1 -1
  56. package/dist/rule-evaluator/function-descriptions.js.map +1 -1
  57. package/dist/rule-evaluator/function-signature-validation.d.ts +2 -0
  58. package/dist/rule-evaluator/function-signature-validation.d.ts.map +1 -1
  59. package/dist/rule-evaluator/function-signature-validation.js +169 -19
  60. package/dist/rule-evaluator/function-signature-validation.js.map +1 -1
  61. package/dist/rule-evaluator/functions.d.ts +24 -1
  62. package/dist/rule-evaluator/functions.d.ts.map +1 -1
  63. package/dist/rule-evaluator/functions.js +423 -95
  64. package/dist/rule-evaluator/functions.js.map +1 -1
  65. package/dist/rule-evaluator/ip-literals.d.ts +56 -0
  66. package/dist/rule-evaluator/ip-literals.d.ts.map +1 -0
  67. package/dist/rule-evaluator/ip-literals.js +162 -0
  68. package/dist/rule-evaluator/ip-literals.js.map +1 -0
  69. package/dist/rule-evaluator/log-sample.d.ts.map +1 -1
  70. package/dist/rule-evaluator/log-sample.js +14 -2
  71. package/dist/rule-evaluator/log-sample.js.map +1 -1
  72. package/dist/rule-evaluator/match-chain.d.ts +2 -1
  73. package/dist/rule-evaluator/match-chain.d.ts.map +1 -1
  74. package/dist/rule-evaluator/match-chain.js +12 -17
  75. package/dist/rule-evaluator/match-chain.js.map +1 -1
  76. package/dist/rule-evaluator/minifier.d.ts +1 -1
  77. package/dist/rule-evaluator/minifier.d.ts.map +1 -1
  78. package/dist/rule-evaluator/minifier.js +15 -14
  79. package/dist/rule-evaluator/minifier.js.map +1 -1
  80. package/dist/rule-evaluator/normalizer.d.ts +1 -1
  81. package/dist/rule-evaluator/normalizer.d.ts.map +1 -1
  82. package/dist/rule-evaluator/normalizer.js +4 -5
  83. package/dist/rule-evaluator/normalizer.js.map +1 -1
  84. package/dist/rule-evaluator/operators.d.ts +4 -0
  85. package/dist/rule-evaluator/operators.d.ts.map +1 -1
  86. package/dist/rule-evaluator/operators.js +26 -98
  87. package/dist/rule-evaluator/operators.js.map +1 -1
  88. package/dist/rule-evaluator/outcome.d.ts +2 -0
  89. package/dist/rule-evaluator/outcome.d.ts.map +1 -1
  90. package/dist/rule-evaluator/outcome.js +0 -6
  91. package/dist/rule-evaluator/outcome.js.map +1 -1
  92. package/dist/rule-evaluator/parse-cache.d.ts +9 -2
  93. package/dist/rule-evaluator/parse-cache.d.ts.map +1 -1
  94. package/dist/rule-evaluator/parse-cache.js +10 -4
  95. package/dist/rule-evaluator/parse-cache.js.map +1 -1
  96. package/dist/rule-evaluator/parser.d.ts +181 -21
  97. package/dist/rule-evaluator/parser.d.ts.map +1 -1
  98. package/dist/rule-evaluator/parser.js +561 -93
  99. package/dist/rule-evaluator/parser.js.map +1 -1
  100. package/dist/rule-evaluator/quantifier.d.ts +96 -2
  101. package/dist/rule-evaluator/quantifier.d.ts.map +1 -1
  102. package/dist/rule-evaluator/quantifier.js +263 -22
  103. package/dist/rule-evaluator/quantifier.js.map +1 -1
  104. package/dist/rule-evaluator/query-args.d.ts +23 -0
  105. package/dist/rule-evaluator/query-args.d.ts.map +1 -0
  106. package/dist/rule-evaluator/query-args.js +46 -0
  107. package/dist/rule-evaluator/query-args.js.map +1 -0
  108. package/dist/rule-evaluator/rule-language-types.d.ts +28 -17
  109. package/dist/rule-evaluator/rule-language-types.d.ts.map +1 -1
  110. package/dist/rule-evaluator/rule-language-types.js +117 -42
  111. package/dist/rule-evaluator/rule-language-types.js.map +1 -1
  112. package/dist/rule-evaluator/string-literals.d.ts +20 -0
  113. package/dist/rule-evaluator/string-literals.d.ts.map +1 -0
  114. package/dist/rule-evaluator/string-literals.js +44 -0
  115. package/dist/rule-evaluator/string-literals.js.map +1 -0
  116. package/dist/rule-evaluator/tokenizer.d.ts +34 -5
  117. package/dist/rule-evaluator/tokenizer.d.ts.map +1 -1
  118. package/dist/rule-evaluator/tokenizer.js +320 -74
  119. package/dist/rule-evaluator/tokenizer.js.map +1 -1
  120. package/dist/rule-evaluator/transformation.d.ts +2 -2
  121. package/dist/rule-evaluator/transformation.d.ts.map +1 -1
  122. package/dist/rule-evaluator/transformation.js +4 -5
  123. package/dist/rule-evaluator/transformation.js.map +1 -1
  124. package/dist/rule-evaluator/validation.d.ts.map +1 -1
  125. package/dist/rule-evaluator/validation.js +261 -122
  126. package/dist/rule-evaluator/validation.js.map +1 -1
  127. package/dist/rule-evaluator.d.ts +4 -2
  128. package/dist/rule-evaluator.d.ts.map +1 -1
  129. package/dist/rule-evaluator.js +3 -1
  130. package/dist/rule-evaluator.js.map +1 -1
  131. package/dist/runtime-config.d.ts.map +1 -1
  132. package/dist/runtime-config.js +4 -3
  133. package/dist/runtime-config.js.map +1 -1
  134. package/dist/tools/explain-rule-miss.js +4 -6
  135. package/dist/tools/explain-rule-miss.js.map +1 -1
  136. package/package.json +2 -2
package/README.md CHANGED
@@ -20,8 +20,9 @@ path until a route is added.
20
20
 
21
21
  `handleRequest` calls that provide a custom `originFetcher` without
22
22
  `stripWorkerRoutePrefix` are deprecated. When `stripWorkerRoutePrefix` is
23
- configured, origin fetching and rule evaluation both use the stripped origin
24
- URL.
23
+ configured, origin fetching and rule evaluation both use the request path with
24
+ the prefix stripped, and query fields read the query as the visitor sent it
25
+ (see [Query Arguments](#query-arguments)).
25
26
 
26
27
  Set `resolveClientHostname: true` in handler options or managed logging runtime
27
28
  config to add `request.client_hostname` to log events. The runtime performs a
@@ -37,18 +38,25 @@ Evaluation:
37
38
  Analysis:
38
39
 
39
40
  - `analyzeRuleExpression`: versioned, JSON-safe Cloudflare Rules AST, symbol metadata, and optional block-comment metadata for dashboard inference.
41
+ - `analyzeRuleExpressionValue`: the same analysis for text parsed as exactly one value, such as one typed for a side of a comparison. A name is a field, whatever side it is meant for; whether the value fits its place, including any whitespace at its ends, is left to validating the rule. A condition, even one typed for an argument that takes one, and text after the value get an error, such as `syntax.condition_instead_of_value`. With `operator: 'matches'`, a quoted string is read as a regex literal, as it is after `matches`. With `leftValueType`, the type analysis gives the left side, such as `'IP address'`, unquoted literals are read as that type, so `{10}` is a list of the address 10.0.0.0 rather than of the integer 10.
40
42
  - `foldRuleExpressionAst`: bottom-up public AST reducer for custom dashboard inference.
41
43
 
42
44
  Validation:
43
45
 
44
46
  - `validateRuleExpressionSyntax`: syntax, length, and field availability validation for Cloudflare URL Rewrite Rule filter expressions by default. Pass an explicit config object for minification, length enforcement, preset, field availability, deprecated-field notices, and list-reference policy. With minification enabled it validates the minified expression against Cloudflare's 4096-character rule limit by default; when minification is disabled, the result omits `minifiedExpression` and `minifiedLength`.
45
47
  - `validateLoggingSourceKeyRuleExpressionSyntax`: runtime-only source-key rule validation using the pre-origin field context, without Custom List references or deployment length enforcement.
48
+ - `trimRuleExpression`: the expression without the whitespace Cloudflare trims off its ends, which is every character Unicode counts as whitespace: unlike `String.prototype.trim()`, it keeps U+FEFF and trims U+0085. Validation reads the expression trimmed this way, so its diagnostic positions count from the first character that is not whitespace, `source.search(/\P{White_Space}/u)`.
46
49
 
47
50
  Formatting:
48
51
 
49
52
  - `normalizeRuleExpression`: syntax-aware readable formatter that preserves operator notation, grouping, and string literal spelling while canonicalizing grammar whitespace.
50
53
  - `minifyRuleExpression`: syntax-aware minifier for Cloudflare Rules expressions before Rewrite Rule deployment. It uses C-like operators, removes precedence-redundant grouping, and preserves string literal spelling. Syntax-invalid source is returned unchanged with diagnostics.
51
54
 
55
+ String literals:
56
+
57
+ - `renderRuleExpressionStringLiteral`: writes a value as a quoted string literal that Cloudflare reads back as the same bytes, on one line. It escapes `"` and `\`, and writes Unicode's control and format characters, such as zero-width spaces and bidi controls, and its line and paragraph separators as their UTF-8 bytes in `\xHH`, as it does bytes that are not UTF-8. Any other character is written as itself. It writes an ordinary string, not a regex pattern for `matches`, which keeps its escapes as written; keep a pattern's source text, or write it as a raw string.
58
+ - `ruleExpressionStringLiteralValue`: the value of text that is exactly one quoted or raw string literal with no errors, or null. It never reads the text as a regex.
59
+
52
60
  Reference metadata for dashboard editors:
53
61
 
54
62
  - `getRuleExpressionFieldDescriptions`: field descriptions filtered by the same preset and field availability override shape used by rule expression validation.
@@ -76,16 +84,19 @@ in `http.host * "x"`, is the `operand` of its `Invalid` node, and the symbols
76
84
  list it. An access segment with an error is `{ kind: 'invalid', raw, span }`
77
85
  in its `accessPath`, and an inline list member with an error is an `Invalid`
78
86
  node among the list's `values`, whose `elementType` comes from the valid
79
- members.
87
+ members. `analyzeRuleExpressionValue` returns the value without the text after
88
+ it, and an `Invalid` node for a condition or text that starts no value. A field
89
+ or call that an error cut short is an `operand` there too, since the text may
90
+ be a comparison.
80
91
  What invalid input keeps from being known is unknown, never guessed: a value
81
92
  whose type depends on invalid input has `valueType: 'Unknown'`, such as a field
82
93
  with an invalid access segment, or a call whose result type comes from an
83
94
  invalid argument: one to a function that can map over its first argument, as
84
95
  `lower()` and `concat()` can, or to `coalesce()`, which returns its arguments'
85
- type. Any other function keeps its catalog type, as `cidr()` returns an IP
86
- address whatever its arguments are. A call to a function that can map over its
87
- first argument has `evaluationMode: 'unknown'` in its node and its symbol when
88
- that argument is invalid, or a syntax error left it uncertain.
96
+ type. Any other function keeps its catalog type, as `hash_in_range()` returns
97
+ an Integer whatever its arguments are. A call to a function that can map over
98
+ its first argument has `evaluationMode: 'unknown'` in its node and its symbol
99
+ when that argument is invalid, or a syntax error left it uncertain.
89
100
  `declaredReturnType` stays the function's catalog type.
90
101
 
91
102
  ### Documented and Observed Behavior
@@ -95,12 +106,22 @@ follows the engine, as observed with dry-run rule validation. For example, URL
95
106
  rewrite expressions accept every field URL rewrite filters accept,
96
107
  `hash_in_range()` takes one seed, `lookup_json_*()` keys must be literals,
97
108
  header map keys such as `http.request.headers["x-a"]` must be lowercase, and
98
- integer literals must fit in 64 bits, with a leading `0` making one octal. Field availability keeps each preset's
109
+ integer literals must fit in 64 bits, with `0x` making one hex and a leading `0` making one octal. Field availability keeps each preset's
99
110
  documented fields and the observed differences apart, and `fieldAvailability`
100
111
  can still allow a field the engine was observed to reject. Source-key rules run
101
112
  in the Worker rather than in a Cloudflare phase, so the URL rewrite phase's
102
113
  observed differences do not apply to them.
103
114
 
115
+ Cloudflare trims any whitespace off the ends of an expression, but reads only
116
+ spaces and line breaks (CR and LF) between its tokens, so a tab or a no-break
117
+ space there is a `syntax.unsupported_whitespace` error. Strings may hold any
118
+ of them. An access, such as `[0]` or `["x"]`, must come right after its field,
119
+ function call, or previous access, so `http.request.headers.names [0]` is a
120
+ `syntax.space_before_access` error, while spaces inside the brackets and
121
+ before a call's `(` are fine. With block comments enabled, a comment counts as
122
+ space. The minifier and the formatter return an expression with these errors
123
+ unchanged, as they do any expression with a syntax error.
124
+
104
125
  Cloudflare does not document how `hash_in_range()` hashes, and may change it
105
126
  without notice. The evaluator reproduces the results Cloudflare returned to
106
127
  live requests, recorded in
@@ -113,8 +134,10 @@ in Cloudflare, so `coalesce()` can supply a fallback.
113
134
 
114
135
  Cloudflare's string functions work on bytes, as live requests showed:
115
136
  `lower()`, `upper()` and case-insensitive wildcards fold ASCII letters only,
116
- `len()` and `substring()` count bytes, and `remove_bytes()` removes each listed
117
- byte. `url_decode()` keeps invalid escapes, and its `r` option repeats until
137
+ `len()` and `substring()` count bytes, `remove_bytes()` removes each listed
138
+ byte, and `trim()`, `trim_start()` and `trim_end()` remove listed bytes from
139
+ the ends, or ASCII whitespace (tab, LF, VT, FF, CR and space) without a byte
140
+ set. `url_decode()` keeps invalid escapes, and its `r` option repeats until
118
141
  nothing changes. `decode_base64()` gives nil for input that is not standard
119
142
  Base64. `to_string()` prints IPv6 addresses compressed, as in `2001:db8::1`,
120
143
  and so do `cidr()` and `cidr6()`. A result that is not valid UTF-8 keeps its
@@ -123,6 +146,12 @@ bytes, such as a `substring()` that splits a character or a `url_decode()` of
123
146
  does. `lookup_json_string()` and `lookup_json_integer()` give nil when such
124
147
  bytes are in a key of an object on the path or in the string looked up.
125
148
 
149
+ Byte set arguments are checked as Cloudflare's dry runs showed. A byte set
150
+ must not repeat a byte, so `"éè"`, whose characters share the byte `\xc3`,
151
+ gets `function.parameter.requires_distinct_bytes`, whose `byte` param is `c3`.
152
+ `remove_bytes()` also rejects an empty byte set; the trim functions accept
153
+ one, which removes nothing.
154
+
126
155
  The evaluator holds integers as JavaScript numbers, so integers beyond 2^53 are
127
156
  approximate: literals, `lookup_json_integer()` values and `hash_in_range()`
128
157
  results that large round, and so do the comparisons and `to_string()` output
@@ -177,21 +206,24 @@ missing-value (nil) comparison results to absent map keys, out-of-bounds
177
206
  indexes, and nil function results. For example, both sides being missing makes
178
207
  `eq` true, and one missing side makes `ne` true.
179
208
 
180
- A function argument can also be a condition, which is a Boolean value that is
181
- never nil. For example, `has_value(http.request.uri.args["a"], "x")` is nil
182
- when the `a` query argument is missing, so
209
+ A function argument can also be a condition, whose value is never nil. For
210
+ example, `has_value(http.request.uri.args["a"], "x")` is nil when the `a`
211
+ query argument is missing, so
183
212
  `coalesce(has_value(http.request.uri.args["a"], "x"), http.host eq "x")` then
184
213
  falls back to the comparison. As in Cloudflare, an argument that starts with
185
214
  `(`, `not`, `any()` or `all()` is always a condition. It can combine
186
215
  conditions with `and`, `or` and `xor`, while any other argument needs
187
216
  parentheses around them, as in `(http.host eq "x" or ssl)`. A function call in
188
- such parentheses is a condition too: it must return a Boolean, and a nil
189
- result counts as false, so with the `a` query argument missing,
217
+ such parentheses is a condition too, and a nil result counts as false, so with
218
+ the `a` query argument missing,
190
219
  `coalesce((has_value(http.request.uri.args["a"], "x")), ssl)` is false. Since
191
220
  conditions are never nil, validation warns that `coalesce()` never uses the
192
- arguments after one. In the analysis AST, condition arguments keep their
221
+ arguments after one. `any()` and `all()` read their argument the same way. A
222
+ condition that reads `[*]` has a result for each element, there and in any
223
+ other argument (see Quantifier Predicates and Conditions Over Each Element as
224
+ Arguments). In the analysis AST, condition arguments keep their
193
225
  predicate shape, a function call argument evaluated as a condition has
194
- `condition: true`, and the AST version is 5.
226
+ `condition: true`, and the AST version is 6.
195
227
 
196
228
  Equality and ordering comparisons use each operand's declared type. Field
197
229
  values are converted to that type, so a numeric `request.cf` value that
@@ -204,9 +236,23 @@ warning.
204
236
 
205
237
  ### Literals and Inline Lists
206
238
 
207
- As in Cloudflare, inline list elements keep the type they are written as:
208
- quoted elements are Strings that match exactly, so `{"10.0.0.0/8"}` is not a
209
- CIDR, and unquoted elements are Integers, IP addresses, CIDRs, or ranges.
239
+ As in Cloudflare, quoted inline list elements are Strings that match
240
+ exactly, so `{"10.0.0.0/8"}` is not a CIDR. Unquoted literals are read as the
241
+ type of the comparison's left side, as Cloudflare reads them:
242
+
243
+ - An Integer is decimal, hex after `0x`, or octal after a leading `0`. In a
244
+ list, a range such as `-10..-1` takes any of them, lower bound first.
245
+ - After `eq` and the other comparison operators, an IP address is one
246
+ address, with no leading zeros, as in `ip.src eq 10.0.0.1`. A CIDR or range
247
+ works only in a list.
248
+ - In a list, an IP address may have leading zeros, as in `1.1.1.01`, or fewer
249
+ than four parts. `10.1` is the one address 10.1.0.0, not the network
250
+ 10.1.0.0/16, so it gets the `inline_list.short_ipv4_address` warning. A CIDR
251
+ can't have bits set past its prefix, as `10.0.0.1/8` does, and an IP range
252
+ has two addresses of one IP version, lower first.
253
+ - A function argument can't be hex, as Cloudflare reads `0x10` there as a
254
+ name.
255
+
210
256
  Inline lists only work with `in`.
211
257
 
212
258
  There are no Boolean literals: `true` is accepted only as the entire
@@ -215,6 +261,23 @@ expression, which matches every request, and a non-Boolean field such as
215
261
  byte literals, such as `65:78:61`, are not supported; write those values as
216
262
  quoted strings.
217
263
 
264
+ Quoted strings are read as Cloudflare reads them:
265
+
266
+ - The escapes are `\"`, `\\`, `\xHH` for a byte, and `\OOO` for a byte in
267
+ octal, up to `\377`. Any other escape, such as `\n` or `\*`, is an error, so
268
+ a wildcard pattern writes a literal `*` as `"a\\*b"`.
269
+ - A string may span lines. When the expression has a syntax error, a string
270
+ that does gets the `syntax.multiline_string_literal` warning, since a missing
271
+ closing quote reads up to the next `"`.
272
+ - After `matches` or `~`, a quoted string is a regex literal, which keeps its
273
+ escapes as written: `"\d"` is valid there, and `"\\d"` matches a backslash
274
+ followed by `d`. Only `\"` outside a `[...]` class becomes `"`, and a `"`
275
+ inside a class does not end the string. Raw strings are read as written
276
+ everywhere, so a pattern passed to a function such as `regex_replace()` is
277
+ written `r"\d"` or `"\\d"`.
278
+ - A map key, as in `http.request.headers["x"]`, must be a quoted string that
279
+ is valid UTF-8, so `[r"x"]` and `["\xff"]` are errors.
280
+
218
281
  ### Maps
219
282
 
220
283
  The request header, cookie, and query argument maps are values too: functions
@@ -225,6 +288,154 @@ argument. A map is never nil, so `coalesce()` returns its first map argument.
225
288
  As in Cloudflare, `[*]` iterates a map's keys in byte order, so
226
289
  `http.request.uri.args[*]` reads `?b=1&a=2` as `a`, then `b`.
227
290
 
291
+ ### Functions Over Arrays
292
+
293
+ As in Cloudflare, a call whose first argument has `[*]` runs once for each
294
+ element and returns an array of the results, so
295
+ `join(substring(http.request.uri.args[*][0], 0, 1), "|")` joins the first byte
296
+ of each query argument's first value. A function maps this way wherever its
297
+ first argument can expand an array, including one that takes an array over an
298
+ array of arrays, as `has_value(http.request.uri.args[*], "x")` checks each query
299
+ argument's values. A nil result drops its element, as `lookup_json_string()`
300
+ gives one for a value without the key, and `starts_with()` and `ends_with()`
301
+ for a nil substring. Over nil, such as a missing header's values, the call
302
+ gives nil rather than an empty array, so
303
+ `len(lower(http.request.headers["x-missing"][*]))` is nil, as
304
+ `len(http.request.headers["x-missing"])` is. Only the first argument may have
305
+ `[*]` (`array_expansion.function_first_argument_only`).
306
+
307
+ The result is an array, so a condition reads it through an index, as in
308
+ `starts_with(http.request.headers.names[*], "x-")[0]`, or `any()` and `all()`
309
+ read it (see Quantifier Predicates). On its own it is no condition
310
+ (`function.result_type_mismatch`).
311
+
312
+ ### Quantifier Predicates
313
+
314
+ `any()` and `all()` read their argument as a function argument is read. One
315
+ that starts with `(`, `not`, `any()` or `all()` can combine conditions with
316
+ `and`, `or` and `xor`, and any other is one comparison, so Cloudflare rejects
317
+ `any(http.request.headers.names[*] eq "a" and http.request.headers.values[*] eq "b")`,
318
+ and validation reports `syntax.unparenthesized_logical_argument` there. A
319
+ comparison over `[*]` has a result for each element, which the conditions
320
+ combine element by element, and `not` negates each. A condition with one
321
+ result, such as `ssl`, cannot combine with those
322
+ (`logical.operand_type_mismatch`), and the predicate needs a result for each
323
+ element (`function.parameter.requires_array_comparison`).
324
+
325
+ A call that gives an array of Booleans, as a Boolean function over `[*]`
326
+ does, is a condition with a result for each element too, so
327
+ `any(starts_with(http.request.headers.names[*], "x-"))` holds when a header
328
+ name starts with `x-`. As in Cloudflare, a call that is the whole argument is
329
+ read as a value, so a `[*]` after it gives single Booleans there, an error,
330
+ while after `not`, in parentheses, or combined with other conditions, as in
331
+ `any((starts_with(http.request.headers.names[*], "x-")[*] and http.request.headers.values[*] eq "1"))`,
332
+ the `[*]` keeps a result for each element. The two readings differ over nil
333
+ too: neither `any()` nor `all()` holds for a value that is nil, so
334
+ `all(starts_with(http.request.headers["x-missing"][*], "x"))` is false, while a
335
+ condition over nil has no results, so
336
+ `all(not starts_with(http.request.headers["x-missing"][*], "x"))` is true.
337
+
338
+ As in Cloudflare, the conditions pair the elements of their arrays by index,
339
+ and the result stops at the shorter array, under `or` too. So an empty array
340
+ leaves nothing for `any()` to find and nothing for `all()` to reject. Live
341
+ requests with the headers `x-qa: 1` and `x-qb: 2` showed it:
342
+
343
+ - `any((http.request.headers.names[*] eq "x-qa" and http.request.headers.values[*] eq "2"))`
344
+ is false, since `x-qa` pairs with its own value, `1`.
345
+ - `any((http.request.headers["x-missing"][*] eq "a" or http.request.headers.names[*] eq "x-qa"))`
346
+ is false.
347
+ - `all((http.request.headers.names[*] eq "zzz" and http.request.headers["x-missing"][*] eq "a"))`
348
+ is true.
349
+
350
+ Pairing means something only for arrays whose elements line up, such as the
351
+ names and values of the request headers. Validation warns with
352
+ `array_expansion.unaligned_arrays` when a predicate pairs arrays from different
353
+ lists, where one `any()` for each array is usually what the rule means. Arrays
354
+ line up when they read the same field and access, directly or through a call
355
+ that gives each element a result, such as `lower()`, or when they come from one
356
+ list: the request header names and values, the query argument names and values,
357
+ or the response header names and values. Raw fields are read before rewrites
358
+ and transforms, so the raw names and values make lists of their own. The
359
+ content scan arrays line up too, as Cloudflare documents them in the order the
360
+ objects were detected. Its documentation says nothing of the order of others,
361
+ such as form fields and JWT claims, so pairing them warns. A map's `[*]`
362
+ iterates its keys in byte order, so it lines up with none of these, and an
363
+ access after `[*]` skips the elements it can't read, so the result lines up
364
+ only with itself.
365
+
366
+ An element Worker context cannot tell makes the result unknown, unless known
367
+ elements settle it. An array may also hold more elements than it lists: when
368
+ `request.cf.requestHeaderNames` is cut, the request header arrays hold the
369
+ listed headers, and others at positions Worker context cannot tell. Their known
370
+ elements still pair with arrays that line up with them, as the warning counts
371
+ them, when each holds as many, but not with other arrays. A pair that would
372
+ settle the result counts only where every array surely has an element. The
373
+ explain output words the reason for a predicate over several arrays by their
374
+ pairs, as in `none of 4 paired element(s) satisfy its predicate`, and for one
375
+ over a single array, such as a call's, by its elements, as in
376
+ `none of 4 element(s) satisfy its predicate`. When a call read as a value gives
377
+ nil, the reason says so, as in
378
+ `function 'starts_with' returned nil, which all() does not hold for`. In the
379
+ analysis AST, each `any()` and `all()` with an argument is a `Quantifier` node
380
+ whose `predicate` holds the argument, and `source`, `op` and `value` are set
381
+ when the argument is one comparison with a right side, under any `not`.
382
+
383
+ ### Conditions Over Each Element as Arguments
384
+
385
+ As in Cloudflare, a function argument read as a condition that reads `[*]` has
386
+ a result for each element, as a quantifier's predicate does: its value is an
387
+ array of Booleans, one for each pair of its arrays, up to the shorter one (see
388
+ Quantifier Predicates). A comparison over `[*]` is such an argument, in
389
+ parentheses or not, and so is a call in parentheses that gives an array of
390
+ Booleans, as in `len((starts_with(http.request.headers.names[*], "x-")))`.
391
+ `len()`, `concat()`, `coalesce()` and `has_value()`'s collection take the
392
+ array, so
393
+ `any(concat((http.request.headers.names[*] eq "x-a"), (http.request.uri.args.names[*] eq "a")))`
394
+ holds when the request has the header or the query argument, without pairing
395
+ the two lists. No call maps over the array, so `len()` gives one Integer. A
396
+ condition over nil has no results, so
397
+ `len((http.request.headers["x-missing"][*] eq "a"))` is 0, while a call that
398
+ is a value gives nil there, which `coalesce()` skips. Like any condition
399
+ argument, the array is never nil, and validation warns that `coalesce()` never
400
+ uses the arguments after one. An element Worker context cannot tell keeps its
401
+ place as unknown, also through `concat()`, and `len()`, `has_value()`, `any()`
402
+ and `all()` read it only where their result depends on it.
403
+
404
+ Validation checks each comparison over each element as a comparison of single
405
+ elements, with the `operator.*` diagnostics, and the array as its parameter's
406
+ value, so `lower((http.request.headers.names[*] eq "a"))` gets
407
+ `function.parameter.requires_typed_value`. Conditions with a result for each
408
+ element combine only with each other (`logical.operand_type_mismatch`), and
409
+ those over arrays from different lists get `array_expansion.unaligned_arrays`,
410
+ naming the function they are an argument of. Where a condition needs a single
411
+ result, as a whole expression or combined with one, a comparison over `[*]`
412
+ gets `array_expansion.direct_comparison`, and a call that gives an array of
413
+ Booleans gets `function.result_type_mismatch`. Dry runs on 2026-10-20 and
414
+ 2026-10-21 showed these, and
415
+ [`test/fixtures/rules-engine-probes.json`](https://github.com/Func86/libreflare-worker-runtime/blob/master/test/fixtures/rules-engine-probes.json)
416
+ records them. In the analysis AST, a condition with a result for each element,
417
+ as an argument or a quantifier's predicate, has the `valueType`
418
+ `Array<Boolean>`.
419
+
420
+ ### Query Arguments
421
+
422
+ Cloudflare reads the query as the client sent it, and decodes nothing in it,
423
+ as live requests over HTTP/1.1, HTTP/2 and HTTP/3 showed
424
+ ([`test/fixtures/query-arg-probes.json`](https://github.com/Func86/libreflare-worker-runtime/blob/master/test/fixtures/query-arg-probes.json)).
425
+ So `?search=red+apples` gives the value `red+apples`, and in `?%61=1`, the key
426
+ is `%61`, not `a`. The query splits at each `&`, and an argument at its first
427
+ `=`. A `;` does not separate arguments, empty arguments are skipped, and one
428
+ without `=`, as in `?a`, has an empty value. `remove_query_args()` removes the
429
+ arguments whose names match exactly, drops empty ones, and keeps the others as
430
+ sent, joined with `&`. `http.request.uri` and `http.request.full_uri` keep a
431
+ `?` with nothing after it.
432
+
433
+ Workers keeps `request.url` as sent too, and the query fields read the query
434
+ from it as written, since `new URL()` percent-encodes `"`, `<`, `>` and `'` in
435
+ a query. Cloudflare answers 400 to a query with a space, a control character or
436
+ a byte outside ASCII before any rule runs, and drops a fragment, so `?a=#b`
437
+ reads as `a=`.
438
+
228
439
  ### Request Headers
229
440
 
230
441
  Workers lowercases and sorts request header names, joins repeated headers into
@@ -320,9 +531,9 @@ headers count once, and over HTTP/1 their names are lowercase rather than the
320
531
  client's spelling. Cloudflare's order followed no protocol's layout in the
321
532
  probe, so positions in the names and values follow the order above, and
322
533
  validation warns where a rule reads them by index or through `join()`, also by
323
- way of `coalesce()`, `concat()` and functions that map over them. The raw
324
- header fields are unknown on a solve, so reading them in order gets no such
325
- warning.
534
+ way of `coalesce()`, `concat()` and functions that map over them, or where
535
+ `any()` or `all()` pairs them with an array from another list. The raw header
536
+ fields are unknown on a solve, so reading them in order gets no such warning.
326
537
 
327
538
  Cloudflare replays a challenged POST with its body, so it keeps its
328
539
  `Content-Type` and is not taken for a solve. Cloudflare's header fields read
@@ -1 +1 @@
1
- {"version":3,"file":"log-handler.d.ts","sourceRoot":"","sources":["../src/log-handler.ts"],"names":[],"mappings":"AAKA,OAAO,EAKN,KAAK,4BAA4B,EAEjC,KAAK,yBAAyB,EAC9B,MAAM,qBAAqB,CAAC;AAE7B,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAC;AAE/E,MAAM,WAAW,gBAAgB;IAChC,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,iCAAiC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,KAAK,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtG,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,YAAY,CA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;IAC3C,sBAAsB,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,GAAG,MAAM,CAAC;CACpD;AAED,MAAM,WAAW,+BAAgC,SAAQ,iCAAiC;IACzF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sBAAsB,CAAC,EAAE,yBAAyB,CAAC;CACnD;AAwDD,wBAAsB,uBAAuB,CAAC,GAAG,SAAS,MAAM,EAC/D,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,gBAAgB,EACrB,OAAO,GAAE,+BAAoC,GAC3C,OAAO,CAAC,QAAQ,CAAC,CAoDnB;AA4BD,wBAAsB,aAAa,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,0BAA0B,EAClC,GAAG,CAAC,EAAE,gBAAgB,GACpB,OAAO,CAAC,QAAQ,CAAC,CAmGnB"}
@@ -101,17 +101,25 @@ export async function handleLibreflareRequest(request, env, ctx, options = {}) {
101
101
  function resolveRouteLoggingSourceKey(request, routeLogging, stripWorkerRoutePrefix) {
102
102
  if (!routeLogging?.sourceKeyRules?.length)
103
103
  return undefined;
104
- const strippedUrl = stripWorkerRoutePrefix ? stripWorkerRoutePrefix(new URL(request.url)) : undefined;
104
+ const path = rulePath(request, stripWorkerRoutePrefix);
105
105
  for (const rule of routeLogging.sourceKeyRules) {
106
106
  const result = evaluateExpression(rule.expression, request, {
107
107
  inferListMatches: false,
108
- url: strippedUrl,
108
+ path,
109
109
  });
110
110
  if (result.matched)
111
111
  return rule.sourceKey;
112
112
  }
113
113
  return undefined;
114
114
  }
115
+ /**
116
+ * The path rules read. Cloudflare runs a route's rule on the visitor's request,
117
+ * before the rewrite that adds the route prefix, so only the path differs from
118
+ * the Worker's request.
119
+ */
120
+ function rulePath(request, stripWorkerRoutePrefix) {
121
+ return stripWorkerRoutePrefix ? new URL(stripWorkerRoutePrefix(new URL(request.url))).pathname : undefined;
122
+ }
115
123
  export async function handleRequest(request, config, ctx) {
116
124
  workerTimestamp ??= new Date().toISOString();
117
125
  if (!config.noPassthrough) {
@@ -129,9 +137,7 @@ export async function handleRequest(request, config, ctx) {
129
137
  }
130
138
  const sourceKey = sourceKeyBase + (config.varyByMonth ? '-' + new Date().getMonth() : '');
131
139
  const requestMetadata = buildMetadataFromHeaders(request.headers);
132
- const ruleEvaluationUrl = config.ruleExpression && config.stripWorkerRoutePrefix
133
- ? config.stripWorkerRoutePrefix(new URL(request.url))
134
- : undefined;
140
+ const ruleEvaluationPath = config.ruleExpression ? rulePath(request, config.stripWorkerRoutePrefix) : undefined;
135
141
  const rUrl = request.url;
136
142
  const rMeth = request.method;
137
143
  const { tlsClientAuth: _, ...rCf } = request.cf;
@@ -174,7 +180,7 @@ export async function handleRequest(request, config, ctx) {
174
180
  if (config.ruleExpression) {
175
181
  const rule = evaluateExpression(config.ruleExpression, request, {
176
182
  response,
177
- url: ruleEvaluationUrl,
183
+ path: ruleEvaluationPath,
178
184
  customLists: config.customLists,
179
185
  });
180
186
  const matchChain = rule.matchChainCompat.join(' -> ');
@@ -1 +1 @@
1
- {"version":3,"file":"log-handler.js","sourceRoot":"","sources":["../src/log-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAC;AACnD,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACN,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,sBAAsB,IAAI,6BAA6B,GAIvD,MAAM,qBAAqB,CAAC;AAqC7B,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,UAAU,CAAC,OAAO,EAA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CAAC,CAAC,SAAS;QACX,CAAC,CAAC,yCAAyC,CAAC;AAC9C,CAAC"}
@@ -12,19 +12,32 @@ export declare function isUnknownElement(element: ElementValue): element is Unkn
12
12
  /**
13
13
  * An array some of whose elements are unknown while evaluating, such as the
14
14
  * request header values when Worker context lacks one. Its known elements can
15
- * still settle any() and all(), and an index whose position is certain;
16
- * anything that reads the whole array is unknown. Unknown elements keep their
17
- * positions, unless `more` says the array may hold further elements, at
18
- * positions it cannot tell.
15
+ * still settle any() and all(), and an index whose position is certain, and
16
+ * concat() keeps them; anything else that reads the whole array is unknown.
17
+ * Unknown elements keep their positions, unless `more` says the array may
18
+ * hold further elements, at positions it cannot tell, though arrays from one
19
+ * list still line up; see evaluatePairedQuantifier().
19
20
  */
20
21
  export declare class PartialArrayValue {
21
22
  readonly elements: readonly ElementValue[];
22
23
  readonly more: UnknownElement | undefined;
23
24
  /** The first unknown element, or `more`. */
24
25
  private readonly firstUnknown;
26
+ /** The only elements `more` may be, when every element is known; see from(). */
27
+ readonly optional?: readonly ElementValue[] | undefined;
25
28
  private constructor();
26
- /** An array of elements, partly known when one is unknown or more may follow. */
27
- static from(elements: readonly ElementValue[], more?: UnknownElement): CfValue[] | PartialArrayValue;
29
+ /**
30
+ * An array of elements, partly known when one is unknown or more may
31
+ * follow. When `more` may be only some of `optional`, as the results of
32
+ * conditions over a collection that may end early, `optional` lists them.
33
+ */
34
+ static from(elements: readonly ElementValue[], more?: UnknownElement, optional?: readonly ElementValue[]): CfValue[] | PartialArrayValue;
35
+ /**
36
+ * Why the array may hold a matching element besides its known ones: its
37
+ * first unknown element, or that it may hold more, unless it may hold only
38
+ * optional elements, none of which match.
39
+ */
40
+ unknownMatch(matches: (value: CfValue) => boolean): UnknownElement | undefined;
28
41
  /** Why the whole array is unknown: its first unknown element, or that it may hold more. */
29
42
  unknown(): Unknown;
30
43
  /** The known elements' values, and why the others, or more, are unknown. */
@@ -1 +1 @@
1
- {"version":3,"file":"access-values.d.ts","sourceRoot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EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,YAAY;IACtD,4CAA4C;IAC3B,IAAI,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC;IAChD,qEAAqE;IACpD,IAAI,CAAC,EAAE,cAAc,YAAA;IAGvC,iEAAiE;IACjE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;IAIpC;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;IAMpC,gDAAgD;IAChD,MAAM,IAAI,OAAO,EAAE,GAAG,iBAAiB;CAOvC;AAED,uFAAuF;AACvF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,iBAAiB,GAAG,YAAY,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC,YAAY,CAAC,CAkBtH;AAcD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAE/F"}
@@ -9,31 +9,56 @@ function evaluatedElement(value) {
9
9
  /**
10
10
  * An array some of whose elements are unknown while evaluating, such as the
11
11
  * request header values when Worker context lacks one. Its known elements can
12
- * still settle any() and all(), and an index whose position is certain;
13
- * anything that reads the whole array is unknown. Unknown elements keep their
14
- * positions, unless `more` says the array may hold further elements, at
15
- * positions it cannot tell.
12
+ * still settle any() and all(), and an index whose position is certain, and
13
+ * concat() keeps them; anything else that reads the whole array is unknown.
14
+ * Unknown elements keep their positions, unless `more` says the array may
15
+ * hold further elements, at positions it cannot tell, though arrays from one
16
+ * list still line up; see evaluatePairedQuantifier().
16
17
  */
17
18
  export class PartialArrayValue {
18
19
  elements;
19
20
  more;
20
21
  firstUnknown;
22
+ optional;
21
23
  constructor(elements, more,
22
24
  /** The first unknown element, or `more`. */
23
- firstUnknown) {
25
+ firstUnknown,
26
+ /** The only elements `more` may be, when every element is known; see from(). */
27
+ optional) {
24
28
  this.elements = elements;
25
29
  this.more = more;
26
30
  this.firstUnknown = firstUnknown;
31
+ this.optional = optional;
27
32
  }
28
- /** An array of elements, partly known when one is unknown or more may follow. */
29
- static from(elements, more) {
33
+ /**
34
+ * An array of elements, partly known when one is unknown or more may
35
+ * follow. When `more` may be only some of `optional`, as the results of
36
+ * conditions over a collection that may end early, `optional` lists them.
37
+ */
38
+ static from(elements, more, optional) {
30
39
  const values = [];
31
40
  for (const element of elements) {
32
41
  if (isUnknownElement(element))
33
42
  return new PartialArrayValue(elements, more, element);
34
43
  values.push(element.value);
35
44
  }
36
- return more ? new PartialArrayValue(elements, more, more) : values;
45
+ return more ? new PartialArrayValue(elements, more, more, optional) : values;
46
+ }
47
+ /**
48
+ * Why the array may hold a matching element besides its known ones: its
49
+ * first unknown element, or that it may hold more, unless it may hold only
50
+ * optional elements, none of which match.
51
+ */
52
+ unknownMatch(matches) {
53
+ if (!this.optional)
54
+ return this.firstUnknown;
55
+ for (const element of this.optional) {
56
+ if (isUnknownElement(element))
57
+ return element;
58
+ if (matches(element.value))
59
+ return this.more;
60
+ }
61
+ return undefined;
37
62
  }
38
63
  /** Why the whole array is unknown: its first unknown element, or that it may hold more. */
39
64
  unknown() {