Skip to content

Commit 9ffc9ef

Browse files
contrib/httptrace: removed links to internal resources (DataDog#1404)
1 parent 0dfa345 commit 9ffc9ef

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

contrib/internal/httptrace/config.go

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const (
2727
)
2828

2929
// defaultQueryStringRegexp is the regexp used for query string obfuscation if `envQueryStringRegexp` is empty.
30-
// The regexp is taken from https://datadoghq.atlassian.net/wiki/spaces/APS/pages/2490990623/QueryString+-+Sensitive+Data+Obfuscation
3130
var defaultQueryStringRegexp = regexp.MustCompile("(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:(?:\\s|%20)*(?:=|%3D)[^&]+|(?:\"|%22)(?:\\s|%20)*(?::|%3A)(?:\\s|%20)*(?:\"|%22)(?:%2[^2]|%[^2]|[^\"%])+(?:\"|%22))|bearer(?:\\s|%20)+[a-z0-9\\._\\-]|token(?::|%3A)[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L](?:[\\w=-]|%3D)+\\.ey[I-L](?:[\\w=-]|%3D)+(?:\\.(?:[\\w.+\\/=-]|%3D|%2F|%2B)+)?|[\\-]{5}BEGIN(?:[a-z\\s]|%20)+PRIVATE(?:\\s|%20)KEY[\\-]{5}[^\\-]+[\\-]{5}END(?:[a-z\\s]|%20)+PRIVATE(?:\\s|%20)KEY|ssh-rsa(?:\\s|%20)*(?:[a-z0-9\\/\\.+]|%2F|%5C|%2B){100,}")
3231

3332
type config struct {

contrib/internal/httptrace/httptrace.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ var (
4040
cfg = newConfig()
4141
)
4242

43+
// multipleIPHeaders sets the multiple ip header tag used internally to tell the backend an error occurred when
44+
// retrieving an HTTP request client IP.
45+
const multipleIPHeaders = "_dd.multiple-ip-headers"
46+
4347
// StartRequestSpan starts an HTTP request span with the standard list of HTTP request span tags (http.method, http.url,
4448
// http.useragent). Any further span start option can be added with opts.
4549
func StartRequestSpan(r *http.Request, opts ...ddtrace.StartSpanOption) (tracer.Span, context.Context) {
@@ -91,7 +95,7 @@ func ippref(s string) *netaddr.IPPrefix {
9195
}
9296

9397
// genClientIPSpanTags generates the client IP related tags that need to be added to the span.
94-
// See https://datadoghq.atlassian.net/wiki/spaces/APS/pages/2118779066/Client+IP+addresses+resolution
98+
// See https://docs.datadoghq.com/tracing/configure_data_security#configuring-a-client-ip-header for more information.
9599
func genClientIPSpanTags(r *http.Request) []ddtrace.StartSpanOption {
96100
ipHeaders := defaultIPHeaders
97101
if len(cfg.clientIPHeader) > 0 {
@@ -122,7 +126,7 @@ func genClientIPSpanTags(r *http.Request) []ddtrace.StartSpanOption {
122126
for i := range ips {
123127
opts = append(opts, tracer.Tag(ext.HTTPRequestHeaders+"."+headers[i], ips[i]))
124128
}
125-
opts = append(opts, tracer.Tag(ext.MultipleIPHeaders, strings.Join(headers, ",")))
129+
opts = append(opts, tracer.Tag(multipleIPHeaders, strings.Join(headers, ",")))
126130
}
127131
return opts
128132
}
@@ -157,7 +161,7 @@ func isGlobal(ip netaddr.IP) bool {
157161

158162
// urlFromRequest returns the full URL from the HTTP request. If query params are collected, they are obfuscated granted
159163
// obfuscation is not disabled by the user (through DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP)
160-
// For more information see https://datadoghq.atlassian.net/wiki/spaces/APM/pages/2357395856/Span+attributes#http.url
164+
// See https://docs.datadoghq.com/tracing/configure_data_security#redacting-the-query-in-the-url for more information.
161165
func urlFromRequest(r *http.Request) string {
162166
// Quoting net/http comments about net.Request.URL on server requests:
163167
// "For most requests, fields other than Path and RawQuery will be
@@ -175,7 +179,6 @@ func urlFromRequest(r *http.Request) string {
175179
url = path
176180
}
177181
// Collect the query string if we are allowed to report it and obfuscate it if possible/allowed
178-
// https://datadoghq.atlassian.net/wiki/spaces/APS/pages/2490990623/QueryString+-+Sensitive+Data+Obfuscation
179182
if cfg.queryString && r.URL.RawQuery != "" {
180183
query := r.URL.RawQuery
181184
if cfg.queryStringRegexp != nil {

contrib/internal/httptrace/httptrace_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ func TestIPHeaders(t *testing.T) {
189189
}
190190
if tc.expectedIP.IsValid() {
191191
require.Equal(t, tc.expectedIP.String(), spanCfg.Tags[ext.HTTPClientIP])
192-
require.Nil(t, spanCfg.Tags[ext.MultipleIPHeaders])
192+
require.Nil(t, spanCfg.Tags[multipleIPHeaders])
193193
} else {
194194
require.Nil(t, spanCfg.Tags[ext.HTTPClientIP])
195195
if tc.multiHeaders != "" {
196-
require.Equal(t, tc.multiHeaders, spanCfg.Tags[ext.MultipleIPHeaders])
196+
require.Equal(t, tc.multiHeaders, spanCfg.Tags[multipleIPHeaders])
197197
for hdr, ip := range tc.headers {
198198
require.Equal(t, ip, spanCfg.Tags[ext.HTTPRequestHeaders+"."+hdr])
199199
}

ddtrace/ext/tags.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,9 @@ const (
4242
// HTTPClientIP sets the HTTP client IP tag.
4343
HTTPClientIP = "http.client_ip"
4444

45-
// MultipleIPHeaders sets the multiple ip header tag used internally to tell the backend an error occurred when
46-
// retrieving an HTTP request client IP.
47-
// See https://datadoghq.atlassian.net/wiki/spaces/APS/pages/2118779066/Client+IP+addresses+resolution
48-
MultipleIPHeaders = "_dd.multiple-ip-headers"
49-
5045
// HTTPRequestHeaders sets the HTTP request headers partial tag
5146
// This tag is meant to be composed, i.e http.request.headers.headerX, http.request.headers.headerY, etc...
52-
// See https://datadoghq.atlassian.net/wiki/spaces/APMINT/pages/2302444638/DD+TRACE+HEADER+TAGS
47+
// See https://docs.datadoghq.com/tracing/trace_collection/tracing_naming_convention/#http-requests
5348
HTTPRequestHeaders = "http.request.headers"
5449

5550
// SpanName is a pseudo-key for setting a span's operation name by means of

0 commit comments

Comments
 (0)