Azure / Azure/azure-sdk-tools

Consider allowing tests to override default sanitizers

Open
#10,093 1 comment 0 reactions 0 assignees View on GitHub
Test-Proxy
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

If a test author is attempting to use a sanitizer that is one of the default Test Proxy sanitizers, their sanitizer will be ignored unless they explicitly remove the default.

e.g. let's say I want to add a BodyKeySanitizer of `..containerUri` that replaces with a specific URI pattern for my service, I would need to do the following in .NET in my test class constructor:

```c#
// find the ID in https://github.com/Azure/azure-sdk-tools/blob/467329aef0738425db314842bb320f7a754da634/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs#L298-L300
SanitizersToRemove.Add("AZSDK3402");
BodyKeySanitizers.Add(new BodyKeySanitizer("..containerUrl") { Value = @"https://sanitized.blob.core.windows.net/mycontainer?restype=container" });
```

It would be nice if Test Proxy would override the sanitizer with the user-specified values as the user has more context as to what the sanitized value should be.

Contributor guide

Open the contributing guide

Research direction

Start with SanitizerDictionary.cs around lines 298-300 and inspect how the default sanitizer is combined with values configured in a .NET test class constructor. Verify the behavior using the relevant Test Proxy sanitizer configuration path; done means a user-specified sanitizer replaces a matching default without requiring SanitizersToRemove.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.