-Daniel Bass
ຊື່ຫຍໍ້ຂອງ : Daniel Bass
ການປັບປຸງຜົນປະໂຫຍດຂອງການນໍາໃຊ້ໂດຍໃຊ້ການນໍາໃຊ້ຜູ້ຊ່ຽວຊານ AI ແມ່ນເປັນວິທີທີ່ຖືກນໍາໃຊ້ຢ່າງກວ້າງຂວາງ - ບໍ່ວ່າຈະເປັນຜົນປະໂຫຍດຂອງການປັບປຸງອຸດສາຫະກໍາຫຼືກໍລະນີການນໍາໃຊ້ທີ່ຖືກນໍາໃຊ້ຢ່າງງ່າຍດາຍ. ບໍ່ວ່າຈະ, ມັນຊ່ວຍໃຫ້ອັດຕະໂນມັດ workflows ແລະປັບປຸງປະສົບການຜູ້ໃຊ້ໃນອຸດສາຫະກໍາຕ່າງໆ.
These AI agents, however, often require access to highly sensitive data, introducing significant security risks. Without standardized access control solutions, development teams often build security measures from scratch—leading to cases where AI assistants expose sensitive patient information and several AI agents being compromised through sophisticated prompt injection attacks.
AI assistants expose sensitive patient informationsophisticated prompt injection attacks
ການປົກປັກຮັກສາອຸປະກອນ AI ໃນຂະນະທີ່ນີ້ເປັນສິ່ງທີ່ສໍາຄັນເປັນຄຸນນະສົມບັດຂອງອຸປະກອນ AI ຂອງຕົນເອງ - ຖ້າຫາກວ່າບໍ່ແມ່ນຫຼາຍ.
To address this problem, we at Permit.io have been working for a while on a structured security approach I wish to introduce to you today:
Permit.ioThe Four-Perimeter FrameworkThe Four-Perimeter Framework
This method provides a comprehensive strategy for protecting AI agents by implementing fine-grained access control, ensuring compliance, and mitigating potential attack vectors. Before I go into the solution, let’s talk more about the problem space.
fine-grained access controlThe Problem: AI Security Risks ໃນ Domains SensitiveTraditional application security measures and access control mechanisms fall short when it comes to handling AI agents. While conventional access control systems like role-based access control (RBAC) excel at managing static permissions, they struggle with the dynamic nature of AI responses. Unlike traditional applications where inputs map to predictable outputs and access patterns are well-defined, AI generates unique responses for each query. This means the access control and input validation techniques we’re used to can’t anticipate all possible outputs.
role-based access control (RBAC)
The way AI systems access data also doesn’t fit security standards. To provide accurate and helpful responses, AI agents need broad access to various data sources and knowledge bases. Classic RBAC proves too rigid for this need - you can’t simply assign static permissions when the data requirements change based on context. This calls for a more sophisticated, attribute-based approach that can make dynamic access decisions.
attribute-based
ການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວຂອງການປິ່ນປົວ.
ການປິ່ນປົວແມ່ນຢູ່ໃນຮູບແບບຂອງໂຄງສ້າງຄວາມປອດໄພຢ່າງກວ້າງຂວາງທີ່ສ້າງຕັ້ງຂຶ້ນໃນໄລຍະ 4 perimeters ທີ່ສໍາຄັນ -
The Solution: The Four-Perimeter Framework
ໃນຂະນະທີ່ອຸປະກອນ AI ອະນຸຍາດຈາກຄອມພິວເຕີປົກກະຕິໃນວິທີການປິ່ນປົວ input, ດາວໂຫລດຂໍ້ມູນ, ການປະຕິບັດ, ແລະການຜະລິດ outputs, ພວກເຂົາເຈົ້າຍັງນໍາສະເຫນີປະສິດທິພາບຄວາມປອດໄພທີ່ເປັນເອກະລັກ. ເພື່ອປິ່ນປົວຄວາມປອດໄພນີ້, ພວກເຮົາມີຄວາມຕ້ອງການການປິ່ນປົວຄວາມປອດໄພທີ່ສ້າງຕັ້ງຂຶ້ນທີ່ນໍາໃຊ້ການຄວບຄຸມການເຂົ້າເຖິງໃນທຸກລະດັບຂອງການຮ່ວມມື AI.
The Four-Perimeter Framework is designed to enforce identity-aware, fine-grained authorization throughout the AI lifecycle. It introduces security boundaries that govern what data AI models can access, what operations they can perform, and how their responses are validated.
ຊື່ຫຍໍ້ຂອງ : Four-Perimeter Frameworkfine-grained authorization throughout the AI lifecycle
ແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນແຜ່ນ
- Prompt Filtering – ການຮັບປະກັນພຽງແຕ່ການເຂົ້າເຖິງທີ່ຮັບປະກັນ, ການເຂົ້າເຖິງທີ່ປອດໄພກັບມາດຕະຖານ AI.
- RAG Data Protection – ການຄວບຄຸມການເຂົ້າເຖິງຂອງມາດຕະຖານ AI ກັບອຸປະກອນຂໍ້ມູນອື່ນໆ.
- Secure External Access – Defining permissions of AI agents when interacting with external tools.
- Response Enforcement – Applying compliance checks and filtering AI-generated outputs.
ໂດຍນໍາໃຊ້ Fine-grained Access Control (FGA) ໃບຢັ້ງຢືນໃນໄລຍະ perimeters ນີ້, ສະຫນັບສະຫນູນ AI ມີຄວາມປອດໄພ , ອັດຕະໂນມັດ, ແລະຄວາມປອດໄພ - ໂດຍບໍ່ເສຍຄ່າຄວາມປອດໄພແລະ functionality ຂອງພວກເຂົາ.
ການຄວບຄຸມການເຂົ້າເຖິງຂະຫນາດນ້ອຍ (FGA)ຄວາມປອດໄພ, audited, ແລະ compliantWhere Does FGA Come In?
ເຊັ່ນດຽວກັນກັບການຄວບຄຸມການເຂົ້າເຖິງທີ່ຜ່ານມາ, ວິທີການຄວບຄຸມການເຂົ້າເຖິງປົກກະຕິເຊັ່ນ RBAC ແມ່ນບໍ່ສາມາດປິ່ນປົວຜົນປະໂຫຍດທີ່ແຕກຕ່າງກັນຂອງການເຂົ້າເຖິງທີ່ແຕກຕ່າງກັນຂອງ AI. ນີ້ແມ່ນສະຖານທີ່ທີ່ທີ່ອະນຸຍາດການເຂົ້າເຖິງທີ່ດີເລີດ (Fine-grained authorization, FGA) ມີຜົນປະໂຫຍດ, ເຊັ່ນດຽວກັນກັບການຄວບຄຸມການເຂົ້າເຖິງທີ່ແຕກຕ່າງກັນ (ABAC) ແລະການຄວບຄຸມການເຂົ້າເຖິງທີ່ແຕກຕ່າງກັນ (ReBAC):
What Does A Step-by-Step Implementation Look Like?
Let's walk through a practical implementation to see the Four-Perimeter Framework in action. This example secures an AI agent by validating prompts, enforcing data protection, restricting external access, and moderating responses—leveraging Permit.io AI Access Control integrations at each step.
ສະຖານທີ່ Four-Perimeter ໃນການເຮັດວຽກ validating prompts, enforcing data protection, restricting external access, ແລະ moderating responsesPermit.io AI Access ControlPermit.io1 Implement Prompt Filtering
ຊື່ຫຍໍ້ຂອງ : Implement Prompt FilteringThe first security perimeter focuses on validating and sanitizing AI inputs before they reach the model. We can enforce structured input handling and enforce access policies on prompts before they reach the AI model.
- ການຄວບຄຸມອະນຸຍາດແມ່ນເຂົ້າໄປໃນ pipe validation prompt, ການປ້ອງກັນຂໍ້ມູນທີ່ບໍ່ໄດ້ຮັບອະນຸຍາດຈາກຜົນປະໂຫຍດຂອງ outputs AI.
- Role, attribute, ແລະການຄວບຄຸມການເຂົ້າເຖິງທີ່ແຕກຕ່າງກັນແມ່ນປະຕິບັດຕາມການຮັບປະກັນພຽງແຕ່ການປັບປຸງທີ່ໄດ້ຮັບອະນຸຍາດໃຫ້ AI.
- Any violations of policies are logged and blocked in real time, preserving an auditable trail of access decisions.
ນີ້ແມ່ນ 3 ວິທີການເພື່ອ filtrate prompts - ຈາກທີ່ງ່າຍທີ່ສຸດກັບທີ່ດີທີ່ສຸດ:
- Token validation - ວິທີການປະສິດທິພາບສໍາລັບການທົດສອບຢ່າງງ່າຍດາຍເຊັ່ນດຽວກັນກັບຄວາມຍາວຂອງ prompt ຫຼືຄວາມຍາວຂອງ input ທີ່ເຮັດວຽກໃນລະບົບ. ຄຸນນະສົມບັດການທົດສອບອະນຸຍາດໃນວິທີນີ້ຈະທົດສອບຄຸນນະສົມບັດຂອງ prompts ວັດສະດຸ.
- Pattern Matching - ໃນວິທີນີ້, ການທົດສອບອະນຸຍາດຈະທົດສອບຮູບແບບໃນຄໍາຮ້ອງສະຫມັກ. ຄຸນນະສົມບັດການທົດສອບອະນຸຍາດແມ່ນມີຄຸນນະສົມບັດທີ່ແຕກຕ່າງກັນ.
- AI Classification - ວິທີທີ່ເຫມາະສົມທີ່ສຸດໃນ
- ການຢັ້ງຢືນ token - ວິທີການປະສິດທິພາບສໍາລັບການທົດສອບຢ່າງງ່າຍດາຍເຊັ່ນດຽວກັນກັບຄວາມຍາວຂອງ prompt ຫຼືອະນຸຍາດທົ່ວໄປຂອງ input ດໍາເນີນໃນລະບົບ. Functions permission check in this method examine the structured attributes of text prompts. ການຢັ້ງຢືນ token
- Pattern Matching - ໃນວິທີນີ້, ການຄວບຄຸມອະນຸຍາດຈະກວດສອບຮູບແບບໃນຄໍາແນະນໍາລະຫັດ. ການຄວບຄຸມ, ເຊັ່ນດຽວກັນ, ຖ້າຫາກວ່າຮູບແບບແມ່ນເຫມາະສົມກັບຄໍາແນະນໍາ SQL ຫຼືຕົວຢ່າງລະຫັດ. ຊື່ຫຍໍ້ຂອງ : Pattern Matching
- AI Classification - ວິທີການທີ່ດີທີ່ສຸດໃນລາຍລະອຽດນີ້, AI Classification ໃຊ້ AI ເພື່ອທົດສອບ prompt ໂດຍໃຊ້ prompt ລະບົບ dedicated, ປະເພດໃຫ້ມັນເປັນການເຂົ້າເຖິງທີ່ສາມາດໄດ້ຮັບການທົດສອບຢ່າງວ່ອງໄວໃນການທົດສອບອະນຸຍາດ. ຊື່ຫຍໍ້ຂອງ :
- The vector and graph sources connected to the AI agents have metadata that can help the engine manipulate the unstructured query, filtering it to include only permitted data.
- ແຕ່ລະເວລາທີ່ agent gets data from the RAG knowledge base, it filters the results by user's permission. ການຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຄຸ້ມຄອງຮູບພາບ ສໍາ ລັບ The Vector ແລະ Graph Sources Connected to the AI Agents ມີ metadata ທີ່ສາມາດຊ່ວຍເຄື່ອງປິ່ນປົວການຊອກຫາທີ່ບໍ່ຖືກສ້າງຕັ້ງ, ການກັ່ນຕອງມັນເພື່ອໃຫ້ມີພຽງແຕ່ຂໍ້ມູນທີ່ບໍ່ໄດ້ຮັບອະນຸຍາດ.
- ໃນແຕ່ລະເວລາທີ່ອຸປະກອນຊອກຫາຂໍ້ມູນຈາກຄອມພິວເຕີ RAG, ມັນ filtrates ຜົນປະໂຫຍດໂດຍໃບອະນຸຍາດຂອງຜູ້ໃຊ້.
FilterObjects
- ໃນວິທີນີ້, ການນໍາໃຊ້ໂຄງການ Graph ອະນຸຍາດໃຫ້ທັງຫມົດຂໍ້ມູນທີ່ກ່ຽວຂ້ອງຈາກ RAG ແລະຫຼັງຈາກນັ້ນ filtrates ມັນໂດຍໃຊ້ໃບອະນຸຍາດຂອງຜູ້ໃຊ້. ເງື່ອນໄຂຂອງການເຮັດວຽກນີ້ແມ່ນວ່າມັນເຮັດໃຫ້ເຄື່ອງຄອມພິວເຕີຄອມພິວເຕີບໍ່ມີສະຖາບັນແລະບໍ່ມີຄວາມຮູ້ກ່ຽວກັບຂໍ້ມູນຂອງ RAG.GetUserPermissions
- ໃນວິທີນີ້, ສະຖາບັນໃຫ້ RAG ກັບການຢັ້ງຢືນທີ່ບໍ່ແມ່ນສະຖາບັນ. RAG ຫຼັງຈາກນັ້ນເລື່ອງGetUserPermissions
, ໂດຍຕິດຕາມການຢັ້ງຢືນ filter ກັບການຢັ້ງຢືນ RAG ທີ່ບໍ່ແມ່ນສະຖາບັນFilterObjects
- ໃນວິທີນີ້, ການນໍາໃຊ້ graph ໄດ້ຊອກຫາຂໍ້ມູນທີ່ກ່ຽວຂ້ອງທັງຫມົດຈາກ RAG ແລະຫຼັງຈາກນັ້ນ filtrates ມັນສໍາລັບການອະນຸຍາດຂອງຜູ້ໃຊ້. ປະສິດທິພາບຂອງການເຮັດວຽກນີ້ແມ່ນວ່າມັນເຮັດໃຫ້ເຄື່ອງຄຸ້ມຄອງຄຸ້ມຄອງບໍ່ມີສະຖານທີ່ແລະບໍ່ຮູ້ສຶກກ່ຽວກັບຂໍ້ມູນ RAG.GetUserPermissions
- ໃນວິທີນີ້, ຜູ້ຊ່ຽວຊານໃຫ້ RAG ກັບການຊອກຫາທີ່ບໍ່ແມ່ນສະແຕນເລດ. RAG ຫຼັງຈາກນັ້ນຊອກຫາ FunctionGetUserPermissions
, ສະແຕນເລດການຊອກຫາ filter ກັບການຊອກຫາ RAG ທີ່ບໍ່ແມ່ນສະແຕນເລດ. ນີ້ອະນຸຍາດໃຫ້ການຊອກຫາທີ່ສາມາດເຂົ້າເຖິງໂດຍຜູ້ໃຊ້ພຽງແຕ່.- Using models like MCP, which defines a server-client model where AI agents interact with external services, is a great step in enabling security for AI external access (e.g., databases, APIs, payment systems).
- The AI action infrastructure can use a service like Permit.io to perform authorization checks at the action level, checking who’s making a request and what action they want to perform.
- Developers are able to assign machine identities to AI agents, limiting their capabilities to pre-approved functions only.
- The AI action infrastructure can use a service like Permit.io to perform authorization checks at the action level, checking who’s making a request and what action they want to perform. Permit.io
- ການພັດທະນາສາມາດສະຫນັບສະຫນູນຜູ້ຊ່ຽວຊານຂອງອຸປະກອນ AI ກັບຕົວແທນເຄື່ອງ, limiting ຄວາມສາມາດຂອງພວກເຂົາເພື່ອພຽງແຕ່ຄຸນນະສົມບັດທີ່ອະນຸຍາດ.
- ການສື່ສານ agent-to-agent - ໃນລະດັບຕໍ່ໄປນີ້, ພວກເຮົາມີຄວາມຕ້ອງການຂອງການຂົນສົ່ງລະດັບຂອງ identities ແລະໃບອະນຸຍາດທີ່ອະນຸຍາດໃຫ້ຜູ້ຊ່ຽວຊານທີ່ຈະເຮັດວຽກຂອງເຂົາເຈົ້າໂດຍທົ່ວໄປໃນຖານະເປັນພື້ນຖານຂອງໃບອະນຸຍາດຂະຫນາດນ້ອຍ. ໃນລະດັບນີ້, ພວກເຮົາມີຄວາມຕ້ອງການທີ່ຈະນໍາໃຊ້ຄວາມກ່ຽວຂ້ອງລະຫວ່າງໃບອະນຸຍາດ - human ແລະ non-human - ເພື່ອສົນສົ່ງລະດັບຕ່າງໆຂອງໃບອະນຸຍາດ. ຊື່ຫຍໍ້ຂອງ : Agent-to-agent
- ຈຸດປະສົງຂອງການເຂົ້າເຖິງອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດອະນຸຍາດດາວໂຫລດ Access request flows
MCP, Human-in-the-Loop, ແລະການເຂົ້າເຖິງພາຍໃນ
MCP, Human-in-the-Loop, ແລະການເຂົ້າເຖິງພາຍໃນModel Context Protocol ເປັນໂປຼລິກໃຫມ່ທີ່ນໍາສະເຫນີໂດຍ Anthropic, ເຊິ່ງແກ້ໄຂບັນຫາຂອງການຊ່ວຍໃຫ້ຜູ້ຊ່ຽວຊານ AI ເຮັດວຽກ proactive ແລະບໍລິການເປັນວິສະວະກອນທີ່ດີທີ່ສຸດສໍາລັບການປະກັນການເຂົ້າເຖິງພາຍນອກ.
ໃນຕົວຢ່າງທີ່ຜ່ານມາ, ພວກເຮົາສະແດງໃຫ້ເຫັນຜູ້ບໍລິໂພກ MCP ທີ່ຮູ້ວິທີການຄວບຄຸມການປິ່ນປົວຄວາມຕ້ອງການການເຂົ້າເຖິງໂດຍເຮັດໃຫ້ມະນຸດເຂົ້າໄປໃນ loop ແລະນໍາໃຊ້ API ຂອງ Permit.io ເພື່ອຊອກຫາຄວາມສາມາດ.
You can see the full code example for the MCP access request server here: https://github.com/permitio/permit-mcp
https://github.com/permitio/permit-mcp
@mcp.tool() async def request_access(username: str, resource: str, resource_name: str) -> dict: """ Initiate access request call to a specific resource in the system Args: username: The username of the person requesting access resource: The resource type the user is request access for resource_name: The name of the restaurant to request access for """ login = await permit.elements.login_as({ "userId": slugify(username), "tenant": "default"}) print(login) url = f"https://api.permit.io/v2/facts/{PROJECT_ID}/{ENV_ID}/access_requests/{ELEMENTS_CONFIG_ID}/user/{slugify(username)}/tenant/default" payload = { "access_request_details": { "tenant": "default", "resource": resource, "resource_instance": resource_name['id'], "role": "viewer", }, "reason": f"User {username} requests role 'viewer' for {resource_name}" } headers = { "authorization": "Bearer YOUR_API_SECRET_KEY", "Content-Type": "application/json", } async with httpx.AsyncClient() as client: await client.post(url, json=payload, headers=headers) return "Your request has been sent. Please check back later."
4. ການຢັ້ງຢືນຄວາມປອດໄພຂອງ AI –
4 ການ validate AI Responses –The final perimeter implies content moderation and compliance on AI-generated responses. This can be done by creating a workflow that applies policy-based filtration before delivering AI outputs:
- ການຄວບຄຸມອະນຸຍາດສາມາດເພີ່ມຂຶ້ນໃນຄໍາຮ້ອງສະຫມັກ agent, ເຮັດໃຫ້ການປະຕິບັດການຄຸ້ມຄອງຄໍາຮ້ອງສະຫມັກໃນແຕ່ລະເລີ່ມຕົ້ນຂອງສົນທະນາກ່ອນຫນ້ານີ້ຜູ້ໃຊ້ສາມາດໄດ້ຮັບຄໍາຮ້ອງສະຫມັກ.
- ການເຮັດວຽກການຢັ້ງຢືນຂໍ້ມູນແລະການຢັ້ງຢືນອະນຸຍາດທີ່ກ່ຽວຂ້ອງຮັບປະກັນວ່າພຽງແຕ່ຂໍ້ມູນທີ່ໄດ້ຮັບການຢັ້ງຢືນແລະທີ່ໄດ້ຮັບການອະນຸຍາດສາມາດຜ່ານມາ.
- ຄໍາຮ້ອງສະຫມັກທີ່ຜ່ານມາໃຫ້ຜູ້ໃຊ້ສາມາດໄດ້ຮັບການປັບປຸງໂດຍໃຊ້ການປົກກະຕິທີ່ຖືກຕ້ອງ, ດັ່ງນັ້ນມັນສາມາດເຮັດໃຫ້ການກວດສອບຂໍ້ມູນຫຼືໃຫ້ຜູ້ໃຊ້ຂໍ້ມູນກ່ຽວກັບການປົກກະຕິຂອງການນໍາໃຊ້.
ລະບົບການເຮັດວຽກຂອງການຢັ້ງຢືນຂໍ້ມູນແລະການຢັ້ງຢືນອະນຸຍາດໃຫ້ເຫັນວ່າພຽງແຕ່ຂໍ້ມູນທີ່ໄດ້ຮັບການຢັ້ງຢືນແລະໄດ້ຮັບການອະນຸຍາດສາມາດຜ່ານມາ.The reply that returns to the users can be edited based on predefined limitations, thus allowing for data masking or notifying the user of use limitations.
ອຸປະກອນການກັ່ນຕອງໂດຍ PydanticAI
ການກັ່ນຕອງຢ່າງວ່ອງໄວທີ່ມີ PydanticAIເພື່ອສະແດງໃຫ້ເຫັນການນໍາໃຊ້ filtering prompt ປະສິດທິພາບທີ່ດີທີ່ສຸດ, here is an example of using PydanticAI tools to filter user inputs to AI agents. PydanticAI is an agent framework that takes advantage of Python's famous Pydantic library and its static typing capabilities and turns it into a structured AI framework that handles unstructured data.
The following GitHub repository contains a full implementation of the framework for PydanticAI: github.com/permitio/permit-pydanticai
github.com/permitio/permit-pydanticai
@financial_agent.tool
async def validate_financial_query(
ctx: RunContext[PermitDeps],
query: FinancialQuery,
) -> bool:
"""Key checks:
- User has explicitly opted in to AI financial advice
- Consent is properly recorded and verified
- Classifies if the prompt is requesting advice
Args:
ctx: Context containing Permit client and user ID
query: The financial query to validate
Returns:
bool: True if user has consented to AI advice, False otherwise
"""
try:
# Classify if the prompt is requesting advice
is_seeking_advice = classify_prompt_for_advice(query.question)
permitted = await ctx.deps.permit.check(
# The user object with their attributes
{
"key": ctx.deps.user_id,
},
# The action being performed
"receive",
# The resource being accessed
{
"type": "financial_advice",
"attributes": {"is_ai_generated": is_seeking_advice},
},
)
if not permitted:
if is_seeking_advice:
return "User has not opted in to receive AI-generated financial advice"
else:
return "User does not have permission to access this information"
return True
except PermitApiError as e:
raise SecurityError(f"Permission check failed: {str(e)}")
ຊື່ຫຍໍ້ຂອງ : Enforce Data Protection –ຊື່ຫຍໍ້ຂອງ : Enforce Data Protection -ຫຼັງຈາກນັ້ນ, ພວກເຮົາມີຄວາມປອດໄພສໍາລັບການຢັ້ງຢືນ ການດໍາເນີນການ (RAG) ໂດຍການຮັບປະກັນວ່າມະນຸດ AI ສາມາດເຂົ້າເຖິງພຽງແຕ່ ສະຫນັບສະຫນູນຂອງຄວາມຮູ້. ນີ້ສາມາດໄດ້ຮັບໂດຍຜ່ານການກັ່ນຕອງຄວາມປອດໄພຂອງຂໍ້ມູນຂອງອຸປະກອນ AI ສໍາ ລັບຜູ້ໃຊ້ໃນລະດັບການເຮັດວຽກຂອງ AI:
ຜະລິດຕະພັນຂອງ RAG (Retrieval Augmented Generation)ຊື່ຫຍໍ້ຂອງ : Authorized knowledge sources
When the agent application performs RAG filtration, it uses one of the following methods:
FilterObjects
GetUserPermissions
GetUserPermissions
RAG Data Protection with Langchain
RAG Data Protection ກັບ LangchainLangchain, framework application AI ທີ່ມີຊື່ສຽງ, ແມ່ນຮູ້ຈັກ (ຍັງ) ສໍາລັບ components Retriever ຂອງຕົນທີ່ສະຫນອງສະຫນັບສະຫນູນທີ່ດີທີ່ສຸດໃນ Retriever Custom ທີ່ສາມາດຕິດຕັ້ງກັບປະເພດໃດໆຂອງອຸປະກອນຂໍ້ມູນ, ເຮັດໃຫ້ການປະຕິບັດຂອງ RAG ທີ່ປອດໄພໄດ້ຢ່າງງ່າຍດາຍ. ໂດຍສະເພາະ, ມີ SelfQueryRetriever
, ທ່ານສາມາດຫຸ້ມຫໍ່ RAG ທີ່ປົກກະຕິກັບ GetUserPermissions
function ທີ່ຈະຕິດຕໍ່ຂໍ້ມູນທີ່ຖືກກວດສອບກັບຄໍາສັ່ງ. Here is an example of the PermitSelfQueryRetriever that gets the user, action, and the type of the RAG resources to filter the results for the LLM:
SelfQueryRetriever
GetUserPermissions
ຊື່ຫຍໍ້ຂອງ : OpenAIEmbeddings() vectorstore = FAISS.from_documents(docs, embedding=embeddings) # 2. ດາວໂຫລດ PermitSelfQueryRetriever retriever = PermitSelfQueryRetriever( api_key=os.getenv("PERMIT_API_KEY", ""), pdp_url=os.getenv("PERMIT_PDP_URL"), user=USER, resource_type=RESOURCE_TYPE, action=ACTION, llm=embeddings, vectorstore=vectorstore, enable_limit=False,
# 1. Build a small in-memory vector store
embeddings = OpenAIEmbeddings()
vectorstore = FAISS.from_documents(docs, embedding=embeddings)
# 2. Initialize the PermitSelfQueryRetriever
retriever = PermitSelfQueryRetriever(
api_key=os.getenv("PERMIT_API_KEY", ""),
pdp_url=os.getenv("PERMIT_PDP_URL"),
user=USER,
resource_type=RESOURCE_TYPE,
action=ACTION,
llm=embeddings,
vectorstore=vectorstore,
enable_limit=False,
)
The following repository contains the full implementation of the framework for Langchain: https://github.com/permitio/langchain-permit
https://github.com/permitio/langchain-permit3. ຄວາມປອດໄພຂອງການເຂົ້າເຖິງ -
3. ຄວາມປອດໄພຂອງການເຂົ້າເຖິງ -ອຸປະກອນການ AI ຫຼາຍກວ້າງຂວາງເຮັດວຽກຮ່ວມກັບ API, ການບໍລິການແລະເຄື່ອງມືອັດຕະໂນມັດອື່ນໆ. ບໍ່ມີການຄວບຄຸມການເຂົ້າເຖິງທີ່ເຫມາະສົມ, ພວກເຂົາເຈົ້າຄວນເຮັດວຽກທີ່ບໍ່ໄດ້ຮັບອະນຸຍາດ. ດັ່ງນັ້ນ, ພວກເຮົາມີຄວາມຕ້ອງການທີ່ຈະຮັບປະກັນການປະຕິບັດທີ່ອຸປະກອນການ AI ມີຄຸນນະສົມບັດທີ່ກ່ຽວຂ້ອງກັບຄຸນນະສົມບັດຂອງເຄື່ອງ. ນີ້ແມ່ນວິທີທີ່ມັນສາມາດໄດ້ຮັບການປັບປຸງ:
ໃນຂະນະທີ່ GPTs ແລະ interfaces natural language ແມ່ນບໍ່ໃຫມ່, ເພື່ອໃຫ້ພວກເຂົາເຈົ້າເຮັດວຽກສໍາລັບຜູ້ໃຊ້ແມ່ນຄວາມຊ່ຽວຊານໃຫມ່ຫຼາຍຂອງວິສະວະກອນ. ພວກເຮົາສາມາດຊອກຫາສາມລະດັບທີ່ແຕກຕ່າງກັນຂອງການຄວບຄຸມການເຂົ້າເຖິງທີ່ສໍາຄັນເພື່ອຮັບປະກັນນີ້:
ການກັ່ນຕອງການຕອບດ້ວຍ Langflow
ການຕອບສະຫນອງດ້ວຍ LangflowIn the following example, we use Langflow, a visual no-code AI applications editor, to create a permissions check component that’s positioned before any chat response to the user. Using LangFlow's friendly flow modeling capabilities, you can easily append another component that masks unwanted details in returned responses. This repository contains all the access control components required for secured Langflow applications.
This repository
ຊື່ຫຍໍ້ຂອງ : H2
ລະບົບ AI ແມ່ນເຂົ້າລະຫັດຢ່າງໄວ້ວາງໃຈໃນອຸປະກອນລະຫວ່າງອຸດສາຫະກໍາ, ແຕ່ລະບົບຄວາມປອດໄພຂອງພວກເຂົາແມ່ນບໍ່ມີການພັດທະນາຢ່າງກວ້າງຂວາງ compared to traditional software. without proper identity-aware access control, AI agents risk exposing sensitive data, executing unauthorized operations, and generating responses that fall outside compliance guidelines.
Instead of building access control from scratch, Permit.io’s AI Access Control integrations with PydanticAI, LangChain, MCP, and LangFlow allow teams to embed security directly into their AI applications—without disrupting development workflows. Try it yourself here.
Try it yourself here
I’d love to hear your feedback, thoughts, and ideas on how to improve this framework to make it even better for production-ready AI systems - comment here, or hit me up in our Slack community.
Slack community