bazelbuild / bazelbuild/bazel

Better log redaction controls

Open
#30,828 5 comments 0 reactions 1 assignee Claimed by @meisterT View on GitHub
P2 team-CLI team-Core type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

Currently, Bazel's [`SafeRequestLogging`](https://cs.opensource.google/bazel/bazel/+/82e3f853f64892a5d7ad131186295117acd88087:src/main/java/com/google/devtools/build/lib/runtime/SafeRequestLogging.java) class has a [static set of strings to redact](https://cs.opensource.google/bazel/bazel/+/82e3f853f64892a5d7ad131186295117acd88087:src/main/java/com/google/devtools/build/lib/runtime/SafeRequestLogging.java;drc=82e3f853f64892a5d7ad131186295117acd88087;l=29) from the environment in the log:

```
private static final Pattern suppressFromLog =
Pattern.compile(
"--client_env=([^=]*(?:auth|pass|cookie|token|api_key)[^=]*)=", Pattern.CASE_INSENSITIVE);
```

It would be very useful to have an additional way to extend this list for other secrets.

Ideally this would be an environment variable, or a Java system property to make it easier to set globally. A bazel flag would also be acceptable (it could be used with a global bazelrc), but this is a little more work to set up.

### Which category does this issue belong to?

Core

### What underlying problem are you trying to solve with this feature?

User secrets appearing in logs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.