Skip to content
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: add client API key authentication #8522

Closed
wants to merge 2 commits into from

Conversation

DeepDiver1975
Copy link
Member

@DeepDiver1975 DeepDiver1975 commented Feb 23, 2024

Description

implements #8515

Related Issue

Motivation and Context

SSO is great until it sucks ....

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Copy link

update-docs bot commented Feb 23, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

Copy link
Contributor

@rhafer rhafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Cool to see some traction here! I am just a bit leery about using the machine auth provider for this.

return nil, false
}

_, token, err := m.UserProvider.GetUserByClaims(r.Context(), "userid", clientAPIKeyRecord.UserId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'd rather prefer not use the machine authprovider to generate the reva token here. Ideally we would have a separate auth manager in reva to handle the api keys.

IMO the machine authprovider is a crutch and we should get away from using it.

BTW there is already the appauth manager in reva (https://github.com/cs3org/reva/blob/edge/pkg/auth/manager/appauth/appauth.go) which seems to serve a similar purpose. Maybe we can use that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@butonic @rhafer let's try to find a time slot tomorrow to discuss this ... or when ever time permits ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW there is already the appauth manager in reva (https://github.com/cs3org/reva/blob/edge/pkg/auth/manager/appauth/appauth.go) which seems to serve a similar purpose. Maybe we can use that?

there is currently only one implementation which stores the password in a json file - https://github.com/owncloud/ocis/blob/afc6ed1e416c8c1abef832df3e6912b7487cccbd/vendor/github.com/cs3org/reva/v2/pkg/appauth/manager/json/json.go

And ... oh lord ... so many layers 🤯 .... what happened to the good old KISS approach ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I miss anything: in case the final implementation of this feature lives within reva it requires a grpc call which somehow violates the dos mitigation requirement as described in the ADR #8515 ......

@butonic
Copy link
Member

butonic commented Mar 1, 2024

@DeepDiver1975 @rhafer @micbar implementing the CS3 auth api with our auth services would require adding another service:

auth services drawio

I think we should implement the client api key feature as a middleware like in this PR. In a subsequent PR we should align the auth services. Either move all behind the CS3 gateway, or use middlewares directly in the proxy. Then we can omit starting dedicated auth services until we open up the CS3 for external requests.

@mmattel
Copy link
Contributor

mmattel commented Mar 1, 2024

@DeepDiver1975 you need to add some explaining text to the proxy readme.md

@DeepDiver1975 DeepDiver1975 force-pushed the feat/middleware-client-api-keys branch from fb0484f to 9760ec6 Compare March 1, 2024 17:02
@DeepDiver1975
Copy link
Member Author

@DeepDiver1975 you need to add some explaining text to the proxy readme.md

see 9760ec6

Copy link

sonarcloud bot commented Mar 1, 2024

@DeepDiver1975 DeepDiver1975 deleted the feat/middleware-client-api-keys branch March 11, 2024 10:49
@DeepDiver1975 DeepDiver1975 restored the feat/middleware-client-api-keys branch April 25, 2024 10:41
@DeepDiver1975 DeepDiver1975 reopened this Apr 25, 2024
@DeepDiver1975 DeepDiver1975 force-pushed the feat/middleware-client-api-keys branch from 9760ec6 to 6f46a99 Compare April 25, 2024 10:42
@DeepDiver1975 DeepDiver1975 force-pushed the feat/middleware-client-api-keys branch from 6f46a99 to a96dc54 Compare April 25, 2024 10:51
Copy link

sonarcloud bot commented Apr 25, 2024

@micbar
Copy link
Contributor

micbar commented May 3, 2024

@DeepDiver1975 @butonic @rhafer

We decided to keep the scope clean. This PR is needed for migration purposes, where a super-powered admin user needs to impersonate all users with unlimited scope for migration purposes.

This should

  • Not run on production or public instances by default
  • Only serve the migration purpose

Other use cases like personal app tokens are tracked in another context. #7711 (comment)

@DeepDiver1975
Copy link
Member Author

This PR is needed for migration purposes, where a super-powered admin user needs to impersonate all users with unlimited scope for migration purposes.

This PR was intended to implement the ADR-30 and to be used for e.g. #8357 and the migration service as started in #8463

We have to see how we move on with the ADR and the existing app auth manager in reva. This all collides somehow.

@micbar micbar mentioned this pull request May 6, 2024
16 tasks
@rhafer rhafer mentioned this pull request May 7, 2024
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants