惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Recent Announcements
Recent Announcements
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog
罗磊的独立博客
月光博客
月光博客
J
Java Code Geeks
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
U
Unit 42
C
Check Point Blog
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
大猫的无限游戏
大猫的无限游戏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Your AI agent shouldn't hold your Stripe key. Here's the ...
Jacob R · 2026-06-03 · via DEV Community

Jacob R

If you're wiring an autonomous agent up to real APIs — Stripe, Supabase, GitHub, your own backend — there's a design decision most stacks get wrong, and it's the same one that turns "the agent did something weird" into "the agent moved money."

The root problem: the credential is the capability

An API key is a bearer token. Whoever holds the bytes can do everything the key permits, for as long as the key lives, with no per-call limit and usually no per-call record. When you paste that key into an agent's environment, you've handed a non-deterministic process the full blast radius of that key in one move. A prompt injection, a logging mistake, a retry loop — any of them now operates with your production credentials.

Rotating after a leak means rotating everywhere the key was ever embedded. And a leaked key is indistinguishable from a legitimate caller until you notice the bill.

The pattern: brokered egress

The fix is to make the thing the agent holds not the thing that grants access:

  1. A human vaults the real provider secret once, in a broker the agent can't read.
  2. The agent gets a scoped, revocable token it can present but never read.
  3. A policy checkpoint sits on the outbound path. The real secret is injected server-side only after the request passes the rules — allowed host, allowed method, a spend ceiling, rate limits.
  4. Every allowed/blocked call lands in an append-only audit log.
Agent ── scoped token ──▶ Broker (policy + vaulted key) ──▶ Stripe / Supabase / ...

Enter fullscreen mode Exit fullscreen mode

Three properties fall out of this:

  • The secret can't be exfiltrated from the agent, its prompt, or its logs — it was never there.
  • Revocation is one write, not a key rotation across every system that ever touched the key.
  • "The agent did something it shouldn't" becomes a synchronous 403 at the broker, not a forensic finding after the money moved.

The part people miss: injection still bites

Even with the key behind a broker, a prompt-injected agent can still drive policy-permitted actions. So the checkpoint has to do more than authenticate the caller — it has to taint requests that carry untrusted-content provenance and refuse the sensitive ones. Authentication is not the same as good intent.

And the audit log should be tamper-evident (e.g. a hash chain), because the log is exactly what a capable attacker edits first.

When you don't need this

If your provider already issues short-lived, least-privilege OAuth tokens with native audit — use those. They're a stronger primitive than proxying a static key. The brokered model earns its keep when you're stuck handing out long-lived static secrets, which, for now, is still most of them.


Disclosure: I work on Vertex, which implements exactly this pattern — vault a key once, the agent gets a scoped token it can't read, with policy + spend caps + taint-based injection blocking on egress and a tamper-evident audit trail. Writing up the architecture because it generalizes regardless of whose broker you use.