-
Notifications
You must be signed in to change notification settings - Fork 0
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
RFC-82: Implement Support for Cedar Tags #11
Conversation
ast.Principal().HasTag(ast.String("key")), | ||
testutil.OK, | ||
}, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have folding examples here ... maybe there needs to be some extra data dumped into the context or something so that's possible? e.g. context.entity
and then have some entity defined in the entities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
- corpus tests
- verify 100% coverage
- update to work against latest
Once those are done, you can close this PR and make a new PR against the actual cedar-go repo for final review, etc.
@@ -33,10 +34,12 @@ func (e Entity) MarshalJSON() ([]byte, error) { | |||
UID ImplicitlyMarshaledEntityUID `json:"uid"` | |||
Parents []ImplicitlyMarshaledEntityUID `json:"parents"` | |||
Attributes Record `json:"attrs"` | |||
Tags Record `json:"tags"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Rust implementation actually elides the field if it's empty, (presumably for backwards compatibility?). To match the behavior, we could use the omitempty
option here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great to know (and it fixes some incompatibilities even in our codebase 😄)
Since Tags
is a struct, it cannot have an empty value, so omitempty
won't be enough here. I could let Tags
be *Record
, which would solve this problem right away, but that possibly introduces a host of other problems of mutability.
Aside: a new tag omitzero
will be introduced in Go v1.24
, which was made to address this exact scenario (golang/go#45669) (commit).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm, right. Thanks for the reminder.
Also, update the README.md removing the line about how entity tags are missing. |
Signed-off-by: Ali Dowair <[email protected]>
This commit will make changes to product code (and not test code), to always instantiate Env.Entities to types.EntityMap{}, if it has not been instantiated. This is a quick fix to safeguard against nil pointer access Env.Entities when Entities is not set. Signed-off-by: Ali Dowair <[email protected]>
Signed-off-by: Ali Dowair <[email protected]>
This commit will add a new test to ensure the partial evaluation of tag methods on context functions correctly. Signed-off-by: Ali Dowair <[email protected]>
Signed-off-by: Ali Dowair <[email protected]>
Signed-off-by: Ali Dowair <[email protected]>
Signed-off-by: Ali Dowair <[email protected]>
This commit will update the corpus test bundle to latest, and copies one of the added corpus tests to TestCorpusRelated, to catch tag related corner cases easier. Signed-off-by: Ali Dowair <[email protected]>
Superseded by cedar-policy#77 |
No description provided.