-
Notifications
You must be signed in to change notification settings - Fork 216
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
AGENT-949 AGENT-951: Add new authz handler and swagger security defn. #6784
base: master
Are you sure you want to change the base?
AGENT-949 AGENT-951: Add new authz handler and swagger security defn. #6784
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pawanpinjarkar The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@pawanpinjarkar: This pull request references AGENT-951 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
0a96eb3
to
07ae8c0
Compare
/cc @carbonin |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6784 +/- ##
==========================================
- Coverage 68.71% 68.64% -0.08%
==========================================
Files 249 250 +1
Lines 37440 37494 +54
==========================================
+ Hits 25727 25737 +10
- Misses 9414 9458 +44
Partials 2299 2299
|
/test edge-subsystem-kubeapi-aws |
1 similar comment
/test edge-subsystem-kubeapi-aws |
So this looks okay, but is it really what you want to do? As far as I can tell this just adds another way to provide the same token, so you're not really adding any additional security because someone with that token could provide it using a different header and still use other endpoints. For this to actually achieve authorization you'd need to issue separate tokens that have some kind of claim that identifies them as read-only. Then in the token verification process somewhere ensure that a read-only token is only valid for the endpoints it's assigned to. |
yes, so my plan is to have the swagger changes from this PR. Then in a different PR, implement a new authz handler in assisted service for ABI and update the installer to create 3 seperate tokens. Code changes from all the 3 PRs then will do the intended operation. |
I think it would be fine to add the authz stuff in this same PR. It gives context that makes these changes worthwhile. Also I wouldn't want to have to go back and change the swagger again if we run into issues later with the next patch. |
07ae8c0
to
ef40248
Compare
@pawanpinjarkar: This pull request references AGENT-949 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. This pull request references AGENT-951 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
ef40248
to
ac696d0
Compare
@pawanpinjarkar: This pull request references AGENT-949 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. This pull request references AGENT-951 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
6431f47
to
994bf61
Compare
994bf61
to
8dec3f8
Compare
return common.NewApiError(http.StatusInternalServerError, fmt.Errorf("claims error: %s", err)) | ||
} | ||
|
||
authClaim, ok := claims["sub"].(string) |
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.
If this is meant to match the scheme I wouldn't use sub
as it doesn't really fit and sub
has a documented meaning (ref: https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.2)
You can review all public claim names at https://www.iana.org/assignments/jwt/jwt.xhtml#claims
I'd say make a claim called auth_scheme
to be explicit here.
return common.NewApiError(http.StatusBadRequest, fmt.Errorf("token missing authClaim or endpoint is missing authScheme")) | ||
} | ||
if authClaim != authScheme { | ||
return common.NewInfraError(http.StatusForbidden, fmt.Errorf("authClaim %s is unauthorized to access. authScheme =%s", authClaim, authScheme)) |
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.
I think this error is visible to the user so maybe make this a bit more user-friendly, or remove some of this debug-like info.
watcherAuth: | ||
type: apiKey | ||
in: header | ||
name: Watcher-Authorization | ||
|
||
security: | ||
- userAuth: [admin, user] |
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.
I also think this might be the slightly more idiomatic way of achieving what we're doing with an additional security definition, but I don't see much real upside to putting this in the roles rather than a separate definition.
If you want to investigate it, then go ahead, but I won't hold the PR up for it.
@pawanpinjarkar: This pull request references AGENT-949 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. This pull request references AGENT-951 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
- Read USER_AUTH_TOKEN - Implememnt a new authorization handler agent_local_authz_handler - Implement new security definition AuthWatcherAuth
…K8sAPI. Simplify claims parsing for authzr
9b5422d
to
6404360
Compare
@pawanpinjarkar: This pull request references AGENT-949 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. This pull request references AGENT-951 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
@pawanpinjarkar: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
The agent-based installer needs a new security definition to perform the read-only operations for the user persona
watcher
. The agent-based installer commands such aswait-for
andmonitor
internally use the read-only personawatcher
which can only make read requests to the endpoints annotated withwatcherAuth
security definition.Other existing authenticators do not support this agent-based installer specific
watcherAuth
security definition.List all the issues related to this PR
What environments does this code impact?
How was this code tested?
Tested locally with dev-scripts using the installer PR AGENT-950: Implement Separate JWT Tokens for Different User Personas installer#9039
Checklist
docs
, README, etc)Reviewers Checklist