startElasticApm()
const s3 = new S3(credentials)
const { Body } = await s3.getObject({ Bucket: 'foo', Key: 'bar' }).promise()
// deal with the Body…
This code works great with apm-agent-nodejs 1.x
Now, when I attempt to update apm-agent-nodejs to 2.x, calls to S3 fail with the following errors:
The request signature we calculated does not match the signature you provided. Check your key and signing method.
Code is the same, credentials are the same (and still valid). I have no clue on how the S3 lib computes the signature internally, but it seems that the apm instrumentation mangles with the request and therefore temper with the signing process.
Hi @Delapouite, welcome to the Discuss forum and thanks for raising this issue.
To support distributed tracing, the agent will automatically add a new HTTP header called elastic-apm-traceparent to all outgoing HTTP requests. My best guess is that this happens after the signature is calculated and that the request therefore fails the signature test.
I'll need to first reproduce this to see if this is in fact what's going on, and then see what can be done to fix it. But unfortunately there's no way around it currently.
This is not the best solution as it only works for the domain s3.amazonaws.com, but until we a more general purpose solution, this should fix your particular problem.
But this got me concern about this header which is now transparently sent to any "external services". It's not that sensitive of an information, but I'm afraid that my colleagues of the security team doing penetration tests will find it a bit worrisome.
For now the s3 regex is hard-coded, but I'm sure that in the short term you plan to add a way to have a configurable white list of domain/host/ips to explicitly decide when to send this header.
We did discuss this on the team previously, but didn't find any security issues with it at the time. If you could elaborate on how this might be an issue, please let us know.
Exactly. I wanted to get this out now to fix your issue, so instead of going through a lengthy process of standardizing this across our different languages, I just put in this quick fix for now.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.