Skip to content

Commit

Permalink
Fix: Revert "Fix: OpenEMR logs sensitive information such as payment …
Browse files Browse the repository at this point in the history
…details (openemr#7341)" (openemr#7396)

This reverts commit 9be12b8.
  • Loading branch information
bradymiller authored Apr 26, 2024
1 parent 548db01 commit 1d0e579
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/Common/Logging/EventAuditLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ class EventAuditLogger
</ParticipantObjectIdentification>
MSG;


/**
* Keep track of the tables and the fields in each table that contains sensitive information
*/
private const SENSITIVE_RECORDS = [
"ar_session" => array("reference")
];

/**
* @param $event
* @param $user
Expand Down Expand Up @@ -640,27 +632,6 @@ public function auditSQLEvent($statement, $outcome, $binds = null)
}
}

/**
* Avoid logging sensitive information in logs.
* 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.
*/
if ($querytype == "insert") {
foreach (self::SENSITIVE_RECORDS as $table => $fields) {
if (strpos($comments, $table) !== false) {
foreach ($fields as $field) {
$pattern = "/($field)\s*=\s*'([^']+)'/";
$comments = preg_replace_callback($pattern, function ($matches) {
$field_name = $matches[1];
$field_value = $matches[2];
$masked_value = str_repeat('X', strlen($field_value));
return "$field_name = '$masked_value'";
}, $comments);
}
}
}
}

/* Avoid filling the audit log with trivial SELECT statements.
* Skip SELECTs from unknown tables.
*/
Expand Down

0 comments on commit 1d0e579

Please sign in to comment.