A multitenant app
A document storage app
Fine-grained authorization logic
What are the benefits of fine-grained authorization?
What are the drawbacks of fine-grained authorization?
Fine-grained authorization (FGA) is a tricky thing to define. The term “fine-grained” only has meaning in comparison to something else that is “coarse-grained.”
Does it mean you have a lot of different roles? Or that you support a lot of permissions? Test a lot of conditions? What’s “a lot,” anyway? This isn’t a dictionary, so we'll skip the definition. It’s more useful to illustrate it.
Many applications start with simple authorization requirements.
member
can use standard featuresadministrator
can configure a single organizationglobal administrator
can manage settings that affect all organizations.You can support this logic with Role-Based Access Control (RBAC). Assign a user a role that corresponds to one of the three user types, and they get access to that role’s capabilities.
A user should only have access to files in the same organization they belong to. You can support this logic with Relationship-Based Access Control (ReBAC). You need to know two relationships:
organization
a user
is inorganization
owns the root folder
for a given file
If a user
and a file
belong to the same organization
, the user
can access the file
.
These are examples of coarse authorization logic. The permissions are blunt. You can administer an organization or you can’t. You have access to a document or you don’t. You can assign those permissions by making a single type of comparison: a user’s role, or the relationships between entities.
Over time, applications become more sophisticated. Their authorization requirements reflect this.
These new authorization requirements no longer fit neatly into a model like RBAC or ReBAC. They combine elements of both, as well as attributes of resources and of the surrounding environment (this is called Attribute-based Access Control, or ABAC).
Fine-grained authorization refers to this kind of logic, which incorporates elements of multiple authorization models.
The permissions defined in FGA are highly targeted. Rather than simply granting or revoking access, different users can have different types of access to the same resource. Permissions are tightly constrained based on multiple conditions, and those conditions incorporate different types of data: roles, relationships, attributes, etc.
FGA is more secure than other authorization models because of its flexibility and specificity.
It’s harder to develop and operate applications that incorporate FGA.
Don’t introduce extra complexity until you need it. If your authorization logic only relies on roles, then stick with RBAC. When you need to combine elements of multiple models to make an authorization decision, you need FGA. Some examples of features that require FGA include:
When building features that require detailed control over user access, start incorporating Fine-Grained Access (FGA) into your authorization model. This way, you can gradually expand to full FGA as your needs grow, without having to completely overhaul your system later on.
The Polar language provided by Oso Cloud can model the complex logic that FGA demands. It also provides simple workflows for RBAC and ReBAC, so you can express all of your logic in a natural syntax. You can build an initial policy based on simple RBAC rules, and extend the policy with ReBAC and ABAC elements over time. This makes FGA policies in Oso Cloud easy to develop, understand, and maintain.
Oso Cloud can use data from your application databases and from external sources. You can keep that data in your local databases, centralize it in Oso Cloud, or pass it to Oso Cloud at request time. This lets you write FGA policies that incorporate information from disparate sources without the need for a convoluted data management process.
As you move into production, the testing and troubleshooting tools that Oso Cloud provides give you confidence that your policy does what you intend it to do. You can add complexity without wondering whether you broke any existing logic. Because your policy is code, you can quickly iterate on it if your tests catch an error or roll it back to a previous state if you do identify an anomaly in production.
Oso Cloud is free to get started – try it out. If you’d like to learn more about building Fine-Grained Authorization with Oso Cloud or just talk authorization with us, come say hi on Slack.