Skip to content

Find where the agent outranks its user

Trace a Claude integration step by step to find where the agent can act beyond the user's permissions, and pick the control that closes each gap.

Scenario

A hospital group builds a "ward assistant" for nurses: ask a question in plain language, get an answer drawn from patient notes and the bed system. Policy is clear: a nurse may see only the patients on the wards she is assigned to.

In testing, a nurse on the cardiology ward asks about a patient in oncology and gets a full summary. Nobody wrote a bug. Every component did what it was built to do.

Before reading how this happens, find it yourself.

Explanation

Every integration step answers three questions. A gap is a step where the answer is broader than the user's own rights.

1. Whose identity does the tool act with?

  • A shared service account acts with the union of everyone's rights. Through it, any user (or any injected instruction) reaches everything the account can.
  • The fix is delegated user identity: the tool calls the data system as the user, or the server checks the user's rights on each request. For MCP, OAuth on every server gives defense in depth and enables user-level authorization at the data layer. With the MCP connector, your application runs the OAuth flow, obtains the user's token and passes it as authorization_token, refreshing it as needed.
  • Each hop should hold a credential meant for it. A server that forwards the user's token unchanged to another system asks that system to trust a credential that wasn't issued for it, and skips the server's own checks. As a general security principle, give the downstream call its own, separately scoped credential and pass on the user's identity in a way the next system can verify.

2. What may it reach?

  • Expose only the tools and data the purpose requires: read-only tools for a read-only assistant, an allowlist of tools on the MCP connector, scopes on each token.
  • Keep credentials out of the agent: a proxy outside the agent's boundary can inject them into requests, so the agent never sees a key it could leak.

3. Where do the checks happen?

  • In deterministic code at the data layer, not in the prompt. The prompt guides behaviour; it isn't an access control.
  • Treat tool inputs from Claude as untrusted. If a tool takes a customer_id or ward argument, the backend takes the real value from the authenticated session, not from what the model sent.
  • Logs are detective, not preventive. Attach the end user's identity to them: telemetry identifies the credential the service used, not the end user it acted for, unless you add that identity yourself.