Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DICOM archive] Ensure that settings necessary for anonymization exist #4165

Merged
merged 4 commits into from
Jan 9, 2019
Merged

[DICOM archive] Ensure that settings necessary for anonymization exist #4165

merged 4 commits into from
Jan 9, 2019

Conversation

johnsaigle
Copy link
Contributor

@johnsaigle johnsaigle commented Nov 29, 2018

Brief summary of changes

While hunting down a PHP Warning I discovered that dicomarchiveanonymizer.class.inc does not do any validation on the config settings it uses. This results in empty values being sent to preg_match with possible consequences where DICOMs are not properly anonymized. I did not actually discover a case where this is true but my dummy imaging data is very limited.

This PR adds some validation to dicom_archive.class.inc. It will now refuse to show DICOM data when the regex config values are not properly configured.

This resolves issue...

Should eliminate warnings like
PHP Warning: preg_match(): Empty regular expression in /var/www/loris/modules/dicom_archive/php/dicomarchiveanonymizer.class.inc on line 62, referer: https://jsaigle-dev.loris.ca/dicom_archive/

To test this change...

  • On another branch, go to DICOM archive and check your error logs. See if you get the above warning.
  • If so, check out my branch and you should see a new error message on the front-end as well as a ConfigurationException in the logs.
    • Now change the Regex ConfigSettings (see source code) to valid regular expressions.
    • Navigate back to DICOM archive and ensure the page loads normally
  • If you do not get a warning, delete one of the Regex Config Settings and follow the steps above.

@johnsaigle johnsaigle added Category: Bug PR or issue that aims to report or fix a bug Category: Feature PR or issue that aims to introduce a new feature [branch] bugfix labels Nov 29, 2018
@davidblader davidblader removed Release: Add to release notes PR whose changes should be highlighted in the release notes labels Dec 7, 2018
davidblader
davidblader previously approved these changes Dec 10, 2018
@@ -106,6 +167,9 @@ class Dicom_Archive extends \NDB_Menu_Filter
*/
function toJSON()
{
/* Ensure that the server is well configured to prevent displaying
* data that is not properly anonmyized.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems to be out of place

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is still here

@johnsaigle johnsaigle added the State: Needs work PR awaiting additional work by the author to proceed label Dec 10, 2018
'LegoPhantomRegex',
'LivingPhantomRegex',
'patientIDRegex',
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any reference to these in this file. I only see them referenced from the view session page, so I don't think this is the right place for this.

Unless I'm missing something, I think this should either:

  1. Be moved to the viewsession page, where the configs are used and it just needs to add a !empty check or
  2. Be checked by the Module class for the module, not the menu page's class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theyr'e used by dicomarchiveanonymizer.class.inc (I mentioned this in my description but maybe I wasn't clear). Would you prefer that the checks go there instead?

Alternatively I can make the comment above more clear about where those settings are used.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should checked close to the thing that they're validating.

The DicomArchiveAnonymizer constructor seems reasonable, or in the module's Module class.

@johnsaigle johnsaigle removed the State: Needs work PR awaiting additional work by the author to proceed label Dec 19, 2018
PapillonMcGill
PapillonMcGill previously approved these changes Jan 7, 2019
@@ -106,6 +167,9 @@ class Dicom_Archive extends \NDB_Menu_Filter
*/
function toJSON()
{
/* Ensure that the server is well configured to prevent displaying
* data that is not properly anonmyized.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is still here

@johnsaigle johnsaigle added the State: Needs work PR awaiting additional work by the author to proceed label Jan 7, 2019
@johnsaigle johnsaigle removed the State: Needs work PR awaiting additional work by the author to proceed label Jan 9, 2019
@driusan driusan merged commit 3f4386b into aces:bugfix Jan 9, 2019
@ridz1208 ridz1208 added this to the 20.1.3 milestone Jan 19, 2019
@ridz1208 ridz1208 removed this from the 20.1.3 milestone Feb 1, 2019
@ridz1208 ridz1208 added this to the 20.2.0 milestone Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug PR or issue that aims to report or fix a bug Category: Feature PR or issue that aims to introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants