cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.2k stars 3.82k forks source link

telemetry logs: we are not redacting ENUM values #77448

Open thtruo opened 2 years ago

thtruo commented 2 years ago

Describe the problem First noticed by @vy-ton

Our telemetry logs do not currently redact user ENUM values. Here's an example query: CREATE TYPE ‹×›.‹×›.‹×› AS ENUM ('STARTED', 'PICKUP', 'FINISHED', 'CANCELED')

Expected behavior

ENUM values are literals and therefore should be redacted from the SQL query being logged for the [sampled_query](CREATE TYPE ‹×›.‹×›.‹×› AS ENUM ('STARTED', 'PICKUP', 'FINISHED', 'CANCELED', 'LOCKED_FOR_ORDERS', 'RUNNING_LATE')) event

Jira issue: CRDB-13597

Epic CRDB-37533

rafiss commented 2 years ago

The test case here might be useful to understand when working on this: https://github.com/cockroachdb/cockroach/blob/f67fd0e2ddcf5297ddfda14c93b1eef3d901e51c/pkg/sql/parser/testdata/create_type#L25-L31

It looks like the code is treating the enum values as "identifiers" but perhaps it should be treating them as "literals."

Still, I would have expected the telemetry logging to redact identifiers, so perhaps the problem is somewhere else.