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. TheBaseten 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.
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
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
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
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
Scope the role's s3:GetObject permission to the adapter prefix the model needs, without granting permission to modify them.
json
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
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 outbound requests to internet hosts on TCP ports 443 (HTTPS) and 80 (HTTP). Egress restrictions let you narrow that access to an allow list of domains and IP ranges for each deployment.
For the adapter example, allow the S3 endpoint used to download adapters and the AWS STS endpoint used to exchange the OIDC token for temporary credentials.
yaml
The allow list makes those network paths explicit. Domains are enforced by IP address, though, and S3 serves many buckets from shared IPs; the IAM policy determines which adapters the model can read once it reaches S3.
If a model needs no outbound connections, set both allow lists to empty to block egress. Omitting the restrictions leaves the default behavior in place.
The configuration lives in your model's config.yaml, so network changes can be reviewed alongside model changes. Updating the allow lists requires a new deployment, so you can apply a restrictive policy to one sensitive workload without changing other deployments in the organization.
Workload controls must be part of a broader security approach
Together, these boundaries reduce the opportunities for a compromise to spread. A malicious dependency would have no static cloud key to steal and could connect only to the limited, allowed destinations. Short-lived tokens do not end an ongoing compromise, so narrowly scoped permissions and carefully chosen destinations remain essential.
Workload controls complement the controls your organization uses to manage the platform. Our RBAC model includes team-based access, restricted environments, and granular API keys, which govern who can manage models, change production environments, and call inference endpoints. Together, platform teams can control who changes a deployment and what that deployment can reach. Engineers can iterate on models and serve new adapters within those boundaries, while platform teams review changes to production access and network configuration.
And while these steps are critical to keeping your work secure, they must be part of a holistic security approach, including securing the underlying hardware you run on, API key hygiene, container and network security, observability, and more. We’ll be publishing more blogs on these topics in the coming weeks.
Apply least privilege to your deployments
Most of this setup lives in your config.yaml: a sealed volume reference, runtime OIDC, and an egress allow list. The volume sync, OIDC, andegress restrictions documentation provide more details on how to use each.
Stay tuned for more blogs in our security series. And if you want to talk to our engineers about any of our security controls in more detail, reach out.












