@libreflare/worker-runtime 0.10.0 → 0.10.2
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/README.md +115 -20
- package/dist/rule-evaluator/ast.d.ts +6 -0
- package/dist/rule-evaluator/ast.d.ts.map +1 -1
- package/dist/rule-evaluator/ast.js +18 -0
- package/dist/rule-evaluator/ast.js.map +1 -1
- package/dist/rule-evaluator/edge-evaluation.d.ts +28 -8
- package/dist/rule-evaluator/edge-evaluation.d.ts.map +1 -1
- package/dist/rule-evaluator/edge-evaluation.js +41 -18
- package/dist/rule-evaluator/edge-evaluation.js.map +1 -1
- package/dist/rule-evaluator/edge-field-gaps.d.ts +52 -0
- package/dist/rule-evaluator/edge-field-gaps.d.ts.map +1 -0
- package/dist/rule-evaluator/edge-field-gaps.js +281 -0
- package/dist/rule-evaluator/edge-field-gaps.js.map +1 -0
- package/dist/rule-evaluator/edge-record.d.ts +29 -6
- package/dist/rule-evaluator/edge-record.d.ts.map +1 -1
- package/dist/rule-evaluator/edge-record.js +27 -18
- package/dist/rule-evaluator/edge-record.js.map +1 -1
- package/dist/rule-evaluator/validation.d.ts.map +1 -1
- package/dist/rule-evaluator/validation.js +4 -8
- package/dist/rule-evaluator/validation.js.map +1 -1
- package/dist/rule-evaluator.d.ts +2 -0
- package/dist/rule-evaluator.d.ts.map +1 -1
- package/dist/rule-evaluator.js +1 -0
- package/dist/rule-evaluator.js.map +1 -1
- package/dist/tools/explain-rule-miss.js +4 -3
- package/dist/tools/explain-rule-miss.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type EdgeLoggedFields } from './edge-record.js';
|
|
2
|
+
import type { TokenizeOptions } from './tokenizer.js';
|
|
3
|
+
/**
|
|
4
|
+
* The fields an edge record holds, by what the probes showed equal to the
|
|
5
|
+
* rules engine's values (README, Edge Record Evaluation > Fields), but for
|
|
6
|
+
* the request headers and cookies, which depend on the zone's logged fields,
|
|
7
|
+
* and the TLS client hashes, which depend on whether the zone copies them.
|
|
8
|
+
* `test/edge-field-gaps.test.ts` checks this list against the resolver on
|
|
9
|
+
* every probe record.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EDGE_RECORD_FIELDS: ReadonlySet<string>;
|
|
12
|
+
/** The TLS client hashes, which edge records hold on a zone that copies them. */
|
|
13
|
+
export declare const EDGE_COPIED_TLS_HASH_FIELDS: ReadonlySet<string>;
|
|
14
|
+
export interface EdgeExpressionFieldGapOptions extends Pick<TokenizeOptions, 'comments'> {
|
|
15
|
+
/** The zone's logged headers and cookies. Without them, every header and cookie read by name is a gap. */
|
|
16
|
+
loggedFields?: EdgeLoggedFields;
|
|
17
|
+
/** Whether the zone copies the TLS client hashes into its records. */
|
|
18
|
+
copiedTlsHashes?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** What an expression reads that edge records lack, each list sorted and without repeats. */
|
|
21
|
+
export interface EdgeExpressionFieldGaps {
|
|
22
|
+
/**
|
|
23
|
+
* Fields no edge record holds, as the expression names them. A header or
|
|
24
|
+
* cookie read by name is among them when no custom field can log it, and
|
|
25
|
+
* so is a cookie whose name differs only in case from another logged
|
|
26
|
+
* cookie's, or one the zone does not log whose name differs only in case
|
|
27
|
+
* from another such cookie the expression reads: Logpush keys a cookie by
|
|
28
|
+
* its name in lowercase, so of two such cookies logged, both are unknown
|
|
29
|
+
* on every record that sends them.
|
|
30
|
+
*/
|
|
31
|
+
fields: string[];
|
|
32
|
+
/** The TLS client hashes the expression reads, on a zone that does not copy them. */
|
|
33
|
+
tlsHashes: string[];
|
|
34
|
+
/** Request headers read by name that the zone does not log raw, a header it logs transformed included. Logging them raw adds them. */
|
|
35
|
+
headers: string[];
|
|
36
|
+
/** Cookies read by name that the zone does not log. Logging them adds them. */
|
|
37
|
+
cookies: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Lists what an expression reads that edge records cannot hold, with the
|
|
41
|
+
* zone's logged fields and copied TLS hashes, so that a dashboard can say what
|
|
42
|
+
* evaluation on edge records will leave unknown and what would fix it. It
|
|
43
|
+
* reads the expression's fields, not a record: a field a record holds can
|
|
44
|
+
* still be missing from one, such as the TLS version over plain HTTP. It
|
|
45
|
+
* describes records nested as the mapping writes them, which an evaluator
|
|
46
|
+
* gets before storage. Flattened, as VictoriaLogs returns them, a header
|
|
47
|
+
* named cookie.<name> and cookie <name> share a key too, which it does not
|
|
48
|
+
* list. It expects an expression that validation accepts, as evaluation
|
|
49
|
+
* gives any other `unavailable`, whatever it reads.
|
|
50
|
+
*/
|
|
51
|
+
export declare function edgeExpressionFieldGaps(expression: string, options?: EdgeExpressionFieldGapOptions): EdgeExpressionFieldGaps;
|
|
52
|
+
//# sourceMappingURL=edge-field-gaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-field-gaps.d.ts","sourceRoot":"","sources":["../../src/rule-evaluator/edge-field-gaps.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAKrG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAgDjD,CAAC;AAEH,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAG1D,CAAC;AAsBH,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;IACvF,0GAA0G;IAC1G,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,6FAA6F;AAC7F,MAAM,WAAW,uBAAuB;IACvC;;;;;;;;OAQG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,qFAAqF;IACrF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,sIAAsI;IACtI,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,6BAAkC,GAAG,uBAAuB,CA8HhI"}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { isBooleanLiteralName, isNeverNilArgument } from './ast.js';
|
|
2
|
+
import { STANDARD_HEADERS, UNLOGGED_REQUEST_HEADERS } from './edge-record.js';
|
|
3
|
+
import { parseExpression } from './parse-cache.js';
|
|
4
|
+
import { keepsPlacesWhenMapped } from './quantifier.js';
|
|
5
|
+
import { inferFunctionInvocation } from './rule-language-types.js';
|
|
6
|
+
import { renderRuleExpressionStringLiteral } from './string-literals.js';
|
|
7
|
+
/**
|
|
8
|
+
* The fields an edge record holds, by what the probes showed equal to the
|
|
9
|
+
* rules engine's values (README, Edge Record Evaluation > Fields), but for
|
|
10
|
+
* the request headers and cookies, which depend on the zone's logged fields,
|
|
11
|
+
* and the TLS client hashes, which depend on whether the zone copies them.
|
|
12
|
+
* `test/edge-field-gaps.test.ts` checks this list against the resolver on
|
|
13
|
+
* every probe record.
|
|
14
|
+
*/
|
|
15
|
+
export const EDGE_RECORD_FIELDS = new Set([
|
|
16
|
+
'cf.client.bot',
|
|
17
|
+
'cf.edge.client_port',
|
|
18
|
+
'cf.edge.client_tcp',
|
|
19
|
+
'cf.ray_id',
|
|
20
|
+
'cf.timings.client_tcp_rtt_msec',
|
|
21
|
+
'cf.tls_cipher',
|
|
22
|
+
'cf.tls_version',
|
|
23
|
+
'cf.verified_bot_category',
|
|
24
|
+
'cf.worker.upstream_zone',
|
|
25
|
+
'cf.zone.name',
|
|
26
|
+
'http.host',
|
|
27
|
+
'http.referer',
|
|
28
|
+
'http.request.full_uri',
|
|
29
|
+
'http.request.headers.truncated',
|
|
30
|
+
'http.request.method',
|
|
31
|
+
'http.request.timestamp.msec',
|
|
32
|
+
'http.request.timestamp.sec',
|
|
33
|
+
'http.request.uri',
|
|
34
|
+
'http.request.uri.args',
|
|
35
|
+
'http.request.uri.args.names',
|
|
36
|
+
'http.request.uri.args.values',
|
|
37
|
+
'http.request.uri.path',
|
|
38
|
+
'http.request.uri.path.basename',
|
|
39
|
+
'http.request.uri.path.extension',
|
|
40
|
+
'http.request.uri.query',
|
|
41
|
+
'http.request.version',
|
|
42
|
+
'http.user_agent',
|
|
43
|
+
'ip.geoip.asnum',
|
|
44
|
+
'ip.geoip.country',
|
|
45
|
+
'ip.geoip.subdivision_1_iso_code',
|
|
46
|
+
'ip.src',
|
|
47
|
+
'ip.src.asnum',
|
|
48
|
+
'ip.src.city',
|
|
49
|
+
'ip.src.country',
|
|
50
|
+
'ip.src.lat',
|
|
51
|
+
'ip.src.lon',
|
|
52
|
+
'ip.src.region_code',
|
|
53
|
+
'ip.src.subdivision_1_iso_code',
|
|
54
|
+
'raw.http.request.full_uri',
|
|
55
|
+
'raw.http.request.uri',
|
|
56
|
+
'raw.http.request.uri.args',
|
|
57
|
+
'raw.http.request.uri.args.names',
|
|
58
|
+
'raw.http.request.uri.args.values',
|
|
59
|
+
'raw.http.request.uri.path',
|
|
60
|
+
'raw.http.request.uri.path.extension',
|
|
61
|
+
'raw.http.request.uri.query',
|
|
62
|
+
'ssl',
|
|
63
|
+
]);
|
|
64
|
+
/** The TLS client hashes, which edge records hold on a zone that copies them. */
|
|
65
|
+
export const EDGE_COPIED_TLS_HASH_FIELDS = new Set([
|
|
66
|
+
'cf.tls_client_ciphers_sha1',
|
|
67
|
+
'cf.tls_client_extensions_sha1',
|
|
68
|
+
]);
|
|
69
|
+
/** The request header maps, read by header name. */
|
|
70
|
+
const HEADER_MAPS = new Set(['http.request.headers', 'raw.http.request.headers']);
|
|
71
|
+
/** Fields that read one request header, which a record holds when the zone logs it raw. */
|
|
72
|
+
const HEADER_FIELDS = new Map([
|
|
73
|
+
['http.request.accepted_languages', 'accept-language'],
|
|
74
|
+
['http.x_forwarded_for', 'x-forwarded-for'],
|
|
75
|
+
]);
|
|
76
|
+
/**
|
|
77
|
+
* Headers no record holds, whatever the zone logs, besides those Cloudflare
|
|
78
|
+
* does not log: the record keeps the host in lowercase, Cloudflare adds
|
|
79
|
+
* X-Forwarded-Proto but not to the request it rebuilds on a challenge solve,
|
|
80
|
+
* and the Cookie header holds cookies the zone did not log.
|
|
81
|
+
*/
|
|
82
|
+
const UNHELD_HEADERS = new Set(['host', 'x-forwarded-proto', 'cookie']);
|
|
83
|
+
/** The names a custom field can log, header or cookie: tokens (RFC 9110), which header names are in lowercase. */
|
|
84
|
+
const TOKEN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
85
|
+
/**
|
|
86
|
+
* Lists what an expression reads that edge records cannot hold, with the
|
|
87
|
+
* zone's logged fields and copied TLS hashes, so that a dashboard can say what
|
|
88
|
+
* evaluation on edge records will leave unknown and what would fix it. It
|
|
89
|
+
* reads the expression's fields, not a record: a field a record holds can
|
|
90
|
+
* still be missing from one, such as the TLS version over plain HTTP. It
|
|
91
|
+
* describes records nested as the mapping writes them, which an evaluator
|
|
92
|
+
* gets before storage. Flattened, as VictoriaLogs returns them, a header
|
|
93
|
+
* named cookie.<name> and cookie <name> share a key too, which it does not
|
|
94
|
+
* list. It expects an expression that validation accepts, as evaluation
|
|
95
|
+
* gives any other `unavailable`, whatever it reads.
|
|
96
|
+
*/
|
|
97
|
+
export function edgeExpressionFieldGaps(expression, options = {}) {
|
|
98
|
+
const { loggedFields, copiedTlsHashes = false } = options;
|
|
99
|
+
// The evaluator reads a header logged transformed as unknown, even when the zone logs it raw too.
|
|
100
|
+
const transformed = new Set((loggedFields?.transformedRequestHeaders ?? []).map(name => name.toLowerCase()));
|
|
101
|
+
const loggedRaw = new Set((loggedFields?.requestHeaders ?? []).map(name => name.toLowerCase()).filter(name => !transformed.has(name)));
|
|
102
|
+
const loggedCookies = new Set(loggedFields?.cookies ?? []);
|
|
103
|
+
const fields = new Set();
|
|
104
|
+
const tlsHashes = new Set();
|
|
105
|
+
const headers = new Set();
|
|
106
|
+
const cookieReads = new Set();
|
|
107
|
+
/**
|
|
108
|
+
* Reads a header by name. Of Host, which every request sends once, only
|
|
109
|
+
* the value is unknown, so a read that does not reach it is no gap.
|
|
110
|
+
*/
|
|
111
|
+
const readHeader = (header, field, readsValue) => {
|
|
112
|
+
if (STANDARD_HEADERS.has(header))
|
|
113
|
+
return;
|
|
114
|
+
if (header === 'host' && !readsValue)
|
|
115
|
+
return;
|
|
116
|
+
if (UNHELD_HEADERS.has(header) || UNLOGGED_REQUEST_HEADERS.has(header) || (!loggedRaw.has(header) && !TOKEN.test(header)))
|
|
117
|
+
fields.add(field);
|
|
118
|
+
else if (!loggedRaw.has(header))
|
|
119
|
+
headers.add(header);
|
|
120
|
+
};
|
|
121
|
+
/** Reads a field, or a map field by key, and whether the read reaches the key's first value. */
|
|
122
|
+
const readField = (name, key, readsValue = true) => {
|
|
123
|
+
if (HEADER_MAPS.has(name)) {
|
|
124
|
+
if (key === undefined)
|
|
125
|
+
fields.add(name);
|
|
126
|
+
// The engine's keys are lowercase, so a key with uppercase letters reads no header.
|
|
127
|
+
else if (key === key.toLowerCase())
|
|
128
|
+
readHeader(key, `${name}[${renderRuleExpressionStringLiteral(key)}]`, readsValue);
|
|
129
|
+
}
|
|
130
|
+
else if (name === 'http.request.cookies') {
|
|
131
|
+
if (key === undefined)
|
|
132
|
+
fields.add(name);
|
|
133
|
+
else
|
|
134
|
+
cookieReads.add(key);
|
|
135
|
+
}
|
|
136
|
+
else if (HEADER_FIELDS.has(name)) {
|
|
137
|
+
readHeader(HEADER_FIELDS.get(name), name, true);
|
|
138
|
+
}
|
|
139
|
+
else if (EDGE_COPIED_TLS_HASH_FIELDS.has(name)) {
|
|
140
|
+
if (!copiedTlsHashes)
|
|
141
|
+
tlsHashes.add(name);
|
|
142
|
+
}
|
|
143
|
+
else if (!EDGE_RECORD_FIELDS.has(name)) {
|
|
144
|
+
fields.add(name);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Reads a value with `after` applied after its own accesses, and whether
|
|
149
|
+
* the read takes what they give, or only whether it is there or how many,
|
|
150
|
+
* as has_key() and len() do: a field, coalesce(), which gives its first
|
|
151
|
+
* operand that is not nil, or the count of the arrays concat() joins, when
|
|
152
|
+
* it joins them once rather than for each element of one. Through any
|
|
153
|
+
* other call, and a comparison, a read takes the values.
|
|
154
|
+
*/
|
|
155
|
+
const readAccessed = (node, after, takesValues) => {
|
|
156
|
+
if (node?.kind === 'Field') {
|
|
157
|
+
const [first, next] = [...node.accessPath, ...after];
|
|
158
|
+
// Past the first, Host's values are nil.
|
|
159
|
+
if (first?.kind === 'MapKeyAccess')
|
|
160
|
+
readField(node.name, first.key, next ? !(next.kind === 'ArrayIndexAccess' && next.index > 0) : takesValues);
|
|
161
|
+
else
|
|
162
|
+
readField(node.name);
|
|
163
|
+
}
|
|
164
|
+
else if (node?.kind === 'Func' && node.name === 'coalesce') {
|
|
165
|
+
const path = [...node.accessPath, ...after];
|
|
166
|
+
// Called for each element of its first operand, it takes the element, which is never nil: an index past
|
|
167
|
+
// an element's end drops it, a call that maps drops its nil results, and an unknown element stays unknown.
|
|
168
|
+
const direct = isDirectCall(node);
|
|
169
|
+
for (const operand of node.args) {
|
|
170
|
+
readAccessed(operand, path, takesValues);
|
|
171
|
+
if (!direct || isNeverNil(operand))
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else if (node?.kind === 'Func' && node.name === 'concat' && !takesValues && after.length === 0 && node.accessPath.length === 0 && isDirectCall(node)) {
|
|
176
|
+
// Joined arrays count their operands' elements. Joined strings need the operands' values, which their own accesses reach.
|
|
177
|
+
for (const operand of node.args)
|
|
178
|
+
readAccessed(operand, [], false);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
visit(node);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
const visit = (node) => {
|
|
185
|
+
if (Array.isArray(node)) {
|
|
186
|
+
for (const child of node)
|
|
187
|
+
visit(child);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (typeof node !== 'object' || node === null)
|
|
191
|
+
return;
|
|
192
|
+
const { kind } = node;
|
|
193
|
+
if (kind === 'Field') {
|
|
194
|
+
readAccessed(node, [], true);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (kind === 'BoolField') {
|
|
198
|
+
const { name } = node;
|
|
199
|
+
// The match-all expression `true` reads no field.
|
|
200
|
+
if (!isBooleanLiteralName(name))
|
|
201
|
+
readField(name);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (kind === 'Func') {
|
|
205
|
+
const call = node;
|
|
206
|
+
const [operand, key, ...rest] = call.args;
|
|
207
|
+
if (call.name === 'coalesce') {
|
|
208
|
+
readAccessed(call, [], true);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
// has_key() with a literal key reads only whether that key is there.
|
|
212
|
+
if (call.name === 'has_key' && key?.kind === 'StringLiteral') {
|
|
213
|
+
readAccessed(operand, [{ kind: 'MapKeyAccess', key: key.value }], false);
|
|
214
|
+
visit(rest);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
// len() of an array reads only how many elements it has.
|
|
218
|
+
if (call.name === 'len') {
|
|
219
|
+
readAccessed(operand, [], false);
|
|
220
|
+
visit(call.args.slice(1));
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
for (const value of Object.values(node))
|
|
225
|
+
visit(value);
|
|
226
|
+
};
|
|
227
|
+
visit(parseExpression(expression, [], { comments: options.comments }));
|
|
228
|
+
// Two cookies that Logpush would key alike cannot both be logged, and of those the zone could add, only tokens.
|
|
229
|
+
const candidates = [...cookieReads].filter(name => !loggedCookies.has(name) && TOKEN.test(name));
|
|
230
|
+
const sharesKey = (cookie, names) => [...names].some(name => name !== cookie && name.toLowerCase() === cookie.toLowerCase());
|
|
231
|
+
const cookies = new Set();
|
|
232
|
+
for (const cookie of cookieReads) {
|
|
233
|
+
const logged = loggedCookies.has(cookie);
|
|
234
|
+
if (sharesKey(cookie, loggedCookies) || (!logged && (!TOKEN.test(cookie) || sharesKey(cookie, candidates)))) {
|
|
235
|
+
fields.add(`http.request.cookies[${renderRuleExpressionStringLiteral(cookie)}]`);
|
|
236
|
+
}
|
|
237
|
+
else if (!logged) {
|
|
238
|
+
cookies.add(cookie);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const sorted = (values) => [...values].sort();
|
|
242
|
+
return { fields: sorted(fields), tlsHashes: sorted(tlsHashes), headers: sorted(headers), cookies: sorted(cookies) };
|
|
243
|
+
}
|
|
244
|
+
/** Whether a call runs once, rather than for each element of an operand, which may have none. */
|
|
245
|
+
function isDirectCall(node) {
|
|
246
|
+
return inferFunctionInvocation(node).mapping === 'direct';
|
|
247
|
+
}
|
|
248
|
+
/** The array a call maps over, from its first operand: that operand up to the `[*]` that expands it. */
|
|
249
|
+
function mappedSource(node) {
|
|
250
|
+
if (node.kind !== 'Field' && node.kind !== 'Func')
|
|
251
|
+
return node;
|
|
252
|
+
const index = node.accessPath.findIndex(access => access.kind === 'ArrayWildcardAccess');
|
|
253
|
+
return index < 0 ? node : { ...node, accessPath: node.accessPath.slice(0, index) };
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Whether a value is never nil, so that coalesce() gives it and reads no
|
|
257
|
+
* operand after it: what validation takes as never nil (isNeverNilArgument()),
|
|
258
|
+
* Host's values, which every request has, a direct coalesce() of one of
|
|
259
|
+
* these, a direct call such as lower() of operands that all are, and a call
|
|
260
|
+
* for each element of an array that is one. Such a call gives an array,
|
|
261
|
+
* empty or not, unless the array is nil.
|
|
262
|
+
*/
|
|
263
|
+
function isNeverNil(node) {
|
|
264
|
+
if (isNeverNilArgument(node))
|
|
265
|
+
return true;
|
|
266
|
+
if (node.kind === 'Field') {
|
|
267
|
+
const [first, ...rest] = node.accessPath;
|
|
268
|
+
return HEADER_MAPS.has(node.name) && first?.kind === 'MapKeyAccess' && first.key === 'host' && rest.length === 0;
|
|
269
|
+
}
|
|
270
|
+
if (node.kind !== 'Func' || node.accessPath.length > 0)
|
|
271
|
+
return false;
|
|
272
|
+
if (isDirectCall(node)) {
|
|
273
|
+
if (node.name === 'coalesce')
|
|
274
|
+
return node.args.some(isNeverNil);
|
|
275
|
+
// A call that gives each value it accepts a result, mapped or not, gives nil only for a nil operand.
|
|
276
|
+
return keepsPlacesWhenMapped(node.name) && node.args.every(operand => isNeverNil(operand));
|
|
277
|
+
}
|
|
278
|
+
const [source] = node.args;
|
|
279
|
+
return source !== undefined && isNeverNil(mappedSource(source));
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=edge-field-gaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-field-gaps.js","sourceRoot":"","sources":["../../src/rule-evaluator/edge-field-gaps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAsE,MAAM,UAAU,CAAC;AACxI,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAyB,MAAM,kBAAkB,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAGzE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC9D,eAAe;IACf,qBAAqB;IACrB,oBAAoB;IACpB,WAAW;IACX,gCAAgC;IAChC,eAAe;IACf,gBAAgB;IAChB,0BAA0B;IAC1B,yBAAyB;IACzB,cAAc;IACd,WAAW;IACX,cAAc;IACd,uBAA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EdgeLoggedFields;
|
|
30
30
|
/** The zone's URL normalization. Without it, a path that a normalization would change is unknown. */
|
|
31
31
|
urlNormalization?: UrlNormalization;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the record keeps the request header and cookie values sent
|
|
34
|
+
* empty, as the edge log mapping passes them on before VictoriaLogs drops
|
|
35
|
+
* them. A logged header or cookie the record lacks was then not sent.
|
|
36
|
+
* User-Agent, Referer and X-Requested-With, which the mapping takes from
|
|
37
|
+
* Logpush's standard fields, stay not sent or sent empty.
|
|
38
|
+
*/
|
|
39
|
+
keepsEmptyValues?: boolean;
|
|
32
40
|
}
|
|
33
41
|
/** A record's time, from `_time`, which Cloudflare's EdgeStartTimestamp sets. */
|
|
34
42
|
export interface EdgeRecordTime {
|
|
@@ -39,10 +47,15 @@ export interface EdgeRecordTime {
|
|
|
39
47
|
/** As http.request.timestamp.msec reads it: the millisecond within the second. */
|
|
40
48
|
readonly msec: number;
|
|
41
49
|
}
|
|
42
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* An entry of the record's MatchedRules, which has one per product. The
|
|
52
|
+
* transform entry lists the matched rules of every transform ruleset, URL
|
|
53
|
+
* rewrites first, then request and response header rules, each ruleset's in
|
|
54
|
+
* rule order. Its ruleset ID and version are the first matched ruleset's.
|
|
55
|
+
*/
|
|
43
56
|
export interface EdgeMatchedRuleset {
|
|
44
57
|
readonly rulesetId: string;
|
|
45
|
-
|
|
58
|
+
readonly rulesetVersion?: string;
|
|
46
59
|
readonly ruleIds: readonly string[];
|
|
47
60
|
}
|
|
48
61
|
/** An edge record read for evaluation; see readEdgeRecord(). */
|
|
@@ -61,12 +74,15 @@ export interface EdgeRecord {
|
|
|
61
74
|
*/
|
|
62
75
|
readonly ruleSourcesAligned: boolean;
|
|
63
76
|
/**
|
|
64
|
-
* The
|
|
65
|
-
* MatchedRules lists no Custom Rules. The mapping drops it when
|
|
77
|
+
* The rules that matched, by product: the transform rules, URL rewrites
|
|
78
|
+
* among them. MatchedRules lists no Custom Rules. The mapping drops it when
|
|
79
|
+
* empty.
|
|
66
80
|
*/
|
|
67
81
|
readonly matchedRules: readonly EdgeMatchedRuleset[];
|
|
68
82
|
/** Whether the record's own headers and cookies stood in for logged fields that were not given. */
|
|
69
83
|
readonly assumedLoggedFields: boolean;
|
|
84
|
+
/** See EdgeRecordOptions.keepsEmptyValues. */
|
|
85
|
+
readonly keepsEmptyValues: boolean;
|
|
70
86
|
readonly urlNormalization: UrlNormalization | undefined;
|
|
71
87
|
/**
|
|
72
88
|
* The paths the non-raw path fields may read: one, or more when the
|
|
@@ -129,6 +145,13 @@ export interface EdgeRecord {
|
|
|
129
145
|
export declare class EdgeRecordError extends Error {
|
|
130
146
|
readonly name = "EdgeRecordError";
|
|
131
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Headers the mapping copies from Logpush's standard fields, which give an
|
|
150
|
+
* empty string both for a header sent empty and for one not sent.
|
|
151
|
+
*/
|
|
152
|
+
export declare const STANDARD_HEADERS: ReadonlySet<string>;
|
|
153
|
+
/** Request headers Cloudflare accepts as custom fields but does not log, so that logged, they stay unknown. */
|
|
154
|
+
export declare const UNLOGGED_REQUEST_HEADERS: ReadonlySet<string>;
|
|
132
155
|
/** Whether a sample is a mapped edge record, which has a Ray ID under `edge`, nested or flattened. */
|
|
133
156
|
export declare function isEdgeRecord(sample: SampleLogRecord): boolean;
|
|
134
157
|
/**
|
|
@@ -162,8 +185,8 @@ export interface EdgeResolverOptions {
|
|
|
162
185
|
/** A route's prefix, which the non-raw path fields read before the visitor's path, as the route's rewrite puts it. */
|
|
163
186
|
routePrefix?: string;
|
|
164
187
|
/**
|
|
165
|
-
* A
|
|
166
|
-
*
|
|
188
|
+
* A rule listed after a route's rewrite that may have set the path, which
|
|
189
|
+
* leaves the non-raw path fields unknown.
|
|
167
190
|
*/
|
|
168
191
|
pathRewrittenBy?: string;
|
|
169
192
|
customLists?: RuleExpressionCustomLists;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-record.d.ts","sourceRoot":"","sources":["../../src/rule-evaluator/edge-record.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAUN,KAAK,eAAe,EAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAA6C,KAAK,eAAe,EAAE,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAElI,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG/E;;;;;;GAMG;AAEH,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,YAAY,GAAG,SAAS,CAAC;AAEhE,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAChC,+DAA+D;IAC/D,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,+FAA+F;IAC/F,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IACjC,kHAAkH;IAClH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"edge-record.d.ts","sourceRoot":"","sources":["../../src/rule-evaluator/edge-record.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAUN,KAAK,eAAe,EAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAA6C,KAAK,eAAe,EAAE,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAElI,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG/E;;;;;;GAMG;AAEH,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,YAAY,GAAG,SAAS,CAAC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Ac,GAAG,SAAS,CActE;AAuGD,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IACnC,sHAAsH;IACtH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC;CACxC;AAID,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,eAAe,CAyBxH"}
|
|
@@ -14,7 +14,9 @@ const COOKIE_PREFIX = 'request.headers.cookie.';
|
|
|
14
14
|
* Headers the mapping copies from Logpush's standard fields, which give an
|
|
15
15
|
* empty string both for a header sent empty and for one not sent.
|
|
16
16
|
*/
|
|
17
|
-
const STANDARD_HEADERS = new Set(['user-agent', 'referer', 'x-requested-with']);
|
|
17
|
+
export const STANDARD_HEADERS = new Set(['user-agent', 'referer', 'x-requested-with']);
|
|
18
|
+
/** Request headers Cloudflare accepts as custom fields but does not log, so that logged, they stay unknown. */
|
|
19
|
+
export const UNLOGGED_REQUEST_HEADERS = new Set(['range']);
|
|
18
20
|
/** Whether a sample is a mapped edge record, which has a Ray ID under `edge`, nested or flattened. */
|
|
19
21
|
export function isEdgeRecord(sample) {
|
|
20
22
|
return stringField(sample, 'edge.ray_id') !== undefined;
|
|
@@ -61,6 +63,7 @@ export function readEdgeRecord(sample, options = {}) {
|
|
|
61
63
|
...customRuleIds(sample),
|
|
62
64
|
matchedRules: matchedRules(sample),
|
|
63
65
|
assumedLoggedFields: options.loggedFields === undefined,
|
|
66
|
+
keepsEmptyValues: options.keepsEmptyValues ?? false,
|
|
64
67
|
urlNormalization: options.urlNormalization,
|
|
65
68
|
normalizedPaths: normalizedPathCandidates(rawPath, options.urlNormalization),
|
|
66
69
|
method: stringField(sample, 'request.method'),
|
|
@@ -140,7 +143,10 @@ function matchedRules(sample) {
|
|
|
140
143
|
if (!isPlainRecord(entry) || typeof entry.rulesetId !== 'string' || !Array.isArray(entry.rules))
|
|
141
144
|
return [];
|
|
142
145
|
const ruleIds = entry.rules.flatMap(rule => (isPlainRecord(rule) && typeof rule.id === 'string' ? [rule.id] : []));
|
|
143
|
-
|
|
146
|
+
// Logpush gives the version as a number, and the Rulesets API as a string. An empty one is none, as the mapping drops empty values.
|
|
147
|
+
const version = entry.rulesetVersion;
|
|
148
|
+
const rulesetVersion = typeof version === 'number' || (typeof version === 'string' && version !== '') ? String(version) : undefined;
|
|
149
|
+
return [{ rulesetId: entry.rulesetId, ...(rulesetVersion !== undefined ? { rulesetVersion } : {}), ruleIds }];
|
|
144
150
|
});
|
|
145
151
|
}
|
|
146
152
|
/**
|
|
@@ -207,7 +213,8 @@ function loggedFields(record, given) {
|
|
|
207
213
|
const transformedHeaders = new Set(given?.transformedRequestHeaders?.map(name => name.toLowerCase()));
|
|
208
214
|
const loggedHeaders = new Set(STANDARD_HEADERS);
|
|
209
215
|
for (const name of given ? given.requestHeaders.map(header => header.toLowerCase()) : record.headers.keys()) {
|
|
210
|
-
|
|
216
|
+
// Cloudflare adds X-Forwarded-Proto, but not to the request it rebuilds on a challenge solve, so logged, it stays unknown too.
|
|
217
|
+
if (!transformedHeaders.has(name) && !UNLOGGED_REQUEST_HEADERS.has(name) && name !== 'x-forwarded-proto')
|
|
211
218
|
loggedHeaders.add(name);
|
|
212
219
|
}
|
|
213
220
|
const byKey = new Map();
|
|
@@ -417,7 +424,8 @@ export function edgeResolverCtx(record, options, warnings) {
|
|
|
417
424
|
* Reads fields from an edge record. A logged header or cookie that the record
|
|
418
425
|
* lacks was not sent, or was sent empty, as the mapping drops empty values;
|
|
419
426
|
* a reading takes those in `sentEmpty` as sent empty, and eitherWay() tries
|
|
420
|
-
* both.
|
|
427
|
+
* both. A record that keeps empty values leaves only the standard headers
|
|
428
|
+
* open.
|
|
421
429
|
*/
|
|
422
430
|
class EdgeRecordFields {
|
|
423
431
|
record;
|
|
@@ -500,13 +508,12 @@ class EdgeRecordFields {
|
|
|
500
508
|
/**
|
|
501
509
|
* The engine's header list holds Host and the headers the client sent,
|
|
502
510
|
* which the record holds when logged. Their places are unknown, and so are
|
|
503
|
-
* the headers the zone did not log, X-Forwarded-Proto
|
|
511
|
+
* the headers the zone did not log, and X-Forwarded-Proto, logged or not:
|
|
504
512
|
* Cloudflare adds it, but not to the request it rebuilds on a challenge
|
|
505
513
|
* solve.
|
|
506
514
|
*/
|
|
507
515
|
headerArray(name, part, ctx) {
|
|
508
516
|
const { record } = this;
|
|
509
|
-
const raw = name.startsWith('raw.');
|
|
510
517
|
const protocol = record.cf.httpProtocol;
|
|
511
518
|
const keys = this.listedHeaderKeys();
|
|
512
519
|
const elements = keys.map((key) => {
|
|
@@ -515,7 +522,7 @@ class EdgeRecordFields {
|
|
|
515
522
|
const value = record.headers.get(key);
|
|
516
523
|
return value !== undefined ? known(value) : unknownElement(name, key === 'host' ? HOST_HEADER_UNKNOWN : COOKIE_HEADER_UNKNOWN, ctx);
|
|
517
524
|
}
|
|
518
|
-
const spelling = headerNameSpelling(key, protocol
|
|
525
|
+
const spelling = headerNameSpelling(key, protocol);
|
|
519
526
|
return spelling === undefined
|
|
520
527
|
? unknownElement(name, `request header names are unknown in edge records over ${protocol || 'an unknown protocol'}, where Cloudflare keeps the client's spelling`, ctx)
|
|
521
528
|
: known(spelling);
|
|
@@ -607,14 +614,17 @@ class EdgeRecordFields {
|
|
|
607
614
|
return unavailable(pathMatters ? fieldSource('http.request.uri.path') : names[0]);
|
|
608
615
|
}
|
|
609
616
|
/** Whether this reading takes a logged header or cookie the record lacks as sent empty. */
|
|
610
|
-
isSentEmpty(
|
|
617
|
+
isSentEmpty(kind, name) {
|
|
618
|
+
if (this.record.keepsEmptyValues && !(kind === 'header' && STANDARD_HEADERS.has(name)))
|
|
619
|
+
return false;
|
|
620
|
+
const key = `${kind}:${name}`;
|
|
611
621
|
this.read.add(key);
|
|
612
622
|
return this.sentEmpty.has(key);
|
|
613
623
|
}
|
|
614
624
|
pathField(name, read) {
|
|
615
625
|
const { paths, record } = this;
|
|
616
626
|
if (this.pathRewrittenBy) {
|
|
617
|
-
return new UnknownFieldValue(`field '${name}' is unknown:
|
|
627
|
+
return new UnknownFieldValue(`field '${name}' is unknown: rule ${this.pathRewrittenBy}, listed after the route's rewrite, may have set the path`);
|
|
618
628
|
}
|
|
619
629
|
this.read.add(PATH);
|
|
620
630
|
const path = JSON.stringify(record.rawPath);
|
|
@@ -655,6 +665,8 @@ class EdgeRecordFields {
|
|
|
655
665
|
}
|
|
656
666
|
/** Why a request header the record does not hold as logged raw is unknown. */
|
|
657
667
|
unloggedHeaderReason(key) {
|
|
668
|
+
if (UNLOGGED_REQUEST_HEADERS.has(key))
|
|
669
|
+
return 'Cloudflare does not log it, even as a custom field';
|
|
658
670
|
if (this.record.transformedHeaders.has(key))
|
|
659
671
|
return 'the zone logs it transformed, as the origin received it';
|
|
660
672
|
if (this.record.ambiguousHeaders.has(key))
|
|
@@ -690,9 +702,9 @@ class EdgeRecordFields {
|
|
|
690
702
|
if (key === 'host')
|
|
691
703
|
return known(PartialArrayValue.from([unknownElement(source, HOST_HEADER_UNKNOWN, ctx)]));
|
|
692
704
|
if (key === 'x-forwarded-proto')
|
|
693
|
-
return unknownElement(source, "request header 'x-forwarded-proto' is unknown: Cloudflare sets it, but not on a challenge solve
|
|
705
|
+
return unknownElement(source, "request header 'x-forwarded-proto' is unknown: Cloudflare sets it, but not on a challenge solve", ctx);
|
|
694
706
|
if (record.loggedHeaders.has(key))
|
|
695
|
-
return known(this.isSentEmpty(
|
|
707
|
+
return known(this.isSentEmpty('header', key) ? [''] : null);
|
|
696
708
|
return unknownElement(source, `request header '${key}' is unknown: ${this.unloggedHeaderReason(key)}`, ctx);
|
|
697
709
|
}
|
|
698
710
|
unloggedHeaders(name, ctx) {
|
|
@@ -717,7 +729,7 @@ class EdgeRecordFields {
|
|
|
717
729
|
return unknownElement(source, `cookie '${cookie}' is unknown: ${reason}, and the record keys a cookie by its name in lowercase`, ctx);
|
|
718
730
|
}
|
|
719
731
|
if (record.loggedCookies.has(cookie))
|
|
720
|
-
return known(this.isSentEmpty(
|
|
732
|
+
return known(this.isSentEmpty('cookie', cookie) ? [''] : null);
|
|
721
733
|
return unknownElement(source, `cookie '${cookie}' is unknown: the zone did not log it`, ctx);
|
|
722
734
|
}, () => keys, unknownElement(name, 'cookies the zone did not log are unknown', ctx));
|
|
723
735
|
}
|
|
@@ -726,13 +738,12 @@ class EdgeRecordFields {
|
|
|
726
738
|
* The engine's spelling of a header name, where the protocol fixes it, as
|
|
727
739
|
* request-headers.ts lays out each protocol's list: lowercase over HTTP/2 and
|
|
728
740
|
* HTTP/3, but for the headers the engine places itself, and the client's
|
|
729
|
-
* spelling over HTTP/1.
|
|
730
|
-
* in lowercase on a challenged request, and in title case otherwise.
|
|
741
|
+
* spelling over HTTP/1.
|
|
731
742
|
*/
|
|
732
|
-
function headerNameSpelling(key, protocol
|
|
743
|
+
function headerNameSpelling(key, protocol) {
|
|
733
744
|
switch (protocol) {
|
|
734
745
|
case 'HTTP/3':
|
|
735
|
-
return key
|
|
746
|
+
return key;
|
|
736
747
|
case 'HTTP/2':
|
|
737
748
|
return HTTP2_PLACED_NAMES.get(key) ?? key;
|
|
738
749
|
case 'HTTP/1.0':
|
|
@@ -745,13 +756,11 @@ function headerNameSpelling(key, protocol, raw) {
|
|
|
745
756
|
const HTTP2_PLACED_NAMES = new Map([
|
|
746
757
|
['content-length', 'Content-Length'],
|
|
747
758
|
['host', 'Host'],
|
|
748
|
-
['x-forwarded-proto', 'X-Forwarded-Proto'],
|
|
749
759
|
]);
|
|
750
760
|
// Listed without a spread, which bundlers would keep in Workers that never use it.
|
|
751
761
|
const HTTP1_PLACED_NAMES = new Map([
|
|
752
762
|
['content-length', 'Content-Length'],
|
|
753
763
|
['host', 'Host'],
|
|
754
|
-
['x-forwarded-proto', 'X-Forwarded-Proto'],
|
|
755
764
|
['connection', 'Connection'],
|
|
756
765
|
['upgrade', 'Upgrade'],
|
|
757
766
|
]);
|