Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency @octokit/request-error to v5 [security] #2480

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate-bot
Copy link
Contributor

@renovate-bot renovate-bot commented Feb 14, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@octokit/request-error ^3.0.0 -> ^5.0.0 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2025-25289

Summary

A Regular Expression Denial of Service (ReDoS) vulnerability exists in the processing of HTTP request headers. By sending an authorization header containing an excessively long sequence of spaces followed by a newline and "@​", an attacker can exploit inefficient regular expression processing, leading to excessive resource consumption. This can significantly degrade server performance or cause a denial-of-service (DoS) condition, impacting availability.

Details

The issue occurs at line 52 of iterator.ts in the @​octokit/request-error repository.
The vulnerability is caused by the use of an inefficient regular expression in the handling of the authorization header within the request processing logic:

authorization: options.request.headers.authorization.replace(
  / .*$/, 
  " [REDACTED]"
)

The regular expression / .*$/ matches a space followed by any number of characters until the end of the line. This pattern is vulnerable to Regular Expression Denial of Service (ReDoS) when processing specially crafted input. Specifically, an attacker can send an authorization header containing a long sequence of spaces followed by a newline and "@​", such as:

headers: {
  authorization: "" + " ".repeat(100000) + "\n@",
}

Due to the way JavaScript's regular expression engine backtracks while attempting to match the space followed by arbitrary characters, this input can cause excessive CPU usage, significantly slowing down or even freezing the server. This leads to a denial-of-service condition, impacting availability.

PoC

The gist of PoC.js

  1. run npm i @​octokit/request-error
  2. run 'node poc.js'
    result:
  3. then the program will stuck forever with high CPU usage
import { RequestError } from "@​octokit/request-error";

const error = new RequestError("Oops", 500, {
  request: {
    method: "POST",
    url: "https://api.github.com/foo",
    body: {
      bar: "baz",
    },
    headers: {
      authorization: ""+" ".repeat(100000)+"\n@",
    },
  },
  response: {
    status: 500,
    url: "https://api.github.com/foo",
    headers: {
      "x-github-request-id": "1:2:3:4",
    },
    data: {
      foo: "bar",
    },
  },
});

Impact

Vulnerability Type & Impact:

This is a Regular Expression Denial of Service (ReDoS) vulnerability, which occurs due to an inefficient regular expression (/ .*$/) used to sanitize the authorization header. An attacker can craft a malicious input that triggers excessive backtracking in the regex engine, leading to high CPU consumption and potential denial-of-service (DoS).

Who is Impacted?

  • Projects or services using this code to process HTTP headers are vulnerable.
  • Applications that rely on user-supplied authorization headers are at risk, especially those processing a large volume of authentication requests.
  • Multi-tenant or API-driven platforms could experience degraded performance or service outages if exploited at scale.

Release Notes

octokit/request-error.js (@​octokit/request-error)

v5.1.1

Compare Source

Bug Fixes

v5.1.0

Compare Source

Bug Fixes
  • upgrade @octokit/types to v13 (3af20bd)
Features

v5.0.1

Compare Source

Bug Fixes

v5.0.0

Compare Source

Bug Fixes
BREAKING CHANGES
  • deps: upgrade @octokit/types to v11

v4.0.2

Compare Source

Bug Fixes

v4.0.1

Compare Source

Bug Fixes

v4.0.0

Compare Source

Continuous Integration
BREAKING CHANGES
  • Drop support for NodeJS v14, v16

  • ci: stop testing against NodeJS v14, v16

  • ci: stop testing against NodeJS v14, v16

  • ci: stop testing against NodeJS v14, v16

  • ci: stop testing against NodeJS v14, v16

  • ci: stop testing against NodeJS v14, v16

v3.0.3

Compare Source

Bug Fixes

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate-bot renovate-bot requested review from a team as code owners February 14, 2025 22:02
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Feb 14, 2025
@renovate-bot renovate-bot force-pushed the renovate/npm-octokit-request-error-vulnerability branch from 7026602 to 7e07905 Compare February 15, 2025 00:07
@renovate-bot renovate-bot changed the title fix(deps): update dependency @octokit/request-error to v6 [security] fix(deps): update dependency @octokit/request-error to v5 [security] Feb 15, 2025
@renovate-bot renovate-bot force-pushed the renovate/npm-octokit-request-error-vulnerability branch 3 times, most recently from e3182a6 to 6e2e608 Compare February 20, 2025 22:31
@renovate-bot renovate-bot force-pushed the renovate/npm-octokit-request-error-vulnerability branch from 6e2e608 to 406fed1 Compare February 20, 2025 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants