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: Revert "Fix: OpenEMR logs sensitive information such as payment details (#7341)" (#7396) #7410

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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