How I Think About Secure Backend Integrations
A working mental model for auth, secrets, scopes, and blast radius — built from scars, not books.
Part of Backend Craft
Security in backend integrations usually fails at the boring edges: a token that never rotates, a logging line that prints a header, an IAM role that was "temporary."
My mental model
I think of every integration as three concentric rings:
- The secret itself — API key, private key, DB password.
- The identity the secret proves — what role/principal/service.
- The scope that identity is bound to — what resources, what actions, for how long.
Every incident I've seen was a collapse of ring 2 or ring 3, not ring 1. The secret didn't leak; the scope was too wide.
Default stance
- Every secret comes from a vault (Secrets Manager, Parameter Store, Vault). No
.envcommitted, no secrets in CI logs. - Every identity is scoped to the narrowest resource + action that makes the feature work. If I can't articulate the scope in one sentence, it's too broad.
- Every token rotates. If rotation is "hard," that's a design bug, not an ops bug.
The line that saves you
The single most underrated security practice is: log identities, not secrets, and log scope decisions at the point they're made.
logger.info(
"crm.lookup authorized",
extra={
"principal": principal.id,
"scope": ["crm:read:customer"],
"resource": f"customer:{customer_id}",
"reason": "fulfillment handler",
},
)
When something goes wrong at 2am, you'll want to know which identity did what. You will never want the secret in the log.
Related
Keep reading
Daily Note: TIL — Polly SSML <mark> tags
Polly's SSML <mark> tags emit timing events over the stream. Useful for synchronizing on-screen captions to voice playback.
Building Voice Integrations on Top of Async Chatbots
What breaks when you front an async chatbot with Amazon Connect + Lex, and how to keep latency, barge-in, and context handoff sane.
What I Learned Designing Omnichannel Backend Integrations
Shared intent schema, eventually-consistent conversation state, and why the channel should be the last thing your backend knows about.
Keep going
Where to next?
Browse more technical writing, see the engineering case studies, or reach out directly.