Skip to content

Resolve Decimal version to use v3#98

Merged
jaeyson merged 1 commit into
mainfrom
97-resolve-decimal-version-to-use-v3
Jun 7, 2026
Merged

Resolve Decimal version to use v3#98
jaeyson merged 1 commit into
mainfrom
97-resolve-decimal-version-to-use-v3

Conversation

@jaeyson

@jaeyson jaeyson commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Fixes #97

Summary by Sourcery

Update dependencies to enforce Decimal v3 usage and mitigate a known DoS vulnerability.

Bug Fixes:

  • Pin Decimal dependency to the 3.x series to address a DoS vulnerability related to unbounded exponents.

Enhancements:

  • Enable mix_audit to run in both dev and test environments for improved security auditing.

Documentation:

  • Document the Decimal dependency security fix in the changelog.

@jaeyson jaeyson self-assigned this Jun 7, 2026
@jaeyson jaeyson added the bug Something isn't working label Jun 7, 2026
@jaeyson jaeyson linked an issue Jun 7, 2026 that may be closed by this pull request
@sourcery-ai

sourcery-ai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates project dependencies to use Decimal 3.x (with an override guard for hex publishing), expands mix_audit to run in dev and test, and documents the Decimal security fix in the changelog.

File-Level Changes

Change Details Files
Adjust dependency configuration to adopt Decimal 3.x while keeping hex publishing compatibility and broaden mix_audit usage.
  • Change mix_audit dependency to run in both :dev and :test environments instead of only :test.
  • Add a Decimal dependency constrained to ~> 3.0 with an override flag conditioned on the HEX_PUBLISH environment variable being not equal to "true".
  • Document the Decimal security advisory context via inline comments in mix.exs to explain the version pin and override.
mix.exs
Document the Decimal dependency security fix in the changelog.
  • Add a changelog entry noting the move to Decimal 3.x in response to GHSA-rhv4-8758-jx7v and describing the underlying DoS vulnerability.
CHANGELOG.md

Assessment against linked issues

Issue Objective Addressed Explanation
#97 Update the Decimal dependency to a non-vulnerable (>= 3.0.0) version so that mix deps.audit no longer reports GHSA-rhv4-8758-jx7v.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@jaeyson jaeyson moved this to In Progress in ExTypesense Jun 7, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@sourcery-ai sourcery-ai Bot 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.

Hey - I've found 1 issue, and left some high level feedback:

  • Overriding :decimal to ~> 3.0 in a library that depends on ecto (which currently targets decimal 2.x) risks subtle incompatibilities for downstream applications; it may be safer to leave decimal unpinned here and document/communicate the advisory so consuming apps can manage the override themselves.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Overriding `:decimal` to `~> 3.0` in a library that depends on `ecto` (which currently targets `decimal` 2.x) risks subtle incompatibilities for downstream applications; it may be safer to leave `decimal` unpinned here and document/communicate the advisory so consuming apps can manage the override themselves.

## Individual Comments

### Comment 1
<location path="mix.exs" line_range="56" />
<code_context>
+      # Severity: moderate
+      # Vulnerable versions: >= 0.1.0, < 3.0.0
+      # First patched versions: 3.0.0
+      {:decimal, "~> 3.0", override: System.get_env("HEX_PUBLISH") != "true"}
     ]
   end
</code_context>
<issue_to_address>
**🚨 issue (security):** Environment-dependent override may lead to different dependency trees between publish and non-publish builds.

Because `override` is tied to `HEX_PUBLISH`, dependency resolution differs between local and publish builds: locally you force Decimal `~> 3.0`, but during publish the override is off and transitive deps can select another version. This can both hide publish-time issues during local testing and allow a vulnerable Decimal version despite the advisory above. Please make the behavior consistent (e.g., always constrain/override `:decimal` and handle `HEX_PUBLISH` via profiles or lockfile management instead).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread mix.exs
# Severity: moderate
# Vulnerable versions: >= 0.1.0, < 3.0.0
# First patched versions: 3.0.0
{:decimal, "~> 3.0", override: System.get_env("HEX_PUBLISH") != "true"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 issue (security): Environment-dependent override may lead to different dependency trees between publish and non-publish builds.

Because override is tied to HEX_PUBLISH, dependency resolution differs between local and publish builds: locally you force Decimal ~> 3.0, but during publish the override is off and transitive deps can select another version. This can both hide publish-time issues during local testing and allow a vulnerable Decimal version despite the advisory above. Please make the behavior consistent (e.g., always constrain/override :decimal and handle HEX_PUBLISH via profiles or lockfile management instead).

@jaeyson jaeyson merged commit 0d7cb5f into main Jun 7, 2026
28 of 29 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in ExTypesense Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Resolve Decimal version to use v3

1 participant