diff --git a/lib/datadog/tracing/contrib/utils/quantization/http.rb b/lib/datadog/tracing/contrib/utils/quantization/http.rb index bc208d6c2bf..3e7d1196ee0 100644 --- a/lib/datadog/tracing/contrib/utils/quantization/http.rb +++ b/lib/datadog/tracing/contrib/utils/quantization/http.rb @@ -134,18 +134,18 @@ def obfuscate_query(query, options = {}) (?:"|%22)? ) (?: # common keys - (?:old_?|new_?)?p(?:ass)?w(?:or)?d(?:1|2)? # pw, password variants - |pass(?:_?phrase)? # pass, passphrase variants + (?:old[-_]?|new_?)?p(?:ass)?w(?:or)?d(?:1|2)? # pw, password variants + |pass(?:[-_]?phrase)? # pass, passphrase variants |secret |(?: # key, key_id variants - api_? - |private_? - |public_? - |access_? - |secret_? - )key(?:_?id)? + api[-_]? + |private[-_]? + |public[-_]? + |access[-_]? + |secret[-_]? + )key(?:[-_]?id)? |token - |consumer_?(?:id|key|secret) + |consumer[-_]?(?:id|key|secret) |sign(?:ed|ature)? |auth(?:entication|orization)? ) diff --git a/spec/datadog/tracing/contrib/utils/quantization/http_spec.rb b/spec/datadog/tracing/contrib/utils/quantization/http_spec.rb index 005ba9fe156..d3f3f05a615 100644 --- a/spec/datadog/tracing/contrib/utils/quantization/http_spec.rb +++ b/spec/datadog/tracing/contrib/utils/quantization/http_spec.rb @@ -21,6 +21,18 @@ it { is_expected.to eq('http://example.com/path?categories[]') } end + context 'default behavior for an array with indices' do + let(:url) { 'http://example.com/path?categories[0]=1&categories[1]=2' } + + it { is_expected.to eq('http://example.com/path?categories[0]&categories[1]') } + end + + context 'default behavior for a hash' do + let(:url) { 'http://example.com/path?categories[foo]=1&categories[bar]=2' } + + it { is_expected.to eq('http://example.com/path?categories[foo]&categories[bar]') } + end + context 'with query: show: value' do let(:options) { { query: { show: ['category_id'] } } } @@ -484,6 +496,13 @@ public_key_id access_key_id secret_key_id + api-key + api-key-id + private-key + private-key-id + public-key-id + access-key-id + secret-key-id token consumerid consumerkey @@ -491,6 +510,9 @@ consumer_id consumer_key consumer_secret + consumer-id + consumer-key + consumer-secret sign signed signature