WritingBasetenBasetenpublished Nov 25, 2026seen 2d

Least Privilege Access For Inference Workloads

Open original ↗

Captured source

source ↗

Least-privilege access for inference workloads Please enable JavaScript This website requires JavaScript in order to work properly.

Please rotate your device To continue exploring this website, please rotate your device to a vertical orientation

Security Least-privilege access for inference workloads Give each deployment only the cloud access and network connections it needs, with short-lived credentials, sealed volumes, and egress restrictions.

Authors Daniel Leef Matt Howard Rachel Rapp

Published November 25, 2026

Inference workloads often need to connect securely to external data or services, like loading private weights from cloud storage or fetching LoRA adapters at request time. The easiest way to set that up is with a permanent cloud key and open internet access, but that gives the model far more access than it needs—and it's easy to exploit. Each deployment should access only the resources it needs, without risking exposure of credentials or data.

Baseten gives you controls to set boundaries on that access. OpenID Connect (OIDC) replaces permanent cloud keys with short-lived tokens tied to a specific deployment, so each credential works only for the job it was issued for and expires automatically. The Baseten Delivery Network (BDN) mirrors your weights once into a read-only volume, so serving replicas never need access to your bucket. Egress restrictions also limit outbound connections to the hosts a model actually calls, so a compromised container can't reach anywhere else. Together, they let teams apply least-privilege access to production workloads.

This blog outlines how to use these controls across a model's deployment lifecycle.

Invoking least-privilege access across the deployment lifecycle

Consider a model whose private base weights live in one Amazon S3 bucket and whose LoRA adapters live in another. Adapters change more often than base weights, so the model fetches them at runtime instead of redeploying.

Stage What the model needs Control Build Copy base weights from your bucket OIDC for volume sync Deploy Give every replica the same weights BDN volume mount Serve Fetch adapters from S3 Runtime OIDC + egress restrictions

How a model on Baseten interfaces with your cloud with least-privilege access. BDN mirrors your private weights once using a short-lived OIDC token, and each replica mounts them read-only. At inference time, the replica uses a runtime token to call your cloud services, and egress restrictions block every host not on the allow list. The model never holds a static credential and can only reach the destinations you approve. Build: replace long-lived cloud keys with OIDC to mirror weights

Long-lived credentials (AWS IAM access keys, GCP service account keys) need ongoing management: they need to be stored securely, and their usage needs to be tracked. They also need to be rotated or revoked, because if a key leaks, anyone holding it can use its permissions until it's disabled.

With OIDC, Baseten issues a signed, short-lived token identifying the workload in lieu of a long-lived credential. Your cloud validates that identity against your configured trust relationship and grants access according to your policies—and you don't need to store a long-lived cloud key in Baseten.

To use OIDC for weight and data loading via BDN , configure your cloud permissions to allow BDN volume sync to read the base weights. The sync copies the weights into secure, Baseten-managed storage and publishes them as a sealed BDN volume : an immutable version identified by a digest of its contents.

bash

baseten volume sync start \ -- source s3:/// \ --dest bdn:/ \ --auth-aws-oidc-role-arn arn:aws:iam:::role/ \ --auth-aws-oidc-region \ -- wait

Deploy from a sealed volume

BDN Sealed Volumes let you publish any read-only data once as a sealed, immutable version with a digest. Because any deployment can mount that version by its digest, every replica serves the exact same bytes, updates upload only what changed, and deployments start without a download step.

All you need to do is reference that digest in your config.yaml .

yaml

bdn: mounts:

  • source:

path: /mnt/base-weights

When a replica starts, BDN makes the sealed volume available as a read-only mount, and the model reads its base weights from that mount. Cold starts and scale-ups no longer depend on downloading those weights from the original S3 bucket. We built BDN to make cold starts faster and more reliable , but its design also reduces external dependencies and runtime egress while preserving the model's access to weights.

That leaves adapter retrieval as a separate runtime dependency, with its own access policy.

Serve adapters with runtime credentials

When a request requires an adapter that’s not already loaded or cached, the model needs to fetch it from the adapter bucket (S3 in this example). Runtime OIDC makes a short-lived Baseten token available inside the serving container. Your model code uses it to get temporary cloud credentials, and Baseten automatically refreshes the mounted OIDC token.

yaml

runtime: oidc: enabled: true

In AWS, the model exchanges that token through AWS Security Token Service (STS) for credentials to assume an IAM role. Your model code handles adapter selection, downloading, and loading.

python

import os import boto3

class Model : def load ( self ): os.environ[ "AWS_WEB_IDENTITY_TOKEN_FILE" ] = os.environ[ "B10_OIDC_TOKEN_PATH" ] self._s3 = boto3.client( "s3" )

Scope the role's s3:GetObject permission to the adapter prefix the model needs, without granting permission to modify them.

json

{ "Effect" : "Allow" , "Action" : "s3:GetObject" , "Resource" : "arn:aws:s3::://*" }

Build-time and runtime permissions serve different purposes. For instance, permission to retrieve base weights should not automatically carry over to the serving container. Runtime tokens always carry the model_container workload type, so the adapter role's trust policy can match running containers only:

json

"Condition" : { "StringLike" : { "oidc.baseten.co:sub" : "v=1:org=abcd1234:team=wxyz5678:*:type=model_container" } }

Configure each identity for the work it needs to do, and enable runtime OIDC when the model needs to authenticate to an external service.

Allow only the outbound connections a model needs

Cloud permissions define which resources the model can use. Network controls define where it can connect.

By default, deployments can make...

Excerpt shown — open the source for the full document.

Notability

notability 5.0/10

Substantive technical post on inference security best practices