cockroachdb / cockroachdb/cockroach

server: VIEWACTIVITY privilege no longer grants visibility of node hostnames in DB Console

Open
#170,127 1 comment 0 reactions 0 assignees View on GitHub
A-observability-inf branch-release-25.2 branch-release-26.1 C-bug v25.2.4 v26.1.4
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

## Bug Report

### Describe the problem

Users with the `VIEWACTIVITY` system privilege (or legacy role option) cannot see node hostnames/IP addresses in the DB Console. Nodes are displayed as `n1`, `n2`, etc. instead of showing the actual hostname or IP address.

This is a regression from the behavior implemented in #77665 / CRDB-13703, which explicitly added hostname visibility for users with `VIEWACTIVITY`. The [current documentation](https://www.cockroachlabs.com/docs/stable/create-role#role-options) still states:

> VIEWACTIVITY also permits visibility of node hostnames and IP addresses in the DB Console

### Steps to reproduce

```sql
-- As root:
CREATE USER ui_test WITH LOGIN PASSWORD 'test';
GRANT SYSTEM VIEWACTIVITY TO ui_test;
```

1. Log in to the DB Console as `ui_test`
2. Navigate to the Node overview page
3. Observe that nodes are displayed as `n1`, `n2`, etc. — hostnames/IPs are not visible

### Expected behavior

Node hostnames and IP addresses should be visible in the DB Console for users with the `VIEWACTIVITY` privilege, as documented and as originally implemented in #77665.

### Actual behavior

Node addresses are empty/hidden. Only node IDs (`n1`, `n2`) are shown.

### Root cause

The `NodesUI` endpoint in [`pkg/server/status.go`](https://github.com/cockroachdb/cockroach/blob/master/pkg/server/status.go) only checks for `VIEWCLUSTERMETADATA` when deciding whether to reveal node addresses:

```go
func (s *systemStatusServer) NodesUI(...) {
hasViewClusterMetadata := false
err := s.privilegeChecker.RequireViewClusterMetadataPermission(ctx)
if err != nil {
if !grpcutil.IsAuthError(err) {
return nil, err
}
} else {
hasViewClusterMetadata = true
}
// ...
for i, nodeStatus := range internalResp.Nodes {
resp.Nodes[i] = nodeStatusToResp(&nodeStatus, hasViewClusterMetadata)
}
}
```

The `nodeStatusToResp` function in [`pkg/server/nodes_response.go`](https://github.com/cockroachdb/cockroach/blob/master/pkg/server/nodes_response.go) defaults the address fields to empty and only populates them when `hasViewClusterMetadata` is true:

```go
func nodeStatusToResp(n *statuspb.NodeStatus, hasViewClusterMetadata bool) serverpb.NodeResponse {
nodeDescriptor := serverpb.NodeDescriptor{
NodeID: n.Desc.NodeID,
Address: util.UnresolvedAddr{}, // default: empty
SQLAddress: util.UnresolvedAddr{}, // default: empty
}
// ...
if hasViewClusterMetadata {
resp.Desc.Address = n.Desc.Address
resp.Desc.SQLAddress = n.Desc.SQLAddress
// also populates: Args, Env, Attrs, LocalityAddress, store node descriptors
}
}
```

`VIEWACTIVITY` is never checked in this code path. The `NodeUI` endpoint has a similar issue — it passes `isAdmin` directly to `nodeStatusToResp`, so only admins see addresses on single-node views.

### Suggested fix

`nodeStatusToResp` (or its callers) should accept an additional signal for `VIEWACTIVITY`. When `VIEWACTIVITY` is present, `Address` and `SQLAddress` should be populated — but the more sensitive fields (`Args`, `Env`, store file paths, etc.) should remain gated behind `VIEWCLUSTERMETADATA` or admin.

This would restore the originally intended behavior from #77665 while maintaining the least-privilege principle.

### Workaround

Users can grant `VIEWCLUSTERMETADATA` instead, which does reveal addresses but also exposes additional privileged information (command-line args, env vars, store paths):

```sql
GRANT SYSTEM VIEWCLUSTERMETADATA TO ui_test;
```

### Environment

- Reproduced on v25.2.4
- Likely affects all versions since the `NodesUI` endpoint was introduced

### Related issues

- #77665 — Original feature request to allow hostname visibility with VIEWACTIVITY (closed, implemented)
- CRDB-13703 — Jira tracking issue (Done)
- DOC-2979, DOC-2980, DOC-3027 — Documentation updates for VIEWACTIVITY hostname visibility (Done)
- Zendesk #11684, #11707 — Original customer tickets that drove #77665

Jira issue: CRDB-63840

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.