server: fix admin server Settings RPC redaction logic #138688
+200
−94
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 querycrdb_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 usingSHOW 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
andcrdb_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.