Rules / Dart
SHIELD-DART-013
Sensitive data logged to console
What it detects
Printing passwords or tokens via print or debugPrint leaks secrets into device and crash logs.
How to fix
Remove secrets from log output or redact them before logging.
Vulnerable — Shield flags thissign_in.dart
Future<void> signIn(String email, String password) async {
final ok = await authApi.signIn(email, password);
print("sign-in ok=$ok email=$email password=$password");
}
Fixed — scans cleansign_in.dart
Future<void> signIn(String email, String password) async {
final ok = await authApi.signIn(email, password);
print("sign-in ok=$ok email=$email");
}
Both snippets are verified against the shipped scanner: the vulnerable one triggers SHIELD-DART-013, the fixed one does not.