-
Notifications
You must be signed in to change notification settings - Fork 393
AWS: ensure request parameters are sent with generate_credentials #403
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
Conversation
The JSON body is not read on GET requests, we either need to POST or pass the arguments as query parameters.
The documentation doesn't explicitly call out POST as an accepted method: https://www.vaultproject.io/api/secret/aws/index.html#generate-credentials. I haven't dug into much, but given the premise and the current upstream documentation, shouldn't we just change the |
Yeah, unfortunately the docs aren't super consistent as the AWS secret engine documentation uses Either way works for me though, so I'm happy to adhere to their API documentation. |
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! I had one comment on the test case update that I'll give you a chance to provide feedback on but I feel like this is a good change to merge in regardless. 👍
@@ -254,11 +254,16 @@ def test_read_role(self, label, configure_first=True, raises=None, exception_mes | |||
d1=json.loads(read_role_response['data']['policy']), | |||
d2=self.TEST_POLICY_DOCUMENT, | |||
) | |||
else: | |||
elif 'credential_types' in read_role_response['data']: |
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 don't have any issue with working around the credential_type
/ credential_types
change in this secrets engine in this manner, but another option would be to go off the Vault version being tested against. E.g.:
key_name = 'credential_types' if vault_version_lt('1.0.0') else 'credential_type'
self.assertEqual(
first=read_role_response['data'][key_name],
second=['iam_user'],
)
I like that route because it makes things a bit more explicit. What do you think?
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.
Sure! Changed and added a link to the corresponding vault commit.
Also for what it is worth, I would be fine with the originally proposed change to a POST method or with the current changes (now that you've done my due diligence in verifying a POST should work just as well 😄). |
GET works for me. I sort of understand the semantics of using a POST for this endpoint (creating credentials, ...), but for some reason it still makes more sense as a read. |
* Generate credentials updated to a post request.
The JSON body is not read on GET requests, we either need to POST or
pass the arguments as query parameters.