@vscode/vsce 3.4.1 → 3.4.2-1
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/out/package.js +2 -1
- package/out/secretLint.js +32 -9
- package/package.json +1 -1
package/out/package.js
CHANGED
|
@@ -1572,8 +1572,9 @@ async function scanFilesForSecrets(files, fileExclusion, options) {
|
|
|
1572
1572
|
return; // No need to scan
|
|
1573
1573
|
}
|
|
1574
1574
|
const onDiskFiles = files.filter(file => !isInMemoryFile(file));
|
|
1575
|
+
const onDiskNoneNodeModulesFiles = onDiskFiles.filter(file => !file.localPath.includes('node_modules'));
|
|
1575
1576
|
const inMemoryFiles = files.filter(file => isInMemoryFile(file));
|
|
1576
|
-
const onDiskResult = await (0, secretLint_1.lintFiles)(
|
|
1577
|
+
const onDiskResult = await (0, secretLint_1.lintFiles)(onDiskNoneNodeModulesFiles.map(file => file.localPath));
|
|
1577
1578
|
const inMemoryResults = await Promise.all(inMemoryFiles.map(file => (0, secretLint_1.lintText)(typeof file.contents === 'string' ? file.contents : file.contents.toString('utf8'), file.path)));
|
|
1578
1579
|
const secretsFound = [...inMemoryResults, onDiskResult].filter(result => !result.ok).flatMap(result => result.results);
|
|
1579
1580
|
// secrets found
|
package/out/secretLint.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.prettyPrintLintResult = exports.getRuleNameFromRuleId = exports.lintText = exports.lintFiles = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const secret_lint_types_1 = require("./typings/secret-lint-types");
|
|
9
|
+
const util_1 = require("./util");
|
|
9
10
|
const lintConfig = {
|
|
10
11
|
rules: [
|
|
11
12
|
{
|
|
@@ -14,8 +15,7 @@ const lintConfig = {
|
|
|
14
15
|
{
|
|
15
16
|
id: "@secretlint/secretlint-rule-basicauth",
|
|
16
17
|
allowMessageIds: ["BasicAuth"]
|
|
17
|
-
},
|
|
18
|
-
{
|
|
18
|
+
}, {
|
|
19
19
|
id: "@secretlint/secretlint-rule-privatekey",
|
|
20
20
|
options: {
|
|
21
21
|
allows: [
|
|
@@ -24,6 +24,15 @@ const lintConfig = {
|
|
|
24
24
|
"/^(?![\\s\\S]*-----BEGIN .*PRIVATE KEY-----[A-Za-z0-9+/=\\r\\n]{50,}-----END .*PRIVATE KEY-----)[\\s\\S]*$/"
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
|
+
}, {
|
|
28
|
+
id: "@secretlint/secretlint-rule-npm",
|
|
29
|
+
options: {
|
|
30
|
+
allows: [
|
|
31
|
+
// An npm token has the prefix npm_ followed by 36 Base62 characters (30 random + 6-character checksum), totaling 40 characters.
|
|
32
|
+
// https://github.com/microsoft/vscode-vsce/issues/1153
|
|
33
|
+
"/^(?!(?:npm_[0-9A-Za-z]{36})$).+$/"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
]
|
|
29
38
|
}, {
|
|
@@ -47,18 +56,32 @@ async function getEngine() {
|
|
|
47
56
|
}
|
|
48
57
|
async function lintFiles(filePaths) {
|
|
49
58
|
const engine = await getEngine();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
let engineResult;
|
|
60
|
+
try {
|
|
61
|
+
engineResult = await engine.executeOnFiles({
|
|
62
|
+
filePathList: filePaths
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
util_1.log.error('Error occurred while scanning secrets (files):', error);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
53
69
|
return parseResult(engineResult);
|
|
54
70
|
}
|
|
55
71
|
exports.lintFiles = lintFiles;
|
|
56
72
|
async function lintText(content, fileName) {
|
|
57
73
|
const engine = await getEngine();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
let engineResult;
|
|
75
|
+
try {
|
|
76
|
+
engineResult = await engine.executeOnContent({
|
|
77
|
+
content,
|
|
78
|
+
filePath: fileName
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
util_1.log.error('Error occurred while scanning secrets (content):', error);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
62
85
|
return parseResult(engineResult);
|
|
63
86
|
}
|
|
64
87
|
exports.lintText = lintText;
|