-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Authz #3008
feat: Authz #3008
Conversation
feat: impl authz middleware feat: impl authz middleware chore: fix panic and bad redux selector chore: fmt ui chore: refactor chore: fix build, change to single role, default role chore: fix build, change to single role, default role chore: rm unneeded files feat: configurable roles/policies chore: config schema and tests chore: mv back events to audit package chore: reset ui folder chore: revert ui back to main chore: policy schema, visibility of errors chore: add policy schema test chore: rebase on main Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
* chore: fix tests, add role attribute path / role mapping to oidc server tests Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: authz middleware tests Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: fix audit tests Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: proto regen Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: try to fix marshal audit events behaviour Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: fix failing test Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> --------- Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
chore: refactor request models to include scope
…3108) * refactor(server/authz): rename scope to resource Signed-off-by: George MacRorie <me@georgemac.com> * feat(config/authz): add policy and data source configuration Signed-off-by: George MacRorie <me@georgemac.com> * refactor(server/authz): make policy and data external dependencies Signed-off-by: George MacRorie <me@georgemac.com> * refactor(cmd/grpc): integrate new authz Engine changes Signed-off-by: George MacRorie <me@georgemac.com> * fix(server/authz): ensure error is captured in return Signed-off-by: George MacRorie <me@georgemac.com> * fix(config): allow policy and data sources to be empty Signed-off-by: George MacRorie <me@georgemac.com> * refactor(server/authz): support separate poll durations for policy and data Signed-off-by: George MacRorie <me@georgemac.com> * fix(config): validate non zero poll duration for authz sources Signed-off-by: George MacRorie <me@georgemac.com> * fix(cmd/grpc): calls to authz engine with changes to polling Signed-off-by: George MacRorie <me@georgemac.com> --------- Signed-off-by: George MacRorie <me@georgemac.com>
…3126) Signed-off-by: George MacRorie <me@georgemac.com>
I'll just add that; while there are limitations with OIDC providers r.e. doing the role management on the IdP itself, you can always express role mappings in the Rego data. Ultimately this is an email to permissions mapping directly in the data payload. Doesn't necessarily need to include roles, but roles and mappings in the data can be expressed for readability and DRYing up the definitions. The Rego/OPA Playground demonstrates this if you choose the RBAC scenario.
Then the policy itself knows to perform the mapping from auth email to granted permissions. |
* chore: go mod tidy Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: set raw claims if they exist in authz metadata Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: fix authn oidc server test Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: skip authz on auth public server Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: log for debugging Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> --------- Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
* chore: go mod tidy Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * fix: authz endpoint skip for getauthself/deleteauthself Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: rm claims unmarshal for now * chore: make authorization experimental Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: add request methods to auth requests Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> * chore: add schema * chore: set package name to flipt.authz.v1 * chore: fix telemetry test Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> --------- Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
cc @smittysmee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. There is one bit of go fmting left I think. Otherwise, good to go.
This adds authz to Flipt using Open Policy Agent for both the 'language' used to define the authz policies as well as the enforcement library.
I think that using OPA in this way continues with Flipt's ethos of:
What/How
This will allow users to enable authz and configure their own policies/data in order to use existing authentication data to enforce authz.
Each API request to Flipt that is to be authorized (management API only) is annotated with a
namespace
,resource
,subject
andaction
similar to our already existing audit events.The authz policies configured by operators enforce what requests are allowed given:
Our existing audit events were changed to use these new
request
types as well, since they map 1-1 to audit events that we already publish.Configurability
The goal is to allow operators to define their own policy rules via Rego as well as provide optional 'data' that can be used in these policies (think static mapping of user emails to roles, groups, or departments).
Currently, policies and data can only be read from the local filesystem, however, in the near future we aim to include support for:
Mapping Authn to Authz
A key aspect of this functionality is the mapping of authentication to authorization.
Most OIDC providers have the notion of roles and allow enriching the tokens they create with custom attributes such as roles.
OIDC Providers:
In our docs PR, I have written a guide demonstrating how to map a user to a role using Keycloak, that can then be enforced by a policy in Flipt using OPA.
We will likely need more documentation and examples on writing policies in the future.
We have also chosen to make this functionality 'experimental' until we add extensive integration tests and have had the ability to get it in user's hands and garner feedback.
cc @piclemx @erka @GeorgeMac