mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-28 17:08:29 +01:00
Don't log the user's refresh token
This commit is contained in:
@@ -113,7 +113,8 @@ class AppLinkRouter {
|
||||
Future<void> _handle(Uri uri) async {
|
||||
final token = tokenFromUri(uri);
|
||||
if (token == null) {
|
||||
_logger.fine('Ignoring unrelated or malformed deep link: $uri');
|
||||
// Never log the fragment: it carries the refresh token on our links.
|
||||
_logger.fine('Ignoring unrelated or malformed deep link: ${uri.removeFragment()}');
|
||||
return;
|
||||
}
|
||||
final state = fragmentParam(uri, 'state');
|
||||
@@ -124,7 +125,10 @@ class AppLinkRouter {
|
||||
// Unsolicited link (no outstanding state), stale (past TTL), or state
|
||||
// mismatch, all three look the same from here and are all rejected by
|
||||
// design. Login-CSRF defence: only accept handoffs the app started itself.
|
||||
_logger.warning('Rejecting handoff deep link with bad/missing state: $uri');
|
||||
// Strip the fragment before logging: it carries the refresh token
|
||||
_logger.warning(
|
||||
'Rejecting handoff deep link with bad/missing state: ${uri.removeFragment()}',
|
||||
);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -800,11 +800,11 @@ class AuthNotifier extends _$AuthNotifier {
|
||||
newRefresh = (data?['refresh_token'] ?? meta?['refresh_token']) as String?;
|
||||
newExp = jwtExp(decodeJwtPayload(newAccess));
|
||||
} catch (e, s) {
|
||||
final bodySnippet = response.body.length > 500
|
||||
? '${response.body.substring(0, 500)}...'
|
||||
: response.body;
|
||||
// Don't log the body: on the success-shaped path it holds the rotated
|
||||
// refresh token
|
||||
_logger.warning(
|
||||
'refreshAccessToken: malformed response body, clearing session. Body: $bodySnippet',
|
||||
'refreshAccessToken: malformed response body, clearing session. '
|
||||
'Status: ${response.statusCode}, body length: ${response.body.length}',
|
||||
e,
|
||||
s,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user