@vscode/vsce 3.4.2-1 → 3.4.2-2

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/main.js CHANGED
@@ -185,7 +185,7 @@ module.exports = function (argv) {
185
185
  .addOption(new commander_1.Option('--noVerify', 'Allow all proposed APIs (deprecated: use --allow-all-proposed-apis instead)').hideHelp(true))
186
186
  .option('--allow-proposed-apis <apis...>', 'Allow specific proposed APIs')
187
187
  .option('--allow-all-proposed-apis', 'Allow all proposed APIs')
188
- .option('--allow-package-secrets <secrets...>', 'Allow packaging specific secrets. The names of the secrets can be found in the error message ([SECRET_NAME]).')
188
+ .option('--allow-package-secrets <secret_type>', 'Allow packaging a specific type of secret. The type of the secrets can be found in the error message ([SECRET_TYPE]).')
189
189
  .option('--allow-package-all-secrets', 'Allow to package all kinds of secrets')
190
190
  .option('--allow-package-env-file', 'Allow packaging .env files')
191
191
  .option('--ignoreFile <path>', 'Indicate alternative .vscodeignore')
package/out/package.js CHANGED
@@ -1568,14 +1568,16 @@ var FileExclusionType;
1568
1568
  FileExclusionType["PackageFiles"] = "package.files";
1569
1569
  })(FileExclusionType || (FileExclusionType = {}));
1570
1570
  async function scanFilesForSecrets(files, fileExclusion, options) {
1571
- if (options.allowPackageAllSecrets && options.allowPackageEnvFile) {
1571
+ const scanForSecrets = !options.allowPackageAllSecrets;
1572
+ const scanDotEnv = !options.allowPackageEnvFile;
1573
+ if (!scanForSecrets && !scanDotEnv) {
1572
1574
  return; // No need to scan
1573
1575
  }
1574
1576
  const onDiskFiles = files.filter(file => !isInMemoryFile(file));
1575
1577
  const onDiskNoneNodeModulesFiles = onDiskFiles.filter(file => !file.localPath.includes('node_modules'));
1576
1578
  const inMemoryFiles = files.filter(file => isInMemoryFile(file));
1577
- const onDiskResult = await (0, secretLint_1.lintFiles)(onDiskNoneNodeModulesFiles.map(file => file.localPath));
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)));
1579
+ const onDiskResult = await (0, secretLint_1.lintFiles)(onDiskNoneNodeModulesFiles.map(file => file.localPath), scanForSecrets, scanDotEnv);
1580
+ const inMemoryResults = await Promise.all(inMemoryFiles.map(file => (0, secretLint_1.lintText)(typeof file.contents === 'string' ? file.contents : file.contents.toString('utf8'), file.path, scanForSecrets, scanDotEnv)));
1579
1581
  const secretsFound = [...inMemoryResults, onDiskResult].filter(result => !result.ok).flatMap(result => result.results);
1580
1582
  // secrets found
1581
1583
  const noneDotEnvSecretsFound = secretsFound.filter(result => result.ruleId &&
@@ -1589,9 +1591,9 @@ async function scanFilesForSecrets(files, fileExclusion, options) {
1589
1591
  errorMessage += ` Your extension package contains sensitive information that should not be published.`;
1590
1592
  errorMessage += ` Please remove these secrets before packaging.`;
1591
1593
  errorMessage += `\n` + noneDotEnvSecretsFound.map(secretLint_1.prettyPrintLintResult).join('\n');
1592
- let hintMessage = `\nIn case of a false positives, you can allowlist secrets with `;
1594
+ let hintMessage = `\nIn case of false positives, you can allow specific types of secrets with `;
1593
1595
  hintMessage += secretsFoundRuleNames.map(name => `--allow-package-secrets ${name}`).join(' ');
1594
- hintMessage += ` or use --allow-package-all-secrets to skip this check (not recommended).`;
1596
+ hintMessage += ` or use --allow-package-all-secrets to skip this check entirely (not recommended).`;
1595
1597
  util.log.error(errorMessage + chalk_1.default.italic(hintMessage));
1596
1598
  process.exit(1);
1597
1599
  }
package/out/secretLint.js CHANGED
@@ -7,55 +7,64 @@ exports.prettyPrintLintResult = exports.getRuleNameFromRuleId = exports.lintText
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const secret_lint_types_1 = require("./typings/secret-lint-types");
9
9
  const util_1 = require("./util");
10
- const lintConfig = {
11
- rules: [
12
- {
13
- id: "@secretlint/secretlint-rule-preset-recommend",
14
- rules: [
15
- {
16
- id: "@secretlint/secretlint-rule-basicauth",
17
- allowMessageIds: ["BasicAuth"]
18
- }, {
19
- id: "@secretlint/secretlint-rule-privatekey",
20
- options: {
21
- allows: [
22
- // Allow all keys which do not start and end with the BEGIN/END PRIVATE KEY and has at least 50 characters in between
23
- // https://github.com/microsoft/vscode-vsce/issues/1147
24
- "/^(?![\\s\\S]*-----BEGIN .*PRIVATE KEY-----[A-Za-z0-9+/=\\r\\n]{50,}-----END .*PRIVATE KEY-----)[\\s\\S]*$/"
25
- ]
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
- }
10
+ const secretsScanningRules = [
11
+ {
12
+ id: "@secretlint/secretlint-rule-preset-recommend",
13
+ rules: [
14
+ {
15
+ id: "@secretlint/secretlint-rule-basicauth",
16
+ allowMessageIds: ["BasicAuth"]
17
+ },
18
+ {
19
+ id: "@secretlint/secretlint-rule-privatekey",
20
+ options: {
21
+ allows: [
22
+ // Allow all keys which do not start and end with the BEGIN/END PRIVATE KEY and has at least 50 characters in between
23
+ // https://github.com/microsoft/vscode-vsce/issues/1147
24
+ "/^(?![\\s\\S]*-----BEGIN .*PRIVATE KEY-----[A-Za-z0-9+/=\\r\\n]{50,}-----END .*PRIVATE KEY-----)[\\s\\S]*$/"
25
+ ]
36
26
  }
37
- ]
38
- }, {
39
- id: "@secretlint/secretlint-rule-no-dotenv"
40
- }
41
- ]
42
- };
43
- const lintOptions = {
44
- configFileJSON: lintConfig,
45
- formatter: "@secretlint/secretlint-formatter-sarif",
46
- color: true,
47
- maskSecrets: false
48
- };
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
+ }
36
+ }
37
+ ]
38
+ }
39
+ ];
40
+ const dotEnvRules = [
41
+ {
42
+ id: "@secretlint/secretlint-rule-no-dotenv"
43
+ }
44
+ ];
49
45
  // Helper function to dynamically import the createEngine function
50
- async function getEngine() {
46
+ async function getEngine(scanSecrets, scanDotEnv) {
51
47
  // Use a raw dynamic import that will not be transformed
52
48
  // This is necessary because @secretlint/node is an ESM module
53
49
  const secretlintModule = await eval('import("@secretlint/node")');
50
+ const rules = [];
51
+ if (scanSecrets) {
52
+ rules.push(...secretsScanningRules);
53
+ }
54
+ if (scanDotEnv) {
55
+ rules.push(...dotEnvRules);
56
+ }
57
+ const lintOptions = {
58
+ configFileJSON: { rules: rules },
59
+ formatter: "@secretlint/secretlint-formatter-sarif",
60
+ color: true,
61
+ maskSecrets: false
62
+ };
54
63
  const engine = await secretlintModule.createEngine(lintOptions);
55
64
  return engine;
56
65
  }
57
- async function lintFiles(filePaths) {
58
- const engine = await getEngine();
66
+ async function lintFiles(filePaths, scanSecrets, scanDotEnv) {
67
+ const engine = await getEngine(scanSecrets, scanDotEnv);
59
68
  let engineResult;
60
69
  try {
61
70
  engineResult = await engine.executeOnFiles({
@@ -69,8 +78,8 @@ async function lintFiles(filePaths) {
69
78
  return parseResult(engineResult);
70
79
  }
71
80
  exports.lintFiles = lintFiles;
72
- async function lintText(content, fileName) {
73
- const engine = await getEngine();
81
+ async function lintText(content, fileName, scanSecrets, scanDotEnv) {
82
+ const engine = await getEngine(scanSecrets, scanDotEnv);
74
83
  let engineResult;
75
84
  try {
76
85
  engineResult = await engine.executeOnContent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/vsce",
3
- "version": "3.4.2-1",
3
+ "version": "3.4.2-2",
4
4
  "description": "VS Code Extensions Manager",
5
5
  "repository": {
6
6
  "type": "git",