Skip to content

Commit 7eeeb33

Browse files
committed
fix(webapp): gate the concurrency-keys resource endpoint behind the queue-metrics UI flag (TRI-12438)
1 parent 4528621 commit 7eeeb33

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

apps/webapp/app/routes/resources.queues.concurrency-keys.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
hasAccessToEnvironment,
88
} from "~/models/runtimeEnvironment.server";
99
import { requireUserId } from "~/services/session.server";
10+
import { canAccessQueueMetricsUi } from "~/v3/canAccessQueueMetricsUi.server";
1011
import { engine } from "~/v3/runEngine.server";
1112

1213
// One page of a queue's concurrency keys. The ClickHouse tier (queue_metrics_ck_v1) is the
@@ -98,6 +99,17 @@ export const action = async ({ request }: ActionFunctionArgs) => {
9899
);
99100
}
100101

102+
// Gate on the per-org Queue Metrics UI flag, matching the queue detail page and run inspector, so
103+
// this endpoint's data isn't reachable for orgs that can't see the UI. 404 (not 403) to hide it.
104+
if (
105+
!(await canAccessQueueMetricsUi({
106+
userId,
107+
organizationSlug: environment.organization.slug,
108+
}))
109+
) {
110+
return json<ConcurrencyKeysResponse>({ success: false, error: "Not found" }, { status: 404 });
111+
}
112+
101113
const range = timeFilterFromTo({
102114
period: period ?? undefined,
103115
from: from ?? undefined,

0 commit comments

Comments
 (0)