@sentry/cli 1.72.2 → 1.73.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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  "You know what they say. Fool me once, strike one, but fool me twice... strike three." — Michael Scott
4
4
 
5
+ ## 1.73.2
6
+
7
+ ### Various fixes & improvements
8
+
9
+ - install: Rename SENTRY_NO_PROGRESS_BAR flag to SENTRYCLI_NO_PROGRESS_BAR (#1132) by @kamilogorek
10
+
11
+ ## 1.73.1
12
+
13
+ ### Various fixes & improvements
14
+
15
+ - feat: Allow for using local binary through SENTRYCLI_USE_LOCAL env (#1129) by @kamilogorek
16
+ - ref: Dont panic on malformed xcodeproj directories (#1127) by @kamilogorek
17
+
18
+ ## 1.73.0
19
+
20
+ * feat: Add checksum validation for installed binaries (set `SENTRYCLI_SKIP_CHECKSUM_VALIDATION` to opt-out) (#1123)
21
+ * fix: Detect unwind and debug information in files linked with `gold` (#1124)
22
+ * ref: Silence progress bar in CI environments by default (#1122)
23
+
5
24
  ## 1.72.2
6
25
 
7
26
  * feat: Use default xcode values for plist struct (#1111)
package/checksums.txt ADDED
@@ -0,0 +1,9 @@
1
+ sentry-cli-Darwin-arm64=a363b15e883041ed24ba3e9c394952eeab3c0072800ab4874e8374f8dc31af0a
2
+ sentry-cli-Darwin-universal=2b7406c9ddd978ed7828a8491cdf2fa4fa4b83c232b6cda52e0b23caaac6452c
3
+ sentry-cli-Darwin-x86_64=072697e2ccb40d4ddf2623684f14635aadf6a22d45c9976bbaf55582626a0924
4
+ sentry-cli-Linux-aarch64=e9941a53eec7cca900582bbbbba63744295840be65d83aad34467c5eb747d881
5
+ sentry-cli-Linux-armv7=9a7ccbb6b732656a6e0754d86552e37e794972ed91a1383be39b9ced6f0b5d28
6
+ sentry-cli-Linux-i686=f09d66e4f640a2a2aeed72be98ddd2547846cca81a309ae056d26360fb7a87af
7
+ sentry-cli-Linux-x86_64=be5b856087324cb5d270c356c276ee48eecdbef591db155efabaf20576100d07
8
+ sentry-cli-Windows-i686.exe=284b67e0c16aaf318f06784f29c4855af62a5c4a5cee32f98076baa455076c63
9
+ sentry-cli-Windows-x86_64.exe=b6596a13760a25decee54ce3c5d7cc1214fff3c59c1e77d81ab0f920ad30c513
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/cli",
3
- "version": "1.72.2",
3
+ "version": "1.73.2",
4
4
  "description": "A command line utility to work with Sentry. https://docs.sentry.io/hosted/learn/cli/",
5
5
  "homepage": "https://docs.sentry.io/hosted/learn/cli/",
6
6
  "license": "BSD-3-Clause",
@@ -40,7 +40,8 @@
40
40
  "node-fetch": "^2.6.7",
41
41
  "npmlog": "^4.1.2",
42
42
  "progress": "^2.0.3",
43
- "proxy-from-env": "^1.1.0"
43
+ "proxy-from-env": "^1.1.0",
44
+ "which": "^2.0.2"
44
45
  },
45
46
  "devDependencies": {
46
47
  "eslint": "^6.8.0",
@@ -18,6 +18,7 @@ const Proxy = require('proxy-from-env');
18
18
  // NOTE: Can be dropped in favor of `fs.mkdirSync(path, { recursive: true })` once we stop supporting Node 8.x
19
19
  const mkdirp = require('mkdirp');
20
20
  const npmLog = require('npmlog');
21
+ const which = require('which');
21
22
 
22
23
  const helper = require('../js/helper');
23
24
  const pkgInfo = require('../package.json');
@@ -47,9 +48,11 @@ function getLogStream(defaultStream) {
47
48
  function shouldRenderProgressBar() {
48
49
  const silentFlag = process.argv.some(v => v === '--silent');
49
50
  const silentConfig = process.env.npm_config_loglevel === 'silent';
50
- const silentEnv = process.env.SENTRY_NO_PROGRESS_BAR;
51
+ // Leave `SENTRY_NO_PROGRESS_BAR` for backwards compatibility
52
+ const silentEnv = process.env.SENTRYCLI_NO_PROGRESS_BAR || process.env.SENTRY_NO_PROGRESS_BAR;
53
+ const ciEnv = process.env.CI === 'true';
51
54
  // If any of possible options is set, skip rendering of progress bar
52
- return !(silentFlag || silentConfig || silentEnv);
55
+ return !(silentFlag || silentConfig || silentEnv || ciEnv);
53
56
  }
54
57
 
55
58
  function getDownloadUrl(platform, arch) {
@@ -149,11 +152,64 @@ function getTempFile(cached) {
149
152
  .slice(2)}.tmp`;
150
153
  }
151
154
 
155
+ function validateChecksum(tempPath, name) {
156
+ let storedHash;
157
+ try {
158
+ const checksums = fs.readFileSync(path.join(__dirname, '../checksums.txt'), 'utf8');
159
+ const entries = checksums.split('\n');
160
+ for (let i = 0; i < entries.length; i++) {
161
+ const [key, value] = entries[i].split('=');
162
+ if (key === name) {
163
+ storedHash = value;
164
+ break;
165
+ }
166
+ }
167
+ } catch (e) {
168
+ npmLog.info(
169
+ 'Checksums are generated when the package is published to npm. They are not available directly in the source repository. Skipping validation.'
170
+ );
171
+ return;
172
+ }
173
+
174
+ if (!storedHash) {
175
+ npmLog.info(`Checksum for ${name} not found, skipping validation.`);
176
+ return;
177
+ }
178
+
179
+ const currentHash = crypto
180
+ .createHash('sha256')
181
+ .update(fs.readFileSync(tempPath))
182
+ .digest('hex');
183
+
184
+ if (storedHash !== currentHash) {
185
+ fs.unlinkSync(tempPath);
186
+ throw new Error(
187
+ `Checksum validation for ${name} failed.\nExpected: ${storedHash}\nReceived: ${currentHash}`
188
+ );
189
+ } else {
190
+ npmLog.info('Checksum validation passed.');
191
+ }
192
+ }
193
+
152
194
  function downloadBinary() {
153
195
  const arch = os.arch();
154
196
  const platform = os.platform();
155
197
  const outputPath = helper.getPath();
156
198
 
199
+ if (process.env.SENTRYCLI_USE_LOCAL === '1') {
200
+ try {
201
+ const binPath = which.sync('sentry-cli');
202
+ npmLog.info('sentry-cli', `Using local binary: ${binPath}`);
203
+ fs.copyFileSync(binPath, outputPath);
204
+ return Promise.resolve();
205
+ } catch (e) {
206
+ throw new Error(
207
+ 'Configured installation of local binary, but it was not found.' +
208
+ 'Make sure that `sentry-cli` executable is available in your $PATH or disable SENTRYCLI_USE_LOCAL env variable.'
209
+ );
210
+ }
211
+ }
212
+
157
213
  const downloadUrl = getDownloadUrl(platform, arch);
158
214
  if (!downloadUrl) {
159
215
  return Promise.reject(new Error(`Unsupported target ${platform}-${arch}`));
@@ -216,6 +272,9 @@ function downloadBinary() {
216
272
  .on('error', e => reject(e))
217
273
  .on('close', () => resolve());
218
274
  }).then(() => {
275
+ if (process.env.SENTRYCLI_SKIP_CHECKSUM_VALIDATION !== '1') {
276
+ validateChecksum(tempPath, name);
277
+ }
219
278
  fs.copyFileSync(tempPath, cachedPath);
220
279
  fs.copyFileSync(tempPath, outputPath);
221
280
  fs.unlinkSync(tempPath);