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

Datalog playground #49

Open
divarvel opened this issue Jul 31, 2023 · 0 comments
Open

Datalog playground #49

divarvel opened this issue Jul 31, 2023 · 0 comments

Comments

@divarvel
Copy link
Collaborator

divarvel commented Jul 31, 2023

While #9 is about having the CLI serve a web page with an interactive playground, this issue is about having the CLI provide a way to run datalog code without having to provide a token.

Currently, when I want to author datalog from my text editor, I use an empty token, along with the corresponding public key and feed them to biscuit inspect, along with the datalog file I'm authoring. This works, but is really not satisfying.
The alternative would be to use the web playground, but this is not as convenient as using my text editor.

What I'd like is a dedicated subcommand that centers on running datalog, without requiring a token:

biscuit playground --authorize-with FILENAME --query QUERY, etc.

Output

Same as in the web playground, the output would be first the authorization results, then the query results, then the complete set of generated facts

The tricky part

As long as no block scoping is needed, this works well. It becomes a little bit tricky when it comes to working with several blocks:

# same option name: the block order is easy to retrieve
biscuit playground --block-file FILENAME --block-file FILENAME --query QUERY
# different option names: the block order is harder to retrieve
biscuit playground --block DATALOG --block-file FILENAME --block DATALOG --query QUERY
# how to handle third-party blocks?
???

The different options I see are:

For the block order part:

  • only allow the authorizer block and forego scoping entirely
  • try to extract the original order information from clap (to mix --block-file and --block)
  • only allow using files to trivially keep the block definition order

For third-party blocks:

  • forego third-party blocks entirely
  • use a specific comment in datalog to extract the private key from the block source before parsing it
  • use position-aware parsing of options to pass a --sign-with / --sign-with-file option after the --block-file / --block option

Using position-aware options seems possible in clap, but I'm not keen on doing that. The two options that i like best for now are:

  • no blocks, only zuul the authorizer
  • only block files + a magic comment at the top of the file containing the private key
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

No branches or pull requests

1 participant