Skip to content

Fix/eslint plugin kit#7

Merged
badasswp merged 1 commit intorelease-1.0.9from
fix/eslint-plugin-kit
Jul 20, 2025
Merged

Fix/eslint plugin kit#7
badasswp merged 1 commit intorelease-1.0.9from
fix/eslint-plugin-kit

Conversation

@badasswp
Copy link
Owner

This PR fixes the security issue: #3

Description / Background Context

The ConfigCommentParser#parseJSONLikeConfig API is vulnerable to a Regular Expression Denial of Service (ReDoS) attack in its only argument.

The regular expression at packages/plugin-kit/src/config-comment-parser.js:158 is vulnerable to a quadratic runtime attack because the grouped expression is not anchored. This can be solved by prepending the regular expression with [^-a-zA-Z0-9/].

const { ConfigCommentParser } = require("@eslint/plugin-kit");

const str = `${"A".repeat(1000000)}?: 1 B: 2`;

console.log("start")
var parser = new ConfigCommentParser();
console.log(parser.parseJSONLikeConfig(str));
console.log("end")

// run `npm i @eslint/plugin-kit@0.3.3` and `node attack.js`
// then the program will stuck forever with high CPU usage

This is a Regular Expression Denial of Service attack which may lead to blocking execution and high CPU usage.

Testing Instructions

  • Re-run pnpm install.
  • Observe that eslint/plugin-kit is now upgraded to 0.3.3.
  • sculpt cli works correctly as before.

@badasswp badasswp changed the base branch from master to release-1.0.9 July 20, 2025 08:26
@badasswp badasswp self-assigned this Jul 20, 2025
@badasswp badasswp added the bug Something isn't working label Jul 20, 2025
@badasswp badasswp merged commit 34c309d into release-1.0.9 Jul 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant