dart-lang / dart-lang/language

Sensitive object logging redaction

Open
#3,828 8 comments 6 reactions 0 assignees View on GitHub
feature
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

A while back, I described this on the [wrong repo](https://github.com/flutter/flutter/issues/132822). I'm finally getting around to putting it in the right place; here. :)

Consider the following scenario: You've got a data class, such as the following.

```dart
class Credentials {
final String username;
final String password;

Credentials({
required this.username,
required this.password,
});

Map toJson() => {'username': username, 'password': password};

@override
String toString() => toJson().toString();
}
```

The following is the _current_ behavior:

```dart
final Credentials myCredentials = Credentials(
username: "hans",
password: "password",
);

print(myCredentials);
```

Output:
`I/flutter (10392): {username: hans, password: password}`

What I'm proposing is a _new_ keyword, such as `sensitive`, that would look something like this:

```dart
class Credentials {
final String username;
final String password;

Credentials({
required this.username,
sensitive required this.password,
});
...
```

So, at a system level when you try to log/print the parameter, you'd see something like this:

`I/flutter (10392): {username: hans, password: }`

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the proposal and its examples in this issue, including the suggested sensitive keyword and the logging output. No repository files, tests, or entry points are identified; done would require an agreed language design for syntax and redaction behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.