Files
reverse-engineering-anything/src/pcap/PcapHttpUri.ts
T
gensokyo-dev 8f9af920ef fix(pcap): redact HTTP credentials in failed capture diagnostics (#7871)
Project bounded JSON diagnostics using shared URI roles and source spans.
Keep complete parser input unchanged and compute safe diagnostics lazily.
Preserve byte facts, error classification, path data and cleanup ownership.
Reuse JSON escape-coordinate mapping with IDA diagnostics.

Fixes #7812

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
2026-10-28 18:14:22 +00:00

24 lines
788 B
TypeScript

import {
parseRecordedTransportUrl,
type RecordedTransportUrl,
} from "../domain/recordedTransportUrl.js";
/** Wireshark URI facts. HTTP/2 :path is a path, not an absolute URI. */
export const PCAP_HTTP_URI_FIELDS = {
"http.request.full_uri": "full-uri",
"http.request.uri": "request-target",
"http2.request.full_uri": "full-uri",
} as const;
export type PcapHttpUriRole =
(typeof PCAP_HTTP_URI_FIELDS)[keyof typeof PCAP_HTTP_URI_FIELDS];
/** Origin-form targets retain path semantics, including a leading double slash. */
export const parsePcapHttpUri = (
value: string,
role: PcapHttpUriRole,
): RecordedTransportUrl =>
role === "request-target" && value.startsWith("/")
? { origin: null, path: null, credentials: null }
: parseRecordedTransportUrl(value);