fix(authz): expose placeholder context in Cedar evaluations - #157
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Schema preflights evaluate custom Cedar policies against a placeholder containing type defaults for required attributes. Policies and denial logs previously lacked an explicit signal that these values were synthetic, so an attribute-dependent forbid could deny a collection or point-read preflight without a useful explanation.
Application and field actions now require Boolean
context.resource_is_placeholder. The authorization engine sets it from the presence of a concrete resource; field checks set false. Required defaults and the_anyUID remain, and custom forbids retain their existing behavior. Decision logs include the marker, actual resource UID, and matched policy IDs; evaluation-error rejection is logged as denial even when Cedar also reports a matching permit.Document guarded Read permit/forbid patterns, Read preflights on both list and point routes, and the generic Create route's existing lack of a proposed-record authorization check. Manual consumers of the generated Cedar schema must now supply the required context attribute, so the next release needs compatibility and semver review. No version, dependency, or owner-policy changes are included.
Validation: 728 integration tests passed (seven skipped). Eight new tests cover required/optional attributes, real default-like values, unchanged unguarded forbids, conditional permits, missing-context request rejection, field checks, structured denial logs, and HTTP list/point behavior. Independent PostgreSQL acceptance passed eleven pagination/filter cases and visible/hidden point reads with a required Boolean; restoring the unguarded policy preserved its denials, and actual JSON logs identified both scopes and matching policies.
Fixes #155.