microsoft/Tools-for-Health-Data-Anonymization

Running the tool with a non supported anonymization method results in error that includes the (raw content) input FHIR JSON files

CarlosSardo opened this issue · 1 comments

Description:

When running the tool with a non supported anonymization method, we see the AnonymizerConfigurationException (stack trace) error displayed in the console log. Although, it also includes the (raw content) input FHIR JSON files.

This could happen by mistake and it is very unlikely to go unnoticed. Nevertheless, if it happens, it might be seen as undesireable behaviour when running the tool in a server, as these logs might leak out (collected inadvertently), while containing sensitive information in the FHIR JSON files.

Desired outcome

Do not include the (raw content) input FHIR JSON files in the console log.

Reproduction steps:

  1. Edit the tool's configuration-sample.json file and purposefuly set a non supported anonymization method:
    {"path": "Resource.id", "method": "FAKEcryptoHash"}.
  2. Run the tool in Windows as it follows:
    Microsoft.Health.Fhir.Anonymizer.R4.CommandLineTool.exe -i "C:\Tool\FHIR\samples\fhir-r4-files" -o "C:\Tool\FHIR\samples\fhir-r4-files\output" -c "C:\Tool\configuration-sample.json"
  3. You'll see the following output in the console:

[C:\Tool\FHIR\samples\fhir-r4-files\practitionerInformation1583281853074.json] Error:
Resource: {
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "urn:uuid:00000170-a2f3-ce01-0000-00000000010e",
"resource": {
"resourceType": "Practitioner",
"id": "00000170-a2f3-ce01-0000-00000000010e",
"meta": {
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner"
]
},
"extension": [
{
"url": "http://synthetichealth.github.io/synthea/utilization-encounters-extension",
"valueInteger": 259
}
],
"identifier": [
{
"system": "http://hl7.org/fhir/sid/us-npi",
"value": "270"
}
],
"active": true,
"name": [
{
"family": "Roberts511",
"given": [
"Chi716"
],
"prefix": [
"Dr."
]
}
],
"telecom": [
{
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-direct",
"valueBoolean": true
}
],
"system": "email",
"value": "Chi716.Roberts511@example.com",
"use": "work"
}
],
"address": [
{
"line": [
"1035-116TH AVE NE"
],
"city": "BELLEVUE",
"state": "WA",
"postalCode": "98004",
"country": "US"
}
],
"gender": "male"
},
"request": {
"method": "POST",
"url": "Practitioner"
}
}
]
}

ErrorMessage: Microsoft.Health.Fhir.Anonymizer.Core.Exceptions.AnonymizerConfigurationException: Anonymization method FAKEcryptoHash not supported.
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurations.AnonymizerConfigurationValidator.Validate(AnonymizerConfiguration config) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurations\AnonymizerConfigurationValidator.cs:line 19
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurationManager..ctor(AnonymizerConfiguration configuration) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurationManager.cs:line 22
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurationManager.CreateFromSettingsInJson(String settingsInJson) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurationManager.cs:line 39
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurationManager.CreateFromConfigurationFile(String configFilePath) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurationManager.cs:line 51
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerEngine.CreateWithFileContext(String configFilePath, String fileName, String inputFolderName) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerEngine.cs:line 53
at Microsoft.Health.Fhir.Anonymizer.Tool.FilesAnonymizerForJsonFormatResource.FileAnonymize(String fileName) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.CommandLineTool\FilesAnonymizerForJsonFormatResource.cs:line 96
Error:
Resource: C:\Projects\T\FHIR\samples\fhir-r4-files\practitionerInformation1583281853074.json
ErrorMessage: Microsoft.Health.Fhir.Anonymizer.Core.Exceptions.AnonymizerConfigurationException: Anonymization method FAKEcryptoHash not supported.
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurations.AnonymizerConfigurationValidator.Validate(AnonymizerConfiguration config) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurations\AnonymizerConfigurationValidator.cs:line 19
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurationManager..ctor(AnonymizerConfiguration configuration) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurationManager.cs:line 22
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurationManager.CreateFromSettingsInJson(String settingsInJson) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurationManager.cs:line 39
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurationManager.CreateFromConfigurationFile(String configFilePath) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurationManager.cs:line 51
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerEngine.CreateWithFileContext(String configFilePath, String fileName, String inputFolderName) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerEngine.cs:line 53
at Microsoft.Health.Fhir.Anonymizer.Tool.FilesAnonymizerForJsonFormatResource.FileAnonymize(String fileName) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.CommandLineTool\FilesAnonymizerForJsonFormatResource.cs:line 96
at Microsoft.Health.Fhir.Anonymizer.Tool.FilesAnonymizerForJsonFormatResource.<>c__DisplayClass5_0.<b__0>d.MoveNext() in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.CommandLineTool\FilesAnonymizerForJsonFormatResource.cs:line 52
Unhandled exception. Microsoft.Health.Fhir.Anonymizer.Core.Exceptions.AnonymizerConfigurationException: Anonymization method FAKEcryptoHash not supported.
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurations.AnonymizerConfigurationValidator.Validate(AnonymizerConfiguration config) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurations\AnonymizerConfigurationValidator.cs:line 19
at Microsoft.Health.Fhir.Anonymizer.Core.AnonymizerConfigurationManager..ctor(AnonymizerConfiguration configuration) in D:\a\1\s\FHIR\src\Microsoft.Health.Fhir.Anonymizer.Shared.Core\AnonymizerConfigurationManager.cs:line 22

Fixed it in pr #176 and close this issue.