Skip to content

Switch IP matcher implementation - #701

Open
timokoessler wants to merge 1 commit into
mainfrom
switch-ip-matcher
Open

Switch IP matcher implementation#701
timokoessler wants to merge 1 commit into
mainfrom
switch-ip-matcher

Conversation

@timokoessler

Copy link
Copy Markdown
Member

No description provided.

Comment thread poetry.lock

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 Open source vulnerabilities detected - high severity
Aikido detected 2 vulnerabilities across 1 package, it includes 1 high and 1 medium vulnerabilities.

Details

Remediation:

  • setuptools — 2 CVEs (high) — fixed in 83.0.0

Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

assert matcher.has("::ffff:0.0.0.0") == True
assert matcher.has("::ffff:127.0.0.1") == True
assert matcher.has("::ffff:123") == True
assert matcher.has("::ffff:123") == False

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually wrong before (the test is also False in Node.js).

Comment thread pyproject.toml
packaging = "^24.1"
wrapt = "^1.17.2"
pytricia = { version = "^1.3.0", markers = "sys_platform != 'win32'" }
ipset_c = "0.2.1"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locked dependency because it is not really popular and has single maintainer.

Comment thread poetry.lock
[package.extras]
crt = ["botocore[crt] (>=1.37.4,<2.0a0)"]

[[package]]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created issue in upstream as I think it shouldn't pull this in as runtime dependency.

Comment thread pyproject.toml
packaging = "^24.1"
wrapt = "^1.17.2"
pytricia = { version = "^1.3.0", markers = "sys_platform != 'win32'" }
ipset_c = "0.2.1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium - Mandatory ipset_c dependency breaks installs on supported platforms without matching wheels

This unconditional runtime dependency is only published with CPython wheels for macOS 15 ARM64, manylinux_2_39 x86_64, and Windows amd64; the lock has no wheel for the repository's Linux ARM CI target, macOS x86_64, musllinux, or Linux systems with older glibc. Poetry/pip therefore falls back to the sdist and must compile the native extension, so ordinary production images without a C toolchain fail during dependency installation before the package can import, while the in-code fallback cannot help because resolution already requires this package. This regresses the documented Windows/Linux/macOS and Python 3.8-3.14 support rather than merely reducing performance on those environments.

Show fix

Either publish compatible ipset_c wheels for every supported interpreter/platform (including the minimum glibc and ARM/macOS targets), or make it an optional/platform-scoped dependency and arrange installation so unsupported environments can omit it and select the pure-Python matcher without a mandatory native build.

More info - Reply on this comment to give feedback or ignore the issue.

@timokoessler timokoessler Aug 21, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that is better than before? So it fallbacks to manual build on some systems but before it had to manually build on all systems as pytricia does not publish any prebuilt wheel?

Comment thread poetry.lock
Comment on lines +3470 to +3475
version = "75.3.4"
description = "Easily download, build, install, upgrade, and uninstall Python packages"
optional = false
python-versions = ">=3.8"
groups = ["main"]
markers = "python_version == \"3.8\""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High - ipset_c adds vulnerable setuptools versions to Python 3.8 and 3.9 installs

The new ipset_c dependency declares unconstrained setuptools, and the lock consequently adds setuptools as a main dependency at 75.3.4 for Python 3.8 and 82.0.1 for Python 3.9, while the security scan identifies two setuptools CVEs fixed in 83.0.0. These versions are therefore installed into production environments that resolve the supported older Python interpreters, exposing package-build or installation paths to the known vulnerabilities even though setuptools was not previously a runtime dependency. The issue is distinct from the native-wheel coverage problem because it also affects otherwise successful installations.

Show fix

Do not ship setuptools as an unconstrained runtime dependency of ipset_c; fix the upstream package metadata to keep it in the build-system requirements, or constrain it to a security-fixed release compatible with each supported Python version and regenerate poetry.lock. Verify that the selected fixed release is actually supported on Python 3.8 and 3.9 before publishing.

More info - Reply on this comment to give feedback or ignore the issue.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a issue in upstream

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