Skip to content

backup: add redaction markers to online restore URIs#166332

Merged
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
andrew-r-thomas:or-redaction
Mar 25, 2026
Merged

backup: add redaction markers to online restore URIs#166332
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
andrew-r-thomas:or-redaction

Conversation

@andrew-r-thomas
Copy link
Copy Markdown
Contributor

This patch adds redaction markers to URIs passed to pebble in online
restore. Specifically, all query params in the URIs are marked as unsafe
and as such will be redacted in logs and error messages.

Informs: #161169

Release note: None

@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io bot commented Mar 20, 2026

😎 Merged successfully - details.

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Mar 20, 2026

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@andrew-r-thomas andrew-r-thomas marked this pull request as ready for review March 20, 2026 23:41
@andrew-r-thomas andrew-r-thomas requested review from a team as code owners March 20, 2026 23:41
@andrew-r-thomas andrew-r-thomas requested review from annrpom, dt and msbutler and removed request for a team March 20, 2026 23:41
@andrew-r-thomas andrew-r-thomas force-pushed the or-redaction branch 4 times, most recently from 0802048 to 9c5bf9b Compare March 23, 2026 22:09
Comment thread pkg/cloud/uris.go
// MakeRedactableLocatorURI builds a redact.RedactableString from a storage URI.
// The query parameter section is treated as unsafe and surrounded with redaction markers.
// Intended for use with pebble's remote.Locator.
func MakeRedactableLocatorURI(uri string) redact.RedactableString {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! could you add a little unit test for this func? and then an integration test in backup_test that shows an error message with the redacted locator(maybe a missing sst test would do this)?

Copy link
Copy Markdown
Collaborator

@msbutler msbutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! one little nit

)
require.Error(t, err)
for _, secret := range fakeSecrets {
require.NotContains(t, err.Error(), secret,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you also validate that the error contains the uri with the redaction?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

This patch adds redaction markers to URIs passed to pebble in online
restore. Specifically, all query params in the URIs are marked as unsafe
and as such will be redacted in logs and error messages.

Informs: cockroachdb#161169

Release note: None
@trunk-io trunk-io bot merged commit 6a81483 into cockroachdb:master Mar 25, 2026
28 checks passed
@andrew-r-thomas andrew-r-thomas added backport-26.2.x Flags PRs that need to be backported to 26.2 and removed target-release-26.3.0 labels Mar 25, 2026
@andrew-r-thomas
Copy link
Copy Markdown
Contributor Author

blathers backport 26.2

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Mar 25, 2026

Successfully created backport PRs for: 26.2

@msbutler msbutler self-assigned this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-26.2.x Flags PRs that need to be backported to 26.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants