mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
redact snode IP used in logs on production builds
This commit is contained in:
parent
47026b8d5b
commit
f12ca66008
|
@ -154,11 +154,11 @@ class LokiPublicChatFactoryAPI extends EventEmitter {
|
|||
);
|
||||
return null;
|
||||
}
|
||||
if (window.isDev) {
|
||||
log.info(
|
||||
`loki_public_chat::findOrCreateServer - set token ${thisServer.token} for ${serverUrl}`
|
||||
);
|
||||
}
|
||||
// if (window.isDev) {
|
||||
// log.info(
|
||||
// `loki_public_chat::findOrCreateServer - set token ${thisServer.token} for ${serverUrl}`
|
||||
// );
|
||||
// }
|
||||
|
||||
this.servers.push(thisServer);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ const { escapeRegExp } = require('lodash');
|
|||
|
||||
const APP_ROOT_PATH = path.join(__dirname, '..', '..', '..');
|
||||
const SESSION_ID_PATTERN = /\b(05[0-9a-f]{64})\b/gi;
|
||||
const SNODE_PATTERN = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
||||
const GROUP_ID_PATTERN = /(group\()([^)]+)(\))/g;
|
||||
const REDACTION_PLACEHOLDER = '[REDACTED]';
|
||||
|
||||
|
@ -64,6 +65,14 @@ exports.redactSessionID = text => {
|
|||
return text.replace(SESSION_ID_PATTERN, REDACTION_PLACEHOLDER);
|
||||
};
|
||||
|
||||
exports.redactSnodeIP = text => {
|
||||
if (!is.string(text)) {
|
||||
throw new TypeError("'text' must be a string");
|
||||
}
|
||||
|
||||
return text.replace(SNODE_PATTERN, REDACTION_PLACEHOLDER);
|
||||
};
|
||||
|
||||
// redactGroupIds :: String -> String
|
||||
exports.redactGroupIds = text => {
|
||||
if (!is.string(text)) {
|
||||
|
@ -84,7 +93,8 @@ exports.redactSensitivePaths = exports._redactPath(APP_ROOT_PATH);
|
|||
exports.redactAll = compose(
|
||||
exports.redactSensitivePaths,
|
||||
exports.redactGroupIds,
|
||||
exports.redactSessionID
|
||||
exports.redactSessionID,
|
||||
exports.redactSnodeIP
|
||||
);
|
||||
|
||||
const removeNewlines = text => text.replace(/\r?\n|\r/g, '');
|
||||
|
|
|
@ -312,6 +312,6 @@ export class OnionPaths {
|
|||
this.onionPaths.push({ path, bad: false });
|
||||
}
|
||||
|
||||
log.info(`Built ${this.onionPaths.length} onion paths`, this.onionPaths);
|
||||
log.info(`Built ${this.onionPaths.length} onion paths`);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue