4 ms·
I was pleased to see a section in here on what they call "flattening" - the problem of "efficiently provide a list of resources my user has access to". I've ma
by simonw 5y ago
I was pleased to see a section in here on what they call "flattening" - the problem of "efficiently provide a list of resources my user has access to".
I've made this mistake more than once when designing an authorization system. Sure, you can build a fast mechanism for answering the question "does actor A have access to object B" - but can you efficiently answer that for 10,000 objects at once?
Say for example you're building a search engine, and you want to search across all public data but ALSO all of the data your user has access to that's private. You probably can't run the search, get back 10,000 results, then apply your "can X access Y" logic to all 10,000 of them.
(I'd love to know how GitHub code search implements this - it shows me results from my private repositories mixed in with results from their public index).
- jzelinskie 5y ago"Flattening", the equivalent of denormalizing a graph, is one way to implement performant ACL Filtering[0]. This is the same strategy used in the Zanzibar paper to gain the desired performance out of their Leopard index system. I tend to consider this largely a performance optimization strategy and not a necessarily the "solution" to this problem. We actually just this week wrote about how Authzed[1] actually reverse walks the graph in order to implement this API. Full disclosure: I'm a founder of Authzed (YC W21), which is a productized Zanzibar system. [0]: https://authzed.com/blog/six-month-profile-page/ https://authzed.com/blog/six-month-profile-page/ [1]: https://authzed.com/blog/acl-filtering-in-authzed/ https://authzed.com/blog/acl-filtering-in-authzed/
- Diggsey 5y agoThe permissions system I designed at work solves the search problem, although it is not as powerful as what's described in the article. We have three main concepts in the sytem: - Capabilities (eg. "read profile") - Selectors (eg. "profiles belonging to customer X) - Groups (eg. "profile") All queries are of the form "Do I have capability X on resource Y" (where resource Y belongs to a particular group). A "permission set" is a mapping from a capability to a set of selectors. Selectors can be composed (eg. you could OR two selectors together) but are predefined. Since they are predefined, our search implementation can understand a subset of the selectors, and translate them into an ElasticSearch-compatible query. We then filter the results by evaluating the permissions normally: this catches any cases where there was no way to construct a query, or if the constructed query could not be completely precise. If this occurs, then we show a message on the page like "some profiles were hidden because you do not have permission to view them" and then we might show 19 profiles on a page instead of the full 20, so that our pagination can still work efficiently.