Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-21.2: sql,jobs: implement redact.SafeValue for JobID and SessionID #72975

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/generated/redact_safe.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ The following types are considered always safe for reporting:
File | Type
--|--
pkg/cli/exit/exit.go | `Code`
pkg/jobs/jobspb/wrap.go | `JobID`
pkg/jobs/jobspb/wrap.go | `Type`
pkg/kv/kvserver/closedts/ctpb/service.go | `LAI`
pkg/kv/kvserver/closedts/ctpb/service.go | `SeqNum`
Expand Down Expand Up @@ -32,6 +33,7 @@ pkg/sql/catalog/descpb/structured.go | `IndexID`
pkg/sql/catalog/descpb/structured.go | `MutationID`
pkg/sql/sem/tree/table_ref.go | `ColumnID`
pkg/sql/sem/tree/table_ref.go | `ID`
pkg/sql/sqlliveness/sqlliveness.go | `SessionID`
pkg/storage/enginepb/mvcc3.go | `*MVCCStats`
pkg/storage/enginepb/mvcc3.go | `MVCCStatsDelta`
pkg/util/hlc/timestamp.go | `ClockTimestamp`
Expand Down
3 changes: 3 additions & 0 deletions pkg/jobs/jobspb/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ type JobID int64
// InvalidJobID is the zero value for JobID corresponding to no job.
const InvalidJobID JobID = 0

// SafeValue implements the redact.SafeValue interface.
func (j JobID) SafeValue() {}

// Details is a marker interface for job details proto structs.
type Details interface{}

Expand Down
3 changes: 3 additions & 0 deletions pkg/sql/sqlliveness/sqlliveness.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func (s SessionID) String() string {
return hex.EncodeToString(encoding.UnsafeConvertStringToBytes(string(s)))
}

// SafeValue implements the redact.SafeValue interface.
func (s SessionID) SafeValue() {}

// UnsafeBytes returns a byte slice representation of the ID. It is unsafe to
// modify this byte slice. This method is exposed to ease storing the session
// ID as bytes in SQL.
Expand Down