Repository navigation
Nexus PDP: error responses on the AuthZen API, and the Nexus PDP API key in the how-tos - #661
Conversation
…PDP API key - AuthZen compatibility: scope the AuthZen error codes to the container PDP and add a table of what Nexus PDP returns instead (401 JSON message, 400, 422, 415 plain text), and that it checks the body before the token. - Get your API key, and the check, user-permissions and authorized-users how-tos: say that Nexus PDP takes the Nexus PDP API key, not the environment API key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for permitio-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
zeevmoney
left a comment
There was a problem hiding this comment.
Changes requested: 1 HIGH, 2 MEDIUM, 3 LOW.
Blocking:
- HIGH
docs/concepts/pdp/overview.mdx:380: the container PDP returns neither these statuses nor AuthZen error codes
Non-blocking:
- MEDIUM
docs/concepts/pdp/overview.mdx:391:/access/v1/evaluationshas400responses that come after the token check (plus413) - MEDIUM
docs/how-to/enforce-permissions/user-permissions.mdx:142(andauthorized-users.mdx:146): the Nexus PDP key sentence is in the ABAC example, and Nexus PDP doesn't evaluate ABAC - LOW
docs/how-to/enforce-permissions/authorized-users.mdx:146: a raw<a>skips Docusaurus link handling - LOW
docs/how-to/enforce-permissions/check.mdx:13: the next prerequisite sends Nexus PDP readers to container and Cloud PDP setup - LOW
docs/overview/get-api-key.mdx:12: the first mention should be "Permit Nexus PDP", with a link
Outside this diff (not inline):
- MEDIUM
docs/how-to/enforce-permissions/data-filtering.mdx:17,23: Nexus PDP feature parity sends readers here. The page still says to use the environment API key, and Nexus PDP rejects that key with401. It needs the same Nexus PDP key sentence as check.mdx. - LOW
docs/concepts/pdp/overview.mdx:378: "Every AuthZen endpoint requires the headerAuthorization: Bearer" is true on the container PDP. On Nexus PDP, the discovery endpointGET /.well-known/authzen-configurationanswers without a token.
Details are in the inline comments on each line.
…idance in Prerequisites Review follow-ups on #661: - AuthZen errors: one table for the container PDP and Nexus PDP. The container PDP answers a wrong key with 403, a missing field with 422, and neither PDP sends AuthZen error codes. Add the /access/v1/evaluations 400 cases and 413, and say which checks run before the token on each PDP type. Discovery on Nexus PDP answers without a token. - user-permissions, authorized-users, data-filtering: the Nexus PDP key goes in Prerequisites, not the ABAC cURL examples; the ABAC notes name Nexus PDP. - check: link Deploy Nexus PDP next to Run the PDP, and give the Nexus PDP URL. - First mention on each page is a linked "Permit Nexus PDP". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks Zeev. Everything is fixed in db345d3, and each inline thread has a reply and is resolved. The two outside-the-diff items:
|
zeevmoney
left a comment
There was a problem hiding this comment.
Approved — no CRITICAL or HIGH issues found.
The previous review's six threads and its two items outside the diff are fixed. Each status in the error table matches the container PDP (pdp-server in permitio/PDP) and the Nexus PDP source.
Non-blocking:
- MEDIUM
docs/concepts/pdp/overview.mdx:382: the error table and the bearer sentence leave out the Cloud PDP (wrong key gets403JSON; body checks come before the token) - LOW
docs/concepts/pdp/overview.mdx:385: Nexus PDP rejectsBEARERwith the right key, and the container PDP accepts it - LOW
docs/concepts/pdp/overview.mdx:393: the ordering paragraph leaves out the empty-array check and the missing-token case - LOW
docs/how-to/enforce-permissions/user-permissions.mdx:15(andauthorized-users.mdx:15,data-filtering.mdx:15): the PDP prerequisite doesn't link Deploy Nexus PDP, unlike check.mdx - LOW
docs/how-to/enforce-permissions/check.mdx:99: the ABAC note doesn't say that an ABAC check on Nexus PDP returns a deny - LOW
docs/how-to/enforce-permissions/check.mdx:181: the addresses to substitute add a second scheme to the sample URL
Outside this diff (not inline):
- MEDIUM
docs/how-to/enforce-permissions/bulk-check.mdx:14: Nexus PDP feature parity lists bulk check as supported. This page has no API key bullet, though, so Nexus PDP readers get no key guidance, and the environment API key gets401. It needs the same key bullet as check.mdx. Its "Combine ReBAC and ABAC checks" use case (line 44) also needs the ABAC note: on Nexus PDP the ABAC item returns a deny, so only the ReBAC check can allow the edit. - LOW
docs/concepts/pdp/overview.mdx:41: the Cloud PDP section (line 53) and the Edge PDP section (line 166) each give the SDK's PDP URL and key. The Nexus PDP section gives neither, and the page mentions the Nexus PDP API key only in the AuthZen section.
Details are in the inline comments on each line.
…and ABAC notes Review follow-ups on #661 (approved round): - AuthZen errors: a Cloud PDP column (verified against cloudpdp.api.permit.io), split the no-scheme and wrong-key rows, note that Nexus PDP and the Cloud PDP match only `Bearer`/`bearer`, link the Cloud PDP 429, and say which checks run before the token on each PDP type, including a missing token and the empty `evaluations` array. - Nexus PDP section of the overview: how to point an SDK at Nexus PDP and which key it takes. - user-permissions, authorized-users, data-filtering, bulk-check: link Deploy Nexus PDP in the PDP prerequisite; bulk-check gets the key bullet. - ABAC notes in check and bulk-check say an ABAC check on Nexus PDP returns a deny, not an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The addresses to substitute already include one, so following the page gave https://http://localhost:7766/allowed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks Zeev. All six inline points are fixed (c7c6b7d, plus 267d0a1 for the code sample), and each thread has a reply and is resolved. The two outside-the-diff items:
|
zeevmoney
left a comment
There was a problem hiding this comment.
Post-merge review of the changes pushed after the approval at bd3a8f7.
Review notes: 2 MEDIUM, 1 LOW. No approval or block submitted.
- MEDIUM
docs/how-to/enforce-permissions/bulk-check.mdx:50: on the Cloud PDP and Nexus PDP, the ABAC item returns the ReBAC item's result, not a deny - MEDIUM
docs/how-to/enforce-permissions/check.mdx:167: the sample still fails after the URL fix, becauseusermust be an object - LOW
docs/how-to/enforce-permissions/check.mdx:99: the deny applies to the Cloud PDP too, and only to access that an ABAC rule would grant
The previous review's items are addressed: the Cloud PDP column with the split auth rows, the Bearer/bearer sentence, the ordering paragraph, the Deploy Nexus PDP links, the Nexus PDP SDK sentence, the bulk check key bullet, and the sample URL scheme. Each cell of the AuthZen error table, the discovery exception, the scheme matching and the order of the token and body checks match the container PDP source (pdp-server in permitio/PDP) and the Cloud PDP and Nexus PDP source. The ABAC note at check.mdx:99 is only partly fixed (see the inline comment).
Outside this diff (not inline):
- MEDIUM
src/sdks/bulk-check/multiple-policy-models/example.js:2: the sample under the new ABAC note callspermit.bulk([...]). The Node.js SDK has onlypermit.bulkCheck()(src/index.ts:206in permitio/permit-node), which this page's SDK table and its other two samples use, so the sample throwsTypeError: permit.bulk is not a function. - LOW
docs/concepts/pdp/nexus-pdp-feature-parity.mdx:61: the same deny wording as check.mdx:99. - LOW
docs/how-to/enforce-permissions/bulk-check.mdx:63anddocs/how-to/enforce-permissions/user-permissions.mdx:196: now that these pages link Deploy Nexus PDP in their prerequisites, two sections that work only on a container PDP should say so.PDP_OPA_CLIENT_QUERY_TIMEOUTis a container PDP variable; Nexus PDP usesOPA_TIMEOUT_MS(Nexus PDP configuration reference). "Get user permissions directly from OPA" needs the OPA port, which Nexus PDP doesn't expose outside the container.
Details are in the inline comments on each line.
| Some operations depend on two policy models. In this example, a user can `edit` a document when a relationship-based access control (ReBAC) role on the document grants `edit`, or when an attribute-based access control (ABAC) rule grants `edit` to the user's subscription tier. The bulk check sends both checks at once, and the code allows the edit when either result is `true`. | ||
|
|
||
| :::note ABAC needs a container PDP | ||
| The Cloud PDP and Nexus PDP don't evaluate ABAC policies. On them, the ABAC item returns a deny, not an error, so only the ReBAC check can allow the edit. Run a container PDP for this example. See [Cloud PDP capabilities](/concepts/pdp/cloud-pdp-capabilities) and [Nexus PDP feature parity](/concepts/pdp/nexus-pdp-feature-parity#abac). |
There was a problem hiding this comment.
[MEDIUM] On the Cloud PDP and Nexus PDP, the ABAC item returns the ReBAC item's result, not a deny
Problem: The second item in the sample below sends the same user key, action and resource instance (document:${document.id}) as the first item, plus the user's tier attribute. The Cloud PDP and Nexus PDP skip ABAC rules, but they still evaluate RBAC and ReBAC for every item, and neither model reads user attributes (the Cloud PDP and Nexus PDP source is in cloud-pdp). So on both PDP types the second result always equals the first: true when a role on the document or a tenant role grants edit, false otherwise. "The ABAC item returns a deny" holds only when the first item is denied too.
A reader who tries the example on Nexus PDP and gets [true, true] would conclude that the tier rule matched. The note's conclusion (only the ReBAC check can allow the edit) is right, but the stated reason is not. "On them" also doesn't name the PDP types (STYLE_GUIDE.md: explicit names over pronouns).
Suggestion:
:::note ABAC needs a container PDP
The Cloud PDP and Nexus PDP don't evaluate ABAC policies. On the Cloud PDP and Nexus PDP, the second check runs the role-based access control (RBAC) and ReBAC rules only and ignores the `tier` attribute. Its result always equals the first check's result, so the subscription-tier rule never allows the edit. Neither PDP type returns an error for the ABAC rule. Run a container PDP for this example. See [Cloud PDP capabilities](/concepts/pdp/cloud-pdp-capabilities) and [Nexus PDP feature parity](/concepts/pdp/nexus-pdp-feature-parity#abac).
:::|
|
||
| :::note ABAC needs a container PDP | ||
| The Cloud PDP doesn't evaluate ABAC policies. Run a container PDP for attribute-based checks. See [Cloud PDP capabilities](/concepts/pdp/cloud-pdp-capabilities). | ||
| The Cloud PDP and Nexus PDP don't evaluate ABAC policies. On Nexus PDP, a check against a policy that uses condition sets, user sets, or resource sets returns a deny, not an error. Run a container PDP for attribute-based checks. See [Cloud PDP capabilities](/concepts/pdp/cloud-pdp-capabilities) and [Nexus PDP feature parity](/concepts/pdp/nexus-pdp-feature-parity#abac). |
There was a problem hiding this comment.
[LOW] The deny applies to the Cloud PDP too, and only to access that an ABAC rule would grant
Problem: This sentence is the wording the previous review suggested, taken from Nexus PDP feature parity. It has two gaps:
- It names only Nexus PDP. The Cloud PDP runs the same policy code (the source is in cloud-pdp): an ABAC rule never grants access there either, and the check returns
falsewithout an error. The bulk check note added in the same commit says the deny happens on both PDP types, so the two pages disagree. - "A check against a policy that uses condition sets, user sets, or resource sets returns a deny" reads as if every check against such a policy is denied. On both PDP types, roles still grant access through RBAC and ReBAC. Only the access that a condition-set rule would grant is lost. A reader whose policy mixes roles and condition sets could conclude that Nexus PDP denies all of their checks.
Suggestion:
The Cloud PDP and Nexus PDP don't evaluate ABAC policies. On both PDP types, a rule that uses condition sets, user sets, or resource sets never grants access: a check that only such a rule allows returns `false`, not an error. Checks that a role grants still return `true`. Run a container PDP for attribute-based checks. See [Cloud PDP capabilities](/concepts/pdp/cloud-pdp-capabilities) and [Nexus PDP feature parity](/concepts/pdp/nexus-pdp-feature-parity#abac).The warning in Nexus PDP feature parity (line 61) uses the same wording and needs the same change.
|
|
||
| ```bash | ||
| curl -X POST https://<your-permit-pdp-url>/allowed \ | ||
| curl -X POST <your-permit-pdp-url>/allowed \ |
There was a problem hiding this comment.
[MEDIUM] The sample still fails after the URL fix: user must be an object
Problem: This commit makes the sample URL work, but the body on line 171 sends "user": "john@doe.me" as a string. POST /allowed expects user to be an object with a key field on every PDP type:
- Container PDP: the request type's
userfield is aUserstruct with a requiredkey(pdp-server/src/opa_client/allowed.rs:36-38and:91-93in permitio/PDP). TheJsonextractor rejects a string there with422. - Cloud PDP and Nexus PDP: the handler in cloud-pdp uses the same request shape and also answers
422.
The paragraph above the sample tells readers to send it to any of the three PDP types, so everyone who copies it gets 422. john@doe.me is also not one of the sample addresses that STYLE_GUIDE.md allows.
Suggestion: In its own commit, as STYLE_GUIDE.md "Code samples" asks, change the body:
curl -X POST <your-permit-pdp-url>/allowed \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-permit-api-key>" \
-d '{
"user": { "key": "john@permit.io" },
"action": "create",
"resource": {
"type": "document",
"tenant": "companyA"
},
"context": {}
}'
This PR handles the two follow-ups from the final review of #657, updated over two review rounds.
AuthZen error responses (
docs/concepts/pdp/overview.mdx, AuthZen compatibility): the old text said a bad request gets400 invalid_requestand a bad token gets401 unauthorized. No PDP type sends AuthZen error codes, and the statuses differ by type. The section now has one table for the container PDP, Nexus PDP and the Cloud PDP, checked against each one's source; the Cloud PDP was also checked live againstcloudpdp.api.permit.io:Authorizationheader401, text401,{"message":"Unauthorized"}401,{"message":"Unauthorized"}Bearerscheme403, text401, JSON401, JSON403, text401, JSON403,{"message":"Forbidden"}Content-Type/ over 2 MB400/422/415/413evaluationsitem missing a field400400400evaluationsarray400, text400,{"evaluations":[]}400,{"evaluations":[]}The section also covers scheme capitalization (only
Bearer/beareron Nexus PDP and the Cloud PDP), the Cloud PDP429, and which checks run before the token on each type. Discovery answers without a token on Nexus PDP and the Cloud PDP.Nexus PDP API key and setup:
check,bulk-check,user-permissions,authorized-usersanddata-filteringhow-tos, say that Permit Nexus PDP takes the Nexus PDP API key. They also link Deploy Nexus PDP next to Run the PDP.check'sPOST /allowedsample.npm run build: 0 bad links, 0 bad anchors, 525/525 baseline routes.🤖 Generated with Claude Code