Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

@google-labs-jules google-labs-jules bot commented Jan 14, 2026

Vulnerability:
The version comparison logic (compareTo in src/index.ts) previously attempted to process strings of any length.
Attackers could supply extremely long strings (e.g., 10MB+) to methods like isAtLeast or isAbove, causing:

  1. Excessive memory allocation (creating new strings via replace and arrays via split).
  2. Potential Event Loop blocking (CPU exhaustion).

Fix:
Introduced a MAX_VERSION_LENGTH constant (256 characters).
The compareTo function now "fails fast" by returning NaN (which evaluates to false in comparisons) if the input string exceeds this limit.

Verification:
Added performance/DoS regression tests in src/security.test.ts ensuring that massive strings are rejected immediately (<100ms) and return false.
Ran existing tests (src/index.test.ts) to ensure no regressions for valid inputs.


PR created automatically by Jules for task 13226085722345310659 started by @srod


Summary by cubic

Fixes a DoS risk in version comparison by limiting input length to 256 characters and failing fast. Long inputs now return false quickly, preventing memory and CPU spikes.

  • Bug Fixes
    • Enforced MAX_VERSION_LENGTH (256) in compareTo; return NaN when exceeded so isAtLeast/isAbove resolve to false.
    • Added regression tests ensuring 1MB+ inputs are rejected in under 100ms without parsing.

Written for commit 907bb8f. Summary will update on new commits.

Limits the length of version strings processed by `compareTo` to 256 characters.
This prevents potential Denial of Service (DoS) attacks via memory exhaustion
or excessive CPU usage when processing extremely long strings (e.g. 10MB+).

Added regression tests in `src/security.test.ts`.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: 907bb8f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
node-version Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (67d8793) to head (907bb8f).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #818   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           46        49    +3     
  Branches        16        17    +1     
=========================================
+ Hits            46        49    +3     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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