From ebd73ee2c413f6fc1ad39c72bc8ad7a43847d3e0 Mon Sep 17 00:00:00 2001 From: Jayant Shrivastava Date: Wed, 25 Jan 2023 10:12:03 -0500 Subject: [PATCH] cdc: remove 'nonsensitive' tag from changefeed description in telemetry logs Previously, the description field in changefeed telemetry logs was marked as `nonsensitive`. This is incorrect because the description field may contain an SQL statement which is not safe to report. This change removes the `nonsensitive` tag so the field is redacted by default. Epic: none Release note: none --- docs/generated/eventlog.md | 4 ++-- pkg/util/log/eventpb/events.proto | 2 +- pkg/util/log/eventpb/json_encode_generated.go | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/generated/eventlog.md b/docs/generated/eventlog.md index a605af4a7773..1c8141db0b11 100644 --- a/docs/generated/eventlog.md +++ b/docs/generated/eventlog.md @@ -2697,7 +2697,7 @@ was triggered. | Field | Description | Sensitive | |--|--|--| -| `Description` | The description of that would show up in the job's description field, redacted | no | +| `Description` | The description of that would show up in the job's description field, redacted | yes | | `SinkType` | The type of sink being emitted to (ex: kafka, nodelocal, webhook-https). | no | | `NumTables` | The number of tables listed in the query that the changefeed is to run on. | no | | `Resolved` | The behavior of emitted resolved spans (ex: yes, no, 10s) | no | @@ -2717,7 +2717,7 @@ ChangefeedFailed events. | Field | Description | Sensitive | |--|--|--| -| `Description` | The description of that would show up in the job's description field, redacted | no | +| `Description` | The description of that would show up in the job's description field, redacted | yes | | `SinkType` | The type of sink being emitted to (ex: kafka, nodelocal, webhook-https). | no | | `NumTables` | The number of tables listed in the query that the changefeed is to run on. | no | | `Resolved` | The behavior of emitted resolved spans (ex: yes, no, 10s) | no | diff --git a/pkg/util/log/eventpb/events.proto b/pkg/util/log/eventpb/events.proto index 13a616fdeb00..699c803e880f 100644 --- a/pkg/util/log/eventpb/events.proto +++ b/pkg/util/log/eventpb/events.proto @@ -82,7 +82,7 @@ message CommonChangefeedEventDetails { CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; // The description of that would show up in the job's description field, redacted - string description = 2 [(gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "redact:\"nonsensitive\""]; + string description = 2 [(gogoproto.jsontag) = ",omitempty"]; // The type of sink being emitted to (ex: kafka, nodelocal, webhook-https). string sink_type = 3 [(gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "redact:\"nonsensitive\""]; diff --git a/pkg/util/log/eventpb/json_encode_generated.go b/pkg/util/log/eventpb/json_encode_generated.go index 51ad19959536..00883f2e8e07 100644 --- a/pkg/util/log/eventpb/json_encode_generated.go +++ b/pkg/util/log/eventpb/json_encode_generated.go @@ -1427,7 +1427,9 @@ func (m *CommonChangefeedEventDetails) AppendJSONFields(printComma bool, b redac } printComma = true b = append(b, "\"Description\":\""...) - b = redact.RedactableBytes(jsonbytes.EncodeString([]byte(b), string(m.Description))) + b = append(b, redact.StartMarker()...) + b = redact.RedactableBytes(jsonbytes.EncodeString([]byte(b), string(redact.EscapeMarkers([]byte(m.Description))))) + b = append(b, redact.EndMarker()...) b = append(b, '"') }