cockroachdb / cockroachdb/cockroach

build: add linter to flag uses of `redact.StripMarkers()`

Open
#135,077 0 comments 0 reactions 0 assignees View on GitHub
A-logging C-enhancement T-supportability
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

We've previously had code merged that explicitly removed redaction markers from strings prior to logging them, we should add a linter to flag these situations as no one should be doing this. Instead, we should either pass `RedactableString` to the logger, or implement `redact.SafeFormatter`.

Example PR with such changes: https://github.com/cockroachdb/cockroach/pull/126507/files#diff-e5a646fccbaa96a87ee8f4b10a481cbe30467306e77ee63b808b2df0678ad9e5R573

One caveat with this usage that we *should* allow is that a typical implementation of `Error` will call `StripMarkers()` on the redactable implementation of the error string (like here: https://github.com/cockroachdb/cockroach/pull/134224

Jira issue: CRDB-44352

Epic CRDB-49081

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.