Suppress credscan warnings in X.509 test files #91041
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recent updates to the unit test files are triggering credscan violations (AzDO 1840538). Our usage on line 56 is safe since there's no private key data present, and our usage on line 3063 is safe since it's a self-signed cert we generated specifically for unit test inclusion. No real creds (either prod or test) are present in these files.
After consulting with the Guardian team via email, the consensus suggestion was not to update the existing CredScanSuppressions.json file to recognize this secret, but instead to suppress the credscan checks at the two field definitions themselves.
CredScan requires a suppression either on the same line or on the line immediately preceding where the cred starts. Using the
/* ... */
pattern here seemed cleaner than other alternatives which would have required me to shift whitespace and other code blocks around. I opted for the smallest possible code change here.