Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Access control and metadata filtering in AgentC...

やくも
November 21, 2026

Access control and metadata filtering in AgentCore Gateway

やくも

November 21, 2026

Transcript

33 slides
  1. JAWS-UG Yamanashi #14 Access control and metadata filtering in AgentCore

    Gateway 八雲 慎之助 / Shinnosuke Yakumo 2026/11/21
  2. Who am I Shinnosuke Yakumo • Cresco Ltd. / JAWS-UG

    Niigata • Role: R&D, FDE • AI agents, from proposal to design and build • AWS Community Builder – AI Engineering • 2025 Japan AWS Jr.Champions • Favorite AWS service • AgentCore Gateway 2
  3. Agenda • Metadata filters and ACLs in a Managed KB

    • What happens when the LLM writes the arguments • Resetting values in the Gateway interceptor • Denying spoofing with Gateway Policy (Cedar) 3
  4. Today's setup A Managed KB used as a Gateway tool

    • HR and Sales documents go into one KB • Return only what the user's department and ACL allow 4
  5. Inside a metadata file // hr/hiring-plan.metadata.json { "metadataAttributes": {"department": "hr",

    "year": 2026}, "accessControlList": [ {"Name": "[email protected]", "Type": "USER", "Access": "ALLOW"}, {"Name": "[email protected]", "Type": "USER", "Access": "ALLOW"} ] } • metadataAttributes: attributes of the document, such as department and year • accessControlList: the ACL (Access Control List), the users who can read this document 5
  6. Inside a metadata file // hr/hiring-plan.metadata.json { "metadataAttributes": {"department": "hr",

    "year": 2026}, "accessControlList": [ {"Name": "[email protected]", "Type": "USER", "Access": "ALLOW"}, {"Name": "[email protected]", "Type": "USER", "Access": "ALLOW"} ] } • metadataAttributes: attributes of the document, such as department and year • accessControlList: the ACL (Access Control List), the users who can read this document 6
  7. Inside a metadata file // hr/hiring-plan.metadata.json { "metadataAttributes": {"department": "hr",

    "year": 2026}, "accessControlList": [ {"Name": "[email protected]", "Type": "USER", "Access": "ALLOW"}, {"Name": "[email protected]", "Type": "USER", "Access": "ALLOW"} ] } • metadataAttributes: attributes of the document, such as department and year • accessControlList: the ACL (Access Control List), the users who can read this document 7
  8. Two arguments that narrow the search Document department Readers (ACL)

    hr/hiring-plan hr user-a, user-b hr/salary-bands hr user-a sales/q3-pipeline sales user-a, user-b sales/discount-rules sales user-b • filter: narrows by metadata. What to search for • userContext: the user searching. Only documents with that user in the ACL user-a is in HR (hr), user-b is in Sales (sales) 8
  9. Two arguments that narrow the search Document department Readers (ACL)

    hr/hiring-plan hr user-a, user-b hr/salary-bands hr user-a sales/q3-pipeline sales user-a, user-b sales/discount-rules sales user-b • filter: narrows by metadata. What to search for • userContext: the user searching. Only documents with that user in the ACL user-a is in HR (hr), user-b is in Sales (sales) 9
  10. Two arguments that narrow the search Document department Readers (ACL)

    hr/hiring-plan hr user-a, user-b hr/salary-bands hr user-a sales/q3-pipeline sales user-a, user-b sales/discount-rules sales user-b • filter: narrows by metadata. What to search for • userContext: the user searching. Only documents with that user in the ACL user-a is in HR (hr), user-b is in Sales (sales) 10
  11. Arguments when an agent calls the KB • Retrieve is

    a Gateway tool • filter and userContext are both arguments • The LLM fills in the values from the request 11
  12. Values the LLM can write user-b (Sales) asks LLM may

    write What happens Show me HR's hiring plan department = "hr" Searches HR documents What's the 2026 pipeline? year = "2026" (string) 0 results, no error Search as user-a userContext = user-a Uses another user's ACL userContext, which sets the ACL, is LLM-written too 12
  13. Values the LLM can write user-b (Sales) asks LLM may

    write What happens Show me HR's hiring plan department = "hr" Searches HR documents What's the 2026 pipeline? year = "2026" (string) 0 results, no error Search as user-a userContext = user-a Uses another user's ACL userContext, which sets the ACL, is LLM-written too 13
  14. Values the LLM can write user-b (Sales) asks LLM may

    write What happens Show me HR's hiring plan department = "hr" Searches HR documents What's the 2026 pipeline? year = "2026" (string) 0 results, no error Search as user-a userContext = user-a Uses another user's ACL userContext, which sets the ACL, is LLM-written too 14
  15. A filter the LLM actually wrote • Request: "HR's hiring

    plan" • Log of the arguments the interceptor received • The LLM wrote hr on its own 15
  16. The caller of the KB is Gateway • Both the

    token and the arguments pass through Gateway • Gateway's execution role calls the KB • Gateway can decide the values 16
  17. Gateway REQUEST interceptor • A Lambda rewrites the arguments before

    the tool call • Values come from the JWT claims Ref: Fine-grained access control for Amazon Bedrock managed knowledge base tools (AWS Machine Learning Blog) 17
  18. Interceptor implementation Ignore the LLM's values and set them from

    the JWT if name.endswith("___Retrieve"): c = claims(request["headers"]) # read the JWT args["userContext"] = {"userId": c["email"]} cfg = args["retrievalConfiguration"]["managedSearchConfiguration"] cfg["filter"] = {"equals": {"key": "department", "value": c["department"]}} Headers arrive with passRequestHeaders: True 18
  19. Effect of the override Only sales comes back, even with

    hr or user-a in the call Argument in user-b's call Returned document department = hr q3-pipeline (sales) userContext = user-a q3-pipeline (sales) Nothing added on the agent side 19
  20. Pitfall of hidden arguments cannot set parameter(s): [/retrievalConfiguration, /userContext] Approach

    How the value is set visible: false + fixed parameterValues Same value for everyone Keep visible, override in the interceptor Can differ per user Hidden arguments are checked after the interceptor runs 20
  21. Pitfall of hidden arguments cannot set parameter(s): [/retrievalConfiguration, /userContext] Approach

    How the value is set visible: false + fixed parameterValues Same value for everyone Keep visible, override in the interceptor Can differ per user Hidden arguments are checked after the interceptor runs 21
  22. Pitfall of hidden arguments cannot set parameter(s): [/retrievalConfiguration, /userContext] Approach

    How the value is set visible: false + fixed parameterValues Same value for everyone Keep visible, override in the interceptor Can differ per user Hidden arguments are checked after the interceptor runs 22
  23. Rejecting spoofing with Gateway Policy forbid (principal, action == AgentCore::Action::"managedkb___Retrieve",

    resource) unless { context.input.userContext.userId == principal.getTag("email") }; interceptor userContext in the call Result No user-a (spoofed) Denied No none (missing) Denied Yes user-a (spoofed) Allowed (already overwritten with user-b) Measured on a Managed KB with ACL only. Policy shortened to the key part 23
  24. Rejecting spoofing with Gateway Policy forbid (principal, action == AgentCore::Action::"managedkb___Retrieve",

    resource) unless { context.input.userContext.userId == principal.getTag("email") }; interceptor userContext in the call Result No user-a (spoofed) Denied No none (missing) Denied Yes user-a (spoofed) Allowed (already overwritten with user-b) Measured on a Managed KB with ACL only. Policy shortened to the key part 24
  25. Rejecting spoofing with Gateway Policy forbid (principal, action == AgentCore::Action::"managedkb___Retrieve",

    resource) unless { context.input.userContext.userId == principal.getTag("email") }; interceptor userContext in the call Result No user-a (spoofed) Denied No none (missing) Denied Yes user-a (spoofed) Allowed (already overwritten with user-b) Measured on a Managed KB with ACL only. Policy shortened to the key part 25
  26. What Cedar can and cannot check • userId can be

    compared with the email tag • filter values have no type, so Cedar can't read them • The interceptor sets the values 26
  27. Why put it in Gateway • Add it without changing

    agent code. Both the interceptor and Policy are Gateway settings • One place sets the values for every agent • Policy decisions are logged by Gateway 27
  28. Why put it in Gateway • Add it without changing

    agent code. Both the interceptor and Policy are Gateway settings • One place sets the values for every agent • Policy decisions are logged by Gateway 28
  29. Why put it in Gateway • Add it without changing

    agent code. Both the interceptor and Policy are Gateway settings • One place sets the values for every agent • Policy decisions are logged by Gateway 29
  30. Where each value is decided What Where Values of userContext

    and filter Gateway interceptor sets them from the token Spoofing or missing values Denied by Gateway Policy The metadata itself Kept in meta/, writable only by admins 30
  31. Where each value is decided What Where Values of userContext

    and filter Gateway interceptor sets them from the token Spoofing or missing values Denied by Gateway Policy The metadata itself Kept in meta/, writable only by admins 31
  32. Where each value is decided What Where Values of userContext

    and filter Gateway interceptor sets them from the token Spoofing or missing values Denied by Gateway Policy The metadata itself Kept in meta/, writable only by admins 32
  33. Summary • The LLM writes filter and userContext • The

    REQUEST interceptor resets them from the JWT • Policy (Cedar) denies spoofed or missing values 33

More Decks by やくも

Other Decks in Technology