--- title: "Credential-Isolation" type: concept tags: [security, credentials, agent-architecture] sources: [n8n-workflow-orchestration] last_updated: 2026-04-17 --- ## Aliases - Credential Isolation - 凭证隔离 ## Definition 将 API 凭证(密钥、token)存储在 Agent 可控范围之外的系统中,确保 Agent 的工作环境无法直接访问敏感凭证,从而防止因 Agent 代码提交、错误输出或 Prompt Injection 导致凭证泄露。 ## Mechanism 在 [[Webhook-Proxy-Pattern]] 中: - Agent 只持有 Webhook URL(例:`http://n8n:5678/webhook/my-workflow`) - API 密钥存储在 n8n 的 Credential Store 中 - Agent 发送的 JSON payload 不包含任何密钥 ## Why It Matters - Agent 的代码、记忆、输出可能被提交到 Git 或暴露在日志中 - 即使 Agent prompt 被泄露,攻击者也拿不到实际密钥 - 凭证轮换可在 n8n 端独立完成,无需修改 Agent 提示词 ## Connections - [[Webhook-Proxy-Pattern]] — 凭证隔离的实现架构 - [[Defense-in-Depth]] — 防御纵深策略的组成部分 - [[Lockable-Workflow]] — 配合凭证隔离防止 Agent 修改调用逻辑