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

Fix: OpenEMR logs sensitive information such as payment details #7341

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

jubittajohn
Copy link
Contributor

Fixes #7340

Short description of what this resolves:

This PR adds a log scrubbing template to mask sensitive details in the log(which is currently exposed in logs). Currently, this template only masks the field "reference" in the table "ar_session" to conceal sensitive payment details in the log. However, if approved, this template can be used to extend the masking of other sensitive details to other tables and fields too. Masking of sensitive information in logs is essential to prevent the stealing of information. (ASVS 7.1.1).

After update:
log-sensitive-payment-detail-after-fix

Changes proposed in this pull request:

  1. In "EventAuditLogger.php", add a class constant to keep track of the tables and the fields in each table that contains sensitive information.
  2. In "EventAuditLogger.php", for any insert operation, if the current table contains any field containing sensitive information, the value for that field is masked to match its length.

$field_value = $matches[2];
$masked_value = str_repeat('X', strlen($field_value));
return "$field_name = '$masked_value'";
}, $comments);
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

bird_jive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stephenwaite is there something else that needs to be updated to the PR?

@jubittajohn
Copy link
Contributor Author

@stephenwaite Thank you for the approval. :)

* For any insert operation, if the current table contains any field containing sensitive information,
* the value for that field is masked to match its length.
*/
foreach (self::SENSITIVE_RECORDS as $table => $fields) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

would put the querytype == insert prior to the foreach (no reason to loop through the sensitive records array if the querytype does not equal insert)

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@bradymiller I believe this is now resolved? Good for us to bring this in?

@bradymiller
Copy link
Sponsor Member

hi @jubittajohn , Code looks good and bringing this in. thanks for the improvement!

@bradymiller bradymiller merged commit 9be12b8 into openemr:master Apr 16, 2024
25 checks passed
sjpadgett pushed a commit to sjpadgett/openemr that referenced this pull request Apr 16, 2024
…emr#7341)

* Adding log scrubbing template to mask sensitive payment details in log

Signed-off-by: Jubitta John <[email protected]>

* Fixed the php styling issue

Signed-off-by: Jubitta John <[email protected]>

* Insert operation check is moved to beginning

Signed-off-by: Jubitta John <[email protected]>

---------

Signed-off-by: Jubitta John <[email protected]>
Co-authored-by: Jubitta John <[email protected]>
(cherry picked from commit 9be12b8)
@jubittajohn
Copy link
Contributor Author

@bradymiller @stephenwaite @adunsulag Thank you for looking into the Pull Request, the review comments, and the approvals.

@bradymiller
Copy link
Sponsor Member

hi @jubittajohn , turns out that modifying entries to the log is not something we should be doing to ensure OpenEMR remains compliant with ONC certification, so we will need to revert this code. Your code was well done and sorry we need to do this.

bradymiller added a commit to bradymiller/openemr that referenced this pull request Apr 23, 2024
bradymiller added a commit that referenced this pull request Apr 26, 2024
bradymiller added a commit to bradymiller/openemr that referenced this pull request Apr 26, 2024
bradymiller added a commit that referenced this pull request Apr 26, 2024
sjpadgett added a commit to sjpadgett/openemr that referenced this pull request May 7, 2024
…_last

* 'master' of https://github.com/openemr/openemr:
  Hide dashboard card 2 (openemr#7423)
  fix: ccda zip import and php warnings and deprecations (openemr#7416)
  Fee sheet and Codes revenue code (openemr#7415)
  Refactor UB04 837i X12 feature to make work again. (openemr#7412)
  feat: support loop 2420E (openemr#7405)
  Fix: Revert "Fix: OpenEMR logs sensitive information such as payment details (openemr#7341)" (openemr#7396)
  Weno better error handling from fetches (openemr#7408)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: OpenEMR logs sensitive field - payment reference number
4 participants