Skip to content

Preserve absolute request targets in HAR URLs - #6168

Closed
liangzaihuanyv wants to merge 1 commit into
sqlmapproject:masterfrom
liangzaihuanyv:fix/har-absolute-request-url
Closed

liangzaihuanyv wants to merge 1 commit into
sqlmapproject:masterfrom
liangzaihuanyv:fix/har-absolute-request-url

Conversation

@liangzaihuanyv

Copy link
Copy Markdown

Problem

Request.url always prefixes http:// and the Host header, even when the parsed request target is already an absolute HTTP(S) URL. For example, a captured line such as GET https://app.example.invalid:8443/items?q=one HTTP/1.1 becomes http://app.example.invalidhttps://app.example.invalid:8443/items?q=one in the exported HAR.

This is reachable from the traffic-log format: Connect.getPage() records absolute targets for refreshing/crawling/checking requests, and logHTTPTraffic() forwards those logs to HTTPCollector. A malformed entries[].request.url misidentifies the recorded origin and path during evidence review.

Fix

Return an absolute HTTP(S) target verbatim, using a case-insensitive anchored check. Keep the existing Host/unknown fallback for origin-form targets. No scheme inference from ports, request transmission, or other HAR behavior changes.

Regression evidence

All executions used synthetic inert HTTP bytes with socket connections blocked, not a live target:

  • RED: final tests with pristine production source: 29 tests, 7 assertion failures / 22 passes, no errors.
  • GREEN: byte-identical tests after the fix: 76 tests passed in one HAR + serialization + BigArray run; zero socket attempts. MAIN independently reran 75, excluding one tree-wide import/reflection test; these are overlapping counts, not additional passes.
  • Independent collector matrix: four malformed URLs before, zero after, across eight GET/POST cases including IPv6 and origin-form controls.

Only Windows CPython 3.12 was exercised. The full suite and other CI interpreters were not run; CI is pending. No scanner CLI, attack entrypoint, server, authentication flow, or on-wire downgrade demonstration was performed.

Prepared with AI assistance, including regression generation and independent source/test review; no claim of unaided human authorship.

Request.url unconditionally prefixed http:// and the Host header, so an
absolute request target recorded in the traffic log for refreshing, crawling
and checking requests came out as http://hosthttps://host/path - a corrupted
scheme, authority and path in the exported HAR entry.

Return a case-insensitive absolute HTTP(S) target verbatim and keep the
existing http:// + Host (and "unknown") fallback for origin-form targets.
No scheme inference from ports; parser, body, header and timestamp behavior
is unchanged.

Focused offline regression on synthetic inert bytes: on the pristine source
the final test bytes produced 7 assertion failures and 22 passes; with the
same bytes after the fix 29 focused tests pass, and 76 tests pass in one
scoped HAR + serialization + BigArray suite. MAIN independently ran 75,
excluding one tree-wide reflection test. An independent eight-case collector
matrix went from 4 wrong to 0. All runs were offline with zero socket
attempts: no scanner CLI, attack entrypoint, server or authentication flow.
CI remains pending.
@stamparm stamparm closed this in c15f4bf Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant