eslint-community / eslint-plugin-security

ESLint rules for Node Security
Apache License 2.0
2.22k stars 109 forks source link

Bug: Converting circular structure to JSON when running eslint #134

Closed cthacker-udel closed 11 months ago

cthacker-udel commented 11 months ago

What version of eslint-plugin-security are you using?

2.0.0 and 2.1.0

ESLint Environment

Node version: 20.9.0 npm version: 10.1.0 Local ESLint version: 8.56.0 Global ESLint version: 8.56.0 Operating System: Windows

What parser are you using?

@typescript-eslint/parser

What did you do?

Configuration NextJS application, running `npm run lint` command which runs `next lint`. Next version 14.0.4

npm run lint next lint

Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'security' -> object with constructor 'Object'
    |     property 'configs' -> object with constructor 'Object'
    |     property 'recommended' -> object with constructor 'Object'
    --- property 'plugins' closes the circle
Referenced from: C:\Users\cthacker\Desktop\Projects\Project1\.eslintrc.js

Raw Eslint Log:

Referenced from: C:\Users\cthacker\Desktop\Projects\Project1\.eslintrc.js
    at JSON.stringify (<anonymous>)
    at C:\Users\cthacker\Desktop\Projects\Project1\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:2156:45
    at Array.map (<anonymous>)
    at ConfigValidator.formatErrors (C:\Users\cthacker\Desktop\Projects\Project1\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:2147:23)
    at ConfigValidator.validateConfigSchema (C:\Users\cthacker\Desktop\Projects\Project1\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:2177:84)
    at ConfigArrayFactory._normalizeConfigData (C:\Users\cthacker\Desktop\Projects\Project1\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3019:19)
    at ConfigArrayFactory._loadExtendedPluginConfig (C:\Users\cthacker\Desktop\Projects\Project1\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3239:25)
    at ConfigArrayFactory._loadExtends (C:\Users\cthacker\Desktop\Projects\Project1\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3154:29)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (C:\Users\cthacker\Desktop\Projects\Project1\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3095:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
Uncaught exception received.

I had to downgrade eslint-plugin-security down to version 1.7.0 in order to fix bug.

What did you expect to happen?

Successfully lint files with known errors, and display those errors in the console.

What actually happened?

Eslint crashed due to this circular bug listed above.

Participation

Additional comments

No response

aladdin-add commented 11 months ago

Duplicate of #131

cthacker-udel commented 11 months ago

I updated eslint-plugin-security to the most recent version, and changed my extends to have the value "plugin:security/recommended-legacy" in it's array, such as:

extends: ["plugin:security/recommended-legacy"]

and now I get the error: Failed to load config "plugin:security/recommended-legacy" to extend from., any idea why?