Skip to content

Add tests for redact_url_query with IPv6 hosts #4

Description

@jieyao-MilestoneHub

What

redact_url_query should handle IPv6 host URLs correctly. Currently we test only path-style URLs like /api?token=x and one https://example.com:8443/... host. We don't have coverage for the IPv6 bracket form, e.g. http://[::1]:8080/api?token=secret.

Expected outcome

Add test cases to tests/test_url_query.py covering:

  • http://[::1]:8080/api?token=abc → token redacted, host/port preserved verbatim
  • http://[2001:db8::1]/api?api_key=abc&page=1 → key redacted, page preserved
  • A case with ? inside the IPv6 bracket should not be misparsed (the current find('?') is naive — verify or fix)

If the third case finds a real bug, please file it separately and ship just the tests here.

Why this is good for newcomers

  • Self-contained: one test file
  • Clear acceptance criteria: assertions follow the existing parse_qsl(urlparse(out).query) pattern in the file
  • No domain knowledge of redaction policy required

Pointers

  • Source: src/redactkit/url_query.py
  • Existing tests: tests/test_url_query.py
  • See CONTRIBUTING.md for dev setup

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions