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

authorizer: always display authorizer facts and rules #195

Merged
merged 1 commit into from
Dec 29, 2023

Conversation

divarvel
Copy link
Collaborator

@divarvel divarvel commented Oct 31, 2023

impl Display for Authorizer only used the datalog world for displaying facts. When calling .to_string() on an authorizer before .authorize(), authorizer facts and rules were not displayed (authorizer facts and rules are added to the datalog world only in .authorize()).

After authorization, authorizer facts and rules are both in the world and the block, so deduplication is needed.

See #193 and #194

Note: the output of .to_string() is still not a faithful representation of the snapshot contents, since the authorizer block can have a block-wide scope annotation, which is not displayed. Maybe displaying a snapshot as a single datalog snippet does not even make sense (after all, we are already using comments to annotate stuff). We could display blocks faithfully (not using the datalog world), and then display generated facts in a separate way (we would still have to deduplicate facts to only display generated facts and not facts coming directly from blocks.

@divarvel divarvel force-pushed the authorizer-facts-in-authorizer-tostring branch 4 times, most recently from 3c06ba7 to b5436a7 Compare October 31, 2023 11:17
`impl Display for Authorizer` only used the datalog world for displaying facts. When calling `.to_string()` on an authorizer before `.authorize()`, authorizer facts and rules were not displayed (authorizer facts and rules are added to the datalog world only in `.authorize()`).

After authorization, authorizer facts and rules are both in the world and the block, so deduplication is needed.
@divarvel divarvel force-pushed the authorizer-facts-in-authorizer-tostring branch from b5436a7 to 9feb665 Compare October 31, 2023 11:21
@divarvel divarvel requested a review from Geal October 31, 2023 11:42
@divarvel divarvel marked this pull request as ready for review October 31, 2023 11:42
@Geal Geal merged commit 41f8667 into main Dec 29, 2023
2 checks passed
divarvel added a commit to biscuit-auth/biscuit-cli that referenced this pull request Feb 26, 2024
`to_string` provides a more complete view than `dump_code`, including facts origins.

Before biscuit-auth/biscuit-rust#195, `to_string()` did not include authorizer facts on snapshots  (before running `authorize`). This is not an issue with the latest biscuit-rust version (`4.1.1`), so it is safe to use `to_string()`
divarvel added a commit to biscuit-auth/biscuit-component-wasm that referenced this pull request Feb 26, 2024
It includes bumping biscuit-rust to 4.1.1, which includes changes from  biscuit-auth/biscuit-rust#195

This means that the little workaround of running authorization on an authorizer copy before generating text output is not needed anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants