Replacing md5 in favor of sha256 for stronger anonymization, #355

This commit is contained in:
James Barnsley
2019-01-28 15:24:14 +13:00
parent 69f2d666f2
commit e2960a3d6f
8 changed files with 864 additions and 682 deletions

View File

@ -1,7 +1,7 @@
import ReactGA from 'react-ga';
import Mopidy from 'mopidy';
import md5 from 'md5';
import { sha256 } from 'js-sha256';
import * as helpers from '../../helpers';
@ -244,7 +244,7 @@ const MopidyMiddleware = (function(){
case 'MOPIDY_CONNECTED':
if (store.getState().ui.allow_reporting){
var hashed_hostname = md5(window.location.hostname);
var hashed_hostname = sha256(window.location.hostname);
ReactGA.event({ category: 'Mopidy', action: 'Connected', label: hashed_hostname });
}
store.dispatch(uiActions.createNotification({content: 'Mopidy connected'}));

View File

@ -1,6 +1,6 @@
import ReactGA from 'react-ga';
import md5 from 'md5';
import { sha256 } from 'js-sha256';
var helpers = require('./../../helpers');
var coreActions = require('../core/actions');
@ -9,10 +9,6 @@ var uiActions = require('../ui/actions');
var pusherActions = require('../pusher/actions');
const SpotifyMiddleware = (function(){
/**
* The actual middleware inteceptor
**/
return store => next => action => {
var spotify = store.getState().spotify;
@ -33,7 +29,7 @@ const SpotifyMiddleware = (function(){
if (store.getState().ui.allow_reporting){
var hashed_username = null
if (store.getState().spotify.me){
hashed_username = md5(store.getState().spotify.me);
hashed_username = sha256(store.getState().spotify.me);
ReactGA.set({userId: hashed_username});
}
ReactGA.event({ category: 'Spotify', action: 'Authorization revoked', label: hashed_username});
@ -470,7 +466,7 @@ const SpotifyMiddleware = (function(){
}
if (store.getState().ui.allow_reporting){
var hashed_username = md5(me.id);
var hashed_username = sha256(me.id);
ReactGA.set({userId: hashed_username});
ReactGA.event({category: 'Spotify', action: 'Authorization verified', label: hashed_username});
}