惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
J
Java Code Geeks
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
量子位
N
Netflix TechBlog - Medium
博客园 - 聂微东
博客园 - Franky
aimingoo的专栏
aimingoo的专栏
The Cloudflare Blog
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
Google DeepMind News
Google DeepMind News
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
C
Check Point Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC

Cerbos - All Posts

Authentik vs Keycloak: Self-hosted IdP comparison Mapping business requirements to authorization policy for automotive Fine-grained authorization for AI gateways EIC 2026: Stop counting agents, protect what they can touch Agent skill for writing authorization policies in Claude Desktop Identity security in 2026 EIC 2026 takeaways: the identity stack built for humans will not hold up for AI agents Already have authentication? Here's the authorization layer you still need. Tokens are authorization decisions: a guide to policy-driven token issuance What is a Runtime Authorization Platform It's a dimmer switch, not a kill switch. How CISOs are rethinking AI agent governance From maps to bitmaps (and from bitmaps to bitmaps) AuthZEN, Shared Signals, SCIM Events, IPSIE: Notes from the OpenID Enterprise Panel How do you update authorization policies without redeploying your application? IIW42 recap: Where agent authorization got real Cerbos PDP v0.52.0/v0.53.0: Engine performance, security hardening, and CEL path functions Authorization Management Platforms: what they do, how they work, and where they fit PocketOS AI coding agent deleted a production database in 9 seconds Non-Human Identity management still has a blind spot Supabase alternative in 2026: Best open source auth options Benefits of on-premise authorization: Why enterprises are moving toward self-hosted Authorization policies: How to write, test, and validate them (faster with AI) Agent skill for writing authorization policies How much does it cost to build authorization in-house? Why centralized authorization governance reduces incident response time OPA alternative Why AI agents make authorization a right now problem Modernizing legacy application authorization: why it’s your biggest security blind spot How to add authorization to legacy applications without code changes 5 authorization blind spots auditors find, and how to fix them
Nested fields support with Prisma Query Plans
Alex Olivier · 2023-07-17 · via Cerbos - All Posts

Cerbos Query Plans address a significant challenge in separating authorization logic from application code. They offer a dynamic solution by generating a set of conditions from policies. These conditions are then used to filter data retrieval, ensuring that only the instances of a resource that a user has permission to access are returned.

To enhance the usability of Query Plans, several adapters have been developed. These adapters take a plan as input and produce filters in formats compatible with popular Object-Relational Mapping (ORM) systems. For example, in the case of Prisma, the adapters support increasingly complex filters over time, including the recent addition of support for related fields.

If you take a simple Prisma schema like below, you have a parent model which includes a related (nested) model and internally the database joins these two based on the ID field:

model Resource {
  id               String         @id @default(cuid())
  nested           NestedResource @relation(fields: [nestedResourceId], references: [id])
  nestedResourceId String
}

model NestedResource {
  id       String     @id @default(cuid())
  aBool    Boolean
  Resource Resource[]
}

When there is a related model it is a common scenario where you want to query the parent model, based on the value in a child relation field:

const results = await prisma.resource.find({
  where: {
   "nested": {
     "aBool": {
         "equal": true
     }
   }
})

With the latest release of the Prisma Query Plan Adapter any nested attributes in policy will be converted into nested filter conditions also - for example providing a field mapper such a below:

const result = queryPlanToPrisma({
   queryPlan,
   fieldNameMapper: {
     "request.resource.attr.nested.aBool": "nested.aBool",
   },
});

and the Cerbos policy contains a condition such as:

condition:
  match:
    expr: request.resource.attr.nested.aBool == true

the adapter will produce a Prisma filter snippet which will now query the nested relational field which can then be passed to Prisma and work as expected.

{
   "nested": {
     "aBool": {
         "equal": true
     }
}

You can find out more about Query Plans in the documentation and our suite of adapters is available on GitHub.