Ver Fonte

Sanitise ICE server usernames and credentials when reporting a log

Lennart Grahl há 6 anos atrás
pai
commit
ed763c0d75
1 ficheiros alterados com 14 adições e 2 exclusões
  1. 14 2
      src/controllers/troubleshooting.ts

+ 14 - 2
src/controllers/troubleshooting.ts

@@ -17,7 +17,7 @@
 
 import {Logger} from 'ts-log';
 
-import {arrayToBuffer, hasFeature, sleep} from '../helpers';
+import {arrayToBuffer, copyShallow, hasFeature, sleep} from '../helpers';
 import * as clipboard from '../helpers/clipboard';
 
 import {MemoryLogger} from '../helpers/logger';
@@ -188,9 +188,21 @@ export class TroubleshootingController extends DialogController {
     private getLog(): string {
         const browser = this.browserService.getBrowser();
 
+        // Sanitise usernames and credentials from ICE servers in config
+        const config = copyShallow(this.config) as threema.Config;
+        config.ICE_SERVERS = config.ICE_SERVERS.map((server: RTCIceServer) => {
+            server = copyShallow(server) as RTCIceServer;
+            for (const key of ['username', 'credential', 'credentialType']) {
+                if (server[key] !== undefined) {
+                    server[key] = `[${server[key].constructor.name}]`;
+                }
+            }
+            return server;
+        });
+
         // Create container for meta data and log records
         const container = {
-            config: this.config,
+            config: config,
             browser: browser.description(),
             log: this.logService.memory.getRecords(),
         };