Release 4.0.0: modern engine by default, legacy frozen - #27
Merged
Merged
Conversation
- Add an algorithm router: IpWare(algorithm="auto"|"modern"|"legacy"). "auto" resolves to "modern"; "legacy" is available only when requested. - Move the v3 algorithm to python_ipware/legacy/ unchanged (byte-identical), and the v3 tests to tests/legacy/ unchanged, with a runner that checks them against the legacy engine. - Add the modern engine: hardened IPv6, bracketed-port and IPv4-mapped parsing, and an expanded default header list. The full v3 suite passes against it. - Modernize packaging: PEP 621 pyproject with Hatchling, SPDX license, Python 3.9-3.13, ruff lint.* config. - Fix CI: current action versions, supported Pythons, legacy suite step, twine check. - Rewrite README around the modern engine with Mermaid diagrams, Maintained with Dojo badge and sponsors; move the v3 guide to the legacy folder.
- Modern engine: with leftmost=False, proxy_list validated the raw chain but picked the client from the reversed chain, so right-most networks with a trusted proxy list returned None. Put the chain in client-first order once, before validation, matching legacy. - Strict mode now rejects empty entries (e.g. "1.2.3.4,, 5.6.7.8"), as v3 does. - Tests: right-most + proxy_list regressions, strict empty-token tests, and a legacy-vs-modern differential test over 3,000+ well-formed combinations. These fail 211 times against the previous engine. - Docs: replace "verified superset of v3" with the accurate claim and list the two remaining malformed-input differences (quoted addresses accepted, 1.2.3.4:80:90 rejected). - CI: key the pip cache on pyproject.toml (the default requirements.txt lookup would fail setup on every job); make Coveralls upload non-fatal. - Packaging: include SECURITY.md in the sdist.
… docs (#25) - Modern engine: proxy_list entries may be CIDR networks (IPv4/IPv6), matched by real network membership; plain prefixes still work. Invalid CIDR raises ValueError. Legacy unchanged. Requested by @griffi-gh in #26. - Modern defaults: add Fly.io's Fly-Client-IP header. Suggested by @mdalp in #23. - README: document CIDR entries and how to put a CDN header first via precedence when all traffic comes through that CDN. Suggested by @iloveitaly in #25. - CHANGELOG: credit community contributions, including @iloveitaly's Python 3.13 CI suggestion (#24). Co-authored-by: mdalp <mdalp@users.noreply.github.com> Co-authored-by: iloveitaly <iloveitaly@users.noreply.github.com> Co-authored-by: griffi-gh <griffi-gh@users.noreply.github.com>
CI installed ruff 0.16.8, whose new PLC0207 rule flagged two lines in the frozen v3 engine. Legacy must stay byte-identical, so exclude it (and its v3 tests) from linting instead of editing it, and pin ruff so future rule additions cannot break CI unannounced. 🚀 Generated with [Dojo](https://heydojo.ai) ⛩️
twine (in [dev]) pulls nh3/cryptography, which need a Rust build on PyPy and failed there. Test jobs only need ruff and coverage, so add a [test] extra and use it in CI; [dev] now extends [test] with build and twine. 🚀 Generated with [Dojo](https://heydojo.ai) ⛩️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
python-ipware 4.0.0. A new modern engine becomes the default; the 3.x algorithm is kept byte-for-byte as an explicit
legacyoption.What changed
IpWare(algorithm="auto" | "modern" | "legacy").autois an alias formodern;legacyonly when requested.python_ipware/legacy/and v3 tests totests/legacy/, both as 100% renames. A runner checks the v3 suite against the legacy engine.1.2.3.4:80:90rejected.proxy_listaccepts networks like100.64.0.0/10andfd7a:115c:a1e0::/48(modern only). Thanks @griffi-gh (Support for CIDR notation #26).Fly-Client-IPadded to the modern defaults. Thanks @mdalp (Add Fly.io header to precedence list #23).precedencewhen all traffic comes through that CDN. Thanks @iloveitaly (fix: proxy-specific headers should have a higher precedent #25).pyproject.tomlwith Hatchling, SPDX license,SECURITY.mdin the sdist.twine check, pip cache keyed onpyproject.toml, non-fatal Coveralls, patched PyPI publish action (resolves Dependabot alert Add py.typed file for static type checking compatability #2).python_ipware/legacy/README.md;SECURITY.mdasks for private email reports.Verification (local)
twine checkpass; clean wheel install worksNo tag is pushed, so merging does not publish to PyPI. Publishing happens only when
v4.0.0is tagged.🚀 Generated with Dojo ⛩️