fix (gateway): redact sensitive status details for non-admin scopes

This commit is contained in:
Vignesh Natarajan
2026-02-14 21:14:55 -08:00
parent 0dec234505
commit fac040cb10
4 changed files with 133 additions and 4 deletions

View File

@@ -5,6 +5,8 @@ import { HEALTH_REFRESH_INTERVAL_MS } from "../server-constants.js";
import { formatError } from "../server-utils.js";
import { formatForLog } from "../ws-log.js";
const ADMIN_SCOPE = "operator.admin";
export const healthHandlers: GatewayRequestHandlers = {
health: async ({ respond, context, params }) => {
const { getHealthCache, refreshHealthSnapshot, logHealth } = context;
@@ -25,8 +27,11 @@ export const healthHandlers: GatewayRequestHandlers = {
respond(false, undefined, errorShape(ErrorCodes.UNAVAILABLE, formatForLog(err)));
}
},
status: async ({ respond }) => {
const status = await getStatusSummary();
status: async ({ respond, client }) => {
const scopes = Array.isArray(client?.connect?.scopes) ? client.connect.scopes : [];
const status = await getStatusSummary({
includeSensitive: scopes.includes(ADMIN_SCOPE),
});
respond(true, status, undefined);
},
};