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

FT: Auth v4 route #37

Merged
merged 1 commit into from
Feb 16, 2016
Merged

FT: Auth v4 route #37

merged 1 commit into from
Feb 16, 2016

Conversation

LaureVergeron
Copy link

No description provided.

@vrancurel vrancurel added this to the Beta Release milestone Feb 15, 2016
@vrancurel
Copy link
Contributor

👍

assert(typeof accessKey === 'string' && accessKey !== '',
'accessKey is required');
assert(typeof region === 'string' && accessKey !== '',
'region is required');

Choose a reason for hiding this comment

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

You're doing two assert for the accessKey parameter, I think the second is useless (done just before), or you mean region instead.

@adrienverge
Copy link
Contributor

Please do like this: https://github.com/scality/vaultclient/blob/931d36e/lib/IAMClient.js#L185-L187
to avoid the bug we had these last days ;)

accessKey,
region,
scopeDate } };
data[requestUidKey] = options.reqUid;

Choose a reason for hiding this comment

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

You could put it in the object creation just before.
Nevermind, after reading @adrienverge comment, I get it.

Copy link
Contributor

Choose a reason for hiding this comment

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

No she couldn't, because there's a trick ;)

It's not data.requestUidKey, it's data[requestUidKey] (i.e. data['x-scal-xxx'])

Choose a reason for hiding this comment

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

Thank's, didn't see that :)

* @param {IAMClient~requestCallback} callback - callback
* @returns {undefined}
*/
verifySignatureV4(string, signature, accessKey, region, scopeDate, options,
Copy link
Contributor

Choose a reason for hiding this comment

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

why not named it stringToSign ?

Copy link
Author

Choose a reason for hiding this comment

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

For no valid reason - updated

@LaureVergeron
Copy link
Author

@adrienverge : done, thanks for finding it!

@ThibaultRiviere
Copy link
Contributor

👍

@adrienverge
Copy link
Contributor

Once you've fixed the problem at line 211 (pointed by @MathieuCassagne) it will be good for me.

@LaureVergeron
Copy link
Author

@adrienverge : I reckon it's fixed already, no?
EDIT: no, sorry, read wrong line

@LaureVergeron
Copy link
Author

@adrienverge @MathieuCassagne : fixed line, I did mean region, thanks for spotting

* Verify AWS request signature using V4 auth (contrary to v2, hash is
* always sha256)
*
* @param {string} stringToSign - string to sign as built from the request
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for waking up late, but I don't agree with @ThibaultRiviere.

verifySignatureV2() uses string, why not being consistent and change the var name? Moreover, it's not a string to sign but a string to verify.

Could you switch it back? (Once again, sorry for saying this 3 min too late).

Copy link
Author

Choose a reason for hiding this comment

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

Actually, Thibault's point makes sense: in AWS IAM / permissions , this is called the stringToSign accross documentation... the right thing to do would be to update v2, but that's a different P, I guess?
The reason it was called string is because of consistency with v2, but consistency with an ambiguous nomenclature isn't worthwile, is it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for explaining the reason, this is a very good reason indeed. In this case V2 will have to be fixed, yes -- but later is fine for me. :)

Copy link
Author

Choose a reason for hiding this comment

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

You're welcome :)
#38 :)

@adrienverge
Copy link
Contributor

Thanks @LaureVergeron 👍

@MathieuCassagne
Copy link

👍

LaureVergeron pushed a commit that referenced this pull request Feb 16, 2016
Implement authentication V4 signature verification route
@LaureVergeron LaureVergeron merged commit 11c3176 into master Feb 16, 2016
region,
scopeDate } };
if (options.reqUid !== undefined) {
data[requestUidKey] = options.reqUid;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity: which bug does this solve?

Copy link
Contributor

Choose a reason for hiding this comment

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

Something about req.setHeader(key, value) complaining about an undefined value.

@ghost ghost deleted the FT/authV4-2 branch February 16, 2016 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants