Skip to content

Commit 4536803

Browse files
rjpowerclaude
andcommitted
[iris] Apply max_band cap in anonymous auth mode too
Budgets should bite regardless of whether auth is configured. The cap previously short-circuited on self._auth.provider, which meant a cluster running without auth (the default for examples/marin.yaml) couldn't enforce tier limits even though user_budgets rows were reconciled from the cluster config. Now the cap fires whenever any caller submits, keyed on the claimed job_id.user. PRODUCTION still requires MANAGE_BUDGETS when auth is on (admin path); in anonymous mode PRODUCTION falls through to the cap and is rejected unless the claimed user's user_budgets row permits it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f12863f commit 4536803

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

lib/iris/src/iris/cluster/controller/service.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,17 +1054,21 @@ def launch_job(
10541054
if self._auth.provider and verified_user is not None and not job_id.is_root:
10551055
self._authorize_job_owner(job_id)
10561056

1057-
# Priority band validation: PRODUCTION requires MANAGE_BUDGETS permission,
1058-
# and non-PRODUCTION submissions are capped by the user's max_band (or
1059-
# UserBudgetDefaults when the user has no explicit row).
1057+
# Priority band validation.
1058+
#
1059+
# - PRODUCTION additionally requires MANAGE_BUDGETS when auth is on;
1060+
# admins pass here and skip the max_band cap below.
1061+
# - The max_band cap fires regardless of auth mode, keyed on the
1062+
# claimed job_id.user. In anonymous mode this doesn't guarantee the
1063+
# user is who they claim to be, but it ensures the cluster's
1064+
# configured tiers and UserBudgetDefaults still bite — an unlisted
1065+
# submitter hits the INTERACTIVE default cap and can't punch up to
1066+
# PRODUCTION just by skipping auth.
10601067
# UNSPECIFIED (0) defaults to INTERACTIVE.
10611068
band = request.priority_band or job_pb2.PRIORITY_BAND_INTERACTIVE
10621069
if band == job_pb2.PRIORITY_BAND_PRODUCTION and self._auth.provider:
1063-
# MANAGE_BUDGETS is the primary gate for PRODUCTION; admins pass
1064-
# here and skip the max_band cap below (the cap is meant to prevent
1065-
# unlisted users from punching up, not to re-check admins).
10661070
authorize(AuthzAction.MANAGE_BUDGETS)
1067-
elif self._auth.provider:
1071+
else:
10681072
user_budget = self._db.get_user_budget(job_id.user)
10691073
max_band = user_budget.max_band if user_budget is not None else self._user_budget_defaults.max_band
10701074
if band < max_band:

0 commit comments

Comments
 (0)