@lvce-editor/eslint-plugin-nvmrc 18.14.2 → 18.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +40 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ const parser = {
|
|
|
46
46
|
const defaultMinimumVersion = '20.0.0';
|
|
47
47
|
const defaultMaximumVersion = '24.15.0';
|
|
48
48
|
const defaultBadVersions = ['24.16.0'];
|
|
49
|
+
const insecureVersionRanges = ['<22.23.4', '>=23 <24', '>=24 <24.22.1', '>=25 <26', '>=26 <26.12.1'];
|
|
49
50
|
const versionPattern = String.raw`^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$`;
|
|
50
51
|
const parseVersion = value => {
|
|
51
52
|
const version = semver.parse(value.trim());
|
|
@@ -158,10 +159,47 @@ const create = context => {
|
|
|
158
159
|
}
|
|
159
160
|
};
|
|
160
161
|
};
|
|
162
|
+
const insecureVersionRule = {
|
|
163
|
+
create(context) {
|
|
164
|
+
const {
|
|
165
|
+
parserServices
|
|
166
|
+
} = context.sourceCode;
|
|
167
|
+
if (!parserServices?.isNvmrc) {
|
|
168
|
+
return {};
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
Program(node) {
|
|
172
|
+
const value = context.sourceCode.text.trim();
|
|
173
|
+
const version = parseVersion(value);
|
|
174
|
+
if (!version || insecureVersionRanges.every(range => !semver.satisfies(version, range))) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
context.report({
|
|
178
|
+
data: {
|
|
179
|
+
value: version.version
|
|
180
|
+
},
|
|
181
|
+
messageId: 'insecureVersion',
|
|
182
|
+
node
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
meta: {
|
|
188
|
+
docs: {
|
|
189
|
+
description: 'Disallow Node.js versions vulnerable to the Brotli decoder security issue'
|
|
190
|
+
},
|
|
191
|
+
messages: {
|
|
192
|
+
insecureVersion: '.nvmrc version {{value}} is affected by CVE-2026-111497; use a fixed Node.js release (22.23.4, 24.22.1, or 26.12.1) or newer'
|
|
193
|
+
},
|
|
194
|
+
schema: [],
|
|
195
|
+
type: 'problem'
|
|
196
|
+
}
|
|
197
|
+
};
|
|
161
198
|
|
|
162
199
|
const validVersion = {
|
|
163
200
|
__proto__: null,
|
|
164
201
|
create,
|
|
202
|
+
insecureVersionRule,
|
|
165
203
|
meta
|
|
166
204
|
};
|
|
167
205
|
|
|
@@ -172,6 +210,7 @@ const plugin = {
|
|
|
172
210
|
version: '0.0.1'
|
|
173
211
|
},
|
|
174
212
|
rules: {
|
|
213
|
+
'insecure-version': insecureVersionRule,
|
|
175
214
|
'valid-version': validVersion
|
|
176
215
|
}
|
|
177
216
|
};
|
|
@@ -184,6 +223,7 @@ const recommended = [{
|
|
|
184
223
|
nvmrc: plugin
|
|
185
224
|
},
|
|
186
225
|
rules: {
|
|
226
|
+
'nvmrc/insecure-version': 'error',
|
|
187
227
|
'nvmrc/valid-version': 'error'
|
|
188
228
|
}
|
|
189
229
|
}];
|