-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix: use mount from path parameter given during authn #7
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ab673e0
fix: use mount from path parameter given during authn
austingebauer 8a7b224
fix: use regex for mount path segment matching
austingebauer 4b0bd35
fix: check path segments using url path split
austingebauer b1222fd
fix: format of request-target header and validation
austingebauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm looking for some feedback on this part of the code. The function
requestTargetToMethodURL()
is taking in the(request-target)
header value along with an expected HTTP method and URL path.The function verifies that:
(request-target)
header existsIs there any precedent for this type of verification? It looks like something using https://tools.ietf.org/html/draft-cavage-http-signatures-06#section-2.3 is being done.
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.
This is problematic for this PR as we need to know the mount path segment in
pathLoginUpdate()
to constructfinalLoginPath
for the verification. Using"oci"
as currently in this PR won't work.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.
@vuhphamw Do you have any advice here?
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.
@austingebauer OCI REST API signature signing process requires the header includes (request-target) as described here https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/signingrequests.htm#five
In order to support mount path, we need to somehow pass the mount path to this function and validate the URL path bases on that, i.e.
/auth/mounted-path/login/devRole
. Is there a way to pass the mount path to this method via context or something else?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.
Thanks, @vuhphamw. Makes sense that the header needs to exist in order to comply with OCI API request signing. I don't think we can use a context here. The Vault CLI and other clients (e.g., curl) exercise this API over HTTP.
Is there any specific reason we're validating the value of the
(request-target)
from the POST body inpathLoginUpdate()
instead of just letting OCI API verify the signature? It seems we're currently just checking the(request-target)
value against some constants (path_login.go#L19) in the backend before sending them to the OCI API. Would checking that the(request-target)
value in the POST body be non-empty or a regex suffice?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.
@austingebauer Yes, I think regex is sufficient. Please ensure the target path match
/auth/%s/login/%s
. I believe it was just extra validation to ensure the header has right fields for signing process.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.
@vuhphamw I've updated this PR to use a regex to do the validation. Please have a look and let me know your thoughts.
I kept the actual login role in the regex. The only part of the URL path which has an open pattern is the mount path, which uses the ASCII character class
[[:ascii:]]
. I'm using that character class because of the limitation noted in the /sys/mounts documentation.