@vscode/gulp-electron 1.34.0 → 1.36.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/SECURITY.md ADDED
@@ -0,0 +1,41 @@
1
+ <!-- BEGIN MICROSOFT SECURITY.MD V0.0.8 BLOCK -->
2
+
3
+ ## Security
4
+
5
+ Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6
+
7
+ If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
8
+
9
+ ## Reporting Security Issues
10
+
11
+ **Please do not report security vulnerabilities through public GitHub issues.**
12
+
13
+ Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
14
+
15
+ If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
16
+
17
+ You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
18
+
19
+ Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20
+
21
+ * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22
+ * Full paths of source file(s) related to the manifestation of the issue
23
+ * The location of the affected source code (tag/branch/commit or direct URL)
24
+ * Any special configuration required to reproduce the issue
25
+ * Step-by-step instructions to reproduce the issue
26
+ * Proof-of-concept or exploit code (if possible)
27
+ * Impact of the issue, including how an attacker might exploit the issue
28
+
29
+ This information will help us triage your report more quickly.
30
+
31
+ If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
32
+
33
+ ## Preferred Languages
34
+
35
+ We prefer all communications to be in English.
36
+
37
+ ## Policy
38
+
39
+ Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
40
+
41
+ <!-- END MICROSOFT SECURITY.MD BLOCK -->
@@ -37,4 +37,6 @@ extends:
37
37
  testSteps:
38
38
  - script: npm ci
39
39
  - script: npm test
40
+ env:
41
+ GITHUB_TOKEN: "$(github-token)"
40
42
  publishPackage: ${{ parameters.publishPackage }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/gulp-electron",
3
- "version": "1.34.0",
3
+ "version": "1.36.0",
4
4
  "description": "gulp plugin for packaging Electron into VS Code",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -41,6 +41,7 @@
41
41
  "rcedit": "^0.3.0",
42
42
  "rimraf": "^2.4.2",
43
43
  "semver": "^4.3.4",
44
+ "sumchecker": "^3.0.1",
44
45
  "temp": "^0.8.3",
45
46
  "vinyl": "^3.0.0",
46
47
  "vinyl-fs": "^3.0.3"
package/src/download.js CHANGED
@@ -9,19 +9,21 @@ var zfs = require("gulp-vinyl-zip");
9
9
  var filter = require("gulp-filter");
10
10
  const { Octokit } = require("@octokit/rest");
11
11
  const got = require("got");
12
+ const sumchecker = require('sumchecker');
12
13
 
13
14
  async function getDownloadUrl(
14
- ownerRepo,
15
+ ownerRepo, customTag,
15
16
  { version, platform, arch, token, artifactName, artifactSuffix }
16
17
  ) {
17
18
  const [owner, repo] = ownerRepo.split("/");
18
19
  const octokit = new Octokit({ auth: token });
19
20
  const releaseVersion = version.startsWith("v") ? version : `v${version}`;
21
+ const tag = customTag ?? releaseVersion;
20
22
 
21
23
  const { data: release } = await octokit.repos.getReleaseByTag({
22
24
  owner,
23
25
  repo,
24
- tag: releaseVersion,
26
+ tag,
25
27
  });
26
28
 
27
29
  if (!release) {
@@ -117,7 +119,7 @@ async function download(opts) {
117
119
  );
118
120
 
119
121
  if (opts.repo) {
120
- const url = await getDownloadUrl(opts.repo, downloadOpts);
122
+ const url = await getDownloadUrl(opts.repo, opts.tag, downloadOpts);
121
123
 
122
124
  downloadOpts = {
123
125
  ...downloadOpts,
@@ -138,7 +140,16 @@ async function download(opts) {
138
140
  function downloadStream(opts) {
139
141
  return es.readable(function (_, cb) {
140
142
  download(opts).then(
141
- (assets) => {
143
+ async (assets) => {
144
+ if (opts.validateChecksum) {
145
+ try {
146
+ await sumchecker('sha256', opts.checksumFile, path.dirname(assets), [
147
+ path.basename(assets),
148
+ ]);
149
+ } catch (err) {
150
+ return cb(err);
151
+ }
152
+ }
142
153
  zfs
143
154
  .src(assets)
144
155
  .on("data", (data) => this.emit("data", data))
@@ -165,15 +176,9 @@ function getDarwinLibFFMpegPath(opts) {
165
176
 
166
177
  module.exports = function (opts) {
167
178
  const downloadOpts = {
168
- version: opts.version,
169
- platform: opts.platform,
179
+ ...opts,
170
180
  arch: opts.arch === "arm" ? "armv7l" : opts.arch,
171
181
  artifactName: "electron",
172
- token: opts.token,
173
- quiet: opts.quiet,
174
- repo: opts.repo,
175
- symbols: opts.symbols,
176
- pdbs: opts.pdbs,
177
182
  };
178
183
 
179
184
  if (opts.symbols) {
package/src/index.js CHANGED
@@ -88,6 +88,14 @@ function electron(opts) {
88
88
  );
89
89
  }
90
90
 
91
+ if (opts.validateChecksum) {
92
+ try {
93
+ fs.openSync(opts.checksumFile, fs.constants.R_OK);
94
+ } catch (err) {
95
+ throw new Error(`Unable to read checksum file: ${opts.checksumFile}`);
96
+ }
97
+ }
98
+
91
99
  return _electron(opts);
92
100
  }
93
101