Skip to content

Fix IPv4 URL safety normalization#793

Merged
adulau merged 1 commit into
mainfrom
codex/fix-attributeerror-in-html_to_markdown.py
Jul 13, 2026
Merged

Fix IPv4 URL safety normalization#793
adulau merged 1 commit into
mainfrom
codex/fix-attributeerror-in-html_to_markdown.py

Conversation

@adulau

@adulau adulau commented Jul 13, 2026

Copy link
Copy Markdown
Member

Motivation

  • Guard access to ipv4_mapped when normalizing parsed host IPs so plain IPv4 literals or hostnames resolving to IPv4 addresses do not raise AttributeError and crash URL safety checks.

Description

  • Replace ip.ipv4_mapped or ip with getattr(ip, "ipv4_mapped", None) or ip in misp_modules/modules/expansion/html_to_markdown.py to safely handle IPv4Address and IPv6Address values and preserve IPv4-mapped IPv6 behavior, and add two regression tests (test_allows_public_ipv4_literal and test_allows_hostnames_resolving_to_public_ipv4_addresses) to tests/test_html_to_markdown.py.

Testing

  • Ran python -m pytest tests/test_html_to_markdown.py -q and all tests passed (6 passed, 5 subtests passed).

Codex Task

@adulau
adulau merged commit 20b1854 into main Jul 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant