Merge remote-tracking branch 'upstream/master' into clearnet

pull/1572/head
Audric Ackermann 4 years ago
commit cfc7825eee
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -7,9 +7,10 @@ const { compose } = require('lodash/fp');
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 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 SERVER_URL_PATTERN = /https?:\/\/[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g;
const REDACTION_PLACEHOLDER = '[REDACTED]';
// _redactPath :: Path -> String -> String
@ -73,6 +74,14 @@ exports.redactSnodeIP = text => {
return text.replace(SNODE_PATTERN, REDACTION_PLACEHOLDER);
};
exports.redactServerUrl = text => {
if (!is.string(text)) {
throw new TypeError("'text' must be a string");
}
return text.replace(SERVER_URL_PATTERN, REDACTION_PLACEHOLDER);
};
// redactGroupIds :: String -> String
exports.redactGroupIds = text => {
if (!is.string(text)) {
@ -94,7 +103,8 @@ exports.redactAll = compose(
exports.redactSensitivePaths,
exports.redactGroupIds,
exports.redactSessionID,
exports.redactSnodeIP
exports.redactSnodeIP,
exports.redactServerUrl
);
const removeNewlines = text => text.replace(/\r?\n|\r/g, '');

@ -2,7 +2,7 @@
"name": "session-desktop",
"productName": "Session",
"description": "Private messaging from your desktop",
"version": "1.5.2",
"version": "1.5.3",
"license": "GPL-3.0",
"author": {
"name": "Loki Project",

@ -63,20 +63,28 @@ describe('Privacy', () => {
'This is a log line with sensitive information:\n' +
`path1 ${APP_ROOT_PATH}/main.js\n` +
'phone1 0531032fc7415b7cc1b7516480ad121d391eddce3cfb2cee27dd5b215609c32827 ipsum\n' +
'group 31032fc7415b7cc1b7516480ad121d391eddce3cfb2cee27dd5b215609c32827 eeee\n' +
'group1 group(123456789) doloret\n' +
`path2 file:///${encodedAppRootPath}/js/background.js.` +
'phone2 0531033dc7415b7cc1b7516480ad121d391eddce3cfb2cee27dd5b215609c32827 lorem\n' +
'group2 group(abcdefghij) doloret\n';
'group2 group(abcdefghij) doloret\n' +
'url1 https://you-have-to-hide.me aaa\n' +
'url1 http://you-have-to-hide.me bbb\n' +
'url1 127.0.0.1:22021 ccc\n';
const actual = Privacy.redactAll(text);
const expected =
'This is a log line with sensitive information:\n' +
'path1 [REDACTED]/main.js\n' +
'phone1 [REDACTED] ipsum\n' +
'group [REDACTED] eeee\n' +
'group1 group([REDACTED]789) doloret\n' +
'path2 file:///[REDACTED]/js/background.js.' +
'phone2 [REDACTED] lorem\n' +
'group2 group([REDACTED]hij) doloret\n';
'group2 group([REDACTED]hij) doloret\n' +
'url1 [REDACTED] aaa\n' +
'url1 [REDACTED] bbb\n' +
'url1 [REDACTED]:22021 ccc\n';
assert.equal(actual, expected);
});
});

@ -64,7 +64,7 @@ export class UserDetailsDialog extends React.Component<Props, State> {
private renderAvatar() {
const { avatarPath, pubkey, profileName } = this.props;
const size = this.state.isEnlargedImageShown ? 300 : 80;
const userName = name || profileName || pubkey;
const userName = profileName || pubkey;
return (
<Avatar

@ -4,7 +4,7 @@ type Job<ResultType> = (() => PromiseLike<ResultType>) | (() => ResultType);
// TODO: This needs to replace js/modules/job_queue.js
export class JobQueue {
private pending: Promise<any> = Promise.resolve();
private pending?: Promise<any> = Promise.resolve();
private readonly jobs: Map<string, Promise<unknown>> = new Map();
public has(id: string): boolean {

Loading…
Cancel
Save