cockroachdb / cockroachdb/cockroach

VIEWACTIVITYREDACTED should redact query text literals for SHOW SESSIONS

Open
#106,588 1 comment 0 reactions 0 assignees View on GitHub
A-cluster-observability C-bug T-supportability
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

This issue tracks adding redaction for the `SHOW SESSIONS` command and the `ListSessions` endpoint.

In accordance with #103560, users with the `VIEWACTIVITYREDACTED` privilege should see a redacted version of the `active_queries` field from the `SHOW SESSIONS` response.

The current behavior allows a user with `VIEWACTIVITYREDACTED` to see the full query:

```
root@localhost:26257/defaultdb> GRANT SYSTEM VIEWACTIVITYREDACTED TO gerardo;
GRANT

Time: 157ms total (execution 156ms / network 0ms)

root@localhost:26257/defaultdb> SELECT pg_sleep(1000);
```

Run `SHOW SESSIONS` from `gerardo`:

```
gerardo@localhost:26257/defaultdb> SELECT session_id, active_queries, user_name from [SHOW SESSIONS];
session_id | active_queries | user_name
-----------------------------------+---------------------------------------------------------------------------+------------
1770d8d0e573a2f00000000000000001 | SELECT pg_sleep(1000) | root
1770d8d2f8f465100000000000000001 | SELECT session_id, active_queries, user_name FROM [SHOW CLUSTER SESSIONS] | gerardo
(2 rows)

Time: 8ms total (execution 7ms / network 0ms)
```

`SELECT pg_sleep(1000)` should have its literals redacted, e.g. `SELECT pg_sleep(_)`.

Jira issue: CRDB-29633

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.