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

Make invalidating CLI secrets feature optional #14172

Open
j-zimnowoda opened this issue Feb 4, 2021 · 6 comments
Open

Make invalidating CLI secrets feature optional #14172

j-zimnowoda opened this issue Feb 4, 2021 · 6 comments
Assignees
Labels
area/oidc kind/requirement New feature or idea on top of harbor

Comments

@j-zimnowoda
Copy link

Hi community,
I would like to share some thoughts about using CLI secret when OIDC is enabled and possible enhancements.

Is your feature request related to a problem? Please describe.
It often happens that CLI secret gets invalidated after JWT expiries.
I understand that by harbor's design, JWT is a single source of truth, thus CLI secrets gets invalidated if JWT is invalidated.

Anyway, I do not consider this as a security enhancement, because the same CLI secret can be used just after JWT is refreshed. Once an intruder obtains CLI secret, he just need to wait, until a user is logged in, so a new JWT becomes valid, so he can use the same CLI secret.

The OIDC login to harbor UI and registry login methods are two totally different ways of user authentication and in my opinion should not depend on each other.

This design is also source of unclear issues, because docker registry does not inform a user about need of refreshing the JWT. It just claims about Error response from daemon: Get https://<domain>/v2/: unauthorized: authentication required. This message is not actionable and a user is not able to come up with the solution.

Describe the solution you'd like
Companies should be able to define if they want CLI secrets to get invalidated together with JWT or not.
There should be a flag that allows to switch on/off this feature.

@j-zimnowoda j-zimnowoda changed the title Make invalidating CLI secrets optional Make invalidating CLI secrets feature optional Feb 4, 2021
@bitsf bitsf added the kind/requirement New feature or idea on top of harbor label Feb 8, 2021
@reasonerjt
Copy link
Contributor

IMO, the CLI secret SHOULD depends on the validity of ID token, otherwise if the user is removed from IDP the CLI still can be used.

If we make the disconnection, the IDP admin invalidate a user in the IDP, the user can no longer login to Harbor portal or access API but he can still use the CLI secret to pull/push artifacts.

This error Get https://<domain>/v2/: unauthorized: authentication required is hard-coded in docker, and on Harbor side we can only know the token associate with CLI secret is no longer valid.

@Morriz
Copy link

Morriz commented Feb 25, 2021

So can we at least be told how to work with this? Default TTL for a JWT is usually suggested to be 60 seconds. This is not problematic as dependent parts would just use the provided refresh token and get a new valid access token. Why is this problematic for harbor? Is harbor not transparently refreshing it's access token when docker client uses this secret? That would break the promise of OIDC imo.

@j-zimnowoda
Copy link
Author

IMO, the CLI secret SHOULD depends on the validity of ID token, otherwise if the user is removed from IDP the CLI still can be used.

If we make the disconnection, the IDP admin invalidate a user in the IDP, the user can no longer login to Harbor portal or access API but he can still use the CLI secret to pull/push artifacts.

This error Get https://<domain>/v2/: unauthorized: authentication required is hard-coded in docker, and on Harbor side we can only know the token associate with CLI secret is no longer valid.

Thank for reply. I understand your reasoning but this hybrid solution results in quite ambiguous errors. Would it be possible to use OAuth2 mechanism for docker registry: https://docs.docker.com/registry/spec/auth/token/ ?

@reasonerjt
Copy link
Contributor

@Morriz Under the hood Harbor does try to refresh the token when verifying the CLI secret.

@j-zimnowoda could you elaborate the solution? I don't think this works with regular OIDC providers out of the box.

@Morriz
Copy link

Morriz commented Mar 17, 2021

@Morriz Under the hood Harbor does try to refresh the token when verifying the CLI secret.

Isn't it strange then that we don't see a refreshed session when executing docker commands? It seems as if harbor code does not ask for a token refresh after the initial docker login. Subsequent docker commands seem to not trigger a refresh.

@github-actions
Copy link

github-actions bot commented Jul 5, 2022

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

@github-actions github-actions bot added the Stale label Jul 5, 2022
@stonezdj stonezdj removed the Stale label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oidc kind/requirement New feature or idea on top of harbor
Projects
None yet
Development

No branches or pull requests

6 participants