{"id":26823,"library":"cedarpy","title":"CedarPy","description":"A Python binding for Cedar (AWS's policy language), enabling policy evaluation and management. Current version 4.8.1 requires Python >=3.9. Active development, monthly releases.","status":"active","version":"4.8.1","language":"python","source_language":"en","source_url":"https://github.com/cedar-policy/cedarpy","tags":["cedar","aws","policy","authorization","abac"],"install":[{"cmd":"pip install cedarpy","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"Used for validation and serialization of Cedar entities and requests.","package":"pydantic","optional":false}],"imports":[{"note":"Primary class for loading and evaluating Cedar policies.","wrong":"","symbol":"CedarPolicy","correct":"from cedarpy import CedarPolicy"},{"note":"Used to define entities in the Cedar authorization model.","wrong":"","symbol":"CedarEntity","correct":"from cedarpy import CedarEntity"}],"quickstart":{"code":"from cedarpy import CedarPolicy, CedarEntity\n\npolicy = CedarPolicy('permit(principal in Namespace::\"User::\"+resource.owner, action, resource);')\nentities = [CedarEntity(uid='User::\"alice\"', attrs={'owner': 'alice'})]\nrequest = policy.evaluate(principal='User::\"alice\"', action='Action::\"view\"', resource='Resource::\"file1\"', entities=entities)\nprint(request.decision)","lang":"python","description":"Load a simple Cedar policy, create entities, and evaluate an authorization request."},"warnings":[{"fix":"Ensure your code accesses `.decision` on the result object, e.g., `result.decision`.","message":"In version 4.x, the API changed significantly from 3.x. The `evaluate` method now returns an object with a `decision` attribute instead of a string.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Replace `CedarPolicy.from_string(policy_str)` with `CedarPolicy(policy_str)`.","message":"The `CedarPolicy.from_string()` method is deprecated in favor of the constructor `CedarPolicy(...)`.","severity":"deprecated","affected_versions":">=4.5.0"},{"fix":"Always specify the entity type in the UID string, like `'User::\"alice\"'`.","message":"Entity UIDs must include the type prefix (e.g., 'User::\"alice\"'). Omitting the type will cause evaluation to fail silently or return Deny.","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Update to use `result.decision` on the returned object (string comparison not needed).","cause":"In versions <4.0.0, `evaluate` returned a string; in 4.x it returns an object. Accessing `.decision` on the old string fails.","error":"AttributeError: 'Decision' object has no attribute 'decision'"},{"fix":"Validate policy with the Cedar CLI or check the official Cedar grammar. Ensure no trailing semicolon issues.","cause":"Cedar policy string contains syntax errors or unsupported features.","error":"ValueError: Invalid policy syntax..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}