Skip to content

Commit b23de9c

Browse files
authored
chore: re-organize zanzibar bits (#404)
1 parent 5cbe9c3 commit b23de9c

File tree

3 files changed

+56
-80
lines changed

3 files changed

+56
-80
lines changed

pages/spicedb/concepts/zanzibar.mdx

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ import { Callout } from 'nextra/components'
55

66
# Google Zanzibar
77

8-
Zanzibar is the internal authorization system at Google.
8+
SpiceDB is based on Google Zanzibar, a revolutionary authorization system developed by Google to handle the massive scale and complexity of their services.
99

10-
A [research paper] publicly documenting the system was published at [2019 USENIX Annual Technical Conference][usenix].
10+
You may recognize the system if you've ever shared access with another user to a Google product like Google Docs or Gmail.
11+
12+
It's designed to provide consistent, secure, and reliable authorization decisions across Google's vast network of applications and users.
13+
14+
A [research paper] publicly documenting the system was published at [2019 USENIX Annual Technical Conference][usenix]. You can check out our [annotated version], which describes the concepts behind its design and implementation.
1115

1216
[research paper]: https://authzed.com/zanzibar
1317
[usenix]: https://www.usenix.org/conference/atc19
18+
[annotated version]: https://authzed.com/zanzibar
1419

1520
## History
1621

@@ -89,12 +94,22 @@ On June 28th 2021, Zanzibar was presented to the [Papers We Love] New York City
8994

9095
## Differences with SpiceDB
9196

92-
<Callout type="info">
93-
The Annotated Zanzibar paper has multiple sets of annotations!
97+
SpiceDB attempts to remain true to Zanzibar's design principles, but without any assumptions around Google's internal infrastructure and use cases.
98+
As a result, many things in SpiceDB are more flexible to accommodate different kinds of users with different software stacks.
99+
For example, [modeling complex user systems][model-users] is possible in SpiceDB, but in Zanzibar all users must be a uint64 identifier.
100+
101+
Because SpiceDB is not forced on developers as company-wide requirement, the project also values developer experience and making the tooling pleasant to work with.
102+
You can see this in our [Schema Language] and [Playground] which vastly improves the user experience of directly manipulating Protocol Buffers at Google.
94103

95-
You can read it with [annotations highlighting the differences between SpiceDB and Zanzibar][paper-diff], too!
104+
[model-users]: ../modeling/representing-users
105+
[Schema Language]: ../concepts/schema
106+
[Playground]: https://play.authzed.com
107+
[z-diff]: ../concepts/zanzibar#differences-with-spicedb
96108

97-
[paper-diff]: https://authzed.com/zanzibar/#annotations/spicedb
109+
<Callout type="info">
110+
The [Annotated Zanzibar paper] highlights the differences between SpiceDB and Zanzibar!
111+
112+
[Annotated Zanzibar paper]: https://authzed.com/zanzibar/#annotations/spicedb
98113
</Callout>
99114

100115
### Schema Language
@@ -126,14 +141,21 @@ This disambiguation also allowed SpiceDB to drop the confusing `_this` keyword u
126141
### Reverse Indices
127142

128143
Both Zanzibar and [SpiceDB][spicedb-expand] implement a ["Reverse Index Expand" API][expand].
129-
This API responds with a tree structure that can be awkward for applications to consume, especially when it's ideal to avoid co-mingling permissions logic and application code.
130144

131-
As a result, SpiceDB supports additional APIs to simplify consuming [Reverse Indices] without structure.
132-
In practice, we find that folks prefer a flattened list of results.
145+
However, this API responds with a tree structure that can be awkward for applications to consume, especially when it's ideal to avoid co-mingling permissions logic and application code.
146+
147+
As a result, SpiceDB supports additional APIs: the [LookupResources] and [LookupSubjects] APIs, which are designed to answer the following questions, respectively:
148+
149+
- "What are all of the resources this subject can access?"
150+
- "What are all of the subjects with access to this resource?"
151+
152+
[LookupResources]: https://buf.build/authzed/api/docs/main:authzed.api.v1#authzed.api.v1.PermissionsService.LookupResources
153+
[LookupSubjects]: https://buf.build/authzed/api/docs/main:authzed.api.v1#authzed.api.v1.PermissionsService.LookupSubjects
154+
155+
These APIs make it easier for consumers, because they return a flattened list of results.
133156

134157
[spicedb-expand]: https://buf.build/authzed/api/docs/main:authzed.api.v1#authzed.api.v1.PermissionsService.ExpandPermissionTree
135158
[expand]: https://authzed.com/zanzibar/2DaJ2vLfht:0.Tk3KF4i94:4S
136-
[reverse indices]: ../getting-started/faq#what-is-a-reverse-index
137159

138160
### Datastores
139161

@@ -162,17 +184,17 @@ SpiceDB is a bit more flexible with the character-set allowed for Object IDs.
162184

163185
Object Types follow the following Regular Expression:
164186

165-
```
166-
^([a-z][a-z0-9_]{1,61}[a-z0-9]\/)*[a-z][a-z0-9_]{1,62}[a-z0-9]$
167-
```
187+
```
188+
^([a-z][a-z0-9_]{1,61}[a-z0-9]\/)*[a-z][a-z0-9_]{1,62}[a-z0-9]$
189+
```
168190

169191
<ObjectTypeDiagram />
170192

171193
Object IDs follow the following Regular Expression:
172194

173-
```
174-
^(([a-zA-Z0-9/_|\\\-=+]{1,})|\\*)$
175-
```
195+
```
196+
^(([a-zA-Z0-9/_|\\\-=+]{1,})|\\*)$
197+
```
176198

177199
<ObjectIDDiagram />
178200

@@ -187,22 +209,22 @@ This allows SpiceDB to support more complex user systems and perform more powerf
187209

188210
A simple example is a SpiceDB schema modeling both users and API keys:
189211

190-
```zed
191-
definition ApiKey {}
192-
definition User {
193-
relation keys: ApiKey
194-
}
195-
```
212+
```zed
213+
definition ApiKey {}
214+
definition User {
215+
relation keys: ApiKey
216+
}
217+
```
196218

197219
You can now model relations and permissions with either type:
198220

199-
```zed {4}
200-
definition Post {
201-
relation viewer: User
202-
...
203-
permission view = viewer + viewer->keys
204-
}
205-
```
221+
```zed {4}
222+
definition Post {
223+
relation viewer: User
224+
...
225+
permission view = viewer + viewer->keys
226+
}
227+
```
206228

207229
Now developers don't have to implement logic in every app that resolves API Keys because SpiceDB already knows how to resolve them.
208230

@@ -221,14 +243,6 @@ Now developers don't have to implement logic in every app that resolves API Keys
221243

222244
## FAQ
223245

224-
### What is Google Zanzibar?
225-
226-
Google Zanzibar is a revolutionary authorization system developed by Google to handle the massive scale and complexity of their services.
227-
It's designed to provide consistent, secure, and reliable authorization decisions across Google's vast network of applications and users.
228-
Google published a paper (check out our [annotated copy](https://zanzibar.tech/)) describing the concepts behind its design and implementation.
229-
230-
You may recognize the system if you’ve ever shared access with another user to a Google product like Google Docs or Gmail.
231-
232246
### Is Zanzibar the same as ReBAC?
233247

234248
While Zanzibar is closely associated with ReBAC (Relationship-Based Access Control), it's not exactly the same thing.
@@ -238,11 +252,6 @@ Zanzibar uses ReBAC as its underlying authorization model.
238252
So, you could say that Zanzibar is a ReBAC system, but it's more than that.
239253
It also encompasses the infrastructure, algorithms, and optimizations that allow it to operate at Google's immense scale.
240254

241-
### How does SpiceDB relate to Google Zanzibar?
242-
243-
SpiceDB is an open source authorization system inspired by Google Zanzibar, designed to provide similar functionality with a focus on being accessible and adaptable to a wider range of use cases.
244-
It shares Zanzibar's core principles,including relationship-based access control (ReBAC), scalability, performance, and strong consistency.
245-
246255
## Recommended Reading
247256

248257
- [Annotated Zanzibar Paper](https://authzed.com/zanzibar)

pages/spicedb/getting-started/client-libraries.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ Additionally, there are `example` directories in the client libraries that provi
1919
## HTTP Clients
2020

2121
SpiceDB exposes an HTTP API when run with the `--http-enabled` flag.
22-
While Authzed doesn't officially maintain HTTP client libraries, there are [OpenAPI] docs available [here](../api/http-api).
23-
and served by a SpiceDB instance running the HTTP server.
24-
For example:
22+
While Authzed doesn't officially maintain HTTP client libraries, there are [OpenAPI] docs available [here](../api/http-api) and served by a SpiceDB instance running the HTTP server.
23+
24+
Try it out:
2525

2626
```sh
27-
docker run --rm -p 50051:50051 -p 8443:8443 authzed/spicedb serve --http-enabled --grpc-preshared-key <preshared key>
27+
docker run --rm -p 50051:50051 -p 8443:8443 authzed/spicedb serve --http-enabled --grpc-preshared-key foobar
2828

2929
curl localhost:8443/openapi.json
3030
```

pages/spicedb/getting-started/faq.mdx

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Notably, policy engines cannot implement [Reverse Indices].
4343
However, there are some scenarios where ReBAC systems can benefit from dynamic enforcement.
4444
For these scenarios, SpiceDB supports [Caveats] as a light-weight form of policy that avoids pitfalls present in many other systems.
4545

46-
[Reverse Indices]: #what-is-a-reverse-index
46+
[Reverse Indices]: ../faq/reverse-indices
4747
[caveats]: ../concepts/caveats
4848

4949
## How can I get involved with SpiceDB?
@@ -56,36 +56,3 @@ If you're looking to contribute code, you can read [CONTRIBUTING.md] in our open
5656

5757
[Discord]: https://authzed.com/discord
5858
[CONTRIBUTING.md]: https://github.com/authzed/spicedb/blob/main/CONTRIBUTING.md
59-
60-
## Zanzibar Questions
61-
62-
### What is a Reverse Index?
63-
64-
>Reverse-index expand answers the question "what does this employee have access to?", which most organizations validate as part of meeting those compliance obligations.
65-
>But, even more critically, organizations use this information to debug access issues and as baseline data to ensure careful data handling.
66-
>
67-
> — Lea Kissner, Zanzibar Coauthor
68-
69-
In SpiceDB, reverse indices often refer to the [LookupResources] and [LookupSubjects] APIs which are designed to answer the following questions, respectively:
70-
71-
- "What are all of the resources this subject can access?"
72-
- "What are all of the subjects with access to this resource?"
73-
74-
[LookupResources]: https://buf.build/authzed/api/docs/main:authzed.api.v1#authzed.api.v1.PermissionsService.LookupResources
75-
[LookupSubjects]: https://buf.build/authzed/api/docs/main:authzed.api.v1#authzed.api.v1.PermissionsService.LookupSubjects
76-
77-
### How does SpiceDB improve on Google's Zanzibar?
78-
79-
At a high-level, SpiceDB attempts to remain true to Zanzibar's design principles, but without any assumptions around Google's internal infrastructure and use cases.
80-
As a result, many things in SpiceDB are more flexible to accomodate different kinds of users with different software stacks.
81-
For example, [modeling complex user systems][model-users] is possible in SpiceDB, but in Zanzibar all users must be a uint64 identifier.
82-
83-
Because SpiceDB is not forced on developers as company-wide requirement, the project also values developer experience and making the tooling pleasant to work with.
84-
You can see this in our [Schema Language] and [Playground] which vastly improves the user experience of directly manipulating Protocol Buffers at Google.
85-
86-
For more specific details, see the documentation on the [Zanzibar][z-diff].
87-
88-
[model-users]: ../modeling/representing-users
89-
[Schema Language]: ../concepts/schema
90-
[Playground]: https://play.authzed.com
91-
[z-diff]: ../concepts/zanzibar#differences-with-spicedb

0 commit comments

Comments
 (0)