-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI should support reading JSON formatted policy sets (as opposed to single policies) #950
Comments
The actual deserializing the policy set from json appears to be easy. About the non-breaking behaviour, the current logic looks like this:
Where in this small cascade do we want to add the "try parsing as policy set" step? |
The procedure I had in mind would look at JSON attributes to decided what it needs to parse. Something like: Parse policies as a
The attributes for policies/policy-sets are disjoint, so we can easily tell when an object is intended to be one or the other. There should probably be helpful error messages if it has none of the attributes or attributes from both. |
Ok, sounds reasonable. (It would introduce some coupling to the actual json representations though, but it might be worth it in terms of simplicity.)
|
I would like to start development on this given we are heading the 'check if set and parse as set' path. If I was to implement it that logic would remain as is, so far as I can tell
Granted I might be missing a lot of context but happy to try this on for size |
I'm actually planning to develop this myself. That's why I'm investigating and discussing the solution here. :)
I mean that the CLI would now know the structure of the json schema, and use it to decide what parser to call. As of right now, the CLI knows nothing about this. |
@memark awesome, looking forward to your contribution. I didn't realise you were planning to develop it :) |
Is it safe to have this issue closed since it's take care of? @memark @john-h-kastner-aws |
@muse254 Actually, it's not implemented yet. The PR above is just a first refactoring step. I'm currently working on the second PR, adding the actual functionality. |
I had not given the merged PR a cursory look, thats ok @memark |
Category
CLI features/changes
Describe the feature you'd like to request
The Cedar CLI supports JSON formatted policies by passing the
--policy-format json
argument, but this expects exactly one policy in the JSON policy.We recently added a JSON format for policy sets in #783, but did not add support for this format to the CLI. We should update the CLI to accept this format. It ideally should continue to accept the single policy format to avoid making an unnecessary breaking change.
Describe alternatives you've considered
.
Additional context
No response
Is this something that you'd be interested in working on?
The text was updated successfully, but these errors were encountered: