8000 feat: implement basic zanzibar API contract by zepatrik · Pull Request #266 · ory/keto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: implement basic zanzibar API contract #266

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

Merged
merged 0 commits into from
Apr 1, 2021
Merged

feat: implement basic zanzibar API contract #266

merged 0 commits into from
Apr 1, 2021

Conversation

zepatrik
Copy link
Member
@zepatrik zepatrik commented Oct 8, 2020

This PR is an umbrella PR that keeps track of everything that goes into implementing a zanzibar-like next-gen Keto. It shows the current state of the zanzibar branch where the development happens. If you have general feedback/usecases/.... please let us know either in this PR or by opening an issue.

@zepatrik zepatrik marked this pull request as draft October 8, 2020 09:58
@zepatrik zepatrik added the corp/m3 Up for M3 at Ory Corp. label Oct 8, 2020
@zepatrik zepatrik self-assigned this Oct 8, 2020
@aeneasr aeneasr added corp/m4 Up for M4 at Ory Corp. and removed corp/m3 Up for M3 at Ory Corp. labels Nov 9, 2020
@robinbraemer
Copy link
Contributor
robinbraemer commented Nov 9, 2020

I was just about to build exactly this authorization system based off of Google’s Zanzibar paper, but then found the very good looking “zanzibar/expand-api” branches in the Keto project. Great work so far! 👍

I would love to help and contribute to Keto’s ACL as I’m also familiar with the Zanzibar paper and began some thoughts about such system myself for my organization.

@zepatrik I assume the Zanzibar based ACL system will be a public API as well as provide the under layer for the planned RBAC, ABAC etc. systems as its that flexible enough?

Let me know if there is something I could help with in terms of implementing or as another code reviewer giving ideas and giving feedback!

Things needed to be discussed, I think (or at a later stage):

  • database interface for zanzibar (Spanner-like global scalability -> CockroachDB with geo-partitioning +follower reads in combination with Zookie concept from the paper)
  • distributed caching of computed/recent results (for fast responses to requests specifying zookie)
    • use google/groupcache to improve throughput (and check tuple once, spread result to nodes - for frequently read queries/check requests)
  • implementation of the offline secondary indexing system for deeply nested relationships (Leopard, or however we will call it)
  • rename the “Zookie”? ^^

@zepatrik
Copy link
Member Author

Awesome, do you want to join our slack for discussions? https://slack.ory.sh/
I would also be up to jump on a call at some point. Just PM me (Patrik (ory)) on slack.

For transparency, here are some answers to your questions:

  1. There will be a public API that allows requests such as "is user allowed to do relation on object" (currently the check package).
  2. There will be a public API to expand user sets (the expand package).
  3. The ACL language itself is flexible enough to allow implementation of RBAC, ABAC, ... We want to evaluate it today to figure out the limitations now
  4. For the database interface we will probably go with https://github.com/gobuffalo/pop as we had good experience with that. It allows us to support multiple databases at once, including CRDB or Yugabyte through the postgres driver. This way you can use them to get a cloudspanner like database.
  5. The other optimizations you mentioned are planed for a later stage when we have the functionality working.
  6. All the distributed and fan-out part of zanzibar will be added later as well. We try to use algorithms now that allow us to do the recursion over multiple nodes later on.
  7. The whole idea of a zookie is not yet implemented as it heavily relies on the database. Naming in general is something we have to rework anyway.

@jon-whit
Copy link
jon-whit commented Feb 3, 2021

@zepatrik I'd love to pitch in and work on this with you. I too am working on a similar design after having read the Zanzibar paper. I'm also trying to get this type of architecture built and scaled up to work for an internal use case at my company. So I'd have plenty of time to work on it.

I'd love to join the slack and collaborate with you weekly or bi-weekly.

@aeneasr
Copy link
Member
aeneasr commented Mar 5, 2021

I would like to get this merged - what's the status on this?

@zepatrik
Copy link
Member Author
zepatrik commented Mar 5, 2021

I updated the milestone: https://github.com/ory/keto/milestone/4
All of the issues are not too much work, just the last details for the release. I think we are at a point where we could rename the current master to e.g. legacy and make this the new master branch, what do you think?

@aeneasr
Copy link
Member
aeneasr commented Mar 5, 2021

Yeah, I think that makes sense - setting up a legacy branch based on current master and then force-pushing the zanzibar branch.

Copy link
Member
@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

access control on their own. Any request made to any Keto API is considered
authenticated, authorized, and is thus being executed. However, these endpoints
are very sensitive as they define who is allowed to do what in your system.

Please protect these endpoints using
[ORY Oathkeeper](https://github.com/ory/oathkeeper) or a comparable API Gateway.
[Ory Oathkeeper](https://github.com/ory/oathkeeper) or a comparable API Gateway.
How you protect them, is up to you.

If you require support for this, consider [asking us](mailto:hi@ory.sh).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would probably link to GitHub discussions here instead

"engines/rbac",
"engines/acp-ory",
"engines/acp-aws"
"Concepts": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move concepts above guides

Copy link
Member
@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bildschirmfoto 2021-03-12 um 08 25 31

@@ -1,166 +0,0 @@
---
id: configure-deploy
title: Configure and Deploy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this document in all the other projects and it helps people understand how to wire things together. I think it makes sense to re-add and update this, even if it is similar to the Try Along. However, the try-along does not explain how to set up or connect the database, does not say anything about migrations, and so on.

Makefile Outdated
&& \
npm i \
&& \
npm test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a "make docker" target which builds the Dockerfile including SQLite!

Dockerfile Outdated
ED4F
#
# $ packr; GO111MODULE=on GOOS=linux GOARCH=amd64 go build; docker build -t oryd/keto:latest .; rm keto; packr clean
FROM alpine:3.9
FROM golang:1.16-alpine AS builder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the structure of https://github.com/ory/kratos/tree/master/.docker

The main Dockerfile is an empty container where goreleaser injects its binary into.

# clone the repository if you don't have it yet
git clone git@github.com:ory/keto.git && cd keto

docker-compose -f contrib/cat-videos-example/docker-compose.yml up
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails with several error messages, including the fallback URL.

Copy link
Member
@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace all /TODO links and/or write the content for those links.

Comment on lines 50 to 51
[namespace migration CLI reference](/TODO) and
[running in production guide](/TODO) to learn more about that process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update links, write migration guide.


Ory Keto knows F438 the concept of namespaces to organize
[relation tuples](./relation-tuples). Namespaces have a configuration that
defines the relations, and some other important values ([see reference](/TODO)).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update links

The namespaces' purpose is to split up the data into coherent partitions, each
with its corresponding configuration. Internally each namespace has its own
table in the database to allow setting individual
[storage specific options](/TODO).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update links - basically just search for /TODO

Copy link
Member
@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please re-generate swagger and rebuild the docs so that I can verify the REST API? :)


// swagger:route GET /check read getCheck
//
// Check a relation tuple
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NYT case for all swagger titles please :)

@aeneasr aeneasr marked this pull request as ready for review April 1, 2021 10:01
@aeneasr
Copy link
Member
aeneasr commented Apr 1, 2021

Is there a reason why /relationtuple is not following REST best practice of plural? Also, is relation tuple one word or two? If it is two, should we use /relation-tuples?

Copy link
Member
@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for

Is there a reason why /relationtuple is not following REST best practice of plural? Also, is relation tuple one word or two? If it is two, should we use /relation-tuples?

and the "todo" pages this is good to go from my side!

Copy link
Member
@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can I say? Good job!

@aeneasr aeneasr merged commit d32767f into master Apr 1, 2021
@zepatrik zepatrik deleted the zanzibar branch April 8, 2021 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
corp/m4 Up for M4 at Ory Corp.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0