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 (#7341)" (#7396) (#7410)

This reverts commit 9be12b8.
  • Loading branch information
bradymiller committed Apr 26, 2024
1 parent 24b7ed2 commit a1ce0a5
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/Common/Logging/EventAuditLogger.php
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 a1ce0a5

Please sign in to comment.