|
201 | 201 | end |
202 | 202 | end |
203 | 203 |
|
204 | | - it "does not record sensitive params" do |
| 204 | + it "does not record any params" do |
205 | 205 | get "/posts?foo=bar&password=42&secret=baz" |
206 | 206 | transaction = transport.events.last.to_h |
207 | 207 |
|
208 | 208 | params = transaction[:spans][0][:data][:params] |
209 | | - expect(params["foo"]).to eq("bar") |
210 | | - expect(params["password"]).to eq("[FILTERED]") |
211 | | - expect(params["secret"]).to eq("[FILTERED]") |
| 209 | + expect(params).to be_empty |
212 | 210 |
|
213 | 211 | path = transaction[:spans][0][:data][:path] |
214 | | - expect(path).to eq("/posts?foo=bar&password=[FILTERED]&secret=[FILTERED]") |
| 212 | + expect(path).to eq("/posts") |
215 | 213 | end |
216 | 214 | end |
217 | 215 |
|
|
223 | 221 | end |
224 | 222 | end |
225 | 223 |
|
226 | | - it "records all params" do |
| 224 | + it "records all params except sensitive params" do |
227 | 225 | get "/posts?foo=bar&password=42&secret=baz" |
228 | 226 | transaction = transport.events.last.to_h |
229 | 227 |
|
230 | 228 | params = transaction[:spans][0][:data][:params] |
231 | 229 | expect(params["foo"]).to eq("bar") |
232 | | - expect(params["password"]).to eq("42") |
233 | | - expect(params["secret"]).to eq("baz") |
| 230 | + expect(params["password"]).to eq("[Filtered]") |
| 231 | + expect(params["secret"]).to eq("[Filtered]") |
| 232 | + |
| 233 | + path = transaction[:spans][0][:data][:path] |
| 234 | + expect(path).to eq("/posts?foo=bar&password=[Filtered]&secret=[Filtered]") |
| 235 | + end |
| 236 | + end |
| 237 | + end |
| 238 | + |
| 239 | + context "data collection" do |
| 240 | + context "with url query params enabled" do |
| 241 | + before do |
| 242 | + make_basic_app do |config| |
| 243 | + config.traces_sample_rate = 1.0 |
| 244 | + config.data_collection.url_query_params.mode = :deny_list |
| 245 | + end |
| 246 | + end |
| 247 | + |
| 248 | + it "records query params except sensitive params" do |
| 249 | + get "/posts?foo=bar&password=42&secret=baz" |
| 250 | + transaction = transport.events.last.to_h |
| 251 | + |
| 252 | + params = transaction[:spans][0][:data][:params] |
| 253 | + expect(params["foo"]).to eq("bar") |
| 254 | + expect(params["password"]).to eq("[Filtered]") |
| 255 | + expect(params["secret"]).to eq("[Filtered]") |
| 256 | + |
| 257 | + path = transaction[:spans][0][:data][:path] |
| 258 | + expect(path).to eq("/posts?foo=bar&password=[Filtered]&secret=[Filtered]") |
| 259 | + end |
| 260 | + end |
| 261 | + |
| 262 | + context "with url query params disabled" do |
| 263 | + before do |
| 264 | + make_basic_app do |config| |
| 265 | + config.traces_sample_rate = 1.0 |
| 266 | + config.data_collection.url_query_params.mode = :off |
| 267 | + end |
| 268 | + end |
| 269 | + |
| 270 | + it "does not record query params" do |
| 271 | + get "/posts?foo=bar&password=42&secret=baz" |
| 272 | + transaction = transport.events.last.to_h |
| 273 | + |
| 274 | + params = transaction[:spans][0][:data][:params] |
| 275 | + expect(params).to be_empty |
234 | 276 |
|
235 | 277 | path = transaction[:spans][0][:data][:path] |
236 | | - expect(path).to eq("/posts?foo=bar&password=42&secret=baz") |
| 278 | + expect(path).to eq("/posts") |
237 | 279 | end |
238 | 280 | end |
239 | 281 | end |
|
0 commit comments