Skip to content

fix:GitRemoteManager.js Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation#2191

Open
mmmsssttt404 wants to merge 2 commits intoisomorphic-git:mainfrom
mmmsssttt404:GitRemoteManager.js-ReDos
Open

fix:GitRemoteManager.js Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation#2191
mmmsssttt404 wants to merge 2 commits intoisomorphic-git:mainfrom
mmmsssttt404:GitRemoteManager.js-ReDos

Conversation

@mmmsssttt404
Copy link

I'm fixing a bug or typo

  • if this is your first time contributing, run npm run add-contributor and follow the prompts to add yourself to the README
  • squash merge the PR with commit message "fix: [Description of fix]"

Steps to reproduce
Hello,

I am writing to report a potential Regular Expression Denial of Service (ReDoS) vulnerability or Inefficient Regular Expression in the project. When using specially crafted input strings in the context, it may lead to extremely high CPU usage, application freezing, or denial of service attacks.

Location of Issue:

The vulnerability is related to a regular expression used in the following validation file, which may result in significantly prolonged execution times under certain conditions.

const matches = url.match(/(\w+)(:\/\/|::)(.*)/)

1.git clone https://github.com/mmmsssttt404/isomorphic-git.git
2.npm install
3.npx jest __tests__/test-GitRemoteManager.js

use time:
{D25C1D96-3E80-4DEA-B4ED-6497AFBB91A3}
屏幕截图 2025-08-20 124736
Benchmarks show clear quadratic growth with input size, not linear. Even at ~100k chars, runtime reaches several seconds. ReDoS does not require exponential blowup — Polynomial behavior is already recognized as exploitable
redos_result (13)

Proposed Solution:
Change the regular expression to
https://github.com/mmmsssttt404/isomorphic-git/blob/7365f82a9a576cad792a26c2a69166b7af382a37/src/managers/GitRemoteManager.js#L56
屏幕截图 2025-08-26 181715

Thank you for your attention to this matter. Your evaluation and response to this potential security concern would be greatly appreciated.

Best regards,

Search keywords: ReDoS

@jcubic
Copy link
Member

jcubic commented Aug 27, 2025

Thanks for the PR. But there are lint (prettier) errors:

/home/vsts/work/1/s/__tests__/test-GitRemoteManager.js
   99:1  error  Delete `··`                               prettier/prettier
  103:9  error  'err' is assigned a value but never used  no-unused-vars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants