Explorar o código

Securise print log

stany.ferer hai 3 meses
pai
achega
fe719622cf
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  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);
+    }
+
+
 }