@libreflare/worker-runtime 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -9
- package/dist/rule-evaluator/access-values.d.ts.map +1 -1
- package/dist/rule-evaluator/access-values.js +6 -1
- package/dist/rule-evaluator/access-values.js.map +1 -1
- 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 +16 -3
- package/dist/rule-evaluator/edge-evaluation.d.ts.map +1 -1
- package/dist/rule-evaluator/edge-evaluation.js +69 -22
- 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 +25 -5
- package/dist/rule-evaluator/edge-record.d.ts.map +1 -1
- package/dist/rule-evaluator/edge-record.js +135 -55
- package/dist/rule-evaluator/edge-record.js.map +1 -1
- package/dist/rule-evaluator/evaluator.d.ts.map +1 -1
- package/dist/rule-evaluator/evaluator.js +4 -0
- package/dist/rule-evaluator/evaluator.js.map +1 -1
- package/dist/rule-evaluator/log-sample.d.ts.map +1 -1
- package/dist/rule-evaluator/log-sample.js +14 -1
- package/dist/rule-evaluator/log-sample.js.map +1 -1
- package/dist/rule-evaluator/parse-cache.d.ts.map +1 -1
- package/dist/rule-evaluator/parse-cache.js +66 -11
- package/dist/rule-evaluator/parse-cache.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 +1 -1
- 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,kBAAk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AAC;QAChE,qGAAqG;QACrG,OAAO,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5F,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;IAC3B,OAAO,MAAM,KAAK,SAAS,IAAI,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -11,18 +11,22 @@ import { type QueryArg } from './query-args.js';
|
|
|
11
11
|
*/
|
|
12
12
|
/** How the zone normalizes URLs, which the non-raw path fields read. */
|
|
13
13
|
export type UrlNormalization = 'off' | 'cloudflare' | 'rfc3986';
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The request headers and cookies a zone's custom-field rules log. Reading a
|
|
16
|
+
* record keeps what it derives from a set for the next records, so a set is
|
|
17
|
+
* changed by replacing it, not in place.
|
|
18
|
+
*/
|
|
15
19
|
export interface EdgeLoggedFields {
|
|
16
20
|
/** Request headers logged in raw form, by name in any case. */
|
|
17
|
-
requestHeaders: readonly string[];
|
|
21
|
+
readonly requestHeaders: readonly string[];
|
|
18
22
|
/**
|
|
19
23
|
* Request headers logged in transformed form, by name in any case. Their
|
|
20
24
|
* values are what the origin received, which a Transform Rule may have
|
|
21
25
|
* set, so they are unknown.
|
|
22
26
|
*/
|
|
23
|
-
transformedRequestHeaders?: readonly string[];
|
|
27
|
+
readonly transformedRequestHeaders?: readonly string[];
|
|
24
28
|
/** Cookies logged, by name as configured; Cloudflare matches cookie names case-sensitively. */
|
|
25
|
-
cookies: readonly string[];
|
|
29
|
+
readonly cookies: readonly string[];
|
|
26
30
|
}
|
|
27
31
|
export interface EdgeRecordOptions {
|
|
28
32
|
/** The zone's logged fields at the record's time. Without them, the record's own headers and cookies stand in. */
|
|
@@ -58,7 +62,10 @@ export interface EdgeMatchedRuleset {
|
|
|
58
62
|
readonly rulesetVersion?: string;
|
|
59
63
|
readonly ruleIds: readonly string[];
|
|
60
64
|
}
|
|
61
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* An edge record read for evaluation; see readEdgeRecord(). Records read
|
|
67
|
+
* with one logged-field set can share its sets of logged names.
|
|
68
|
+
*/
|
|
62
69
|
export interface EdgeRecord {
|
|
63
70
|
readonly rayId: string;
|
|
64
71
|
readonly time: EdgeRecordTime | undefined;
|
|
@@ -145,6 +152,13 @@ export interface EdgeRecord {
|
|
|
145
152
|
export declare class EdgeRecordError extends Error {
|
|
146
153
|
readonly name = "EdgeRecordError";
|
|
147
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Headers the mapping copies from Logpush's standard fields, which give an
|
|
157
|
+
* empty string both for a header sent empty and for one not sent.
|
|
158
|
+
*/
|
|
159
|
+
export declare const STANDARD_HEADERS: ReadonlySet<string>;
|
|
160
|
+
/** Request headers Cloudflare accepts as custom fields but does not log, so that logged, they stay unknown. */
|
|
161
|
+
export declare const UNLOGGED_REQUEST_HEADERS: ReadonlySet<string>;
|
|
148
162
|
/** Whether a sample is a mapped edge record, which has a Ray ID under `edge`, nested or flattened. */
|
|
149
163
|
export declare function isEdgeRecord(sample: SampleLogRecord): boolean;
|
|
150
164
|
/**
|
|
@@ -157,6 +171,12 @@ export declare function isEdgeRecord(sample: SampleLogRecord): boolean;
|
|
|
157
171
|
* or https URL in `edge.url`.
|
|
158
172
|
*/
|
|
159
173
|
export declare function readEdgeRecord(sample: SampleLogRecord, options?: EdgeRecordOptions): EdgeRecord;
|
|
174
|
+
/**
|
|
175
|
+
* Reads a mapped edge record whose time, from edgeRecordTime(), is known.
|
|
176
|
+
*
|
|
177
|
+
* @throws {EdgeRecordError} See readEdgeRecord().
|
|
178
|
+
*/
|
|
179
|
+
export declare function readEdgeRecordAt(sample: SampleLogRecord, time: EdgeRecordTime | undefined, options: EdgeRecordOptions): EdgeRecord;
|
|
160
180
|
/**
|
|
161
181
|
* The paths a mapped edge record's non-raw path fields may read with a URL
|
|
162
182
|
* normalization; see EdgeRecord.normalizedPaths.
|
|
@@ -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
|
|
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;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,+DAA+D;IAC/D,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvD,+FAA+F;IAC/F,QAAQ,CA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