Allow parameters to be marked as secret
Problem
API Security handles data that can contain secrets, most often in the form of authentication credentials for the system under test. Leaking these secrets is a security vulnerability.
As part of the broader solution to secret leak prevention, a method to mark data as secret, allowing it to be masked when logged or included in reports.
See EPIC for more context: &9312
Proposal
Use SecretValue<T> type for Parameter values instead of (for example) string or Variant.
OperationIntoRequest/OperationIntoResponse
When converting an Operation instance into a Request or Response, only the header values use SecretValue<T>. For path, querystring, and body parameters, the masking/unmasking occurs during the conversion process.
Implementation plan
-
Update Parameter.OriginalValueandParameter.MutatedValueto beSecretValue<T>types -
Identify every usage and update to use .MaskedValue,.UnmaskedValue, or.SetValue-
Parameter.OriginalValue -
Parameter.MutatedValue -
Parameter.Value
-
-
Update Operation.Cloneto propagateIsSecret -
Update the following WebApiServicemethods making sureIsSecretis propagated (when possible):-
OperationFromRequest -
OperationFromResponse -
OperationIntoRequest
-
-
Add a maskSecretsargument toOperationIntoRequestthat produced a maskedRequestinstance -
Add an OperationIntoResponsemethod with amaskSecretsargument toIWebApiServicethat produces a maskedResponseinstance -
Tests to verify correct masking of: -
Paths -
Querystring -
Headers -
Body parameters (json, graphql, xml)
-
-
Tests to verify correct masking of the below when converting Operations into Request and Response objects with maskSecretsset totrue.-
Paths -
Querystring -
Headers -
Body parameters (json, graphql, xml)
-
Edited by Michael Eddington