You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
elixir_security_importer_v2 strips '~>' in patched_versions into '!=', marking patched Hex releases as affected #2529
When importing Elixir advisories whose patched_versions use the ~> pessimistic version operator (4 of the 10 imported advisories: plug/2017-02-28, plug/2017-02-28_2, plug/2017-04-17, and phoenix/2017-03-14), elixir_security_importer_v2 converts each ~> X.Y.Z entry into !=X.Y.Z, causing unfurl_version_range_v2 to mark subsequent patched Hex releases on those minor branches as affected.
Reproduction
From a migrated vulnerablecode checkout:
python manage.py import elixir_security_importer_v2
python manage.py improve unfurl_version_range_v2
python manage.py shell -c 'from vulnerabilities.models import AdvisoryV2imp = AdvisoryV2.objects.get(advisory_id="plug/2017-02-28").impacted_packages.get()print("affecting_vers:", imp.affecting_vers)print("fixed_by:", sorted(p.version for p in imp.fixed_by_packages.all()))print("affected 1.2.x:", sorted(p.version for p in imp.affecting_packages.all() if p.version.startswith("1.2.")))'
Expected: plug/2017-02-28 (CVE-2017-1000052) declares patched_versions: ['>= 1.3.2', '~> 1.2.3', '~> 1.1.7', '~> 1.0.4']. Under Elixir Version requirement rules, ~> 1.2.3 matches >= 1.2.3 and < 1.3.0 (and similarly [1.1.7, 1.2.0) and [1.0.4, 1.1.0)), so affecting_vers should be vers:hex/<1.0.4|>=1.1.0|<1.1.7|>=1.2.0|<1.2.3|>=1.3.0|<1.3.2, and patched plug releases 1.2.4, 1.2.5, and 1.2.6 (along with 1.0.5, 1.0.6, 1.1.8, and 1.1.9) should not be marked as affected.
Versions
vulnerablecode: v40.2.0 (910df628cf485e8d58c61b0a7c8c1a64b0964a14) and main (9a9c9b3e8ff7d173bf8d2d04b4587c445a6d96b3)
univers: 32.0.1
Python: 3.12.16
Root Cause
In vulnerabilities/pipelines/v2_importers/elixir_security_importer.py (lines 115-119), ElixirSecurityImporterPipeline.process_file strips "~>" with version = version[2:] before calling VersionConstraint.from_string(...).invert(), turning "~> 1.2.3" into "!=1.2.3" instead of inverting the pessimistic range >= 1.2.3, < 1.3.0.
Found with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.
Activity
Gowri213 commentedon Nov 25, 2026
Hi! I'd like to work on fixing this in elixir_security_importer.py and adding regression tests for pessimistic (~>) version requirements.