Added WAF vendors headers in traces tags#3528
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3528 +/- ##
==========================================
- Coverage 98.23% 98.23% -0.01%
==========================================
Files 1275 1275
Lines 75279 75308 +29
Branches 3554 3556 +2
==========================================
+ Hits 73954 73982 +28
- Misses 1325 1326 +1 ☔ View full report in Codecov by Sentry. |
lloeki
left a comment
There was a problem hiding this comment.
LGTM, save for a minor suggestion
There was a problem hiding this comment.
This is a bit unwieldy but it works.
ivoanjo
left a comment
There was a problem hiding this comment.
Note: Please hold off on merging this to master until we get the 1.21.1 release out. (Feel free to dismiss afterwards! Thanks for the patience!)
5e96bc4 to
679f92f
Compare
lloeki
left a comment
There was a problem hiding this comment.
LGTM, just an extra comment left
| Akamai-User-Risk | ||
| ].map(&:downcase).freeze | ||
|
|
||
| # .map { |s| [s.downcase, Datadog::Tracing::Contrib::Rack::Header.to_rack_header(s)] }.to_h |
There was a problem hiding this comment.
Leftover comment, to be removed ;)
| module AppSec | ||
| module Contrib | ||
| module Rack | ||
| # Create an array of lowercased headers |

What does this PR do?
Add WAF vendors headers in traces tags according to this RFC
Motivation:
This will enable the ASM Respond team to parse the value of these headers and check that they are in the correct format
Additional Notes:
I used a hash to access traces-formatted headers and rack-formatted headers at the same time, and this hash is created from a list of string, corresponding to the HTTP-formatted header. Maybe these operations can add overhead time, and manually creating the hash would be faster
How to test the change?
-e 'with WAF vendor headers')run.sh tests/appsec/test_traces.py::Test_ExternalWafRequestsIdentification::test_external_wafs_header_collectionFor Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance.JIRA