Module: Datadog::AppSec::DefaultHeaderTags Private
- Defined in:
- lib/datadog/appsec/default_header_tags.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Sets the always-on span tags built from a fixed allowlist of request and response headers.
NOTE: Unlike Event.record, which reports request headers only when a security event fires, these are tagged on every request/response
Constant Summary collapse
- REQUEST_HEADERS_TAGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
NOTE: Contains additional WAF vendor headers
%w[ accept content-type user-agent akamai-user-risk x-amzn-trace-id x-cloud-trace-context x-appgw-trace-id x-sigsci-requestid x-sigsci-tags cf-ray cloudfront-viewer-ja3-fingerprint ].freeze
- RESPONSE_HEADERS_TAGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[ content-type content-length content-encoding content-language ].freeze
Class Method Summary collapse
Class Method Details
.tag_request(span, headers) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 |
# File 'lib/datadog/appsec/default_header_tags.rb', line 35 def self.tag_request(span, headers) REQUEST_HEADERS_TAGS.each do |name| value = headers.get(name) span.set_tag("http.request.headers.#{name}", value) if value end end |
.tag_response(span, headers) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 45 46 47 |
# File 'lib/datadog/appsec/default_header_tags.rb', line 42 def self.tag_response(span, headers) RESPONSE_HEADERS_TAGS.each do |name| value = headers.get(name) span.set_tag("http.response.headers.#{name}", value.to_s) if value end end |