mcp-web-validator 1.3.51 → 1.3.53
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/CHANGELOG.md +41 -0
- package/README.md +64 -4
- package/dist/audit-history.d.ts +9 -0
- package/dist/audit-history.js +27 -0
- package/dist/audit-history.js.map +1 -1
- package/dist/index.js +2508 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/browser-ux/lighthouse-lab-probe.d.ts +21 -0
- package/dist/modules/browser-ux/lighthouse-lab-probe.js +190 -0
- package/dist/modules/browser-ux/lighthouse-lab-probe.js.map +1 -0
- package/dist/modules/browser-ux/lighthouse-lab.d.ts +61 -0
- package/dist/modules/browser-ux/lighthouse-lab.js +98 -0
- package/dist/modules/browser-ux/lighthouse-lab.js.map +1 -0
- package/dist/modules/browser-ux/media-diagnostics.d.ts +41 -0
- package/dist/modules/browser-ux/media-diagnostics.js +183 -0
- package/dist/modules/browser-ux/media-diagnostics.js.map +1 -0
- package/dist/modules/browser-ux/raw-rendered-diff.d.ts +70 -0
- package/dist/modules/browser-ux/raw-rendered-diff.js +262 -0
- package/dist/modules/browser-ux/raw-rendered-diff.js.map +1 -0
- package/dist/modules/browser-ux/raw-rendered-probe.d.ts +17 -0
- package/dist/modules/browser-ux/raw-rendered-probe.js +163 -0
- package/dist/modules/browser-ux/raw-rendered-probe.js.map +1 -0
- package/dist/modules/browser-ux/resource-failures-probe.d.ts +11 -0
- package/dist/modules/browser-ux/resource-failures-probe.js +231 -0
- package/dist/modules/browser-ux/resource-failures-probe.js.map +1 -0
- package/dist/modules/browser-ux/resource-failures.d.ts +79 -0
- package/dist/modules/browser-ux/resource-failures.js +178 -0
- package/dist/modules/browser-ux/resource-failures.js.map +1 -0
- package/dist/modules/browser-ux/viewport-parity-probe.d.ts +5 -0
- package/dist/modules/browser-ux/viewport-parity-probe.js +307 -0
- package/dist/modules/browser-ux/viewport-parity-probe.js.map +1 -0
- package/dist/modules/browser-ux/viewport-parity.d.ts +112 -0
- package/dist/modules/browser-ux/viewport-parity.js +224 -0
- package/dist/modules/browser-ux/viewport-parity.js.map +1 -0
- package/dist/modules/browser-ux/wcag-interactions.d.ts +95 -0
- package/dist/modules/browser-ux/wcag-interactions.js +360 -0
- package/dist/modules/browser-ux/wcag-interactions.js.map +1 -0
- package/dist/modules/change-regression/availability-history-store.d.ts +18 -0
- package/dist/modules/change-regression/availability-history-store.js +168 -0
- package/dist/modules/change-regression/availability-history-store.js.map +1 -0
- package/dist/modules/change-regression/crawler-log-correlation.d.ts +111 -0
- package/dist/modules/change-regression/crawler-log-correlation.js +374 -0
- package/dist/modules/change-regression/crawler-log-correlation.js.map +1 -0
- package/dist/modules/change-regression/google-common-crawler-ip.d.ts +15 -0
- package/dist/modules/change-regression/google-common-crawler-ip.js +129 -0
- package/dist/modules/change-regression/google-common-crawler-ip.js.map +1 -0
- package/dist/modules/change-regression/historical-comparisons.d.ts +120 -0
- package/dist/modules/change-regression/historical-comparisons.js +330 -0
- package/dist/modules/change-regression/historical-comparisons.js.map +1 -0
- package/dist/modules/change-regression/production-change-comparison.d.ts +68 -0
- package/dist/modules/change-regression/production-change-comparison.js +214 -0
- package/dist/modules/change-regression/production-change-comparison.js.map +1 -0
- package/dist/modules/change-regression/regression-alerts.d.ts +73 -0
- package/dist/modules/change-regression/regression-alerts.js +183 -0
- package/dist/modules/change-regression/regression-alerts.js.map +1 -0
- package/dist/modules/change-regression/strict-observation-time.d.ts +7 -0
- package/dist/modules/change-regression/strict-observation-time.js +31 -0
- package/dist/modules/change-regression/strict-observation-time.js.map +1 -0
- package/dist/modules/content-schema/citation-methodology-consistency.d.ts +108 -0
- package/dist/modules/content-schema/citation-methodology-consistency.js +360 -0
- package/dist/modules/content-schema/citation-methodology-consistency.js.map +1 -0
- package/dist/modules/content-schema/competitor-intent-comparison.d.ts +74 -0
- package/dist/modules/content-schema/competitor-intent-comparison.js +185 -0
- package/dist/modules/content-schema/competitor-intent-comparison.js.map +1 -0
- package/dist/modules/content-schema/empty-boilerplate-content.d.ts +36 -0
- package/dist/modules/content-schema/empty-boilerplate-content.js +225 -0
- package/dist/modules/content-schema/empty-boilerplate-content.js.map +1 -0
- package/dist/modules/content-schema/extract-citation-methodology.d.ts +6 -0
- package/dist/modules/content-schema/extract-citation-methodology.js +201 -0
- package/dist/modules/content-schema/extract-citation-methodology.js.map +1 -0
- package/dist/modules/content-schema/extract-competitor-intent.d.ts +2 -0
- package/dist/modules/content-schema/extract-competitor-intent.js +140 -0
- package/dist/modules/content-schema/extract-competitor-intent.js.map +1 -0
- package/dist/modules/content-schema/extract-main-content.d.ts +6 -0
- package/dist/modules/content-schema/extract-main-content.js +33 -0
- package/dist/modules/content-schema/extract-main-content.js.map +1 -0
- package/dist/modules/content-schema/extract-metadata-consistency.d.ts +3 -0
- package/dist/modules/content-schema/extract-metadata-consistency.js +62 -0
- package/dist/modules/content-schema/extract-metadata-consistency.js.map +1 -0
- package/dist/modules/content-schema/extract-product-claims.d.ts +3 -0
- package/dist/modules/content-schema/extract-product-claims.js +58 -0
- package/dist/modules/content-schema/extract-product-claims.js.map +1 -0
- package/dist/modules/content-schema/extract-structured-data.d.ts +3 -0
- package/dist/modules/content-schema/extract-structured-data.js +25 -0
- package/dist/modules/content-schema/extract-structured-data.js.map +1 -0
- package/dist/modules/content-schema/metadata-consistency.d.ts +66 -0
- package/dist/modules/content-schema/metadata-consistency.js +282 -0
- package/dist/modules/content-schema/metadata-consistency.js.map +1 -0
- package/dist/modules/content-schema/product-claims.d.ts +73 -0
- package/dist/modules/content-schema/product-claims.js +195 -0
- package/dist/modules/content-schema/product-claims.js.map +1 -0
- package/dist/modules/content-schema/same-language-duplicates.d.ts +52 -0
- package/dist/modules/content-schema/same-language-duplicates.js +158 -0
- package/dist/modules/content-schema/same-language-duplicates.js.map +1 -0
- package/dist/modules/content-schema/structured-data-validation.d.ts +37 -0
- package/dist/modules/content-schema/structured-data-validation.js +385 -0
- package/dist/modules/content-schema/structured-data-validation.js.map +1 -0
- package/dist/modules/external-metrics/crux-field-probe.d.ts +10 -0
- package/dist/modules/external-metrics/crux-field-probe.js +113 -0
- package/dist/modules/external-metrics/crux-field-probe.js.map +1 -0
- package/dist/modules/external-metrics/crux-field.d.ts +61 -0
- package/dist/modules/external-metrics/crux-field.js +231 -0
- package/dist/modules/external-metrics/crux-field.js.map +1 -0
- package/dist/modules/http-crawl/availability-observations.d.ts +68 -0
- package/dist/modules/http-crawl/availability-observations.js +206 -0
- package/dist/modules/http-crawl/availability-observations.js.map +1 -0
- package/dist/modules/http-crawl/availability-probe.d.ts +8 -0
- package/dist/modules/http-crawl/availability-probe.js +46 -0
- package/dist/modules/http-crawl/availability-probe.js.map +1 -0
- package/dist/modules/http-crawl/crawler-access-probe.d.ts +6 -0
- package/dist/modules/http-crawl/crawler-access-probe.js +79 -0
- package/dist/modules/http-crawl/crawler-access-probe.js.map +1 -0
- package/dist/modules/http-crawl/crawler-access.d.ts +75 -0
- package/dist/modules/http-crawl/crawler-access.js +404 -0
- package/dist/modules/http-crawl/crawler-access.js.map +1 -0
- package/dist/modules/http-crawl/http-delivery-probe.d.ts +3 -0
- package/dist/modules/http-crawl/http-delivery-probe.js +44 -0
- package/dist/modules/http-crawl/http-delivery-probe.js.map +1 -0
- package/dist/modules/http-crawl/http-delivery.d.ts +64 -0
- package/dist/modules/http-crawl/http-delivery.js +269 -0
- package/dist/modules/http-crawl/http-delivery.js.map +1 -0
- package/dist/modules/http-crawl/https-security.d.ts +84 -0
- package/dist/modules/http-crawl/https-security.js +441 -0
- package/dist/modules/http-crawl/https-security.js.map +1 -0
- package/dist/modules/http-crawl/non-html-directives.d.ts +74 -0
- package/dist/modules/http-crawl/non-html-directives.js +353 -0
- package/dist/modules/http-crawl/non-html-directives.js.map +1 -0
- package/dist/modules/http-crawl/redirect-canonical-chains.d.ts +80 -0
- package/dist/modules/http-crawl/redirect-canonical-chains.js +459 -0
- package/dist/modules/http-crawl/redirect-canonical-chains.js.map +1 -0
- package/dist/modules/http-crawl/redirect-canonical-probe.d.ts +6 -0
- package/dist/modules/http-crawl/redirect-canonical-probe.js +83 -0
- package/dist/modules/http-crawl/redirect-canonical-probe.js.map +1 -0
- package/dist/modules/http-crawl/sitemap-inventory-probe.d.ts +8 -0
- package/dist/modules/http-crawl/sitemap-inventory-probe.js +155 -0
- package/dist/modules/http-crawl/sitemap-inventory-probe.js.map +1 -0
- package/dist/modules/http-crawl/sitemap-inventory.d.ts +107 -0
- package/dist/modules/http-crawl/sitemap-inventory.js +557 -0
- package/dist/modules/http-crawl/sitemap-inventory.js.map +1 -0
- package/dist/modules/http-crawl/url-variants.d.ts +86 -0
- package/dist/modules/http-crawl/url-variants.js +379 -0
- package/dist/modules/http-crawl/url-variants.js.map +1 -0
- package/dist/modules/site-architecture/extract-internal-links.d.ts +3 -0
- package/dist/modules/site-architecture/extract-internal-links.js +88 -0
- package/dist/modules/site-architecture/extract-internal-links.js.map +1 -0
- package/dist/modules/site-architecture/extract-multilingual-page.d.ts +2 -0
- package/dist/modules/site-architecture/extract-multilingual-page.js +29 -0
- package/dist/modules/site-architecture/extract-multilingual-page.js.map +1 -0
- package/dist/modules/site-architecture/internal-link-graph-probe.d.ts +7 -0
- package/dist/modules/site-architecture/internal-link-graph-probe.js +116 -0
- package/dist/modules/site-architecture/internal-link-graph-probe.js.map +1 -0
- package/dist/modules/site-architecture/internal-link-graph.d.ts +113 -0
- package/dist/modules/site-architecture/internal-link-graph.js +414 -0
- package/dist/modules/site-architecture/internal-link-graph.js.map +1 -0
- package/dist/modules/site-architecture/internal-link-quality.d.ts +77 -0
- package/dist/modules/site-architecture/internal-link-quality.js +260 -0
- package/dist/modules/site-architecture/internal-link-quality.js.map +1 -0
- package/dist/modules/site-architecture/multilingual-clusters.d.ts +82 -0
- package/dist/modules/site-architecture/multilingual-clusters.js +363 -0
- package/dist/modules/site-architecture/multilingual-clusters.js.map +1 -0
- package/dist/network.d.ts +4 -0
- package/dist/network.js +18 -2
- package/dist/network.js.map +1 -1
- package/dist/presentation.d.ts +53 -0
- package/dist/presentation.js +526 -0
- package/dist/presentation.js.map +1 -1
- package/dist/screenshot.d.ts +2 -1
- package/dist/screenshot.js +4 -2
- package/dist/screenshot.js.map +1 -1
- package/dist/seo-auditor.js +16 -6
- package/dist/seo-auditor.js.map +1 -1
- package/package.json +7 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"availability-history-store.js","sourceRoot":"","sources":["../../../src/modules/change-regression/availability-history-store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,GAEhC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,mCAAmC,GAAG,MAAM,CAAC;AAC1D,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAE7C,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC1D,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,QAAQ,EAAE;IACtD,YAAY,EAAE,CAAC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AAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1F,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC7C,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/**\n * V02 local opt-in availability history. Separate from site-audit snapshots:\n * stores only ten compact HTTP outcome observations; hosted Worker stays\n * stateless. Uses the same guarded .mcp-validator directory convention.\n */\nimport * as fs from \"node:fs/promises\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\nimport { z } from \"zod\";\nimport {\n AVAILABILITY_FAILURE_CODES,\n validateAvailabilityObservation,\n type AvailabilityObservation,\n} from \"../http-crawl/availability-observations.js\";\nimport { safeHttpResourceUrl } from \"../http-crawl/non-html-directives.js\";\n\nexport const MAX_AVAILABILITY_HISTORY = 10;\nexport const MAX_AVAILABILITY_HISTORY_FILE_BYTES = 24_000;\nconst SUBDIRECTORY = \".mcp-validator\";\nconst FILENAME = \"availability-history.json\";\n\nconst observationSchema = z.object({\n observed_at: z.string().max(40),\n status_code: z.number().int().min(100).max(599).optional(),\n failure: z.enum(AVAILABILITY_FAILURE_CODES).optional(),\n cf_challenge: z.boolean().optional(),\n elapsed_ms: z.number().int().min(0).max(120_000).optional(),\n}).strict();\nconst storedRecordSchema = z.object({\n id: z.string().uuid(),\n saved_at: z.string().datetime({ offset: true }),\n url: z.string().max(512),\n observation: observationSchema,\n}).strict();\nconst persistedSchema = z.object({\n version: z.literal(1),\n items: z.array(storedRecordSchema).max(MAX_AVAILABILITY_HISTORY),\n}).strict();\n\ntype PersistedRecord = z.infer<typeof storedRecordSchema>;\nexport interface AvailabilitySavedRecord {\n id: string;\n saved_at: string;\n observation: AvailabilityObservation;\n}\nexport interface AvailabilityStoreResponse {\n count: number;\n records: AvailabilitySavedRecord[];\n saved_id?: string;\n evicted_id?: string;\n}\n\nfunction rootDirectory(): string {\n const configured = process.env.MCP_WEB_VALIDATOR_WORKSPACE_ROOT;\n if (configured === undefined) return os.homedir();\n if (!path.isAbsolute(configured)) throw new Error(\"Workspace root must be an absolute path.\");\n return configured;\n}\n\nasync function historyPath(root: string, create: boolean): Promise<string> {\n const resolvedRoot = await fs.realpath(root);\n const dir = path.join(resolvedRoot, SUBDIRECTORY);\n if (create) await fs.mkdir(dir, { recursive: true, mode: 0o700 });\n const entry = await fs.lstat(dir).catch((cause: NodeJS.ErrnoException) => {\n if (!create && cause.code === \"ENOENT\") return undefined;\n throw cause;\n });\n if (!entry) return path.join(dir, FILENAME);\n if (!entry.isDirectory() || entry.isSymbolicLink()) {\n throw new Error(\"Availability history directory must be a real directory.\");\n }\n const actualDir = await fs.realpath(dir);\n if (path.dirname(actualDir) !== resolvedRoot) {\n throw new Error(\"Availability history must remain inside its configured workspace root.\");\n }\n return path.join(actualDir, FILENAME);\n}\n\nasync function readHistory(root: string): Promise<PersistedRecord[]> {\n const file = await historyPath(root, false);\n const info = await fs.lstat(file).catch((cause: NodeJS.ErrnoException) => {\n if (cause.code === \"ENOENT\") return undefined;\n throw cause;\n });\n if (!info) return [];\n if (!info.isFile() || info.isSymbolicLink() || info.nlink !== 1 ||\n info.size > MAX_AVAILABILITY_HISTORY_FILE_BYTES) {\n throw new Error(\"Availability history must be a bounded regular file, not a link.\");\n }\n let candidate: unknown;\n try {\n candidate = JSON.parse(await fs.readFile(file, \"utf8\"));\n } catch {\n throw new Error(\"Availability history is unreadable; nothing was changed.\");\n }\n const parsed = persistedSchema.safeParse(candidate);\n if (!parsed.success) {\n throw new Error(\"Availability history has invalid fields; nothing was changed.\");\n }\n for (const record of parsed.data.items) {\n if (!safeHttpResourceUrl(record.url)) {\n throw new Error(\"Availability history has an unsafe URL label; nothing was changed.\");\n }\n validateAvailabilityObservation(record.observation);\n }\n return parsed.data.items;\n}\n\nasync function writeHistory(root: string, items: PersistedRecord[]): Promise<void> {\n const file = await historyPath(root, true);\n const contents = JSON.stringify({ version: 1, items });\n if (Buffer.byteLength(contents, \"utf8\") > MAX_AVAILABILITY_HISTORY_FILE_BYTES) {\n throw new Error(\"Availability history would exceed the 24 KB file limit.\");\n }\n const temporary = path.join(path.dirname(file), \".\" + FILENAME + \".\" + randomUUID() + \".tmp\");\n let handle: fs.FileHandle | undefined;\n try {\n handle = await fs.open(temporary, \"wx\", 0o600);\n await handle.writeFile(contents, \"utf8\");\n await handle.sync();\n await handle.close();\n handle = undefined;\n await fs.rename(temporary, file);\n } finally {\n if (handle) await handle.close();\n await fs.rm(temporary, { force: true });\n }\n}\n\nfunction response(items: PersistedRecord[], url: string,\n savedId?: string, evictedId?: string): AvailabilityStoreResponse {\n const records = items.filter((item) => item.url === url)\n .map(({ id, saved_at, observation }) => ({ id, saved_at, observation }));\n return {\n count: records.length, records,\n ...(savedId ? { saved_id: savedId } : {}),\n ...(evictedId ? { evicted_id: evictedId } : {}),\n };\n}\n\nlet pendingSave: Promise<unknown> = Promise.resolve();\n\n/** Read-only, bounded, exact-URL history lookup. No global list or raw URL output. */\nexport async function getAvailabilityHistory(\n url: string, root = rootDirectory(),\n): Promise<AvailabilityStoreResponse> {\n const safe = safeHttpResourceUrl(url);\n if (!safe) throw new Error(\"History lookup requires a safe query-free URL label.\");\n return response(await readHistory(root), safe);\n}\n\n/** Opt-in single HTTP observation save, with atomic write and ten-item eviction. */\nexport function saveAvailabilityObservation(\n url: string, observation: AvailabilityObservation, root = rootDirectory(),\n): Promise<AvailabilityStoreResponse> {\n const safe = safeHttpResourceUrl(url);\n if (!safe) throw new Error(\"History save requires a safe query-free URL label.\");\n validateAvailabilityObservation(observation);\n const parsedObservation = observationSchema.parse(observation);\n const action = async (): Promise<AvailabilityStoreResponse> => {\n const items = await readHistory(root);\n const sameUrl = items.filter((item) => item.url === safe);\n const last = sameUrl.at(-1);\n if (last && Date.parse(parsedObservation.observed_at) <=\n Date.parse(last.observation.observed_at)) {\n if (Date.parse(parsedObservation.observed_at) === Date.parse(last.observation.observed_at) &&\n JSON.stringify(last.observation) === JSON.stringify(parsedObservation)) {\n return response(items, safe, last.id);\n }\n throw new Error(\"Saved observations must advance chronologically for each exact URL.\");\n }\n const newItem: PersistedRecord = {\n id: randomUUID(), saved_at: new Date().toISOString(), url: safe,\n observation: parsedObservation,\n };\n const next = [...items, newItem];\n const removed = next.length > MAX_AVAILABILITY_HISTORY ? next.shift() : undefined;\n await writeHistory(root, next);\n // The archive is globally capped; never disclose an ID that belongs to\n // some other exact URL when its oldest record is evicted.\n return response(next, safe, newItem.id, removed?.url === safe ? removed.id : undefined);\n };\n const request = pendingSave.then(action, action);\n pendingSave = request.catch(() => undefined);\n return request;\n}\n"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V12: bounded, offline correlation of caller-supplied HTTP access records.
|
|
3
|
+
* No IP, URL, user agent, token, log line or timestamp is returned. A bot
|
|
4
|
+
* user-agent is only a self-declared string; optional range matching is not DNS proof.
|
|
5
|
+
*/
|
|
6
|
+
import { type NumericCidr } from "./google-common-crawler-ip.js";
|
|
7
|
+
export declare const MAX_CRAWL_LOG_RECORDS = 500;
|
|
8
|
+
export declare const MAX_CRAWL_LOG_TOTAL_BYTES = 256000;
|
|
9
|
+
export declare const MAX_CRAWL_IMPORTANT_URLS = 16;
|
|
10
|
+
export declare const MAX_CRAWL_FINDINGS = 16;
|
|
11
|
+
export declare const CRAWL_LOG_FORMATS: readonly ["structured", "combined_access"];
|
|
12
|
+
export declare const CRAWL_PROFILES: readonly ["claimed_googlebot", "claimed_bingbot", "claimed_gptbot", "claimed_other_bot", "other"];
|
|
13
|
+
export declare const CRAWL_FINDING_CODES: readonly ["no_important_url_matches", "incomplete_before_after_sample", "failed_requests_increased", "post_block_challenge", "post_rate_limiting", "post_server_errors", "post_missing_pages", "important_url_post_failures", "unparsed_log_entries", "query_variants_observed", "user_agents_unverified", "sample_only", "googlebot_range_match", "googlebot_range_mismatch", "googlebot_ranges_unavailable"];
|
|
14
|
+
type LogFormat = typeof CRAWL_LOG_FORMATS[number];
|
|
15
|
+
type LogProfile = typeof CRAWL_PROFILES[number];
|
|
16
|
+
type LogCode = typeof CRAWL_FINDING_CODES[number];
|
|
17
|
+
export interface LogObservation {
|
|
18
|
+
timestamp: string;
|
|
19
|
+
method: string;
|
|
20
|
+
path: string;
|
|
21
|
+
status: number;
|
|
22
|
+
user_agent?: string;
|
|
23
|
+
client_ip?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CrawlerLogInput {
|
|
26
|
+
site_origin: string;
|
|
27
|
+
important_urls: string[];
|
|
28
|
+
cutover_at: string;
|
|
29
|
+
format: LogFormat;
|
|
30
|
+
observations?: LogObservation[];
|
|
31
|
+
access_log?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface LogPeriodStats {
|
|
34
|
+
requests: number;
|
|
35
|
+
http_2xx: number;
|
|
36
|
+
redirects_3xx: number;
|
|
37
|
+
block_401_403: number;
|
|
38
|
+
rate_limited_429: number;
|
|
39
|
+
missing_404_410: number;
|
|
40
|
+
server_5xx: number;
|
|
41
|
+
other_4xx: number;
|
|
42
|
+
problem_responses: number;
|
|
43
|
+
failure_rate_percent: number | null;
|
|
44
|
+
}
|
|
45
|
+
export interface LogUrlStats {
|
|
46
|
+
url_index: number;
|
|
47
|
+
before_requests: number;
|
|
48
|
+
after_requests: number;
|
|
49
|
+
after_problem_responses: number;
|
|
50
|
+
after_block_401_403: number;
|
|
51
|
+
after_rate_limited_429: number;
|
|
52
|
+
after_server_5xx: number;
|
|
53
|
+
}
|
|
54
|
+
export interface LogProfileStats {
|
|
55
|
+
profile: LogProfile;
|
|
56
|
+
before_requests: number;
|
|
57
|
+
after_requests: number;
|
|
58
|
+
after_problem_responses: number;
|
|
59
|
+
}
|
|
60
|
+
export interface GooglebotIpEvidence {
|
|
61
|
+
status: "not_requested" | "checked_current_official_ranges" | "unavailable";
|
|
62
|
+
claimed_requests: number;
|
|
63
|
+
matched_current_ranges: number;
|
|
64
|
+
outside_current_ranges: number;
|
|
65
|
+
missing_or_invalid_ip: number;
|
|
66
|
+
matched_before: number;
|
|
67
|
+
matched_after: number;
|
|
68
|
+
matched_after_problem_responses: number;
|
|
69
|
+
}
|
|
70
|
+
export interface CrawlerLogFinding {
|
|
71
|
+
code: LogCode;
|
|
72
|
+
severity: "warning" | "info";
|
|
73
|
+
url_index?: number;
|
|
74
|
+
message: string;
|
|
75
|
+
}
|
|
76
|
+
export interface CrawlerLogReview {
|
|
77
|
+
scope: "caller_supplied_access_log_sample";
|
|
78
|
+
format: LogFormat;
|
|
79
|
+
status: "comparable_sample" | "partial" | "not_comparable";
|
|
80
|
+
important_urls_supplied: number;
|
|
81
|
+
source_records: number;
|
|
82
|
+
parsed_records: number;
|
|
83
|
+
invalid_records: number;
|
|
84
|
+
ignored_methods: number;
|
|
85
|
+
unmatched_requests: number;
|
|
86
|
+
query_variants_observed: number;
|
|
87
|
+
matched_requests: number;
|
|
88
|
+
before: LogPeriodStats;
|
|
89
|
+
after: LogPeriodStats;
|
|
90
|
+
failure_rate_delta_percentage_points: number | null;
|
|
91
|
+
per_url: LogUrlStats[];
|
|
92
|
+
claimed_crawler_profiles: LogProfileStats[];
|
|
93
|
+
googlebot_ip_evidence: GooglebotIpEvidence;
|
|
94
|
+
crawler_identities_verified: false;
|
|
95
|
+
coverage_limited: true;
|
|
96
|
+
limitations: string[];
|
|
97
|
+
total_findings: number;
|
|
98
|
+
findings: CrawlerLogFinding[];
|
|
99
|
+
findings_truncated: boolean;
|
|
100
|
+
error?: string;
|
|
101
|
+
}
|
|
102
|
+
export declare function emptyCrawlerLogReview(format?: LogFormat): CrawlerLogReview;
|
|
103
|
+
export declare function isoTimestamp(raw: unknown): number | undefined;
|
|
104
|
+
export declare function safeLogOrigin(raw: unknown): string | undefined;
|
|
105
|
+
/** A deliberately narrow Apache combined log parser; malformed lines become unknown evidence. */
|
|
106
|
+
export declare function parseCombinedAccessLine(line: string): LogObservation | undefined;
|
|
107
|
+
export declare function analyzeCrawlerLogs(input: CrawlerLogInput, ipCheck?: {
|
|
108
|
+
requested: true;
|
|
109
|
+
ranges?: readonly NumericCidr[];
|
|
110
|
+
}): CrawlerLogReview;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V12: bounded, offline correlation of caller-supplied HTTP access records.
|
|
3
|
+
* No IP, URL, user agent, token, log line or timestamp is returned. A bot
|
|
4
|
+
* user-agent is only a self-declared string; optional range matching is not DNS proof.
|
|
5
|
+
*/
|
|
6
|
+
import { matchesOfficialGoogleRange, } from "./google-common-crawler-ip.js";
|
|
7
|
+
export const MAX_CRAWL_LOG_RECORDS = 500;
|
|
8
|
+
export const MAX_CRAWL_LOG_TOTAL_BYTES = 256_000;
|
|
9
|
+
export const MAX_CRAWL_IMPORTANT_URLS = 16;
|
|
10
|
+
export const MAX_CRAWL_FINDINGS = 16;
|
|
11
|
+
export const CRAWL_LOG_FORMATS = ["structured", "combined_access"];
|
|
12
|
+
export const CRAWL_PROFILES = ["claimed_googlebot", "claimed_bingbot", "claimed_gptbot", "claimed_other_bot", "other"];
|
|
13
|
+
export const CRAWL_FINDING_CODES = [
|
|
14
|
+
"no_important_url_matches", "incomplete_before_after_sample", "failed_requests_increased",
|
|
15
|
+
"post_block_challenge", "post_rate_limiting", "post_server_errors",
|
|
16
|
+
"post_missing_pages", "important_url_post_failures", "unparsed_log_entries",
|
|
17
|
+
"query_variants_observed", "user_agents_unverified", "sample_only",
|
|
18
|
+
"googlebot_range_match", "googlebot_range_mismatch", "googlebot_ranges_unavailable",
|
|
19
|
+
];
|
|
20
|
+
const limitations = [
|
|
21
|
+
"Only caller-supplied bounded log observations are analyzed; missing log periods or unmatched URLs cannot prove real availability, crawling frequency or absence of defects.",
|
|
22
|
+
"User-agent claims remain unverified. Optional source-IP matches against Google's current common-crawler ranges do not prove historical identity, reverse DNS, or identities of other bots.",
|
|
23
|
+
"The before/after cutover is a sample comparison of request counts and HTTP statuses, not a causal test of deployment changes, Google indexing, rankings or traffic loss.",
|
|
24
|
+
"IP addresses, raw paths, query strings, user agents, timestamps and source log text are never returned or stored; redirects, robots policy and Google-selected canonicals are not followed.",
|
|
25
|
+
];
|
|
26
|
+
const encoder = new TextEncoder();
|
|
27
|
+
const byteLength = (s) => encoder.encode(s).byteLength;
|
|
28
|
+
function emptyPeriod() {
|
|
29
|
+
return {
|
|
30
|
+
requests: 0, http_2xx: 0, redirects_3xx: 0, block_401_403: 0,
|
|
31
|
+
rate_limited_429: 0, missing_404_410: 0, server_5xx: 0,
|
|
32
|
+
other_4xx: 0, problem_responses: 0, failure_rate_percent: null,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function emptyGooglebotIpEvidence() {
|
|
36
|
+
return {
|
|
37
|
+
status: "not_requested", claimed_requests: 0, matched_current_ranges: 0,
|
|
38
|
+
outside_current_ranges: 0, missing_or_invalid_ip: 0,
|
|
39
|
+
matched_before: 0, matched_after: 0, matched_after_problem_responses: 0,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function emptyCrawlerLogReview(format = "structured") {
|
|
43
|
+
return {
|
|
44
|
+
scope: "caller_supplied_access_log_sample", format, status: "not_comparable",
|
|
45
|
+
important_urls_supplied: 0, source_records: 0, parsed_records: 0, invalid_records: 0,
|
|
46
|
+
ignored_methods: 0, unmatched_requests: 0, query_variants_observed: 0,
|
|
47
|
+
matched_requests: 0, before: emptyPeriod(), after: emptyPeriod(),
|
|
48
|
+
failure_rate_delta_percentage_points: null, per_url: [],
|
|
49
|
+
claimed_crawler_profiles: [], googlebot_ip_evidence: emptyGooglebotIpEvidence(),
|
|
50
|
+
crawler_identities_verified: false,
|
|
51
|
+
coverage_limited: true, limitations, total_findings: 0, findings: [], findings_truncated: false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const offsetIso = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/u;
|
|
55
|
+
export function isoTimestamp(raw) {
|
|
56
|
+
if (typeof raw !== "string" || raw.length > 40 || !offsetIso.test(raw))
|
|
57
|
+
return;
|
|
58
|
+
const calendar = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/u.exec(raw);
|
|
59
|
+
if (!calendar)
|
|
60
|
+
return;
|
|
61
|
+
const [year, month, day, hour, minute, second] = calendar.slice(1).map(Number);
|
|
62
|
+
if (year < 2000 || year > 2100 || month < 1 || month > 12 || hour > 23 || minute > 59 || second > 59)
|
|
63
|
+
return;
|
|
64
|
+
const checked = new Date(Date.UTC(year, month - 1, day, hour, minute, second));
|
|
65
|
+
if (checked.getUTCFullYear() !== year || checked.getUTCMonth() !== month - 1 ||
|
|
66
|
+
checked.getUTCDate() !== day)
|
|
67
|
+
return;
|
|
68
|
+
const zone = /([+-])(\d{2}):(\d{2})$/u.exec(raw);
|
|
69
|
+
if (zone && (Number(zone[2]) > 14 || Number(zone[3]) > 59))
|
|
70
|
+
return;
|
|
71
|
+
const v = Date.parse(raw);
|
|
72
|
+
return Number.isFinite(v) ? v : undefined;
|
|
73
|
+
}
|
|
74
|
+
export function safeLogOrigin(raw) {
|
|
75
|
+
if (typeof raw !== "string" || byteLength(raw) > 300)
|
|
76
|
+
return;
|
|
77
|
+
try {
|
|
78
|
+
const url = new URL(raw);
|
|
79
|
+
if (url.protocol !== "https:" || url.username || url.password || url.port ||
|
|
80
|
+
url.search || url.hash || !url.hostname.includes(".") ||
|
|
81
|
+
/(?:^|\.)(?:localhost|local|internal|invalid|test)$/iu.test(url.hostname) ||
|
|
82
|
+
/^\d+\.\d+\.\d+\.\d+$/u.test(url.hostname) || url.hostname.includes(":") ||
|
|
83
|
+
(raw !== url.origin && raw !== url.origin + "/"))
|
|
84
|
+
return;
|
|
85
|
+
return url.origin;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function safeRequestPath(raw, origin) {
|
|
92
|
+
if (typeof raw !== "string" || byteLength(raw) > 1024 || !raw.startsWith("/") ||
|
|
93
|
+
raw.startsWith("//") || raw.includes("\\") ||
|
|
94
|
+
/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(raw) ||
|
|
95
|
+
/%(?:2e|2f|5c|00|0a|0d)/iu.test(raw) || raw.includes("#") ||
|
|
96
|
+
// URL() normalizes plain dot segments; reject them before path matching.
|
|
97
|
+
/(?:^|\/)\.{1,2}(?:\/|$)/u.test(raw.split("?", 1)[0]))
|
|
98
|
+
return;
|
|
99
|
+
try {
|
|
100
|
+
const url = new URL(raw, origin);
|
|
101
|
+
if (url.origin !== origin || url.username || url.password || url.hash)
|
|
102
|
+
return;
|
|
103
|
+
return { path: url.pathname, query: Boolean(url.search) };
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function validateImportant(input, origin) {
|
|
110
|
+
if (!Array.isArray(input) || input.length < 1 || input.length > MAX_CRAWL_IMPORTANT_URLS)
|
|
111
|
+
throw new Error("Require 1–16 explicit same-origin important URLs");
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const raw of input) {
|
|
114
|
+
if (typeof raw !== "string" || raw.length > 512)
|
|
115
|
+
throw new Error("Invalid important URL");
|
|
116
|
+
let u;
|
|
117
|
+
try {
|
|
118
|
+
u = new URL(raw);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
throw new Error("Invalid important URL");
|
|
122
|
+
}
|
|
123
|
+
if (u.origin !== origin || u.search || u.hash || u.username || u.password || u.port ||
|
|
124
|
+
!raw.startsWith(origin) || raw.includes("\\"))
|
|
125
|
+
throw new Error("Unsafe important URL");
|
|
126
|
+
// Validate the original path before URL.pathname can normalize ../.
|
|
127
|
+
const path = safeRequestPath(raw.slice(origin.length) || "/", origin)?.path;
|
|
128
|
+
if (!path || out.includes(path))
|
|
129
|
+
throw new Error("Duplicate or unsafe important URL");
|
|
130
|
+
out.push(path);
|
|
131
|
+
}
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
134
|
+
const months = {
|
|
135
|
+
Jan: 1, Feb: 2, Mar: 3, Apr: 4, May: 5, Jun: 6,
|
|
136
|
+
Jul: 7, Aug: 8, Sep: 9, Oct: 10, Nov: 11, Dec: 12,
|
|
137
|
+
};
|
|
138
|
+
function apacheTime(raw) {
|
|
139
|
+
const m = /^(\d{2})\/([A-Z][a-z]{2})\/(\d{4}):(\d{2}):(\d{2}):(\d{2}) ([+-])(\d{2})(\d{2})$/u.exec(raw);
|
|
140
|
+
if (!m || !months[m[2]])
|
|
141
|
+
return;
|
|
142
|
+
const [day, year, hour, minute, second, offsetHour, offsetMinute] = [
|
|
143
|
+
Number(m[1]), Number(m[3]), Number(m[4]), Number(m[5]),
|
|
144
|
+
Number(m[6]), Number(m[8]), Number(m[9])
|
|
145
|
+
];
|
|
146
|
+
if (year < 2000 || year > 2100 || hour > 23 || minute > 59 || second > 59 || offsetHour > 14 || offsetMinute > 59)
|
|
147
|
+
return;
|
|
148
|
+
const month = months[m[2]];
|
|
149
|
+
const checked = new Date(Date.UTC(year, month - 1, day, hour, minute, second));
|
|
150
|
+
if (checked.getUTCDate() !== day || checked.getUTCMonth() !== month - 1 || checked.getUTCFullYear() !== year)
|
|
151
|
+
return;
|
|
152
|
+
const offset = (offsetHour * 60 + offsetMinute) * (m[7] === "+" ? 1 : -1);
|
|
153
|
+
return new Date(Date.UTC(year, month - 1, day, hour, minute, second) - offset * 60_000).toISOString();
|
|
154
|
+
}
|
|
155
|
+
/** A deliberately narrow Apache combined log parser; malformed lines become unknown evidence. */
|
|
156
|
+
export function parseCombinedAccessLine(line) {
|
|
157
|
+
if (typeof line !== "string" || byteLength(line) > 2048)
|
|
158
|
+
return;
|
|
159
|
+
const m = /^(\S+) \S+ \S+ \[([^\]]{15,45})\] "([A-Z]+) ([^"\s]{1,1024}) HTTP\/\d(?:\.\d)?" ([2-5]\d{2}) (?:\d+|-) "[^"]{0,1024}" "([^"]{0,300})"$/u.exec(line);
|
|
160
|
+
if (!m)
|
|
161
|
+
return;
|
|
162
|
+
const timestamp = apacheTime(m[2]);
|
|
163
|
+
if (!timestamp)
|
|
164
|
+
return;
|
|
165
|
+
return { timestamp, method: m[3], path: m[4], status: Number(m[5]), user_agent: m[6], client_ip: m[1] };
|
|
166
|
+
}
|
|
167
|
+
function claimedAgent(raw) {
|
|
168
|
+
if (typeof raw !== "string" || raw.length > 300)
|
|
169
|
+
return "other";
|
|
170
|
+
if (/googlebot/iu.test(raw))
|
|
171
|
+
return "claimed_googlebot";
|
|
172
|
+
if (/bingbot/iu.test(raw))
|
|
173
|
+
return "claimed_bingbot";
|
|
174
|
+
if (/gptbot/iu.test(raw))
|
|
175
|
+
return "claimed_gptbot";
|
|
176
|
+
return /bot|crawler|spider/iu.test(raw) ? "claimed_other_bot" : "other";
|
|
177
|
+
}
|
|
178
|
+
function accumulate(period, status) {
|
|
179
|
+
period.requests++;
|
|
180
|
+
if (status >= 200 && status < 300)
|
|
181
|
+
period.http_2xx++;
|
|
182
|
+
else if (status >= 300 && status < 400)
|
|
183
|
+
period.redirects_3xx++;
|
|
184
|
+
else if (status === 401 || status === 403)
|
|
185
|
+
period.block_401_403++;
|
|
186
|
+
else if (status === 429)
|
|
187
|
+
period.rate_limited_429++;
|
|
188
|
+
else if (status === 404 || status === 410)
|
|
189
|
+
period.missing_404_410++;
|
|
190
|
+
else if (status >= 500 && status < 600)
|
|
191
|
+
period.server_5xx++;
|
|
192
|
+
else if (status >= 400 && status < 500)
|
|
193
|
+
period.other_4xx++;
|
|
194
|
+
if (status >= 400)
|
|
195
|
+
period.problem_responses++;
|
|
196
|
+
}
|
|
197
|
+
function finalize(period) {
|
|
198
|
+
period.failure_rate_percent = period.requests ? Math.round(period.problem_responses / period.requests * 10_000) / 100 : null;
|
|
199
|
+
}
|
|
200
|
+
function addFinding(report, code, severity, message, urlIndex) {
|
|
201
|
+
report.total_findings++;
|
|
202
|
+
if (report.findings.length < MAX_CRAWL_FINDINGS)
|
|
203
|
+
report.findings.push({ code, severity, message, ...(urlIndex === undefined ? {} : { url_index: urlIndex }) });
|
|
204
|
+
}
|
|
205
|
+
export function analyzeCrawlerLogs(input, ipCheck) {
|
|
206
|
+
if (!input || !CRAWL_LOG_FORMATS.includes(input.format))
|
|
207
|
+
throw new Error("Invalid log format");
|
|
208
|
+
const origin = safeLogOrigin(input.site_origin);
|
|
209
|
+
if (!origin)
|
|
210
|
+
throw new Error("Unsafe log site origin");
|
|
211
|
+
const important = validateImportant(input.important_urls, origin);
|
|
212
|
+
const cutoff = isoTimestamp(input.cutover_at);
|
|
213
|
+
if (cutoff === undefined)
|
|
214
|
+
throw new Error("Invalid offset-aware cutover timestamp");
|
|
215
|
+
const report = emptyCrawlerLogReview(input.format);
|
|
216
|
+
if (ipCheck?.requested)
|
|
217
|
+
report.googlebot_ip_evidence.status = ipCheck.ranges ?
|
|
218
|
+
"checked_current_official_ranges" : "unavailable";
|
|
219
|
+
report.important_urls_supplied = important.length;
|
|
220
|
+
const all = [];
|
|
221
|
+
if (input.format === "structured") {
|
|
222
|
+
if (input.access_log !== undefined || !Array.isArray(input.observations) ||
|
|
223
|
+
input.observations.length < 1 || input.observations.length > MAX_CRAWL_LOG_RECORDS)
|
|
224
|
+
throw new Error("Invalid structured log evidence");
|
|
225
|
+
if (byteLength(JSON.stringify(input.observations)) > MAX_CRAWL_LOG_TOTAL_BYTES)
|
|
226
|
+
throw new Error("Oversized structured log evidence");
|
|
227
|
+
all.push(...input.observations);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
if (input.observations !== undefined || typeof input.access_log !== "string" ||
|
|
231
|
+
byteLength(input.access_log) > MAX_CRAWL_LOG_TOTAL_BYTES)
|
|
232
|
+
throw new Error("Invalid combined access log evidence");
|
|
233
|
+
const lines = input.access_log.split(/\r?\n/u).filter(Boolean);
|
|
234
|
+
if (lines.length < 1 || lines.length > MAX_CRAWL_LOG_RECORDS)
|
|
235
|
+
throw new Error("Too many access log lines");
|
|
236
|
+
for (const line of lines) {
|
|
237
|
+
const parsed = parseCombinedAccessLine(line);
|
|
238
|
+
if (parsed)
|
|
239
|
+
all.push(parsed);
|
|
240
|
+
else
|
|
241
|
+
report.invalid_records++;
|
|
242
|
+
}
|
|
243
|
+
report.source_records = lines.length;
|
|
244
|
+
}
|
|
245
|
+
if (input.format === "structured")
|
|
246
|
+
report.source_records = all.length;
|
|
247
|
+
const pathIndex = new Map(important.map((path, i) => [path, i]));
|
|
248
|
+
const urlStats = important.map((_, i) => ({
|
|
249
|
+
url_index: i + 1, before_requests: 0, after_requests: 0,
|
|
250
|
+
after_problem_responses: 0, after_block_401_403: 0,
|
|
251
|
+
after_rate_limited_429: 0, after_server_5xx: 0,
|
|
252
|
+
}));
|
|
253
|
+
const profiles = CRAWL_PROFILES.map(profile => ({
|
|
254
|
+
profile, before_requests: 0, after_requests: 0, after_problem_responses: 0,
|
|
255
|
+
}));
|
|
256
|
+
for (const item of all) {
|
|
257
|
+
const timestamp = isoTimestamp(item?.timestamp);
|
|
258
|
+
const status = item?.status;
|
|
259
|
+
const path = safeRequestPath(item?.path, origin);
|
|
260
|
+
if (timestamp === undefined || !Number.isInteger(status) || status < 200 || status > 599 ||
|
|
261
|
+
typeof item?.method !== "string" || item.method.length > 12 ||
|
|
262
|
+
(item.user_agent !== undefined && (typeof item.user_agent !== "string" || item.user_agent.length > 300)) ||
|
|
263
|
+
!path) {
|
|
264
|
+
report.invalid_records++;
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
report.parsed_records++;
|
|
268
|
+
if (path.query)
|
|
269
|
+
report.query_variants_observed++;
|
|
270
|
+
if (!["GET", "HEAD"].includes(item.method)) {
|
|
271
|
+
report.ignored_methods++;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
const index = pathIndex.get(path.path);
|
|
275
|
+
if (index === undefined) {
|
|
276
|
+
report.unmatched_requests++;
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
report.matched_requests++;
|
|
280
|
+
const after = timestamp >= cutoff;
|
|
281
|
+
const period = after ? report.after : report.before;
|
|
282
|
+
accumulate(period, status);
|
|
283
|
+
const u = urlStats[index];
|
|
284
|
+
if (after) {
|
|
285
|
+
u.after_requests++;
|
|
286
|
+
if (status >= 400)
|
|
287
|
+
u.after_problem_responses++;
|
|
288
|
+
if (status === 401 || status === 403)
|
|
289
|
+
u.after_block_401_403++;
|
|
290
|
+
if (status === 429)
|
|
291
|
+
u.after_rate_limited_429++;
|
|
292
|
+
if (status >= 500)
|
|
293
|
+
u.after_server_5xx++;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
u.before_requests++;
|
|
297
|
+
}
|
|
298
|
+
const agent = claimedAgent(item.user_agent);
|
|
299
|
+
const profile = profiles.find(p => p.profile === agent);
|
|
300
|
+
if (agent === "claimed_googlebot") {
|
|
301
|
+
const evidence = report.googlebot_ip_evidence;
|
|
302
|
+
evidence.claimed_requests++;
|
|
303
|
+
if (ipCheck?.ranges) {
|
|
304
|
+
const matched = matchesOfficialGoogleRange(item.client_ip, ipCheck.ranges);
|
|
305
|
+
if (matched === null)
|
|
306
|
+
evidence.missing_or_invalid_ip++;
|
|
307
|
+
else if (!matched)
|
|
308
|
+
evidence.outside_current_ranges++;
|
|
309
|
+
else {
|
|
310
|
+
evidence.matched_current_ranges++;
|
|
311
|
+
if (after) {
|
|
312
|
+
evidence.matched_after++;
|
|
313
|
+
if (status >= 400)
|
|
314
|
+
evidence.matched_after_problem_responses++;
|
|
315
|
+
}
|
|
316
|
+
else
|
|
317
|
+
evidence.matched_before++;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (after) {
|
|
322
|
+
profile.after_requests++;
|
|
323
|
+
if (status >= 400)
|
|
324
|
+
profile.after_problem_responses++;
|
|
325
|
+
}
|
|
326
|
+
else
|
|
327
|
+
profile.before_requests++;
|
|
328
|
+
}
|
|
329
|
+
finalize(report.before);
|
|
330
|
+
finalize(report.after);
|
|
331
|
+
report.per_url = urlStats;
|
|
332
|
+
report.claimed_crawler_profiles = profiles;
|
|
333
|
+
if (report.before.failure_rate_percent !== null && report.after.failure_rate_percent !== null)
|
|
334
|
+
report.failure_rate_delta_percentage_points =
|
|
335
|
+
Math.round((report.after.failure_rate_percent - report.before.failure_rate_percent) * 100) / 100;
|
|
336
|
+
report.status = report.matched_requests === 0 ? "not_comparable" :
|
|
337
|
+
report.before.requests === 0 || report.after.requests === 0 || report.invalid_records > 0
|
|
338
|
+
? "partial" : "comparable_sample";
|
|
339
|
+
if (report.matched_requests === 0)
|
|
340
|
+
addFinding(report, "no_important_url_matches", "warning", "No valid GET/HEAD requests match the bounded important-URL sample; do not infer pages were not crawled.");
|
|
341
|
+
if (report.before.requests === 0 || report.after.requests === 0)
|
|
342
|
+
addFinding(report, "incomplete_before_after_sample", "info", "At least one cutover period has no matched observations; a before/after failure-rate comparison is unavailable.");
|
|
343
|
+
if (report.failure_rate_delta_percentage_points !== null &&
|
|
344
|
+
report.failure_rate_delta_percentage_points > 0)
|
|
345
|
+
addFinding(report, "failed_requests_increased", "warning", "The observed HTTP 4xx/5xx fraction increased after the supplied cutover; this does not prove a deployment or search-visibility cause.");
|
|
346
|
+
if (report.after.block_401_403 > 0)
|
|
347
|
+
addFinding(report, "post_block_challenge", "warning", "HTTP 401/403 responses were observed on sampled important routes after the cutover.");
|
|
348
|
+
if (report.after.rate_limited_429 > 0)
|
|
349
|
+
addFinding(report, "post_rate_limiting", "warning", "HTTP 429 rate limiting was observed on sampled important routes after the cutover.");
|
|
350
|
+
if (report.after.server_5xx > 0)
|
|
351
|
+
addFinding(report, "post_server_errors", "warning", "HTTP 5xx responses were observed on sampled important routes after the cutover.");
|
|
352
|
+
if (report.after.missing_404_410 > 0)
|
|
353
|
+
addFinding(report, "post_missing_pages", "warning", "HTTP 404/410 responses were observed on sampled important routes after the cutover.");
|
|
354
|
+
for (const u of urlStats) {
|
|
355
|
+
if (u.after_problem_responses > 0)
|
|
356
|
+
addFinding(report, "important_url_post_failures", "warning", "This numbered important URL had one or more observed HTTP 4xx/5xx responses after the cutover.", u.url_index);
|
|
357
|
+
}
|
|
358
|
+
if (report.invalid_records > 0)
|
|
359
|
+
addFinding(report, "unparsed_log_entries", "info", "Some input entries could not be parsed or safely matched; review coverage before interpreting apparent changes.");
|
|
360
|
+
if (report.query_variants_observed > 0)
|
|
361
|
+
addFinding(report, "query_variants_observed", "info", "Query-bearing log requests were counted by safe path only; raw query values were dropped.");
|
|
362
|
+
if (profiles.some(p => p.profile !== "other" && (p.before_requests + p.after_requests) > 0))
|
|
363
|
+
addFinding(report, "user_agents_unverified", "info", "Crawler groups are user-agent claims. Any optional Googlebot IP-range matches are partial evidence, not reverse-DNS verification.");
|
|
364
|
+
if (report.googlebot_ip_evidence.status === "unavailable")
|
|
365
|
+
addFinding(report, "googlebot_ranges_unavailable", "info", "The requested official Google common-crawler IP list was unavailable or invalid; no source IPs were verified.");
|
|
366
|
+
if (report.googlebot_ip_evidence.matched_current_ranges > 0)
|
|
367
|
+
addFinding(report, "googlebot_range_match", "info", "Some claimed Googlebot requests matched Google's current published common-crawler IP ranges; this is not historical or DNS proof.");
|
|
368
|
+
if (report.googlebot_ip_evidence.outside_current_ranges > 0)
|
|
369
|
+
addFinding(report, "googlebot_range_mismatch", "warning", "Some claimed Googlebot requests were outside Google's current common-crawler IP ranges; check proxy IPs and snapshot timing.");
|
|
370
|
+
addFinding(report, "sample_only", "info", "The supplied log sample and cutoff cannot establish complete server traffic, Google indexing or ranking causation.");
|
|
371
|
+
report.findings_truncated = report.total_findings > report.findings.length;
|
|
372
|
+
return report;
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=crawler-log-correlation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawler-log-correlation.js","sourceRoot":"","sources":["../../../src/modules/change-regression/crawler-log-correlation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,MAAM,CAAC,MAAM,qBAAqB,GAAC,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,yBAAyB,GAAC,OAAO,CAAC;AAC/C,MAAM,CAAC,MAAM,wBAAwB,GAAC,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAC,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,iBAAiB,GAAC,CAAC,YAAY,EAAC,iBAAiB,CAAU,CAAC;AACzE,MAAM,CAAC,MAAM,cAAc,GAAC,CAAC,mBAAmB,EAAC,iBAAiB,EAAC,gBAAgB,EAAC,mBAAmB,EAAC,OAAO,CAAU,CAAC;AAC1H,MAAM,CAAC,MAAM,mBAAmB,GAAC;IAC/B,0BAA0B,EAAC,gCAAgC,EAAC,2BAA2B;IACvF,sBAAsB,EAAC,oBAAoB,EAAC,oBAAoB;IAChE,oBAAoB,EAAC,6BAA6B,EAAC,sBAAsB;IACzE,yBAAyB,EAAC,wBAAwB,EAAC,aAAa;IAChE,uBAAuB,EAAC,0BAA0B,EAAC,8BAA8B;CACzE,CAAC;AAyFX,MAAM,WAAW,GAAC;IAChB,6KAA6K;IAC7K,4LAA4L;IAC5L,0KAA0K;IAC1K,6LAA6L;CAC9L,CAAC;AACF,MAAM,OAAO,GAAC,IAAI,WAAW,EAAE,CAAC;AAChC,MAAM,UAAU,GAAC,CAAC,CAAQ,EAAC,EAAE,CAAA,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;AAC1D,SAAS,WAAW;IAClB,OAAO;QACL,QAAQ,EAAC,CAAC,EAAC,QAAQ,EAAC,CAAC,EAAC,aAAa,EA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AM,EACrD,+GAA+G,CAAC,CAAC;IACrH,IAAG,MAAM,CAAC,qBAAqB,CAAC,sBAAsB,GAAC,CAAC;QACtD,UAAU,CAAC,MAAM,EAAC,uBAAuB,EAAC,MAAM,EAC9C,mIAAmI,CAAC,CAAC;IACzI,IAAG,MAAM,CAAC,qBAAqB,CAAC,sBAAsB,GAAC,CAAC;QACtD,UAAU,CAAC,MAAM,EAAC,0BAA0B,EAAC,SAAS,EACpD,8HAA8H,CAAC,CAAC;IACpI,UAAU,CAAC,MAAM,EAAC,aAAa,EAAC,MAAM,EACpC,oHAAoH,CAAC,CAAC;IACxH,MAAM,CAAC,kBAAkB,GAAC,MAAM,CAAC,cAAc,GAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IACvE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * V12: bounded, offline correlation of caller-supplied HTTP access records.\n * No IP, URL, user agent, token, log line or timestamp is returned. A bot\n * user-agent is only a self-declared string; optional range matching is not DNS proof.\n */\nimport {\n matchesOfficialGoogleRange, type NumericCidr,\n} from \"./google-common-crawler-ip.js\";\nexport const MAX_CRAWL_LOG_RECORDS=500;\nexport const MAX_CRAWL_LOG_TOTAL_BYTES=256_000;\nexport const MAX_CRAWL_IMPORTANT_URLS=16;\nexport const MAX_CRAWL_FINDINGS=16;\nexport const CRAWL_LOG_FORMATS=[\"structured\",\"combined_access\"] as const;\nexport const CRAWL_PROFILES=[\"claimed_googlebot\",\"claimed_bingbot\",\"claimed_gptbot\",\"claimed_other_bot\",\"other\"] as const;\nexport const CRAWL_FINDING_CODES=[\n \"no_important_url_matches\",\"incomplete_before_after_sample\",\"failed_requests_increased\",\n \"post_block_challenge\",\"post_rate_limiting\",\"post_server_errors\",\n \"post_missing_pages\",\"important_url_post_failures\",\"unparsed_log_entries\",\n \"query_variants_observed\",\"user_agents_unverified\",\"sample_only\",\n \"googlebot_range_match\",\"googlebot_range_mismatch\",\"googlebot_ranges_unavailable\",\n] as const;\ntype LogFormat=typeof CRAWL_LOG_FORMATS[number];\ntype LogProfile=typeof CRAWL_PROFILES[number];\ntype LogCode=typeof CRAWL_FINDING_CODES[number];\nexport interface LogObservation {\n timestamp:string;\n method:string;\n path:string;\n status:number;\n user_agent?:string;\n client_ip?:string;\n}\nexport interface CrawlerLogInput {\n site_origin:string;\n important_urls:string[];\n cutover_at:string;\n format:LogFormat;\n observations?:LogObservation[];\n access_log?:string;\n}\nexport interface LogPeriodStats {\n requests:number;\n http_2xx:number;\n redirects_3xx:number;\n block_401_403:number;\n rate_limited_429:number;\n missing_404_410:number;\n server_5xx:number;\n other_4xx:number;\n problem_responses:number;\n failure_rate_percent:number|null;\n}\nexport interface LogUrlStats {\n url_index:number;\n before_requests:number;\n after_requests:number;\n after_problem_responses:number;\n after_block_401_403:number;\n after_rate_limited_429:number;\n after_server_5xx:number;\n}\nexport interface LogProfileStats {\n profile:LogProfile;\n before_requests:number;\n after_requests:number;\n after_problem_responses:number;\n}\nexport interface GooglebotIpEvidence {\n status:\"not_requested\"|\"checked_current_official_ranges\"|\"unavailable\";\n claimed_requests:number;\n matched_current_ranges:number;\n outside_current_ranges:number;\n missing_or_invalid_ip:number;\n matched_before:number;\n matched_after:number;\n matched_after_problem_responses:number;\n}\nexport interface CrawlerLogFinding{\n code:LogCode;\n severity:\"warning\"|\"info\";\n url_index?:number;\n message:string;\n}\nexport interface CrawlerLogReview{\n scope:\"caller_supplied_access_log_sample\";\n format:LogFormat;\n status:\"comparable_sample\"|\"partial\"|\"not_comparable\";\n important_urls_supplied:number;\n source_records:number;\n parsed_records:number;\n invalid_records:number;\n ignored_methods:number;\n unmatched_requests:number;\n query_variants_observed:number;\n matched_requests:number;\n before:LogPeriodStats;\n after:LogPeriodStats;\n failure_rate_delta_percentage_points:number|null;\n per_url:LogUrlStats[];\n claimed_crawler_profiles:LogProfileStats[];\n googlebot_ip_evidence:GooglebotIpEvidence;\n crawler_identities_verified:false;\n coverage_limited:true;\n limitations:string[];\n total_findings:number;\n findings:CrawlerLogFinding[];\n findings_truncated:boolean;\n error?:string;\n}\nconst limitations=[\n \"Only caller-supplied bounded log observations are analyzed; missing log periods or unmatched URLs cannot prove real availability, crawling frequency or absence of defects.\",\n \"User-agent claims remain unverified. Optional source-IP matches against Google's current common-crawler ranges do not prove historical identity, reverse DNS, or identities of other bots.\",\n \"The before/after cutover is a sample comparison of request counts and HTTP statuses, not a causal test of deployment changes, Google indexing, rankings or traffic loss.\",\n \"IP addresses, raw paths, query strings, user agents, timestamps and source log text are never returned or stored; redirects, robots policy and Google-selected canonicals are not followed.\",\n];\nconst encoder=new TextEncoder();\nconst byteLength=(s:string)=>encoder.encode(s).byteLength;\nfunction emptyPeriod():LogPeriodStats{\n return {\n requests:0,http_2xx:0,redirects_3xx:0,block_401_403:0,\n rate_limited_429:0,missing_404_410:0,server_5xx:0,\n other_4xx:0,problem_responses:0,failure_rate_percent:null,\n };\n}\nfunction emptyGooglebotIpEvidence():GooglebotIpEvidence{\n return {\n status:\"not_requested\",claimed_requests:0,matched_current_ranges:0,\n outside_current_ranges:0,missing_or_invalid_ip:0,\n matched_before:0,matched_after:0,matched_after_problem_responses:0,\n };\n}\nexport function emptyCrawlerLogReview(format:LogFormat=\"structured\"):CrawlerLogReview{\n return {\n scope:\"caller_supplied_access_log_sample\",format,status:\"not_comparable\",\n important_urls_supplied:0,source_records:0,parsed_records:0,invalid_records:0,\n ignored_methods:0,unmatched_requests:0,query_variants_observed:0,\n matched_requests:0,before:emptyPeriod(),after:emptyPeriod(),\n failure_rate_delta_percentage_points:null,per_url:[],\n claimed_crawler_profiles:[],googlebot_ip_evidence:emptyGooglebotIpEvidence(),\n crawler_identities_verified:false,\n coverage_limited:true,limitations,total_findings:0,findings:[],findings_truncated:false,\n };\n}\nconst offsetIso=/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?(?:Z|[+-]\\d{2}:\\d{2})$/u;\nexport function isoTimestamp(raw:unknown):number|undefined {\n if(typeof raw!==\"string\"||raw.length>40||!offsetIso.test(raw))return;\n const calendar=/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})/u.exec(raw);\n if(!calendar)return;\n const [year,month,day,hour,minute,second]=calendar.slice(1).map(Number);\n if(year<2000||year>2100||month<1||month>12||hour>23||minute>59||second>59)return;\n const checked=new Date(Date.UTC(year,month-1,day,hour,minute,second));\n if(checked.getUTCFullYear()!==year||checked.getUTCMonth()!==month-1||\n checked.getUTCDate()!==day)return;\n const zone=/([+-])(\\d{2}):(\\d{2})$/u.exec(raw);\n if(zone&&(Number(zone[2])>14||Number(zone[3])>59))return;\n const v=Date.parse(raw);\n return Number.isFinite(v)?v:undefined;\n}\nexport function safeLogOrigin(raw:unknown):string|undefined {\n if(typeof raw!==\"string\"||byteLength(raw)>300) return;\n try{\n const url=new URL(raw);\n if(url.protocol!==\"https:\"||url.username||url.password||url.port||\n url.search||url.hash||!url.hostname.includes(\".\")||\n /(?:^|\\.)(?:localhost|local|internal|invalid|test)$/iu.test(url.hostname)||\n /^\\d+\\.\\d+\\.\\d+\\.\\d+$/u.test(url.hostname)||url.hostname.includes(\":\")||\n (raw!==url.origin&&raw!==url.origin+\"/\"))return;\n return url.origin;\n }catch{return;}\n}\nfunction safeRequestPath(raw:unknown,origin:string):{path:string;query:boolean}|undefined {\n if(typeof raw!==\"string\"||byteLength(raw)>1024||!raw.startsWith(\"/\")||\n raw.startsWith(\"//\")||raw.includes(\"\\\\\")||\n /[\\u0000-\\u001f\\u007f-\\u009f\\u202a-\\u202e\\u2066-\\u2069]/u.test(raw)||\n /%(?:2e|2f|5c|00|0a|0d)/iu.test(raw)||raw.includes(\"#\")||\n // URL() normalizes plain dot segments; reject them before path matching.\n /(?:^|\\/)\\.{1,2}(?:\\/|$)/u.test(raw.split(\"?\",1)[0])) return;\n try{\n const url=new URL(raw,origin);\n if(url.origin!==origin||url.username||url.password||url.hash)return;\n return {path:url.pathname,query:Boolean(url.search)};\n }catch{return;}\n}\nfunction validateImportant(input:unknown,origin:string):string[] {\n if(!Array.isArray(input)||input.length<1||input.length>MAX_CRAWL_IMPORTANT_URLS)\n throw new Error(\"Require 1–16 explicit same-origin important URLs\");\n const out:string[]=[];\n for(const raw of input){\n if(typeof raw!==\"string\"||raw.length>512)throw new Error(\"Invalid important URL\");\n let u:URL;\n try{u=new URL(raw);}catch{throw new Error(\"Invalid important URL\");}\n if(u.origin!==origin||u.search||u.hash||u.username||u.password||u.port||\n !raw.startsWith(origin)||raw.includes(\"\\\\\"))throw new Error(\"Unsafe important URL\");\n // Validate the original path before URL.pathname can normalize ../.\n const path=safeRequestPath(raw.slice(origin.length)||\"/\",origin)?.path;\n if(!path||out.includes(path))throw new Error(\"Duplicate or unsafe important URL\");\n out.push(path);\n }\n return out;\n}\nconst months:Record<string,number>={\n Jan:1,Feb:2,Mar:3,Apr:4,May:5,Jun:6,\n Jul:7,Aug:8,Sep:9,Oct:10,Nov:11,Dec:12,\n};\nfunction apacheTime(raw:string):string|undefined {\n const m=/^(\\d{2})\\/([A-Z][a-z]{2})\\/(\\d{4}):(\\d{2}):(\\d{2}):(\\d{2}) ([+-])(\\d{2})(\\d{2})$/u.exec(raw);\n if(!m||!months[m[2]])return;\n const [day,year,hour,minute,second,offsetHour,offsetMinute]=[\n Number(m[1]),Number(m[3]),Number(m[4]),Number(m[5]),\n Number(m[6]),Number(m[8]),Number(m[9])];\n if(year<2000||year>2100||hour>23||minute>59||second>59||offsetHour>14||offsetMinute>59)\n return;\n const month=months[m[2]];\n const checked=new Date(Date.UTC(year,month-1,day,hour,minute,second));\n if(checked.getUTCDate()!==day||checked.getUTCMonth()!==month-1||checked.getUTCFullYear()!==year)\n return;\n const offset=(offsetHour*60+offsetMinute)*(m[7]===\"+\"?1:-1);\n return new Date(Date.UTC(year,month-1,day,hour,minute,second)-offset*60_000).toISOString();\n}\n/** A deliberately narrow Apache combined log parser; malformed lines become unknown evidence. */\nexport function parseCombinedAccessLine(line:string):LogObservation|undefined {\n if(typeof line!==\"string\"||byteLength(line)>2048)return;\n const m=/^(\\S+) \\S+ \\S+ \\[([^\\]]{15,45})\\] \"([A-Z]+) ([^\"\\s]{1,1024}) HTTP\\/\\d(?:\\.\\d)?\" ([2-5]\\d{2}) (?:\\d+|-) \"[^\"]{0,1024}\" \"([^\"]{0,300})\"$/u.exec(line);\n if(!m)return;\n const timestamp=apacheTime(m[2]);\n if(!timestamp)return;\n return {timestamp,method:m[3],path:m[4],status:Number(m[5]),user_agent:m[6],client_ip:m[1]};\n}\nfunction claimedAgent(raw:unknown):LogProfile {\n if(typeof raw!==\"string\"||raw.length>300)return \"other\";\n if(/googlebot/iu.test(raw))return \"claimed_googlebot\";\n if(/bingbot/iu.test(raw))return \"claimed_bingbot\";\n if(/gptbot/iu.test(raw))return \"claimed_gptbot\";\n return /bot|crawler|spider/iu.test(raw)?\"claimed_other_bot\":\"other\";\n}\nfunction accumulate(period:LogPeriodStats,status:number):void {\n period.requests++;\n if(status>=200&&status<300)period.http_2xx++;\n else if(status>=300&&status<400)period.redirects_3xx++;\n else if(status===401||status===403)period.block_401_403++;\n else if(status===429)period.rate_limited_429++;\n else if(status===404||status===410)period.missing_404_410++;\n else if(status>=500&&status<600)period.server_5xx++;\n else if(status>=400&&status<500)period.other_4xx++;\n if(status>=400)period.problem_responses++;\n}\nfunction finalize(period:LogPeriodStats):void{\n period.failure_rate_percent=period.requests?Math.round(period.problem_responses/period.requests*10_000)/100:null;\n}\nfunction addFinding(\n report:CrawlerLogReview,code:LogCode,severity:CrawlerLogFinding[\"severity\"],\n message:string,urlIndex?:number,\n):void{\n report.total_findings++;\n if(report.findings.length<MAX_CRAWL_FINDINGS)\n report.findings.push({code,severity,message,...(urlIndex===undefined?{}:{url_index:urlIndex})});\n}\nexport function analyzeCrawlerLogs(\n input:CrawlerLogInput,\n ipCheck?:{requested:true;ranges?:readonly NumericCidr[]},\n):CrawlerLogReview {\n if(!input||!CRAWL_LOG_FORMATS.includes(input.format))throw new Error(\"Invalid log format\");\n const origin=safeLogOrigin(input.site_origin);\n if(!origin)throw new Error(\"Unsafe log site origin\");\n const important=validateImportant(input.important_urls,origin);\n const cutoff=isoTimestamp(input.cutover_at);\n if(cutoff===undefined)throw new Error(\"Invalid offset-aware cutover timestamp\");\n const report=emptyCrawlerLogReview(input.format);\n if(ipCheck?.requested)\n report.googlebot_ip_evidence.status=ipCheck.ranges?\n \"checked_current_official_ranges\":\"unavailable\";\n report.important_urls_supplied=important.length;\n const all:LogObservation[]=[];\n if(input.format===\"structured\"){\n if(input.access_log!==undefined||!Array.isArray(input.observations)||\n input.observations.length<1||input.observations.length>MAX_CRAWL_LOG_RECORDS)\n throw new Error(\"Invalid structured log evidence\");\n if(byteLength(JSON.stringify(input.observations))>MAX_CRAWL_LOG_TOTAL_BYTES)\n throw new Error(\"Oversized structured log evidence\");\n all.push(...input.observations);\n }else{\n if(input.observations!==undefined||typeof input.access_log!==\"string\"||\n byteLength(input.access_log)>MAX_CRAWL_LOG_TOTAL_BYTES)\n throw new Error(\"Invalid combined access log evidence\");\n const lines=input.access_log.split(/\\r?\\n/u).filter(Boolean);\n if(lines.length<1||lines.length>MAX_CRAWL_LOG_RECORDS)\n throw new Error(\"Too many access log lines\");\n for(const line of lines){\n const parsed=parseCombinedAccessLine(line);\n if(parsed)all.push(parsed);\n else report.invalid_records++;\n }\n report.source_records=lines.length;\n }\n if(input.format===\"structured\") report.source_records=all.length;\n const pathIndex=new Map(important.map((path,i)=>[path,i]));\n const urlStats:LogUrlStats[]=important.map((_,i)=>({\n url_index:i+1,before_requests:0,after_requests:0,\n after_problem_responses:0,after_block_401_403:0,\n after_rate_limited_429:0,after_server_5xx:0,\n }));\n const profiles:LogProfileStats[]=CRAWL_PROFILES.map(profile=>({\n profile,before_requests:0,after_requests:0,after_problem_responses:0,\n }));\n for(const item of all){\n const timestamp=isoTimestamp(item?.timestamp);\n const status=item?.status;\n const path=safeRequestPath(item?.path,origin);\n if(timestamp===undefined||!Number.isInteger(status)||status<200||status>599||\n typeof item?.method!==\"string\"||item.method.length>12||\n (item.user_agent!==undefined&&(typeof item.user_agent!==\"string\"||item.user_agent.length>300))||\n !path){\n report.invalid_records++;\n continue;\n }\n report.parsed_records++;\n if(path.query)report.query_variants_observed++;\n if(![\"GET\",\"HEAD\"].includes(item.method)){\n report.ignored_methods++;\n continue;\n }\n const index=pathIndex.get(path.path);\n if(index===undefined){report.unmatched_requests++;continue;}\n report.matched_requests++;\n const after=timestamp>=cutoff;\n const period=after?report.after:report.before;\n accumulate(period,status);\n const u=urlStats[index];\n if(after){\n u.after_requests++;\n if(status>=400)u.after_problem_responses++;\n if(status===401||status===403)u.after_block_401_403++;\n if(status===429)u.after_rate_limited_429++;\n if(status>=500)u.after_server_5xx++;\n }else{u.before_requests++;}\n const agent=claimedAgent(item.user_agent);\n const profile=profiles.find(p=>p.profile===agent)!;\n if(agent===\"claimed_googlebot\"){\n const evidence=report.googlebot_ip_evidence;\n evidence.claimed_requests++;\n if(ipCheck?.ranges){\n const matched=matchesOfficialGoogleRange(item.client_ip,ipCheck.ranges);\n if(matched===null)evidence.missing_or_invalid_ip++;\n else if(!matched)evidence.outside_current_ranges++;\n else{\n evidence.matched_current_ranges++;\n if(after){\n evidence.matched_after++;\n if(status>=400)evidence.matched_after_problem_responses++;\n }else evidence.matched_before++;\n }\n }\n }\n if(after){\n profile.after_requests++;\n if(status>=400)profile.after_problem_responses++;\n }else profile.before_requests++;\n }\n finalize(report.before);\n finalize(report.after);\n report.per_url=urlStats;\n report.claimed_crawler_profiles=profiles;\n if(report.before.failure_rate_percent!==null&&report.after.failure_rate_percent!==null)\n report.failure_rate_delta_percentage_points=\n Math.round((report.after.failure_rate_percent-report.before.failure_rate_percent)*100)/100;\n report.status=report.matched_requests===0?\"not_comparable\":\n report.before.requests===0||report.after.requests===0||report.invalid_records>0\n ?\"partial\":\"comparable_sample\";\n if(report.matched_requests===0)\n addFinding(report,\"no_important_url_matches\",\"warning\",\n \"No valid GET/HEAD requests match the bounded important-URL sample; do not infer pages were not crawled.\");\n if(report.before.requests===0||report.after.requests===0)\n addFinding(report,\"incomplete_before_after_sample\",\"info\",\n \"At least one cutover period has no matched observations; a before/after failure-rate comparison is unavailable.\");\n if(report.failure_rate_delta_percentage_points!==null&&\n report.failure_rate_delta_percentage_points>0)\n addFinding(report,\"failed_requests_increased\",\"warning\",\n \"The observed HTTP 4xx/5xx fraction increased after the supplied cutover; this does not prove a deployment or search-visibility cause.\");\n if(report.after.block_401_403>0)\n addFinding(report,\"post_block_challenge\",\"warning\",\n \"HTTP 401/403 responses were observed on sampled important routes after the cutover.\");\n if(report.after.rate_limited_429>0)\n addFinding(report,\"post_rate_limiting\",\"warning\",\n \"HTTP 429 rate limiting was observed on sampled important routes after the cutover.\");\n if(report.after.server_5xx>0)\n addFinding(report,\"post_server_errors\",\"warning\",\n \"HTTP 5xx responses were observed on sampled important routes after the cutover.\");\n if(report.after.missing_404_410>0)\n addFinding(report,\"post_missing_pages\",\"warning\",\n \"HTTP 404/410 responses were observed on sampled important routes after the cutover.\");\n for(const u of urlStats){\n if(u.after_problem_responses>0)\n addFinding(report,\"important_url_post_failures\",\"warning\",\n \"This numbered important URL had one or more observed HTTP 4xx/5xx responses after the cutover.\",u.url_index);\n }\n if(report.invalid_records>0)addFinding(report,\"unparsed_log_entries\",\"info\",\n \"Some input entries could not be parsed or safely matched; review coverage before interpreting apparent changes.\");\n if(report.query_variants_observed>0)addFinding(report,\"query_variants_observed\",\"info\",\n \"Query-bearing log requests were counted by safe path only; raw query values were dropped.\");\n if(profiles.some(p=>p.profile!==\"other\"&&(p.before_requests+p.after_requests)>0))\n addFinding(report,\"user_agents_unverified\",\"info\",\n \"Crawler groups are user-agent claims. Any optional Googlebot IP-range matches are partial evidence, not reverse-DNS verification.\");\n if(report.googlebot_ip_evidence.status===\"unavailable\")\n addFinding(report,\"googlebot_ranges_unavailable\",\"info\",\n \"The requested official Google common-crawler IP list was unavailable or invalid; no source IPs were verified.\");\n if(report.googlebot_ip_evidence.matched_current_ranges>0)\n addFinding(report,\"googlebot_range_match\",\"info\",\n \"Some claimed Googlebot requests matched Google's current published common-crawler IP ranges; this is not historical or DNS proof.\");\n if(report.googlebot_ip_evidence.outside_current_ranges>0)\n addFinding(report,\"googlebot_range_mismatch\",\"warning\",\n \"Some claimed Googlebot requests were outside Google's current common-crawler IP ranges; check proxy IPs and snapshot timing.\");\n addFinding(report,\"sample_only\",\"info\",\n \"The supplied log sample and cutoff cannot establish complete server traffic, Google indexing or ranking causation.\");\n report.findings_truncated=report.total_findings>report.findings.length;\n return report;\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const GOOGLE_COMMON_CRAWLERS_URL = "https://developers.google.com/static/crawling/ipranges/common-crawlers.json";
|
|
2
|
+
export declare const MAX_GOOGLE_RANGES_BYTES = 512000;
|
|
3
|
+
export declare const MAX_GOOGLE_CIDR_PREFIXES = 1000;
|
|
4
|
+
interface NumericAddress {
|
|
5
|
+
family: 4 | 6;
|
|
6
|
+
bits: 32 | 128;
|
|
7
|
+
value: bigint;
|
|
8
|
+
}
|
|
9
|
+
export interface NumericCidr extends NumericAddress {
|
|
10
|
+
length: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function parseOfficialGoogleCommonRanges(raw: string): NumericCidr[];
|
|
13
|
+
export declare function matchesOfficialGoogleRange(raw: unknown, ranges: readonly NumericCidr[]): boolean | null;
|
|
14
|
+
export declare function fetchOfficialGoogleCommonRanges(fetcher?: typeof fetch): Promise<NumericCidr[]>;
|
|
15
|
+
export {};
|