File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ func (i DataCorruptionInfo) String() string {
7373func (i DataCorruptionInfo ) SafeFormat (w redact.SafePrinter , _ rune ) {
7474 w .Printf ("on-disk corruption: %s" , redact .Safe (i .Path ))
7575 if i .IsRemote {
76- w .Printf (" (remote locator %q)" , redact . Safe ( i .Locator ) )
76+ w .Printf (" (remote locator %q)" , i .Locator )
7777 }
7878 w .Printf ("; bounds: %s; details: %+v" , i .Bounds .String (), i .Details )
7979}
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
1919 "github.com/cockroachdb/pebble/objstorage/objstorageprovider/remoteobjcat"
2020 "github.com/cockroachdb/pebble/objstorage/objstorageprovider/sharedcache"
2121 "github.com/cockroachdb/pebble/objstorage/remote"
22+ "github.com/cockroachdb/redact"
2223)
2324
2425// remoteSubsystem contains the provider fields related to remote storage.
@@ -276,7 +277,8 @@ func (p *provider) sharedSync() error {
276277
277278func (p * provider ) remotePath (meta objstorage.ObjectMetadata ) string {
278279 if meta .Remote .Locator != "" {
279- return fmt .Sprintf ("remote-%s://%s" , meta .Remote .Locator , remoteObjectName (meta ))
280+ return fmt .Sprintf ("remote-%s://%s" ,
281+ redact .Sprint (meta .Remote .Locator ).Redact (), remoteObjectName (meta ))
280282 }
281283 return "remote://" + remoteObjectName (meta )
282284}
Original file line number Diff line number Diff line change @@ -13,14 +13,15 @@ import (
1313
1414// Locator is an opaque string identifying a remote.Storage implementation.
1515//
16- // The Locator must not contain secrets (like authentication keys). Locators are
17- // stored on disk in the shared object catalog and are passed around as part of
18- // RemoteObjectBacking; they can also appear in error messages.
19- type Locator string
16+ // Locators are stored on disk in the shared object catalog and are passed around as part of
17+ // RemoteObjectBacking. They can also appear in error messages.
18+ // As such, if a Locator contains secrets, the constructor must ensure that the necessary redaction
19+ // is implemented.
20+ type Locator redact.RedactableString
2021
2122// SafeFormat implements redact.SafeFormatter.
22- func (l Locator ) SafeFormat (w redact.SafePrinter , _ rune ) {
23- w . Printf ( "%s" , redact .SafeString (l ))
23+ func (l Locator ) SafeFormat (w redact.SafePrinter , r rune ) {
24+ redact .RedactableString (l ). SafeFormat ( w , r )
2425}
2526
2627// StorageFactory is used to return Storage implementations based on locators. A
You can’t perform that action at this time.
0 commit comments