filter the hash from error reports

This commit is contained in:
Danny Coates 2017-08-02 14:13:53 -07:00
parent d208a82089
commit 5944b85e67
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
5 changed files with 28 additions and 10 deletions

View File

@ -31,6 +31,7 @@ deployment:
test: test:
override: override:
- npm run build:version
- npm run lint - npm run lint
- npm test - npm test
- nsp check - nsp check

View File

@ -1,13 +1,14 @@
window.Raven = require('raven-js'); window.Raven = require('raven-js');
window.Raven.config(window.dsn).install(); if (navigator.doNotTrack !== '1' && window.RAVEN_CONFIG) {
window.dsn = undefined; window.Raven.config(window.SENTRY_ID, window.RAVEN_CONFIG).install();
}
const testPilotGA = require('testpilot-ga'); const testPilotGA = require('testpilot-ga');
const { gcmCompliant, sendEvent } = require('./utils'); const { gcmCompliant, sendEvent } = require('./utils');
window.analytics = new testPilotGA({ window.analytics = new testPilotGA({
an: 'Firefox Send', an: 'Firefox Send',
ds: 'web', ds: 'web',
tid: window.trackerId tid: window.GOOGLE_ANALYTICS_ID
}); });
const isSender = !location.pathname.includes('/download'); const isSender = !location.pathname.includes('/download');

View File

@ -92,6 +92,6 @@
"test": "npm-run-all test:*", "test": "npm-run-all test:*",
"test:unit": "mocha test/unit", "test:unit": "mocha test/unit",
"test:server": "mocha test/server", "test:server": "mocha test/server",
"test:browser": "browserify test/frontend/frontend.bundle.js -o test/frontend/bundle.js -d && node test/frontend/driver.js" "test--browser": "browserify test/frontend/frontend.bundle.js -o test/frontend/bundle.js -d && node test/frontend/driver.js"
} }
} }

View File

@ -10,6 +10,7 @@ const storage = require('./storage.js');
const Raven = require('raven'); const Raven = require('raven');
const crypto = require('crypto'); const crypto = require('crypto');
const fs = require('fs'); const fs = require('fs');
const version = require('../public/version.json');
if (conf.sentry_dsn) { if (conf.sentry_dsn) {
Raven.config(conf.sentry_dsn).install(); Raven.config(conf.sentry_dsn).install();
@ -106,8 +107,10 @@ app.get('/legal', (req, res) => {
app.get('/jsconfig.js', (req, res) => { app.get('/jsconfig.js', (req, res) => {
res.set('Content-Type', 'application/javascript'); res.set('Content-Type', 'application/javascript');
res.render('jsconfig', { res.render('jsconfig', {
trackerId: conf.analytics_id, googleAnalyticsId: conf.analytics_id,
dsn: conf.sentry_id, sentryId: conf.sentry_id,
version: version.version,
commit: version.commit,
maxFileSize: conf.max_file_size, maxFileSize: conf.max_file_size,
expireSeconds: conf.expire_seconds, expireSeconds: conf.expire_seconds,
layout: false layout: false

View File

@ -5,11 +5,24 @@ if (isIE && !isUnsupportedPage) {
window.location.replace('/unsupported/ie'); window.location.replace('/unsupported/ie');
} }
{{#if dsn}} {{#if sentryId}}
window.dsn = '{{{dsn}}}'; var RAVEN_CONFIG = {
release: '{{{version}}}',
tags: {
commit: '{{{commit}}}'
},
dataCallback: function (data) {
var hash = window.location.hash;
if (hash) {
return JSON.parse(JSON.stringify(data).replace(new RegExp(hash.slice(1), 'g'), ''));
}
return data;
}
}
var SENTRY_ID = '{{{sentryId}}}';
{{/if}} {{/if}}
{{#if trackerId}} {{#if googleAnalyticsId}}
window.trackerId = '{{{trackerId}}}'; var GOOGLE_ANALYTICS_ID = '{{{googleAnalyticsId}}}';
{{/if}} {{/if}}
var MAXFILESIZE = {{{maxFileSize}}}; var MAXFILESIZE = {{{maxFileSize}}};
var EXPIRE_SECONDS = {{{expireSeconds}}}; var EXPIRE_SECONDS = {{{expireSeconds}}};