@valiron/crawler-protection 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +223 -2
- package/dist/activation.d.ts +25 -0
- package/dist/activation.js +121 -0
- package/dist/adapters.d.ts +29 -0
- package/dist/adapters.js +69 -0
- package/dist/admission.d.ts +62 -0
- package/dist/admission.js +188 -0
- package/dist/cache.d.ts +42 -0
- package/dist/cache.js +130 -0
- package/dist/configuration.d.ts +54 -0
- package/dist/configuration.js +223 -0
- package/dist/directory.d.ts +36 -0
- package/dist/directory.js +155 -0
- package/dist/gateway.d.ts +31 -0
- package/dist/gateway.js +352 -0
- package/dist/guard.d.ts +110 -0
- package/dist/guard.js +294 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +37 -0
- package/dist/internal.d.ts +29 -0
- package/dist/internal.js +50 -0
- package/dist/ip.d.ts +18 -0
- package/dist/ip.js +81 -0
- package/dist/meta.d.ts +13 -0
- package/dist/meta.js +34 -0
- package/dist/onboarding.d.ts +56 -0
- package/dist/onboarding.js +60 -0
- package/dist/operations.d.ts +60 -0
- package/dist/operations.js +149 -0
- package/dist/reporting.d.ts +44 -0
- package/dist/reporting.js +72 -0
- package/dist/runtime.d.ts +56 -0
- package/dist/runtime.js +69 -0
- package/dist/telemetry.d.ts +16 -0
- package/dist/telemetry.js +61 -0
- package/dist/verification.d.ts +113 -0
- package/dist/verification.js +238 -0
- package/gateway/Dockerfile +21 -0
- package/gateway/README.md +110 -0
- package/gateway/admin.cjs +34 -0
- package/gateway/compose.yaml +40 -0
- package/gateway/directory.cjs +10 -0
- package/gateway/service.cjs +97 -0
- package/gateway/work-api.openapi.json +186 -0
- package/integrations/python/valiron_crawler_protection.py +90 -0
- package/package.json +57 -4
package/dist/guard.js
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CrawlerGuard = void 0;
|
|
4
|
+
exports.validateGuardPolicy = validateGuardPolicy;
|
|
5
|
+
const operations_1 = require("./operations");
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const activation_1 = require("./activation");
|
|
8
|
+
const ip_1 = require("./ip");
|
|
9
|
+
const verification_1 = require("./verification");
|
|
10
|
+
const admission_1 = require("./admission");
|
|
11
|
+
/** Shared runtime validation used by the guard and configuration compiler. */
|
|
12
|
+
function validateGuardPolicy(p) {
|
|
13
|
+
if (!p || typeof p !== 'object')
|
|
14
|
+
throw new Error('Invalid policy');
|
|
15
|
+
if (p.configurationId !== undefined && !/^[a-f0-9]{64}$/.test(p.configurationId))
|
|
16
|
+
throw new Error('Invalid configuration identity');
|
|
17
|
+
if (p.rollout && (!['observe', 'enforce'].includes(p.rollout.mode) || !Array.isArray(p.rollout.enforceGroups) ||
|
|
18
|
+
new Set(p.rollout.enforceGroups).size !== p.rollout.enforceGroups.length ||
|
|
19
|
+
p.rollout.enforceGroups.some(group => typeof group !== 'string' || !Object.hasOwn(p.routes, group)) ||
|
|
20
|
+
(p.rollout.mode === 'observe' && p.rollout.enforceGroups.length !== 0) ||
|
|
21
|
+
(p.rollout.mode === 'enforce' && p.rollout.enforceGroups.length === 0)))
|
|
22
|
+
throw new Error('Invalid rollout groups');
|
|
23
|
+
if (typeof p.version !== 'string' || !p.version || p.version.length > 128 || !Number.isSafeInteger(p.expiresAt))
|
|
24
|
+
throw new Error('Invalid policy');
|
|
25
|
+
if (!p.routes || !Object.keys(p.routes).length || Object.keys(p.routes).length > 128)
|
|
26
|
+
throw new Error('Missing protected routes');
|
|
27
|
+
for (const [group, route] of Object.entries(p.routes)) {
|
|
28
|
+
if (!/^[a-zA-Z0-9_-]{1,64}$/.test(group) || !Number.isFinite(route.cost) || route.cost < 1 ||
|
|
29
|
+
!route.rate || route.cost > route.rate.capacity)
|
|
30
|
+
throw new Error('Invalid route cost');
|
|
31
|
+
}
|
|
32
|
+
if (p.customers) {
|
|
33
|
+
const c = p.customers;
|
|
34
|
+
if (![c.shopperReserve, c.checkoutReserve].every(n => Number.isSafeInteger(n) && n >= 1) ||
|
|
35
|
+
c.shopperReserve + c.checkoutReserve >= p.globalWorkLimit || p.localWorkLimit < p.globalWorkLimit)
|
|
36
|
+
throw new Error('Invalid customer reservations or local ceiling');
|
|
37
|
+
for (const r of [c.shopperRate, c.checkoutRate])
|
|
38
|
+
if (!r || !Number.isFinite(r.capacity) || r.capacity < 1 || r.capacity > 1e9 ||
|
|
39
|
+
!Number.isFinite(r.refillPerSecond) || r.refillPerSecond <= 0 || r.capacity / r.refillPerSecond > 86400)
|
|
40
|
+
throw new Error('Invalid customer rate');
|
|
41
|
+
}
|
|
42
|
+
const maxCost = Math.max(...Object.values(p.routes).map(route => route.cost));
|
|
43
|
+
for (const rate of [p.globalRate, p.unknownRate, p.perIpRate,
|
|
44
|
+
...(p.customers ? [p.customers.shopperRate, p.customers.checkoutRate] : []),
|
|
45
|
+
...(p.rollout ? [p.rollout.safetyRate, p.rollout.safetyPerIpRate] : []),
|
|
46
|
+
...Object.values(p.providers).flatMap(provider => [provider.rate, ...Object.values(provider.classes)])]) {
|
|
47
|
+
if (!rate || rate.capacity < maxCost)
|
|
48
|
+
throw new Error('Route cost exceeds a rate capacity');
|
|
49
|
+
}
|
|
50
|
+
for (const rate of [p.globalRate, p.unknownRate, p.perIpRate, ...Object.values(p.routes).map(r => r.rate),
|
|
51
|
+
...(p.customers ? [p.customers.shopperRate, p.customers.checkoutRate] : []),
|
|
52
|
+
...(p.rollout ? [p.rollout.safetyRate, p.rollout.safetyPerIpRate] : []),
|
|
53
|
+
...Object.values(p.providers).flatMap(provider => [provider.rate, ...Object.values(provider.classes)])]) {
|
|
54
|
+
if (!rate || !Number.isFinite(rate.capacity) || rate.capacity < 1 || rate.capacity > 1e9 ||
|
|
55
|
+
!Number.isFinite(rate.refillPerSecond) || rate.refillPerSecond <= 0 ||
|
|
56
|
+
rate.refillPerSecond > 1e9 ||
|
|
57
|
+
rate.capacity / rate.refillPerSecond > 86400)
|
|
58
|
+
throw new Error('Invalid policy rate');
|
|
59
|
+
}
|
|
60
|
+
for (const limit of [p.globalWorkLimit, p.unknownWorkLimit, p.providerWorkLimit, p.localWorkLimit, p.maxOperationsPerRequest]) {
|
|
61
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100000)
|
|
62
|
+
throw new Error('Invalid work limit');
|
|
63
|
+
}
|
|
64
|
+
for (const rate of Object.values(p.providers).flatMap(provider => [provider.rate, ...Object.values(provider.classes)])) {
|
|
65
|
+
if (p.unknownRate.capacity > rate.capacity || p.unknownRate.refillPerSecond > rate.refillPerSecond) {
|
|
66
|
+
throw new Error('Unverified policy must not grant a larger budget');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (p.unknownWorkLimit > p.providerWorkLimit)
|
|
70
|
+
throw new Error('Unverified work limit exceeds provider limit');
|
|
71
|
+
if (!Number.isSafeInteger(p.maxContextAgeMs) || p.maxContextAgeMs < 1 || p.maxContextAgeMs > 60000)
|
|
72
|
+
throw new Error('Invalid context lifetime');
|
|
73
|
+
}
|
|
74
|
+
class CrawlerGuard {
|
|
75
|
+
config;
|
|
76
|
+
policy;
|
|
77
|
+
localWork = 0;
|
|
78
|
+
localRender = 0;
|
|
79
|
+
// Only contexts produced by this guard may be used as work authorization.
|
|
80
|
+
contexts = new WeakSet();
|
|
81
|
+
children = new WeakMap();
|
|
82
|
+
operations = new WeakMap();
|
|
83
|
+
constructor(config) {
|
|
84
|
+
this.config = config;
|
|
85
|
+
(0, activation_1.validateActivation)(config.activation);
|
|
86
|
+
this.policy = structuredClone(config.policy);
|
|
87
|
+
validateGuardPolicy(this.policy);
|
|
88
|
+
}
|
|
89
|
+
now() { return (this.config.now ?? Date.now)(); }
|
|
90
|
+
emit(decision, evidence, details) {
|
|
91
|
+
// The caller's sink must enqueue bounded telemetry without I/O on the hot path.
|
|
92
|
+
try {
|
|
93
|
+
void Promise.resolve(this.config.onDecision?.(Object.freeze({ ...decision }), evidence, details ? Object.freeze({ ...details }) : undefined)).catch(() => { });
|
|
94
|
+
}
|
|
95
|
+
catch { /* telemetry cannot grant/deny access */ }
|
|
96
|
+
}
|
|
97
|
+
async admit(input) {
|
|
98
|
+
const requestId = (0, node_crypto_1.randomUUID)();
|
|
99
|
+
const base = { requestId, policyVersion: this.policy.version };
|
|
100
|
+
let evidence;
|
|
101
|
+
let details = { routeGroup: input.routeGroup };
|
|
102
|
+
let decision;
|
|
103
|
+
try {
|
|
104
|
+
(0, activation_1.assertActivation)(this.config.activation);
|
|
105
|
+
if (this.policy.expiresAt <= this.now())
|
|
106
|
+
throw new Error('Expired policy');
|
|
107
|
+
const ip = (0, ip_1.normalizeIp)(input.ip);
|
|
108
|
+
if (!/^[a-zA-Z0-9_-]{1,64}$/.test(input.routeGroup) || !Number.isFinite(input.cost) || input.cost < 1) {
|
|
109
|
+
throw new Error('Invalid route');
|
|
110
|
+
}
|
|
111
|
+
if (!Object.hasOwn(this.policy.routes, input.routeGroup) || input.cost !== this.policy.routes[input.routeGroup].cost) {
|
|
112
|
+
throw new Error('Unconfigured route cost');
|
|
113
|
+
}
|
|
114
|
+
let customer = this.policy.customers && this.config.customer ? await this.config.customer(input.request, input.routeGroup) : undefined;
|
|
115
|
+
if (customer && (!['shopper', 'checkout'].includes(customer.lane) || !customer.principal || customer.principal.length > 256))
|
|
116
|
+
throw new Error('Invalid customer grant');
|
|
117
|
+
if (customer?.lane === 'checkout' && this.policy.routes[input.routeGroup].customerLane !== 'checkout')
|
|
118
|
+
customer = { ...customer, lane: 'shopper' };
|
|
119
|
+
const lane = customer?.lane ?? 'catalog';
|
|
120
|
+
const rollout = this.policy.rollout;
|
|
121
|
+
const mode = customer || !rollout || (rollout.mode === 'enforce' && rollout.enforceGroups.includes(input.routeGroup)) ? 'enforce' : 'observe';
|
|
122
|
+
details = { routeGroup: input.routeGroup, lane, mode };
|
|
123
|
+
const classified = this.config.registry.classify(ip, input.userAgent);
|
|
124
|
+
evidence = this.config.trustedEvidence?.(input.request, ip, input.userAgent) ?? (classified.claimedCrawler === 'bingbot' && (0, verification_1.crawlerClaim)(input.userAgent)?.provider === 'bing'
|
|
125
|
+
? this.config.bing.classify(ip) : classified);
|
|
126
|
+
const verified = evidence.state === 'verified';
|
|
127
|
+
const provider = verified ? this.policy.providers[evidence.provider] : undefined;
|
|
128
|
+
const crawlerRate = provider?.classes[evidence.crawlerClass];
|
|
129
|
+
// Known source without an explicit allowance gets the conservative policy.
|
|
130
|
+
const privileged = Boolean(provider && crawlerRate);
|
|
131
|
+
const bucket = (key, rate) => ({ key, ...rate, cost: input.cost });
|
|
132
|
+
const buckets = [bucket('global', this.policy.globalRate), bucket('ip:' + (0, admission_1.keyPart)(ip), this.policy.perIpRate)];
|
|
133
|
+
if (customer) {
|
|
134
|
+
buckets.splice(0, buckets.length, bucket('customer:' + lane, lane === 'checkout' ? this.policy.customers.checkoutRate : this.policy.customers.shopperRate), bucket('customer-principal:' + lane + ':' + (0, admission_1.keyPart)(customer.principal), this.policy.perIpRate));
|
|
135
|
+
}
|
|
136
|
+
buckets.push(bucket((customer ? lane + ':' : '') + 'route:' + input.routeGroup, this.policy.routes[input.routeGroup].rate));
|
|
137
|
+
if (!customer) {
|
|
138
|
+
if (privileged) {
|
|
139
|
+
buckets.push(bucket('provider:' + evidence.provider, provider.rate));
|
|
140
|
+
buckets.push(bucket('crawler:' + evidence.provider + ':' + evidence.crawlerClass, crawlerRate));
|
|
141
|
+
}
|
|
142
|
+
else
|
|
143
|
+
buckets.push(bucket('unknown', this.policy.unknownRate));
|
|
144
|
+
}
|
|
145
|
+
const denied = !customer && evidence.state === 'verified' && this.config.crawlerAccess?.(evidence, input.routeGroup) === 'deny';
|
|
146
|
+
if (denied && mode === 'enforce') {
|
|
147
|
+
decision = { ...base, action: 'block', reason: 'crawler_policy_denied' };
|
|
148
|
+
this.emit(decision, evidence, { ...details, proposedAction: 'block' });
|
|
149
|
+
return { decision };
|
|
150
|
+
}
|
|
151
|
+
// Observation shadows rate/access policy only. Hard work caps and safety buckets stay active.
|
|
152
|
+
if (rollout && !customer) {
|
|
153
|
+
const safety = await this.config.store.consume([bucket('safety:global', rollout.safetyRate), bucket('safety:ip:' + (0, admission_1.keyPart)(ip), rollout.safetyPerIpRate)]);
|
|
154
|
+
if (!safety.allow) {
|
|
155
|
+
decision = { ...base, action: 'limit', reason: 'safety_budget_exhausted', retryAfterSeconds: safety.retryAfterSeconds };
|
|
156
|
+
this.emit(decision, evidence, details);
|
|
157
|
+
return { decision };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (mode === 'observe')
|
|
161
|
+
for (const b of buckets)
|
|
162
|
+
b.key = 'observe:' + b.key;
|
|
163
|
+
// Route costs are selected by trusted integration code, never request input.
|
|
164
|
+
const result = await this.config.store.consume(buckets);
|
|
165
|
+
(0, activation_1.assertActivation)(this.config.activation);
|
|
166
|
+
details = { ...details, proposedAction: denied ? 'block' : result.allow ? 'allow' : 'limit' };
|
|
167
|
+
if (result.allow || mode === 'observe') {
|
|
168
|
+
const context = Object.freeze({ lane, principal: customer ? (0, admission_1.keyPart)(customer.principal) : undefined, ip, routeGroup: input.routeGroup, cost: input.cost, requestId,
|
|
169
|
+
expiresAt: Math.min(this.policy.expiresAt, this.now() + this.policy.maxContextAgeMs),
|
|
170
|
+
evidence: Object.freeze({ ...evidence }) });
|
|
171
|
+
this.contexts.add(context);
|
|
172
|
+
this.operations.set(context, 0);
|
|
173
|
+
decision = { ...base, action: 'allow', reason: mode === 'observe' ? 'observation_within_safety' : 'within_budget' };
|
|
174
|
+
this.emit(decision, evidence, details);
|
|
175
|
+
return { decision, context };
|
|
176
|
+
}
|
|
177
|
+
decision = { ...base, action: 'limit', reason: 'rate_budget_exhausted', retryAfterSeconds: result.retryAfterSeconds };
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
decision = { ...base, action: 'unavailable', reason: 'admission_unavailable', retryAfterSeconds: 1 };
|
|
181
|
+
}
|
|
182
|
+
this.emit(decision, evidence, details);
|
|
183
|
+
return { decision };
|
|
184
|
+
}
|
|
185
|
+
forward(context, channel, target) {
|
|
186
|
+
(0, activation_1.assertActivation)(this.config.activation);
|
|
187
|
+
if (!(this.config.store instanceof operations_1.ManagedRedisAdmission) || !this.contexts.has(context) || context.expiresAt <= this.now())
|
|
188
|
+
throw new Error('Invalid parent context');
|
|
189
|
+
return channel.sign(context, (0, operations_1.policyFingerprint)(this.policy), target);
|
|
190
|
+
}
|
|
191
|
+
acceptInternal(token, channel, target) {
|
|
192
|
+
(0, activation_1.assertActivation)(this.config.activation);
|
|
193
|
+
if (!(this.config.store instanceof operations_1.ManagedRedisAdmission) || this.policy.expiresAt <= this.now())
|
|
194
|
+
throw new Error('Managed active policy required');
|
|
195
|
+
const claims = channel.verify(token, target, (0, operations_1.policyFingerprint)(this.policy));
|
|
196
|
+
const context = Object.freeze({ ...claims.context, evidence: Object.freeze({ ...claims.context.evidence }) });
|
|
197
|
+
this.contexts.add(context);
|
|
198
|
+
this.operations.set(context, 0);
|
|
199
|
+
this.children.set(context, claims.childId);
|
|
200
|
+
return context;
|
|
201
|
+
}
|
|
202
|
+
/** Bound SSR separately from DB operations; retain the hold until the render/fetches settle. */
|
|
203
|
+
async withRenderingAdmission(context, operation) {
|
|
204
|
+
(0, activation_1.assertActivation)(this.config.activation);
|
|
205
|
+
const p = this.policy;
|
|
206
|
+
if (!this.contexts.has(context) || context.expiresAt <= this.now() || p.expiresAt <= this.now() || this.localRender >= p.localWorkLimit)
|
|
207
|
+
throw new admission_1.AdmissionError({ action: 'unavailable', reason: 'render_unavailable', requestId: context?.requestId ?? (0, node_crypto_1.randomUUID)(), policyVersion: p.version });
|
|
208
|
+
const slots = [{ key: 'ssr:global', limit: p.globalWorkLimit }];
|
|
209
|
+
if (p.customers) {
|
|
210
|
+
if (context.lane !== 'checkout')
|
|
211
|
+
slots.push({ key: 'ssr:non-checkout', limit: p.globalWorkLimit - p.customers.checkoutReserve });
|
|
212
|
+
if (context.lane !== 'checkout' && context.lane !== 'shopper')
|
|
213
|
+
slots.push({ key: 'ssr:catalog', limit: p.globalWorkLimit - p.customers.checkoutReserve - p.customers.shopperReserve });
|
|
214
|
+
}
|
|
215
|
+
this.localRender++;
|
|
216
|
+
try {
|
|
217
|
+
return await (0, admission_1.withWorkSlot)({ store: this.config.store, slots, requestId: context.requestId, policyVersion: p.version, lane: 'render',
|
|
218
|
+
onReleaseFailure: () => this.emit({ action: 'unavailable', reason: 'render_release_failed', requestId: context.requestId, policyVersion: p.version }) }, async () => { (0, activation_1.assertActivation)(this.config.activation); return operation(); });
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
this.localRender--;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
databaseSlots(context) {
|
|
225
|
+
const p = this.policy;
|
|
226
|
+
const lane = context.lane ?? 'catalog';
|
|
227
|
+
const slots = [{ key: 'global', limit: p.globalWorkLimit }];
|
|
228
|
+
if (p.customers) {
|
|
229
|
+
if (lane !== 'checkout')
|
|
230
|
+
slots.push({ key: 'non-checkout', limit: p.globalWorkLimit - p.customers.checkoutReserve });
|
|
231
|
+
if (lane === 'catalog')
|
|
232
|
+
slots.push({ key: 'catalog', limit: p.globalWorkLimit - p.customers.checkoutReserve - p.customers.shopperReserve });
|
|
233
|
+
}
|
|
234
|
+
const e = context.evidence;
|
|
235
|
+
const verified = e.state === 'verified' && e.expiresAt > this.now() &&
|
|
236
|
+
Object.hasOwn(p.providers, e.provider) && Object.hasOwn(p.providers[e.provider].classes, e.crawlerClass);
|
|
237
|
+
if (lane === 'catalog')
|
|
238
|
+
slots.push(verified ? { key: 'provider:' + e.provider, limit: p.providerWorkLimit } : { key: 'unknown', limit: p.unknownWorkLimit });
|
|
239
|
+
return slots;
|
|
240
|
+
}
|
|
241
|
+
/** HTTP work broker: shared Redis caps replace a process-affine callback/local counter. */
|
|
242
|
+
async acquireRemoteDatabaseAdmission(context) {
|
|
243
|
+
(0, activation_1.assertActivation)(this.config.activation);
|
|
244
|
+
const p = this.policy;
|
|
245
|
+
if (!(this.config.store instanceof operations_1.ManagedRedisAdmission) || !this.contexts.has(context) || p.expiresAt <= this.now() || context.expiresAt <= this.now())
|
|
246
|
+
throw new admission_1.AdmissionError({ action: 'unavailable', reason: 'invalid_remote_context', requestId: context?.requestId ?? (0, node_crypto_1.randomUUID)(), policyVersion: p.version });
|
|
247
|
+
const child = this.children.get(context);
|
|
248
|
+
if (!child || !await this.config.store.claimChild(context.requestId, child, p.maxOperationsPerRequest, context.expiresAt))
|
|
249
|
+
throw new admission_1.AdmissionError({ action: 'unavailable', reason: 'child_replay_or_fanout', requestId: context.requestId, policyVersion: p.version });
|
|
250
|
+
const permit = await this.config.store.acquirePermit(this.databaseSlots(context), { requestId: context.requestId, lane: context.lane ?? 'catalog' });
|
|
251
|
+
if (!permit)
|
|
252
|
+
throw new admission_1.AdmissionError({ action: 'unavailable', reason: 'work_capacity_exhausted', requestId: context.requestId, policyVersion: p.version, retryAfterSeconds: 1 });
|
|
253
|
+
try {
|
|
254
|
+
(0, activation_1.assertActivation)(this.config.activation);
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
await this.config.store.releasePermit(permit);
|
|
258
|
+
throw error;
|
|
259
|
+
}
|
|
260
|
+
return permit;
|
|
261
|
+
}
|
|
262
|
+
async withDatabaseAdmission(context, operation) {
|
|
263
|
+
(0, activation_1.assertActivation)(this.config.activation);
|
|
264
|
+
const p = this.policy;
|
|
265
|
+
if (!this.contexts.has(context) || p.expiresAt <= this.now() || context.expiresAt <= this.now() || this.localWork >= p.localWorkLimit ||
|
|
266
|
+
(this.operations.get(context) ?? Infinity) >= p.maxOperationsPerRequest) {
|
|
267
|
+
throw new admission_1.AdmissionError({ action: 'unavailable', reason: 'local_work_unavailable', requestId: context?.requestId ?? (0, node_crypto_1.randomUUID)(),
|
|
268
|
+
policyVersion: p.version, retryAfterSeconds: 1 });
|
|
269
|
+
}
|
|
270
|
+
this.operations.set(context, this.operations.get(context) + 1);
|
|
271
|
+
if (this.config.store instanceof operations_1.ManagedRedisAdmission) {
|
|
272
|
+
let claimed = false;
|
|
273
|
+
try {
|
|
274
|
+
claimed = await this.config.store.claimChild(context.requestId, this.children.get(context) ?? (0, node_crypto_1.randomUUID)(), p.maxOperationsPerRequest, context.expiresAt);
|
|
275
|
+
}
|
|
276
|
+
catch { /* fail closed */ }
|
|
277
|
+
if (!claimed)
|
|
278
|
+
throw new admission_1.AdmissionError({ action: 'unavailable', reason: 'child_replay_or_fanout', requestId: context.requestId, policyVersion: p.version });
|
|
279
|
+
}
|
|
280
|
+
const slots = this.databaseSlots(context);
|
|
281
|
+
if (this.localWork >= p.localWorkLimit)
|
|
282
|
+
throw new admission_1.AdmissionError({ action: 'unavailable', reason: 'local_work_unavailable', requestId: context.requestId, policyVersion: p.version });
|
|
283
|
+
this.localWork++;
|
|
284
|
+
try {
|
|
285
|
+
return await (0, admission_1.withWorkSlot)({ store: this.config.store, requestId: context.requestId, policyVersion: p.version, lane: context.lane ?? 'catalog',
|
|
286
|
+
onReleaseFailure: () => this.emit({ action: 'unavailable', reason: 'work_release_failed', requestId: context.requestId, policyVersion: p.version }),
|
|
287
|
+
slots }, async () => { (0, activation_1.assertActivation)(this.config.activation); return operation(); });
|
|
288
|
+
}
|
|
289
|
+
finally {
|
|
290
|
+
this.localWork--;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
exports.CrawlerGuard = CrawlerGuard;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './ip';
|
|
2
|
+
export * from './verification';
|
|
3
|
+
export * from './admission';
|
|
4
|
+
export * from './guard';
|
|
5
|
+
export * from './adapters';
|
|
6
|
+
export * from "./operations";
|
|
7
|
+
export * from './internal';
|
|
8
|
+
export * from './meta';
|
|
9
|
+
export * from './cache';
|
|
10
|
+
export * from './configuration';
|
|
11
|
+
export * from './reporting';
|
|
12
|
+
export * from './runtime';
|
|
13
|
+
export * from './onboarding';
|
|
14
|
+
export * from './gateway';
|
|
15
|
+
export * from './telemetry';
|
|
16
|
+
export * from './directory';
|
|
17
|
+
export { createCrawlerActivation, activateCrawlerProtection, CRAWLER_ACTIVATION_ENDPOINT, type CrawlerActivation } from './activation';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.CRAWLER_ACTIVATION_ENDPOINT = exports.activateCrawlerProtection = exports.createCrawlerActivation = void 0;
|
|
18
|
+
__exportStar(require("./ip"), exports);
|
|
19
|
+
__exportStar(require("./verification"), exports);
|
|
20
|
+
__exportStar(require("./admission"), exports);
|
|
21
|
+
__exportStar(require("./guard"), exports);
|
|
22
|
+
__exportStar(require("./adapters"), exports);
|
|
23
|
+
__exportStar(require("./operations"), exports);
|
|
24
|
+
__exportStar(require("./internal"), exports);
|
|
25
|
+
__exportStar(require("./meta"), exports);
|
|
26
|
+
__exportStar(require("./cache"), exports);
|
|
27
|
+
__exportStar(require("./configuration"), exports);
|
|
28
|
+
__exportStar(require("./reporting"), exports);
|
|
29
|
+
__exportStar(require("./runtime"), exports);
|
|
30
|
+
__exportStar(require("./onboarding"), exports);
|
|
31
|
+
__exportStar(require("./gateway"), exports);
|
|
32
|
+
__exportStar(require("./telemetry"), exports);
|
|
33
|
+
__exportStar(require("./directory"), exports);
|
|
34
|
+
var activation_1 = require("./activation");
|
|
35
|
+
Object.defineProperty(exports, "createCrawlerActivation", { enumerable: true, get: function () { return activation_1.createCrawlerActivation; } });
|
|
36
|
+
Object.defineProperty(exports, "activateCrawlerProtection", { enumerable: true, get: function () { return activation_1.activateCrawlerProtection; } });
|
|
37
|
+
Object.defineProperty(exports, "CRAWLER_ACTIVATION_ENDPOINT", { enumerable: true, get: function () { return activation_1.CRAWLER_ACTIVATION_ENDPOINT; } });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RequestContext } from './guard';
|
|
2
|
+
export type InternalTarget = {
|
|
3
|
+
method: string;
|
|
4
|
+
path: string;
|
|
5
|
+
body?: Uint8Array;
|
|
6
|
+
};
|
|
7
|
+
export type InternalClaims = {
|
|
8
|
+
context: RequestContext;
|
|
9
|
+
policy: string;
|
|
10
|
+
childId: string;
|
|
11
|
+
issuer: string;
|
|
12
|
+
audience: string;
|
|
13
|
+
target: string;
|
|
14
|
+
};
|
|
15
|
+
/** Independent secrets for service-to-service admission; never expose to browser bundles. */
|
|
16
|
+
export declare class InternalAdmission {
|
|
17
|
+
private readonly config;
|
|
18
|
+
private readonly keys;
|
|
19
|
+
constructor(config: {
|
|
20
|
+
issuer: string;
|
|
21
|
+
audience: string;
|
|
22
|
+
activeKey: string;
|
|
23
|
+
keys: Record<string, string>;
|
|
24
|
+
now?: () => number;
|
|
25
|
+
});
|
|
26
|
+
private target;
|
|
27
|
+
sign(context: RequestContext, policy: string, target: InternalTarget): string;
|
|
28
|
+
verify(token: string, target: InternalTarget, policy: string): InternalClaims;
|
|
29
|
+
}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternalAdmission = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const operations_1 = require("./operations");
|
|
6
|
+
/** Independent secrets for service-to-service admission; never expose to browser bundles. */
|
|
7
|
+
class InternalAdmission {
|
|
8
|
+
config;
|
|
9
|
+
keys;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.keys = Object.freeze({ ...config.keys });
|
|
13
|
+
if (!config.issuer || !config.audience || !this.keys[config.activeKey] || Object.keys(this.keys).length > 4 ||
|
|
14
|
+
Object.entries(this.keys).some(([id, secret]) => !/^[a-z0-9_-]{1,32}$/.test(id) || Buffer.byteLength(secret) < 32))
|
|
15
|
+
throw new Error('Invalid internal keys');
|
|
16
|
+
}
|
|
17
|
+
target(target) {
|
|
18
|
+
if (!/^[A-Z]{3,10}$/.test(target.method) || !target.path.startsWith('/') || target.path.length > 4096)
|
|
19
|
+
throw new Error('Invalid internal target');
|
|
20
|
+
return (0, operations_1.policyFingerprint)({ method: target.method, path: target.path, body: Buffer.from(target.body ?? []).toString('base64') });
|
|
21
|
+
}
|
|
22
|
+
sign(context, policy, target) {
|
|
23
|
+
const payload = { context, policy, childId: (0, node_crypto_1.randomUUID)(), issuer: this.config.issuer, audience: this.config.audience, target: this.target(target) };
|
|
24
|
+
const encoded = Buffer.from(JSON.stringify(payload)).toString('base64url');
|
|
25
|
+
const message = this.config.activeKey + '.' + encoded;
|
|
26
|
+
const token = message + '.' + (0, node_crypto_1.createHmac)('sha256', this.keys[this.config.activeKey]).update(message).digest('base64url');
|
|
27
|
+
if (token.length > 8192)
|
|
28
|
+
throw new Error('Internal token too large');
|
|
29
|
+
return token;
|
|
30
|
+
}
|
|
31
|
+
verify(token, target, policy) {
|
|
32
|
+
if (typeof token !== 'string' || token.length > 8192)
|
|
33
|
+
throw new Error('Invalid internal token');
|
|
34
|
+
const parts = token.split('.');
|
|
35
|
+
if (parts.length !== 3 || !Object.hasOwn(this.keys, parts[0]))
|
|
36
|
+
throw new Error('Unknown signing key');
|
|
37
|
+
const expected = (0, node_crypto_1.createHmac)('sha256', this.keys[parts[0]]).update(parts[0] + '.' + parts[1]).digest();
|
|
38
|
+
const actual = Buffer.from(parts[2], 'base64url');
|
|
39
|
+
if (actual.length !== expected.length || !(0, node_crypto_1.timingSafeEqual)(actual, expected))
|
|
40
|
+
throw new Error('Invalid internal signature');
|
|
41
|
+
const claims = JSON.parse(Buffer.from(parts[1], 'base64url').toString());
|
|
42
|
+
const now = (this.config.now ?? Date.now)();
|
|
43
|
+
if (claims.issuer !== this.config.issuer || claims.audience !== this.config.audience || claims.policy !== policy ||
|
|
44
|
+
claims.target !== this.target(target) || !Number.isSafeInteger(claims.context?.expiresAt) ||
|
|
45
|
+
claims.context.expiresAt <= now || claims.context.expiresAt - now > 60000 || !/^[a-f0-9-]{36}$/.test(claims.childId))
|
|
46
|
+
throw new Error('Invalid internal scope');
|
|
47
|
+
return claims;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.InternalAdmission = InternalAdmission;
|
package/dist/ip.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IncomingMessage } from 'node:http';
|
|
2
|
+
export declare function normalizeIp(input: string): string;
|
|
3
|
+
export declare function cidrMatcher(cidrs: readonly string[]): (ip: string) => boolean;
|
|
4
|
+
/** Only use after authenticating the distribution/origin path. Reject bad chains. */
|
|
5
|
+
export declare function cloudFrontClientIp(input: {
|
|
6
|
+
peerIp: string;
|
|
7
|
+
forwardedFor: string | undefined;
|
|
8
|
+
authenticatedOrigin: boolean;
|
|
9
|
+
trustedProxyCidrs: readonly string[];
|
|
10
|
+
/** Number of known forwarding proxies between CloudFront and this server. */
|
|
11
|
+
additionalProxyHops?: number;
|
|
12
|
+
}): string;
|
|
13
|
+
/** Set the same secret as a custom origin header on the intended distribution. */
|
|
14
|
+
export declare function createCloudFrontClientIpResolver(config: {
|
|
15
|
+
originSecret: string;
|
|
16
|
+
trustedProxyCidrs: readonly string[];
|
|
17
|
+
additionalProxyHops?: number;
|
|
18
|
+
}): (request: IncomingMessage) => string;
|
package/dist/ip.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.normalizeIp = normalizeIp;
|
|
7
|
+
exports.cidrMatcher = cidrMatcher;
|
|
8
|
+
exports.cloudFrontClientIp = cloudFrontClientIp;
|
|
9
|
+
exports.createCloudFrontClientIpResolver = createCloudFrontClientIpResolver;
|
|
10
|
+
const node_net_1 = require("node:net");
|
|
11
|
+
const node_crypto_1 = require("node:crypto");
|
|
12
|
+
const ipaddr_js_1 = __importDefault(require("ipaddr.js"));
|
|
13
|
+
function normalizeIp(input) {
|
|
14
|
+
if (!(0, node_net_1.isIP)(input) || input.includes('%'))
|
|
15
|
+
throw new Error('Invalid IP address');
|
|
16
|
+
return ipaddr_js_1.default.process(input).toString();
|
|
17
|
+
}
|
|
18
|
+
function cidrMatcher(cidrs) {
|
|
19
|
+
if (!cidrs.length || cidrs.length > 10000)
|
|
20
|
+
throw new Error('Invalid CIDR count');
|
|
21
|
+
const ranges = cidrs.map(cidr => {
|
|
22
|
+
if (cidr.length > 64 || !cidr.includes('/'))
|
|
23
|
+
throw new Error('Invalid CIDR');
|
|
24
|
+
const [raw, bits, extra] = cidr.split('/');
|
|
25
|
+
normalizeIp(raw);
|
|
26
|
+
if (extra !== undefined || !/^\d{1,3}$/.test(bits) || Number(bits) === 0)
|
|
27
|
+
throw new Error('Invalid CIDR prefix');
|
|
28
|
+
const [address, prefix] = ipaddr_js_1.default.parseCIDR(cidr);
|
|
29
|
+
if (address.kind() === 'ipv6' && address.isIPv4MappedAddress()) {
|
|
30
|
+
if (prefix <= 96)
|
|
31
|
+
throw new Error('Overbroad mapped CIDR');
|
|
32
|
+
return [address.toIPv4Address(), prefix - 96];
|
|
33
|
+
}
|
|
34
|
+
return [address, prefix];
|
|
35
|
+
});
|
|
36
|
+
return input => {
|
|
37
|
+
const address = ipaddr_js_1.default.parse(normalizeIp(input));
|
|
38
|
+
return ranges.some(([network, prefix]) => address.kind() === network.kind() && address.match(network, prefix));
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Only use after authenticating the distribution/origin path. Reject bad chains. */
|
|
42
|
+
function cloudFrontClientIp(input) {
|
|
43
|
+
if (!input.authenticatedOrigin)
|
|
44
|
+
throw new Error('Unauthenticated origin');
|
|
45
|
+
const trusted = cidrMatcher(input.trustedProxyCidrs);
|
|
46
|
+
if (!trusted(input.peerIp) || !input.forwardedFor || input.forwardedFor.length > 2048) {
|
|
47
|
+
throw new Error('Untrusted proxy path');
|
|
48
|
+
}
|
|
49
|
+
const chain = input.forwardedFor.split(',').map(part => normalizeIp(part.trim()));
|
|
50
|
+
if (chain.length > 16)
|
|
51
|
+
throw new Error('Too many proxy hops');
|
|
52
|
+
const hops = input.additionalProxyHops ?? 0;
|
|
53
|
+
if (!Number.isSafeInteger(hops) || hops < 0 || hops > 8 || chain.length <= hops)
|
|
54
|
+
throw new Error('Invalid proxy topology');
|
|
55
|
+
for (let i = 0; i < hops; i++) {
|
|
56
|
+
if (!trusted(chain[chain.length - 1 - i]))
|
|
57
|
+
throw new Error('Untrusted intermediate proxy');
|
|
58
|
+
}
|
|
59
|
+
// Use the configured topology, rather than skipping a viewer whose address
|
|
60
|
+
// happens to fall inside a proxy range. Earlier entries remain untrusted.
|
|
61
|
+
return chain[chain.length - 1 - hops];
|
|
62
|
+
}
|
|
63
|
+
/** Set the same secret as a custom origin header on the intended distribution. */
|
|
64
|
+
function createCloudFrontClientIpResolver(config) {
|
|
65
|
+
if (Buffer.byteLength(config.originSecret) < 32 || Buffer.byteLength(config.originSecret) > 256) {
|
|
66
|
+
throw new Error('Origin secret must contain 32 to 256 bytes');
|
|
67
|
+
}
|
|
68
|
+
const secret = Buffer.from(config.originSecret);
|
|
69
|
+
const cidrs = [...config.trustedProxyCidrs];
|
|
70
|
+
const hops = config.additionalProxyHops;
|
|
71
|
+
cidrMatcher(cidrs); // Validate before the first request.
|
|
72
|
+
return request => {
|
|
73
|
+
const supplied = request.headers['x-valiron-origin-auth'];
|
|
74
|
+
const bytes = typeof supplied === 'string' ? Buffer.from(supplied) : Buffer.alloc(0);
|
|
75
|
+
const authenticated = bytes.length === secret.length && (0, node_crypto_1.timingSafeEqual)(bytes, secret);
|
|
76
|
+
const chain = request.headers['x-forwarded-for'];
|
|
77
|
+
return cloudFrontClientIp({ peerIp: request.socket.remoteAddress ?? '',
|
|
78
|
+
forwardedFor: typeof chain === 'string' ? chain : undefined,
|
|
79
|
+
authenticatedOrigin: authenticated, trustedProxyCidrs: cidrs, additionalProxyHops: hops });
|
|
80
|
+
};
|
|
81
|
+
}
|
package/dist/meta.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IncomingMessage } from 'node:http';
|
|
2
|
+
import type { CrawlerEvidence } from './verification';
|
|
3
|
+
/** Trust AWS verification only across an authenticated, spoof-resistant WAF→origin path.
|
|
4
|
+
* WAF must reject viewer x-amzn-waf-* headers BEFORE inserting a class header,
|
|
5
|
+
* and insert it only when BOTH verified=true and the configured bot-name label match.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createAwsWafMetaEvidence(config: {
|
|
8
|
+
authenticatedClientIp: (request: IncomingMessage) => string;
|
|
9
|
+
/** Operator attestation that the prerequisite WAF rules are installed. */
|
|
10
|
+
rejectViewerWafHeaders: true;
|
|
11
|
+
rulesVersion: string;
|
|
12
|
+
now?: () => number;
|
|
13
|
+
}): (request: unknown, ip: string, userAgent: string) => CrawlerEvidence | undefined;
|
package/dist/meta.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAwsWafMetaEvidence = createAwsWafMetaEvidence;
|
|
4
|
+
const ip_1 = require("./ip");
|
|
5
|
+
const META_CLAIMS = [
|
|
6
|
+
[/\bfacebookexternalhit\b/i, 'social-preview'],
|
|
7
|
+
[/\bmeta-externalads\b/i, 'advertising'],
|
|
8
|
+
[/\bmeta-webindexer\b/i, 'search'],
|
|
9
|
+
[/\bmeta-externalagent\b/i, 'training'],
|
|
10
|
+
[/\bmeta-externalfetcher\b/i, 'fetcher'],
|
|
11
|
+
];
|
|
12
|
+
/** Trust AWS verification only across an authenticated, spoof-resistant WAF→origin path.
|
|
13
|
+
* WAF must reject viewer x-amzn-waf-* headers BEFORE inserting a class header,
|
|
14
|
+
* and insert it only when BOTH verified=true and the configured bot-name label match.
|
|
15
|
+
*/
|
|
16
|
+
function createAwsWafMetaEvidence(config) {
|
|
17
|
+
if (config.rejectViewerWafHeaders !== true || !config.rulesVersion || config.rulesVersion.length > 128)
|
|
18
|
+
throw new Error('Verified WAF configuration required');
|
|
19
|
+
return (request, ip, userAgent) => {
|
|
20
|
+
if (!request)
|
|
21
|
+
return undefined;
|
|
22
|
+
const req = request;
|
|
23
|
+
if ((0, ip_1.normalizeIp)(config.authenticatedClientIp(req)) !== (0, ip_1.normalizeIp)(ip))
|
|
24
|
+
throw new Error('WAF client mismatch');
|
|
25
|
+
const value = req.headers['x-amzn-waf-valiron-meta-class'];
|
|
26
|
+
if (value === undefined)
|
|
27
|
+
return undefined;
|
|
28
|
+
const claims = META_CLAIMS.filter(([pattern]) => pattern.test(userAgent));
|
|
29
|
+
if (typeof value !== 'string' || claims.length !== 1 || value !== claims[0][1])
|
|
30
|
+
return { state: 'claim_mismatch' };
|
|
31
|
+
return Object.freeze({ state: 'verified', provider: 'meta', crawlerClass: value,
|
|
32
|
+
method: 'trusted_waf', evidenceVersion: config.rulesVersion, expiresAt: (config.now ?? Date.now)() + 10000 });
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type CrawlerConfiguration } from './configuration';
|
|
2
|
+
export type CapacityBaseline = Readonly<{
|
|
3
|
+
safeDbConnections: number;
|
|
4
|
+
nonGuardConnections: number;
|
|
5
|
+
pools: readonly {
|
|
6
|
+
name: string;
|
|
7
|
+
maxConnections: number;
|
|
8
|
+
processes: number;
|
|
9
|
+
}[];
|
|
10
|
+
windowSeconds: number;
|
|
11
|
+
sampledRequests: number;
|
|
12
|
+
checkoutP95Ms: number;
|
|
13
|
+
checkoutTargetMs: number;
|
|
14
|
+
}>;
|
|
15
|
+
/** Read-only onboarding report. Missing measurements never become invented production limits. */
|
|
16
|
+
export declare function planCrawlerRollout(configuration: unknown, baseline?: CapacityBaseline, now?: number): {
|
|
17
|
+
configurationId: string;
|
|
18
|
+
mode: "observe" | "enforce";
|
|
19
|
+
enforceGroups: readonly string[];
|
|
20
|
+
inventory: {
|
|
21
|
+
id: string;
|
|
22
|
+
kind: "bypass" | "protected";
|
|
23
|
+
methods: readonly string[];
|
|
24
|
+
path: string;
|
|
25
|
+
}[];
|
|
26
|
+
poolConnections: number | undefined;
|
|
27
|
+
readyForControlledTrial: boolean;
|
|
28
|
+
blockers: string[];
|
|
29
|
+
next: string[];
|
|
30
|
+
boundaries: string[];
|
|
31
|
+
};
|
|
32
|
+
/** The customer supplies every budget and actual route. No company-specific branch in the engine. */
|
|
33
|
+
export declare function createEcommerceConfiguration(input: {
|
|
34
|
+
tenant: string;
|
|
35
|
+
policy: CrawlerConfiguration['policy'];
|
|
36
|
+
paths: {
|
|
37
|
+
listing: string;
|
|
38
|
+
detail: string;
|
|
39
|
+
checkout: string;
|
|
40
|
+
bypass?: readonly {
|
|
41
|
+
id: string;
|
|
42
|
+
path: string;
|
|
43
|
+
methods: readonly string[];
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
groups: {
|
|
47
|
+
listing: string;
|
|
48
|
+
detail: string;
|
|
49
|
+
checkout: string;
|
|
50
|
+
};
|
|
51
|
+
rollout: CrawlerConfiguration['rollout'];
|
|
52
|
+
cache?: CrawlerConfiguration['cache'];
|
|
53
|
+
crawlerAccess?: CrawlerConfiguration['crawlerAccess'];
|
|
54
|
+
}, now?: number): CrawlerConfiguration;
|
|
55
|
+
/** @deprecated Use createEcommerceConfiguration. Retained for existing integrations. */
|
|
56
|
+
export declare const createEcommercePilotConfiguration: typeof createEcommerceConfiguration;
|