The open-source agent harness - the runtime layer that turns an LLM into a working agent.
[AuthZ: 1/N] Remove TrueFoundry global admin (#584)
Chirag Jaincd97a9ef8bc5
diff --git a/packages/trueforge/src/auth/identity.ts b/packages/trueforge/src/auth/identity.tsindex 26fe48f7f..6436542d1 100644--- a/packages/trueforge/src/auth/identity.ts+++ b/packages/trueforge/src/auth/identity.ts@@ -3,9 +3,6 @@ import type { Context } from 'hono';import configuration, { getTrueForgeMode, isOidcConfigured, TrueForgeMode } from '../config';-/** TrueFoundry Control Plane role treated as admin until mapping is settled. */-export const TRUEFOUNDRY_ADMIN_ROLE = 'tenant-admin';-/** Standalone / default TrueForge admin role string. */export const STANDALONE_ADMIN_ROLE = 'admin';@@ -55,18 +52,19 @@ export function resolveRequestContext(c: Context): RequestContext {* Mode and OIDC admin claim value come from process config ({@link getTrueForgeMode}).* - Standalone: `roles` includes `admin`* - OIDC: `roles` includes configured `OIDC_ADMIN_ROLE_VALUE`- * - TrueFoundry: `roles` includes `tenant-admin` (temporary; revisit mapping later)+ * - TrueFoundry: no tenant-wide TrueForge admin*/+// TODO (chiragjn): hasAdminRole will be renamed to canAccessSettings once all authorizer changes are doneexport function hasAdminRole(requestContext: Pick<RequestContext, 'roles'>): boolean {switch (getTrueForgeMode()) {case TrueForgeMode.TrueFoundry:- // TODO: stop treating `tenant-admin` as TrueForge admin once TFY role mapping is settled.- return requestContext.roles.includes(TRUEFOUNDRY_ADMIN_ROLE);+ return false;case TrueForgeMode.Oidc: {- const adminValue = isOidcConfigured(configuration)- ? configuration.OIDC.OIDC_ADMIN_ROLE_VALUE- : STANDALONE_ADMIN_ROLE;- return requestContext.roles.includes(adminValue);+ if (!isOidcConfigured(configuration)) {+ // this is technically unreachable since case TrueForgeMode.Oidc already ensures OIDC is configured+ return false;+ }+ return requestContext.roles.includes(configuration.OIDC.OIDC_ADMIN_ROLE_VALUE);}case TrueForgeMode.Standalone:return requestContext.roles.includes(STANDALONE_ADMIN_ROLE);