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

'AWS Signer SigV4A Headers' unit test failing #491

Closed
langhorstg316 opened this issue Oct 10, 2023 · 9 comments
Closed

'AWS Signer SigV4A Headers' unit test failing #491

langhorstg316 opened this issue Oct 10, 2023 · 9 comments
Labels
bug This issue is a bug. p1 This is a high priority issue

Comments

@langhorstg316
Copy link

Describe the bug

I was testing the SigV4A signing examples from https://github.com/aws-samples/sigv4a-signing-examples and kept receiving the following credential error.

image

I then cloned this repo and ran the unit tests with "npm run test" and saw the same credentials error was occurring with the unit test.

image

I am running the latest macOS: 14.0 (23A344). I tried to debug it with vs code but the issue is in the c code. Any obvious areas to look or purge like keychain, some local aws cache, etc? I just have the standard default profile configured in ~/.aws/credentials and config.

Expected Behavior

I expect to see the signed headers returned.

Current Behavior

Failing on 'AWS Signer SigV4A Headers' unit test

Reproduction Steps

  • Clone the repo
  • Follow build instructions
  • Run npm test

Possible Solution

No response

Additional Information/Context

No response

aws-crt-nodejs version used

1.18

nodejs version used

20.*

Operating System and version

macOS 14.0 (23A344)

@langhorstg316 langhorstg316 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 10, 2023
@bretambrose
Copy link
Contributor

You could enable trace logging (https://github.com/awslabs/aws-crt-nodejs/blob/main/lib/native/io.ts#L87) and attach the log for that particular test.

That being said, we do not have any access to Sonoma at present for testing purposes and I don't have an ETA when we would.

@langhorstg316
Copy link
Author

I enabled logging with level TRACE. Nothing was captured for that specific test. Saw plenty of trace outputs for the other tests in auth.spec.ts.

image

@langhorstg316
Copy link
Author

In addition, I see the following output from macOS unified logger.

image

@bretambrose
Copy link
Contributor

Try modifying the test so that it swallows the error and doesn't fail. For me, I get:

[INFO] [2023-10-10T18:06:55Z] [00007ff846e5d700] [AuthCredentialsProvider] - (id=0x6000027db3f0) Static credentials provider successfully sourced credentials
[INFO] [2023-10-10T18:06:55Z] [00007ff846e5d700] [AuthSigning] - (id=0x600000addef0) Signing successfully built canonical request for algorithm SigV4Asymmetric, with contents 
GET
/

host:example.amazonaws.com
x-amz-date:20150830T123600Z
x-amz-region-set:us-east-1

host;x-amz-date;x-amz-region-set
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
[INFO] [2023-10-10T18:06:55Z] [00007ff846e5d700] [AuthSigning] - (id=0x600000addef0) Signing successfully built string-to-sign via algorithm SigV4Asymmetric, with contents 
AWS4-ECDSA-P256-SHA256
20150830T123600Z
20150830/service/aws4_request
cf59db423e841c8b7e3444158185aa261b724a5c27cbe762676f3eed19f4dc02
[INFO] [2023-10-10T18:06:55Z] [00007ff846e5d700] [AuthSigning] - (id=0x600000addef0) Http request successfully built final authorization value via algorithm SigV4Asymmetric, with contents 
AWS4-ECDSA-P256-SHA256 Credential=AKIDEXAMPLE/20150830/service/aws4_request, SignedHeaders=host;x-amz-date;x-amz-region-set, Signature=3044022011ba5a1e8d5d0459b4a29db48e6948158dc29ba0476319578d6d50f74c1aec92022001b3fbece96f58b6e423f8fd19376a2e3f8032eb12bd8166d43bc37e91747dc4

@bretambrose
Copy link
Contributor

bretambrose commented Oct 10, 2023

Seems likely that something is failing in here that does not fail for any versions < 14:

https://github.com/awslabs/aws-c-cal/blob/main/source/darwin/securityframework_ecc.c

@jmklix jmklix added p1 This is a high priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Oct 10, 2023
@TingDaoK
Copy link
Contributor

TingDaoK commented Oct 16, 2023

Thanks for reporting the issue. The latest version https://github.com/awslabs/aws-crt-nodejs/tree/v1.18.1, with the fix just released. It should be available from npm soon.

The fix is here for visibility

@TingDaoK
Copy link
Contributor

Okay, the latest version is available now, can you try it out and let us know if you still have any issue?

@langhorstg316
Copy link
Author

Just updated and tested. Worked as expected. Amazing work and response time!

@jmklix
Copy link
Member

jmklix commented Oct 18, 2023

I'm glad this fix worked for you, let us know if you run into any other problems with this repo.

@jmklix jmklix closed this as completed Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p1 This is a high priority issue
Projects
None yet
Development

No branches or pull requests

4 participants