[SSK] Better logging for envelopes
Leave last 3 digits of recipientId when scrubbing logs. This is in line with other Signal clients, and makes it possible to trace interactions. // FREEBIE
This commit is contained in:
parent
fe18cb9a39
commit
6466e9f41f
|
@ -133,7 +133,7 @@ CHECKOUT OPTIONS:
|
|||
:commit: 23a5d1b67afc4dd028198202e25fd2e06ce396d7
|
||||
:git: https://github.com/WhisperSystems/SignalProtocolKit.git
|
||||
SignalServiceKit:
|
||||
:commit: 1fd7627daf713521e5ea8f20e266873d41e8c488
|
||||
:commit: 63cc0328b5523b53216285e0c754d0500b3ec344
|
||||
:git: https://github.com/WhisperSystems/SignalServiceKit.git
|
||||
SocketRocket:
|
||||
:commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Created by Michael Kirk on 9/27/16.
|
||||
// Copyright © 2016 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSScrubbingLogFormatter.h"
|
||||
|
||||
|
@ -17,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSString *filteredString = [phoneRegex stringByReplacingMatchesInString:string
|
||||
options:0
|
||||
range:NSMakeRange(0, [string length])
|
||||
withTemplate:@"[ REDACTED_PHONE_NUMBER ]"];
|
||||
withTemplate:@"[ REDACTED_PHONE_NUMBER:xxx$1 ]"];
|
||||
|
||||
return filteredString;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Created by Michael Kirk on 9/27/16.
|
||||
// Copyright © 2016 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSScrubbingLogFormatter.h"
|
||||
#import <XCTest/XCTest.h>
|
||||
|
@ -36,11 +37,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
for (NSString *phoneString in phoneStrings) {
|
||||
OWSScrubbingLogFormatter *formatter = [OWSScrubbingLogFormatter new];
|
||||
NSString *actual = [formatter
|
||||
formatLogMessage:[self
|
||||
messageWithString:[NSString stringWithFormat:@"My phone number is %@", phoneString]]];
|
||||
|
||||
NSRange redactedRange = [actual rangeOfString:@"My phone number is [ REDACTED_PHONE_NUMBER ]"];
|
||||
NSString *messageText = [NSString stringWithFormat:@"My phone number is %@", phoneString];
|
||||
NSString *actual = [formatter formatLogMessage:[self messageWithString:messageText]];
|
||||
NSRange redactedRange = [actual rangeOfString:@"My phone number is [ REDACTED_PHONE_NUMBER:xxx234 ]"];
|
||||
XCTAssertNotEqual(NSNotFound, redactedRange.location, "Failed to redact phone string: %@", phoneString);
|
||||
|
||||
NSRange phoneNumberRange = [actual rangeOfString:phoneString];
|
||||
|
|
Loading…
Reference in New Issue