advanced30 min studyLesson 914 in Engineering

Authorize the resolved tenant, model, version and adapter on every path

Bind authenticated caller context to canonical serving resources across streaming, batch, fallback, adapter activation and result retrieval paths.

On this page

What you’ll understand

  • Separate authenticated identity from a tenant/model/adapter permission decision.
  • Reauthorize the actual resolved resource on direct, fallback and asynchronous paths.
  • Test hot loaded adapters and result handles for cross-tenant isolation.

A model can be approved for the service yet unavailable to a particular tenant. An adapter can belong to a different tenant even when it runs on a shared base model. Authentication identifies a caller under a credential contract; authorization decides whether that caller may perform a specific operation on the resolved resource now. Build that decision into every path that can load, activate, execute, download or retrieve a model-related result. A shared GPU or a hot cache entry must not turn resource residency into permission.

Resolve authoritative identities before making the decision

Derive tenant membership from verified server-side identity and policy rather than accepting a tenant field or header as authority. Resolve friendly model aliases to canonical model, version and adapter identities under a documented namespace. Check both the requested operation and its resolved targets; a permitted alias must not later switch to an unapproved version. A random-looking identifier reduces accidental discovery but does not replace an authorization check when the identifier is guessed, leaked or reused.

An illustrative policy can require permission for the base model and for each activated tenant adapter, together with compatibility and lifecycle state. Public/shared models can have explicit sharing rules, so ownership equality is not the only possible valid policy. Keep the chosen rule deterministic and deny missing or ambiguous context. Compatibility is another predicate: matching dimensions or successful adapter loading does not show that the caller may use its learned parameters or the data they encode.

allow(p,a,m,v,d,t)=Abase(p,a,m,v,t)∧Aadapter(p,a,d,t)∧K(m,v,d){\rm allow}(p,a,m,v,d,t)=A_{\rm base}(p,a,m,v,t)\land A_{\rm adapter}(p,a,d,t)\land K(m,v,d)
p is the authenticated principal with trusted tenant context, a the action, m/v the resolved base model/version, d the optional adapter, and t policy-evaluation time. A_adapter is true for an absent adapter only under the explicit base-only rule; K is compatibility. This is a proposed Boolean policy, not a framework guarantee.↔ Scroll wide equations horizontally.

Keep asynchronous and fallback execution inside the same boundary

Check direct generation, streaming, batch submission, queued execution, retries, fallback models, adapter preload/activation, artifact download and job-result retrieval. Some systems bind an authorization lease to a submitted job; others recheck at execution. State which policy applies and how revocation affects queued or running work. An expired browser session does not automatically stop a GPU task, and a valid job identifier does not automatically authorize another caller to read its outputs.

Bind resource identities and tenant context to the actual scheduled operation, including shared-worker state. A cache key or model slot should retain its full canonical owner/version identity, with a separate current permission check before use. Reset or partition request-specific adapter state under the serving implementation. Logical policy checks do not by themselves prove physical side-channel isolation or correct kernel state cleanup; those properties need their own threat model and tests on the selected platform.

permit_job(j,p,t)=owner_or_delegate(j,p,t)∧permitted_action(j,p,t){\rm permit\_job}(j,p,t)={\rm owner\_or\_delegate}(j,p,t)\land {\rm permitted\_action}(j,p,t)
This illustrative job-access decision checks current ownership/delegation and the requested action at time t. A declared submission lease can alter execution-time semantics, but must not silently grant result access to unrelated principals. The expression concerns logical authorization and makes no hardware-isolation claim.↔ Scroll wide equations horizontally.

Use a cross-tenant matrix and stale-state fixtures

Construct two tenants, a shared base model, one private adapter per tenant, and explicit delegated cases. Verify authorized success and denied cross-tenant use for every path, including a warm adapter, an old job handle and a fallback after the preferred model becomes unavailable. Mutate the untrusted tenant field while keeping the authenticated principal fixed. Inspect backend execution and result delivery, not just the response code, to establish that a denial prevented the forbidden action.

The modular lab illustrates why a shared slot number is not a complete resource identity. Reset, set both m=2,a=1, predict residues 0,1,0 at steps zero through two, then take two Steps. Reset and set both m=4,a=1 for 0,1,2. Indices zero and two share slot zero under the first rule but remain different resources. This toy index mapping is not a cryptographic hash, tenant boundary, adapter loader or permission engine; authorization must use full authoritative identities.

Count the required path and identity fixtures

A fictional endpoint has two authenticated tenant principals and two private adapters, one per tenant. It exposes synchronous generation, batch submission, streaming, and result retrieval. Count the principal/adapter/path combinations, assuming each path is applicable to every pair in this fixture.

  1. Two principals multiplied by two adapter targets produces four identity pairs. Two are same-tenant allowed pairs under the fixture policy, and two are cross-tenant denied pairs.

  2. Multiplying those four pairs by four paths yields sixteen fixtures. Eight should allow the intended authorized action and eight should deny it.

  3. For each denial, verify no forbidden adapter execution or result release occurred. Equal counts do not establish complete coverage of revocation, alias changes, fallbacks or hardware isolation; those require additional specified cases.

The result

The basic matrix contains sixteen cases with eight expected denials. The count organizes coverage without measuring a probability of security or proving untested paths.

Explore the model

Interactive lab

Interactive lab · modular

Show why a reused slot is not an authoritative identity

Reset → set both m=2,a=1 predicts 0,1,0 through two Steps. Reset → set both m=4,a=1 predicts 0,1,2. Slot reuse is deterministic modular indexing, not cryptographic hashing or authorization. No tenant membership, adapter state, scheduler or isolation control is implemented.

Show why a reused slot is not an authoritative identityAddition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Current readings: Residue r0: 0; Orbit period · m/gcd(m,a): 12; Distinct residues visited: 1 of 12. All parameters are adjustable with the labeled controls below.Repeated addition modulo 12: the current residue is 0, and the orbit period is 12.01234567891011+ 5mod 12An additive orbitn = 0rₙ = 0Period = 12Cycle starts at 0:0 → 5 → 10 → 3 →8 → 1 → 6 → 11 →4 → 9 → 2 → 7 → 0Exact residues · two additions per second
Additive orbitCurrent residue / next edge
Residue r0
0
Orbit period · m/gcd(m,a)
12
Distinct residues visited
1 of 12
t = 0 s

Addition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forResource slots need complete canonical identities and a separate current permission decision.

Check your understanding

Tenant A requests a hot adapter belonging to tenant B while using an allowed shared base model. Under an explicit private-adapter policy, what should happen?

Try it yourself

A new fallback-generation path is added to the sixteen-case matrix above. It is applicable to the same four principal/adapter pairs. How many basic cases are now required, and what must be checked besides the denial response?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Add one path for every identity pair, then inspect the action at its actual execution boundary.

Compare with the solution

There are now 4×5=20 basic cases: ten expected allows and ten expected denials under the same policy. A denied response must be accompanied by evidence that the forbidden target was not executed or returned through the fallback. The matrix still needs separate stale-policy, revocation and alias/version fixtures; twenty passing basic cases do not prove every future path or physical isolation property.

Take it with you

  • Authorize the actual canonical model/version/adapter under trusted caller context.
  • Carry the boundary through queues, fallbacks, streaming and result retrieval.
  • Warm residency and compatible shapes cannot substitute for permission.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.