Jelajahi Sumber

Securise print log

stany.ferer 3 bulan lalu
induk
melakukan
fe719622cf
1 mengubah file dengan 7 tambahan dan 1 penghapusan
  1. 7 1
      core/class/serverLog.class.php

+ 7 - 1
core/class/serverLog.class.php

@@ -17,7 +17,8 @@ class serverLog {
     }
 
     public static function filtreLog(string $_log){
-        self::printLog($_log);
+        $log = self::hidePassword($_log);
+        self::printLog($log);
     }
 
     private static function ifFolderWww(string $_log){
@@ -32,4 +33,9 @@ class serverLog {
         return (stripos($_log, "/var/www/") == FALSE AND stripos($_log, "https://") == FALSE) ? TRUE : FALSE;
     }
 
+    private static function hidePassword($input) {
+        return preg_replace("/('password'\s*=>\s*)'[^']*'/", "$1'####'", $input);
+    }
+
+
 }