Skip to content

Expand pessimistic (~>) patched versions in elixir_security_importer_v2 - #2530

Open
Gowri213 wants to merge 1 commit into
aboutcode-org:mainfrom
Gowri213:fix-elixir-pessimistic-version-2529
Open

Gowri213 wants to merge 1 commit into
aboutcode-org:mainfrom
Gowri213:fix-elixir-pessimistic-version-2529

Conversation

@Gowri213

Copy link
Copy Markdown

Summary

Fixes handling of Elixir pessimistic (~>) version requirements in elixir_security_importer_v2 (resolves #2529).

Changes

  • Added expand_pessimistic_version in vulnerabilities/pipelines/v2_importers/elixir_security_importer.py to expand ~> X.Y.Z / ~> X.Y constraints into inverted VersionConstraint bounds for HexVersionRange.
  • Updated ElixirSecurityImporterPipeline.process_file to use expand_pessimistic_version for ~> entries in patched_versions.
  • Added test_pessimistic_patched_versions_expanded in vulnerabilities/tests/pipelines/v2_importers/test_elixir_security_importer_v2.py.

Verification

  • Ran pytest vulnerabilities/tests/pipelines/v2_importers/test_elixir_security_importer_v2.py (all tests passing).

@Gowri213
Gowri213 force-pushed the fix-elixir-pessimistic-version-2529 branch from 6c7173b to 1a58985 Compare November 25, 2026 11:07

@nikolya-ctrl nikolya-ctrl left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested this locally on the PR head (WSL Ubuntu, Python 3.13).

  • vulnerabilities/tests/pipelines/v2_importers/test_elixir_security_importer_v2.py: 4 passed.
  • I also checked expand_pessimistic_version against the plug/2017-02-28 example from #2529 (>= 1.3.2, ~> 1.2.3, ~> 1.1.7, ~> 1.0.4). The resulting range is vers:hex/<1.0.4|>=1.1.0|<1.1.7|>=1.2.0|<1.2.3|>=1.3.0|<1.3.2, which matches the expected value in the issue.

Spot checks:

1.0.3 affected    1.0.5 patched
1.1.6 affected    1.1.8 patched
1.2.2 affected    1.2.4 patched
1.3.1 affected    1.3.2 patched

1.2.4, which #2529 reported as wrongly affected, is now patched. Looks good to me from a behaviour point of view.

@Gowri213

Gowri213 commented Nov 25, 2026 •

Copy link
Copy Markdown
Author

@nikolya-ctrl Thank you for taking the time to test this locally and run through those spot checks, Really appreciate the thorough verification and feedback.

This branch has not been deployed

No deployments
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.

elixir_security_importer_v2 strips '~>' in patched_versions into '!=', marking patched Hex releases as affected

2 participants