Secure Deployment
Standards, extended to AI stacks
Deployment security for AI: secrets outside reach, network egress controlled, models served from pinned artifacts, and the pipeline scanned. The model doesn't change your deployment discipline — it extends it.
What you will learn
- Protect provider secrets end-to-end
- Control network egress from AI services
- Lock model and dependency artifacts
What is this?
Secure deployment brings classic supply-chain and runtime security to AI: API keys in secrets managers (never env-visible to the model or tools), egress allowlists for model providers, pinned and integrity-checked model/serving artifacts, dependency SBOM scanning, and least-privilege service accounts for calls.
Why do you need it?
- Compromised keys = free compute and data access.
- Pinned artifacts prevent tampered models or SDKs.
- Egress control limits exfiltration by any injected flow.
- AI adds attack surface without exempting you from standards.
Mental model
A bank vault's loading dock
Secure deployment
Money (secrets) enters via a certified armored van (secrets manager), cargo is scanned and logged (SBOM), only authorized doors open (egress), and every crate is integrity-locked (signatures). The AI model is another crate on that dock — locked, logged, and route-confined like everything else.
How it works
- Secrets → secrets manager; injected at runtime only.
- Serving/model artifacts: pinned hashes + signed releases.
- Egress: allowlist provider endpoints only.
- SBOM + dependency scanning in CI.
- Least-privilege IAM: model calls can't reach everything.
Deployment locks.
In production
- Serverless functions fetch provider keys from the secrets store.
- Model artifacts pulled from a registry with hash pinning.
- Egress firewalls allow only the LLM provider endpoint.
Best practices
- Nothing secret ever enters model-visible context (keys, tokens).
- Pin SDK and model versions with integrity checks.
- Allowlist egress; deny by default.
- Scan dependencies and the serving image in CI.
Common mistakes
- API keys in env vars visible to executor tools.
- Bleeding-edge unpinned model artifacts (unreviewed updates).
- Open egress 'to be safe' (defeats containment).
Common issues
Secret exposed in a trace/logEnv or headers leaked
Redact in middleware; never log request headers wholesale.
Tampered artifact loadsNo pin
Pin hashes in CI; block non-conforming pulls.
Debugging tips
- A tool reads env → it can see vars; scope service identity tighter.
- Update drift → pin versions; audit upgrade paths.
- Egress blocked legitimately → review + allowlist conversation, don't open all.
Interview checkpoint
Quick quiz
Provider secrets belong in…
Model artifacts should be pinned and integrity-checked.