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

server: fix admin server Settings RPC redaction logic #138688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kyle-a-wong
Copy link
Contributor

@kyle-a-wong kyle-a-wong commented Jan 8, 2025

Previously admin.Settings only allowed admins to view all cluster settings without redaction. If the
requester was not an admin, would use the isReportable field on settings to determine if the setting should be redacted or not. This API also had outdated logic, as users with the MODIFYCLUSTERSETTINGS should also be able to view all cluster settings (See #115356 for more discussions on this).

This patch respects this new role, and no longer uses the isReportable setting flag to determine if a setting should be redacted. This is implemented by query crdb_internal.cluster_settings directly, allowing the sql layer to permission check.

This commit also removes the unredacted_values from the request entity as well, since it is no longer necessary.

Ultimately, this commit updates the Settings RPC to have the same redaction logic as querying crdb_internal.cluster_settings or using SHOW CLUSTER SETTINGS.

Epic: None
Fixes: #137698
Release note (general change): The /_admin/v1/settings API now returns cluster settings using the same redaction logic as querying SHOW CLUSTER SETTINGS and crdb_internal.cluster_settings. This means that only settings flagged as "sensitive" will be redacted, all other settings will be visible. The same authorization is required for this endpoint, meaning the user must be an admin or have MODIFYCLUSTERSETTINGS or VIEWCLUSTERSETTINGS roles to hit this API. The exception is that if the user has VIEWACTIVITY or VIEWACTIVITYREDACTED, they will see console only settings.

@kyle-a-wong kyle-a-wong requested review from a team as code owners January 8, 2025 22:14
@kyle-a-wong kyle-a-wong requested review from angles-n-daemons and removed request for a team January 8, 2025 22:14
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@kyle-a-wong kyle-a-wong force-pushed the fix_cluster_settings branch from e8f3727 to 28748df Compare January 9, 2025 14:44
@kyle-a-wong kyle-a-wong requested review from a team as code owners January 9, 2025 14:44
@kyle-a-wong kyle-a-wong removed the request for review from a team January 9, 2025 15:16
Previously admin.Settings only allowed admins to view
all cluster settings without redaction. If the
requester was not an admin, would use the isReportable
field on settings to determine if the setting should be
redacted or not. This API also had outdated logic, as
users with the MODIFYCLUSTERSETTINGS should also be
able to view all cluster settings (See cockroachdb#115356 for
more discussions on this).

This patch respects this new role, and no longer
uses the `isReportable` setting flag to determine
if a setting should be redacted. This is implemented
by query `crdb_internal.cluster_settings` directly,
allowing the sql layer to permission check.

This commit also removes the `unredacted_values` from
the request entity as well, since it is no longer
necessary.

Ultimately, this commit updates the Settings RPC
to have the same redaction logic as querying
`crdb_internal.cluster_settings` or using
`SHOW CLUSTER SETTINGS`.

Epic: None
Fixes: cockroachdb#137698
Release note (general change): The /_admin/v1/settings
API now returns cluster settings using the same redaction
logic as querying `SHOW CLUSTER SETTINGS` and
`crdb_internal.cluster_settings`. This means that only
settings flagged as "sensitive" will be redacted, all
other settings will be visible. The same authorization
is required for this endpoint, meaning the user must
be an admin or have MODIFYCLUSTERSETTINGS or
VIEWCLUSTERSETTINGS roles to hit this API. The exception
is that if the user has VIEWACTIVITY or
VIEWACTIVITYREDACTED, they will see console only settings.
@kyle-a-wong kyle-a-wong force-pushed the fix_cluster_settings branch from 28748df to 7534bd4 Compare January 9, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

db-console: Allow users with MODIFIFYCLUSTERSETTING to view unredacted cluster settings
2 participants