Skip to content

Preserve unknown HTTPS DNS parameters across JSON round trips - #8531

Closed
hakarrr wants to merge 6 commits into
mitmproxy:mainfrom
hakarrr:fix/https-json-numeric-params
Closed

hakarrr wants to merge 6 commits into
mitmproxy:mainfrom
hakarrr:fix/https-json-numeric-params

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Description

HTTPSRecord.to_json() retains unknown service parameter IDs as integer keys. A real JSON encode/decode turns those keys into strings, but HTTPSRecord.from_json() treats every string as an enum name. For example, a record containing parameter 111 fails to round-trip with a KeyError, which ResourceRecord.from_json() catches before failing on its fallback string parser.

Accept decimal string IDs as integers while keeping existing named and integer-key handling. This preserves unknown and private-use parameter values without adding any parameter-specific parsing.

Tests cover ResourceRecord and DNSMessage JSON round trips, plus JSON input to DNSContentview.reencode, using IDs111 and65400 and escaped binary values. The normal YAML prettifier retains integer keys and is not affected.

  • Four regression cases fail on unchanged source.
  • Related DNS, contentview and strip-DNS-HTTPS tests:48 passed.
  • Non-addon/non-proxy mitmproxy tests:1016 passed,1 skipped.
  • uv run --no-sync tox -e lint and changed Python files' format check pass.

Checklist

  • I have updated tests where applicable.
  • I have added an entry to the CHANGELOG.

hakarrr and others added 6 commits October 26, 2026 02:50
Accept decimal string parameter IDs produced by JSON serialization while retaining named and integer-key handling.

Co-authored-by: generaltony007 <[email protected]>
Cover unknown and private-use parameter IDs through ResourceRecord and DNSMessage JSON round trips.

Co-authored-by: generaltony007 <[email protected]>
Cover JSON input to the interactive DNS contentview with escaped binary parameter values.

Co-authored-by: generaltony007 <[email protected]>
Add the unknown HTTPS parameter JSON fix to the unreleased changelog.

Co-authored-by: generaltony007 <[email protected]>
@hakarrr

hakarrr commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Could a maintainer give the HTTPS DNS parameter round-trip fix a human review and advise on the next step? Please let me know if changes are needed or if you'd prefer this PR closed. Thanks.

@hakarrr hakarrr closed this Nov 17, 2026
@hakarrr
hakarrr deleted the fix/https-json-numeric-params branch November 25, 2026 06:25
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