Enable redacting user-code exception messages #790
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.
Context
DTFx code is often hosted in Azure App Service and Azure Functions. When running on these platforms, certain framework traces are captured into an internal log capturing service. One of the things logged by DTFx is exception messages for activity failures. These exception messages are often generated by user code, which may contain sensitive information (PII, secrets, etc.).
Change
As a safety mechanism, this PR will redact exception messages that come from activity failures. This redaction is enabled by default when hosted in an Azure App Service environment, which we infer by checking for the
WEBSITE_SITE_NAME
environment variable. This policy of redaction can be overridden by setting aDTFX_REDACT_USER_CODE_EXCEPTIONS
environment variable to1
ortrue
.This PR also adds additional
#nullable enable
compiler directives, which is something we routinely do as we touch the code to help make it safe from unexpected null-ref exceptions.Testing
I tested the exception redaction logic using the following LINQPad script:
The results when redaction IS NOT enabled:
This is what would be seen if redaction IS enabled: