AI agents have graduated from chat windows. They now book meetings, update customer records, query internal databases, and trigger financial transactions. That shift from advisor to operator changes everything about risk. When software stops suggesting and starts doing, every API endpoint becomes a potential doorway. Traditional security models were built around predictable human behavior: a person logs in, clicks through familiar paths, and logs out. Autonomous agents do not follow those patterns. They loop, retry, and branch across hundreds of calls in seconds. The API layer, originally designed for human-initiated requests, now faces persistent automated pressure. If your defenses still rely on static rules written last quarter, you are leaving the door wide open for data leaks and unauthorized access. You need real-time defense that evaluates every call as it happens.
Limit Agent Privileges
The single most dangerous shortcut in agent deployment is handing over one powerful API key. One key grants all access, across every system. If an attacker compromises the agent through a poisoned prompt or a hijacked integration, they inherit the keys to the kingdom. Recovery becomes a nightmare because the blast radius covers everything from your email service to your production database.
Break that habit immediately. Start with OAuth 2.0 for delegated authorization. The agent should not authenticate as a standalone superuser. Instead, it should carry a token that represents both the agent and the end user it serves. When the human session ends, the agent’s access should die with it.
Token Exchange makes this practical. Issue short-lived tokens scoped to exactly what the agent needs right now. A scheduling agent might receive permission to read a calendar and send invites, but not to delete calendar infrastructure or access payroll APIs. If an attacker intercepts the token, the window for abuse stays narrow.
Context-Bound Scopes add another layer. Default every token to read-only. If the agent must write data, such as processing a refund or updating a contract, enforce a human approval gate. Never let the model alone decide when money moves, accounts change, or records disappear. The permission should match the moment, not the maximum.
Ephemeral Windows close the loop entirely. Keep token lifetimes measured in minutes, not days. A token harvested during a brief compromise should be useless by the time an attacker attempts to replay it. Think of it as a constantly rotating lock.
Consider a sales automation agent that reads lead data from your CRM and writes follow-up emails through your mail API. Instead of one eternal admin key, the agent receives a 15-minute token from your identity provider. The token allows CRM reads and mail sends, but blocks contact deletion and billing access. If the agent encounters a suspicious instruction to export the entire database, the scope simply prevents the attempt.
Stop Indirect Prompt Injection
Prompt injection is no longer a party trick for chatbots. In the agentic era, it functions like remote code execution delivered by email.
Here is a concrete scenario. An agent monitors a user’s inbox to schedule meetings. Buried inside a message, perhaps in invisible text or metadata within an attachment, sits a command such as forwarding all invoices to an external address and deleting the originals. The agent reads the email, mistakes the poisoned text for a legitimate system instruction, and begins calling APIs. Because the agent itself is authorized, the malicious requests flow through normal channels. The result is unauthorized data exfiltration that looks like standard behavior.
Your first defense is strict input validation. Treat every parameter the AI generates as untrusted until proven otherwise. Run JSON-schema validation at your API gateway. If the agent requests a customer record, the gateway should verify that the payload contains a single expected identifier, not a wildcard or an unusually large batch request. Reject anything malformed, oversized, or synthetically bizarre before it ever reaches your backend.
第二に、レスポンスパスにデータ持ち出し防止フィルタを導入してください。APIレスポンスは、AIに到達する前に検査を通過させる必要があります。シークレット、認証トークン、または大量の個人情報に一致するパターンをスキャンしてください。CRMクエリが1件ではなく1万件のレコードを返した場合は、ブロックします。ペイロードに内部APIキーが含まれている場合は、マスキングしてください。エージェントが業務を遂行するために生のシークレットは必要ありません。また、アウトバウンドチャネルが盗まれたデータの密輸ルートになってはなりません。
第三に、ドメインのホワイトリスト化を徹底してください。エージェントは、カレンダーサービス、決済プロセッサ、および社内の在庫管理システムと通信する必要があります。一方で、任意のファイル共有サイト、ペーストボードサービス、または外部のクラウドストレージエンドポイントと通信する必要はありません。アウトバウンドのDNS解決とHTTPリクエストを、明示的な許可リストに制限してください。たとえ攻撃者がエージェントを欺いてデータを別の場所に送信させようとしても、ネットワーク層が単に接続を拒否します。
ゼロトラスト・アーキテクチャの構築
ゼロトラストは、インストールする製品ではありません。それは、ある一つの前提に基づいた設計思想です。すなわち、「エージェントはすでに侵害されている」という前提です。それに基づいた行動をとってください。
それは、アイデンティティを明確に分離することを意味します。エージェントがユーザーに代わって動作する場合であっても、人間のユーザーとエージェントは同一のエンティティではありません。人間のSSOセッションとは別に、エージェント自体のための個別のサービスアイデンティティを維持してください。監査ログには、両方のアイデンティティを並べて記録する必要があります。何かがうまくいかなくなったとき、あなたは
