summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-11-09 12:38:07 +0100
committerErik Larkö <erik@mullvad.net>2017-11-09 12:53:41 +0100
commit075f22daad44128a0fd08f0b2c38d205c490d57a (patch)
tree538b476537577152b632f6b74a2fb4081db26187
parent07584089561a99be78590c803e891cecbdd91697 (diff)
downloadmullvadvpn-075f22daad44128a0fd08f0b2c38d205c490d57a.tar.xz
mullvadvpn-075f22daad44128a0fd08f0b2c38d205c490d57a.zip
Redact account token from logs
-rw-r--r--app/components/Support.js12
-rw-r--r--app/containers/SupportPage.js4
-rw-r--r--app/main.js14
-rw-r--r--test/components/Support.spec.js6
4 files changed, 29 insertions, 7 deletions
diff --git a/app/components/Support.js b/app/components/Support.js
index 2dcb6ad1ee..04e6c7392d 100644
--- a/app/components/Support.js
+++ b/app/components/Support.js
@@ -3,6 +3,8 @@ import React, { Component } from 'react';
import { Layout, Container, Header } from './Layout';
import ExternalLinkSVG from '../assets/images/icon-extLink.svg';
+import type { AccountReduxState } from '../redux/account/reducers';
+
export type SupportReport = {
email: string,
message: string,
@@ -16,9 +18,10 @@ export type SupportState = {
sendState: 'INITIAL' | 'LOADING' | 'SUCCESS' | 'FAILED',
};
export type SupportProps = {
+ account: AccountReduxState,
onClose: () => void;
onViewLog: (string) => void;
- onCollectLog: () => Promise<string>;
+ onCollectLog: (Array<string>) => Promise<string>;
onSend: (email: string, message: string, savedReport: string) => void;
};
@@ -60,10 +63,15 @@ export default class Support extends Component {
}
_getLog() {
+ const toRedact = [];
+ if (this.props.account.accountToken) {
+ toRedact.push(this.props.account.accountToken.toString());
+ }
+
const { savedReport } = this.state;
return savedReport ?
Promise.resolve(savedReport) :
- this.props.onCollectLog()
+ this.props.onCollectLog(toRedact)
.then( path => {
return new Promise(resolve => this.setState({ savedReport: path }, () => resolve(path)));
});
diff --git a/app/containers/SupportPage.js b/app/containers/SupportPage.js
index e57985d7d3..4d802183d7 100644
--- a/app/containers/SupportPage.js
+++ b/app/containers/SupportPage.js
@@ -35,12 +35,12 @@ const mapDispatchToProps = (dispatch, _props) => {
return {
onClose: () => dispatch(push('/settings')),
- onCollectLog: () => {
+ onCollectLog: (toRedact) => {
return new Promise((resolve, reject) => {
const id = uuid.v4();
unAnsweredIpcCalls.set(id, { resolve, reject });
- ipcRenderer.send('collect-logs', id);
+ ipcRenderer.send('collect-logs', id, toRedact);
setTimeout(() => reapIpcCall(id), 1000);
})
.catch((e) => {
diff --git a/app/main.js b/app/main.js
index 483a79fd5c..d9a3358e1f 100644
--- a/app/main.js
+++ b/app/main.js
@@ -382,7 +382,7 @@ const appDelegate = {
// add IPC handler to change tray icon from renderer
ipcMain.on('changeTrayIcon', (_: Event, type: TrayIconType) => trayIconManager.iconType = type);
- ipcMain.on('collect-logs', (event, id) => {
+ ipcMain.on('collect-logs', (event, id, toRedact) => {
log.info('Collecting logs in', appDelegate._logFileLocation);
fs.readdir(appDelegate._logFileLocation, (err, files) => {
if (err) {
@@ -396,12 +396,20 @@ const appDelegate = {
const reportPath = path.join(writableDirectory, uuid.v4() + '.report');
const binPath = resolveBin('problem-report');
- const args = [
+ let args = [
'collect',
'--output', reportPath,
- ...logFiles,
];
+ if (toRedact.length > 0) {
+ args = args.concat([
+ '--redact', ...toRedact,
+ '--',
+ ]);
+ }
+
+ args = args.concat(logFiles);
+
execFile(binPath, args, {windowsHide: true}, (err) => {
if (err) {
event.sender.send('collect-logs-reply', id, err);
diff --git a/test/components/Support.spec.js b/test/components/Support.spec.js
index 2352cbcef2..b5b9b3d24b 100644
--- a/test/components/Support.spec.js
+++ b/test/components/Support.spec.js
@@ -12,6 +12,12 @@ describe('components/Support', () => {
const makeProps = (mergeProps: $Shape<SupportProps> = {}): SupportProps => {
const defaultProps: SupportProps = {
+ account: {
+ accountToken: null,
+ error: null,
+ expiry: null,
+ status: 'none',
+ },
onClose: () => {},
onViewLog: (_path) => {},
onCollectLog: () => Promise.resolve('/tmp/mullvad_problem_report.log'),