News for hackers. Stuff that matters.
Re:Show HN: RBAC for your REST API in 2 minutes by troydavis on Tuesday March 01, 2022 @10:56AM (#30515666)
Re:Show HN: RBAC for your REST API in 2 minutes by ogazitt on Tuesday March 01, 2022 @11:12AM (#30515934)
This was meant to be a "Show" of an unauthenticated experience (i.e. no account required) for creating OPA policies, different than the thread you referenced (which linked a public beta blog post).
Re:Show HN: RBAC for your REST API in 2 minutes by yodon on Tuesday March 01, 2022 @01:46PM (#30518221)
Thanks for the link to that post - unusually good discussion on that page (even for HN)
Re:Show HN: RBAC for your REST API in 2 minutes by ogazitt on Tuesday March 01, 2022 @10:32AM (#30515354)
Authorization is a must-have for every application, but most teams have to build it from scratch. The Open Policy Agent [0] is a good place to start for creating an OSS-based solution, but you still need to build a lot of stuff yourself.

The Aserto playground [1] lets you import your REST service’s openapi.json spec and automatically generates a permissions for each operation. You can assign these permissions to one or more roles (viewer, editor, admin, or create your own). Export the project to get your OPA policy for your REST service.

You can also try it out with the Petstore API [2]. Click the “Start Tour” button for a guided tour.

Would love feedback on how to make this better!

[0] https://openpolicyagent.org

[1] https://aserto.com/playground

[2] https://petstore3.swagger.io/api/v3/openapi.json

Re:Show HN: RBAC for your REST API in 2 minutes by itsronenh on Tuesday March 01, 2022 @10:55AM (#30515656)
Do package names have to match API routes? Can I create a policy that is shared by multiple endpoints?
Re:Show HN: RBAC for your REST API in 2 minutes by gertd on Tuesday March 01, 2022 @10:57AM (#30515673)
Technically names do not have to match, but it certainly makes it easier if you have a pattern to rely on when injecting authorization into a middleware layer.
Re:Show HN: RBAC for your REST API in 2 minutes by ogazitt on Tuesday March 01, 2022 @11:00AM (#30515731)
By convention, we generate a package for every API definition in the OpenAPI spec. But the calling application can decide which package to use when authorizing an operation, so you can use a single policy for multiple endpoints.
Re:Show HN: RBAC for your REST API in 2 minutes by itsronenh on Tuesday March 01, 2022 @11:04AM (#30515802)
So this is basically a tool for generating and testing Rego policies from an OpenAPI spec. Very cool!
Re:Show HN: RBAC for your REST API in 2 minutes by gertd on Tuesday March 01, 2022 @10:59AM (#30515703)
Endpoint wise you can have N.
Re:Show HN: RBAC for your REST API in 2 minutes by yodon on Tuesday March 01, 2022 @01:44PM (#30518180)
Does your k8s sidecar approach work with https://dapr.io sidecars?
Re:Show HN: RBAC for your REST API in 2 minutes by rschwabco on Tuesday March 01, 2022 @10:59AM (#30515717)
What can I do with policies I create in this playground?
Re:Show HN: RBAC for your REST API in 2 minutes by ogazitt on Tuesday March 01, 2022 @11:03AM (#30515789)
You can use the OPA CLI [0] or the policy CLI [1] to build and run the policies.

[0] https://www.openpolicyagent.org/docs/edge/cli/#opa-build

[1] https://github.com/opcr-io/policy