Verified Permissions: CreatePolicy errors on static policies with a type constraint in the scope #87
Closed
Plasmadog
started this conversation in
Bugs (AWS)
Replies: 1 comment 2 replies
|
Hello @Plasmadog and thanks for your report! We've pushed a fix and it should be available in our dev release, available at Could you confirm it now works for you? Thank you! |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
The LocalStack emulation of Verified Permissions fails in some cases that work correctly in the real AWS service.
CreatePolicyfails withInternalError (KeyError: 'entity')for any static policy whose scope uses a type constraint (i.e. theisoperator), such asprincipal is Userorresource is Photo. The policies are valid Cedar and work in AWS. The failure doesn't depend on a schema or on validation mode: it happens whether or not a schema has been supplied. Policies with an unconstrained scope, or with==orinentity constraints, are created normally.Environment
docker run -e LOCALSTACK_AUTH_TOKEN=... -e SERVICES=verifiedpermissions -p 4566:4566 localstack/localstack:latestReproduction
Works: unscoped policy
Fails: principal type constraint
Fails: resource type constraint
Fails: type constraint combined with
inExpected: each call returns a policyId, as in AWS. These are valid Cedar scope forms.
Actual: the first call succeeds. The other three fail with HTTP 500:
Server log (with DEBUG=1), identical for all three failing calls:
Fails: instantiation of a policy template that has a type constraint
CreatePolicyTemplate allows creation of a template that has a type constraint (no error), but CreateTemplate throws the same error as above when attempting to instantiate such a template.
Impact
We create policy stores in LocalStack and load the same static policies that we deploy to AWS. About a dozen of our policies use
principal isorresource is, so we can't load them locally. Type constraints using theisoperator are standard Cedar and have been supported in AVP since it was upgraded to use Cedar v4.All reactions