feat(meta): Remove log redaction

This commit is contained in:
PapaTutuWawa 2023-04-02 14:38:32 +02:00
parent b354ca8d0a
commit 29f0419154
9 changed files with 21 additions and 26 deletions

View File

@ -152,7 +152,7 @@ class XmppConnection {
/// True if we are authenticated. False if not.
bool _isAuthenticated = false;
/// Timer for the connecting timeout
/// Timer for the connecting timeout.
Timer? _connectingTimeoutTimer;
/// Completers for certain actions
@ -467,10 +467,10 @@ class XmppConnection {
}
/// Sends an [XMLNode] without any further processing to the server.
void sendRawXML(XMLNode node, {String? redact}) {
void sendRawXML(XMLNode node) {
final string = node.toXml();
_log.finest('==> $string');
_socket.write(string, redact: redact);
_socket.write(string);
}
/// Sends [raw] to the server.

View File

@ -43,7 +43,7 @@ class NegotiatorAttributes {
);
/// Sends the nonza nonza and optionally redacts it in logs if redact is not null.
final void Function(XMLNode nonza, {String? redact}) sendNonza;
final void Function(XMLNode nonza) sendNonza;
/// Returns the connection settings.
final ConnectionSettings Function() getConnectionSettings;

View File

@ -50,7 +50,6 @@ class SaslPlainNegotiator extends Sasl2AuthenticationNegotiator {
final data = await getRawStep('');
attributes.sendNonza(
SaslPlainAuthNonza(data),
redact: SaslPlainAuthNonza('******').toXml(),
);
_authSent = true;
return const Result(NegotiatorState.ready);

View File

@ -259,7 +259,6 @@ class SaslScramNegotiator extends Sasl2AuthenticationNegotiator {
body: await getRawStep(''),
type: hashType,
),
redact: SaslScramAuthNonza(body: '******', type: hashType).toXml(),
);
return const Result(NegotiatorState.ready);
case ScramState.initialMessageSent:
@ -275,7 +274,6 @@ class SaslScramNegotiator extends Sasl2AuthenticationNegotiator {
attributes.sendNonza(
SaslScramResponseNonza(body: await getRawStep(nonza.innerText())),
redact: SaslScramResponseNonza(body: '******').toXml(),
);
return const Result(NegotiatorState.ready);
case ScramState.challengeResponseSent:

View File

@ -232,11 +232,11 @@ class Sasl2Negotiator extends XmppFeatureNegotiatorBase {
'mechanism': _currentSaslNegotiator!.mechanismName,
},
children: [
if (userAgent != null) userAgent!.toXml(),
XMLNode(
tag: 'initial-response',
text: await _currentSaslNegotiator!.getRawStep(''),
),
if (userAgent != null) userAgent!.toXml(),
...children,
],
);

View File

@ -30,9 +30,8 @@ abstract class BaseSocketWrapper {
/// reused by calling [this.connect] again.
void close();
/// Write [data] into the socket. If [redact] is not null, then [redact] will be
/// logged instead of [data].
void write(String data, {String? redact});
/// Write [data] into the socket.
void write(String data);
/// This must connect to [host]:[port] and initialize the streams accordingly.
/// [domain] is the domain that TLS should be validated against, in case the Socket

View File

@ -18,7 +18,8 @@ Future<void> _runTest(String domain) async {
TestingReconnectionPolicy(),
AlwaysConnectedConnectivityManager(),
socket,
)..registerFeatureNegotiators([
);
await connection.registerFeatureNegotiators([
StartTlsNegotiator(),
]);
await connection.registerManagers([

View File

@ -19,7 +19,8 @@ void main() {
TestingSleepReconnectionPolicy(10),
AlwaysConnectedConnectivityManager(),
TCPSocketWrapper(),
)..registerFeatureNegotiators([
);
await connection.registerFeatureNegotiators([
StartTlsNegotiator(),
]);
await connection.registerManagers([
@ -68,7 +69,8 @@ void main() {
TestingReconnectionPolicy(),
AlwaysConnectedConnectivityManager(),
TCPSocketWrapper(),
)..registerFeatureNegotiators([
);
await connection.registerFeatureNegotiators([
StartTlsNegotiator(),
]);
await connection.registerManagers([

View File

@ -289,17 +289,13 @@ class TCPSocketWrapper extends BaseSocketWrapper {
_eventStream.stream.asBroadcastStream();
@override
void write(String data, {String? redact}) {
void write(String data) {
if (_socket == null) {
_log.severe('Failed to write to socket as _socket is null');
return;
}
if (redact != null) {
_log.finest('**> $redact');
} else {
_log.finest('==> $data');
}
try {
_socket!.write(data);