Skip to content

fix: reject invalid hosts payloads before publishing - #315

Open
xuyua9 wants to merge 1 commit into
521xueweihan:mainfrom
xuyua9:codex/hosts-payload-validation
Open

fix: reject invalid hosts payloads before publishing#315
xuyua9 wants to merge 1 commit into
521xueweihan:mainfrom
xuyua9:codex/hosts-payload-validation

Conversation

@xuyua9

@xuyua9 xuyua9 commented Aug 12, 2026

Copy link
Copy Markdown

Summary

  • reject empty or incomplete DNS results before publishing generated hosts files
  • reject duplicate or unknown hostnames, non-IPv4 mappings, and the DNS failure sentinel
  • add regression coverage for the validation boundary

fetch_ips.py can continue after a DNS failure and append # IP Address Not Found to an otherwise publishable result. This change validates the complete mapping list in common.py before write_file or write_json_file runs, so a partial result cannot overwrite the generated artifacts.

Validation

  • python3 -m unittest discover -s tests -p 'test_*.py' -v
  • python3 -m py_compile common.py fetch_ips.py update_ips.py tests/test_hosts_payload_validation.py
  • git diff --check

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