-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add optional access control to API #965
Conversation
8e4b23b
to
85d8ff1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #965 +/- ##
==========================================
+ Coverage 52.16% 53.06% +0.90%
==========================================
Files 100 101 +1
Lines 5590 5661 +71
==========================================
+ Hits 2916 3004 +88
+ Misses 2428 2408 -20
- Partials 246 249 +3 ☔ View full report in Codecov by Sentry. |
85d8ff1
to
29a32bb
Compare
@djjuhasz @mcantelon @sevein @sbreker While this is still a work in progress and I'm working in a document explaining the existing OIDC implementation, I think there is enough information in this PR description and in code for you to see where this is going and provide some initial feedback. I'd appreciate if you can take a look when you have some time. It will be better if you review each commit individually, they have a detailed message (the same as in the PR description), and also check the TODO section. Thanks! |
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.
@jraddaoui this looks great to me, thanks for all the work! 🙇 I like the way ABAC rules are specified and checked, and adding access attributes seems easy now that you've set up the system.
I added a bunch of questions and some minor suggestions, but nothing that I see as a blocker.
Thanks @djjuhasz! I addressed most of your feedback, I'll ping you for another review after adding all the scopes we discussed yesterday and some of the dashboard TODOs. |
401b521
to
9197388
Compare
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.
Looks good! I've added a few minor observations.
Follow-up work that may or may not happen in this pull request.
I'm leaning towards "may not" here. Smaller pull requests are generally better!
This looks amazing @jraddaoui! 🤩 I do not have anything to add beyond the others' comments. Thanks for your efforts with this! I agree that follow-on work might work best as a second PR after this is merged... |
5b0cf03
to
8eb2d4d
Compare
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.
LGTM! 👍
@jraddaoui I tried testing the authentication out locally, but I'm getting an "NS_ERROR_UNKNOWN_HOST" error from keycloak when I click the Enduro Dashboard "Sign In" button. The only config change I made was to change |
@jraddaoui nevermind, I forgot to add keycloak to my |
After updating my When I tried to process a SIP, I got an error in the upload activity though:
It's possible the error is unrelated to your changes, but I've never seen it before. |
Thanks @djjuhasz! That's totally related to these changes, I fixed that issue in the tests, but I thought the service was created differently in the main functions. Will fix! |
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.
Does the order you add the endpoints to the client effect authentication?
No, it doesn't. That was just a cosmetic commit:
|
Dex allowed us to implement OIDC authentication in front of an OpenLDAP instance in the development environment. However, it does not provide the IAM tools to manage access control in Enduro. - Remove Dex and OpenLDAP from the Kubernetes environment. - Add Keycloak to the environment: - Use development server. - Listen in `7470` to avoid collisions. - Import a custom `enduro` realm with: - Clients for Enduro, Temporal and MinIO. - Minimal OIDC built-in scopes. - Custom client scopes for Enduro and Minio. - Custom user attributes and claims mapped to those scopes. - Add three default users with different sets of attributes. - Without persistence to recreate the custom realm on each start. - Update docs to use `keycloack` instead of `dex` in `/etc/hosts`. - Update access section to indicate new credentials and service. - Set up MinIO and Temporal to SSO with Keycloack. - Update default Enduro configuration to work with Keycloack. - Remove `offline_access` from the requested scopes (a following commit/PR will make scopes configurable). - Update Pulumi project and related Github action. - Add TODO note in dashboard to end sessions in the provider.
Optionally enable Attribute Based Access Control (ABAC) in the API. When enabled, the API will look for a custom claim in the access token and extract the attributes relevant to Enduro. If a custom scope needs to be requested to get that claim, it has to be configured in the dashboard. - Add OIDC ABAC configuration. Allows to enable or disable access control entirely and set a claim to get the attributes. That claim could be nested and include values unrelated to Enduro. - Extend claims and token verifier to parse ABAC attributes from the access token based on configuration. - Allow custom scopes in dashboard and configure it to work with the Keycloak instance for the dev. env. by default. - Add scopes, forbidden error and security to all endpoints in Goa's API design. - Check scopes against attributes in API requests. As a first access control check, the scopes configured on the API design need to be included in the user attributes. - This check allows attributes with wildcards, so: - `package:read` will only provide access to that action(s). - `package:*` will provide access to all package related actions. - `*` will provide full access to all actions. - Add claims with the extracted attributes to the context on each request. After that initial check is passed, the claims are included in the context to make them available for other possible access control checks on the endpoints implementation. - Re-order API design methods in storage service: - Keep locations and packages methods together. - Move `submit` to indicate `update` is related to that method and not to `create`.
c7322c3
to
673c572
Compare
Refs #957.
Use Keycloak instead of Dex in dev env
Dex allowed us to implement OIDC authentication in front of an
OpenLDAP instance in the development environment. However, it
does not provide the IAM tools to manage access control in Enduro.
7470
to avoid collisions.enduro
realm with:keycloack
instead ofdex
in/etc/hosts
.offline_access
from the requested scopes (a followingcommit/PR will make scopes configurable).
Add optional access control to API
Optionally enable Attribute Based Access Control (ABAC) in the API. When
enabled, the API will look for a custom claim in the access token and
extract the attributes relevant to Enduro. If a custom scope needs to be
requested to get that claim, it has to be configured in the dashboard.
control entirely and set a claim to get the attributes. That claim
could be nested and include values unrelated to Enduro.
access token based on configuration.
Keycloak instance for the dev. env. by default.
API design.
control check, the scopes configured on the API design need to be
included in the user attributes.
package:read
will only provide access to that action(s).package:*
will provide access to all package related actions.*
will provide full access to all actions.request. After that initial check is passed, the claims are included
in the context to make them available for other possible access
control checks on the endpoints implementation.
submit
to indicateupdate
is related to that methodand not to
create
.TODO
Follow-up work that may or may not happen in this pull request.
now when access control is enabled) [done].
now the landing page is the packages list.
explaining the current behavior.
configuration.
Note: moving to a BFF auth. flow could simplify some of these changes
and documentation, but that won't happen in this PR.