Skip to content

Policy-as-Code Authorization

We decoupled authorization from business logic. Labs64.IO uses Cerbos to evaluate fine-grained, policy-as-code permissions at runtime.

Fine-Grained RBAC

Complex role-based and attribute-based access controls are handled independently from the core microservice logic.

  • A central Cerbos policy decision point evaluates policy. It is not duplicated per module.
  • Roles and attributes are decided outside the service, so modules stay small.
  • Routes that match no known policy fail closed.
Same module, different rolesillustrative
  1. Auth Gateway
  2. Cerbos policy
  3. Module
Customer reads own order200 OK
policy: customers may read their own orders
Customer refunds an order403 Forbidden
policy: refund requires the finance role
Finance refunds an order200 OK
policy: finance may refund

Auditable Policies

Since permissions are defined as code, access rules can be code-reviewed, tested, and audited systematically.

  • A change to who may do what goes through review like any other change.
  • Policies are tested before they ship.
  • Version history shows who changed access, and when.
Permissions as codeprocess
  1. 1
    Write the policyCerbos

    Access rules live in policy files next to the code, not inside each service.

  2. 2
    Code reviewpull request

    A change to who may do what is reviewed like any other change.

  3. 3
    Testautomated

    Policies are tested, so a rule change cannot silently open access.

  4. 4
    Audithistory

    Every rule is versioned, so you can show who changed access and when.

Ready to see how it fits together?

See where Cerbos policy evaluation sits in the request path, alongside the modules it protects.