Skip to content
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

Provide Getter for Context from Request and attributes of the Entity #363

Open
2 tasks
maxcshui opened this issue Oct 16, 2023 · 2 comments
Open
2 tasks
Labels
feature-request This issue requets a substantial new feature good-first-issue Good for newcomers. A smaller issue that someone new to the Cedar codebase should be able to tackle help-wanted Community help desired. We have not scheduled time to fix this, but think it important.

Comments

@maxcshui
Copy link

maxcshui commented Oct 16, 2023

Category

User level API changes

Describe the feature you'd like to request

Currently, both Request and Entity do not expose the API for user to retrieve the Context of the Request and Attribute of the Entity.
In my use case, I need to access both Request and Entity information for purposes like authorization logging and mapping these fields into the OCSF (Open Cybersecurity Framework) format. However, my current option is limited to using the to_string() method to store the entire context of the entity and request in the authorization log.
If cedar could introduce features such as Request.context() -> Option<impl Iterator<Item = (String, RestrictedExpression)>>, Entity.attributes() -> Option<HashMap<String, RestrictedExpression>> , it would significantly enhance my authorization log by providing additional information. It would be beneficial for user to access both fields such that user could do some data manipulation and other purpose.

Describe alternatives you've considered

I used to_string() to log the whole string into the authorization log.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@maxcshui maxcshui added feature-request This issue requets a substantial new feature pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. labels Oct 16, 2023
@yuana97
Copy link

yuana97 commented Oct 16, 2023

+1
not an immediate issue for our team since we're interacting with cedar through a custom wrapper class, but this should probably be built in.

@khieta
Copy link
Contributor

khieta commented Oct 16, 2023

Thanks for the suggestion, we agree that would be useful! I'm adding it to our backlog for now, but I'll also mark it as "good first issue" since this is a small API change that we would love a PR for 😉

@khieta khieta added good-first-issue Good for newcomers. A smaller issue that someone new to the Cedar codebase should be able to tackle backlog help-wanted Community help desired. We have not scheduled time to fix this, but think it important. and removed pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. labels Oct 16, 2023
@mstalzer mstalzer changed the title Provide Getter for Context from Request and attributes of the Entity Provide Better for Context from Request and attributes of the Entity Jun 7, 2024
@mstalzer mstalzer changed the title Provide Better for Context from Request and attributes of the Entity Provide Getter for Context from Request and attributes of the Entity Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue requets a substantial new feature good-first-issue Good for newcomers. A smaller issue that someone new to the Cedar codebase should be able to tackle help-wanted Community help desired. We have not scheduled time to fix this, but think it important.
Projects
None yet
Development

No branches or pull requests

4 participants