From e93d9e6cf525b4748301d04ea846ed8bbdb5c8df Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sat, 5 Nov 2022 14:59:52 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20API=EC=97=90=EC=84=9C=20=EB=AF=BC?= =?UTF-8?q?=EA=B0=90=ED=95=9C=20argument=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sammo/API/Login/LoginByID.php | 2 ++ src/sammo/API/Login/LoginByToken.php | 1 + src/sammo/BaseAPI.php | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/src/sammo/API/Login/LoginByID.php b/src/sammo/API/Login/LoginByID.php index a71519bf..b12fdbc1 100644 --- a/src/sammo/API/Login/LoginByID.php +++ b/src/sammo/API/Login/LoginByID.php @@ -15,6 +15,8 @@ use sammo\Validator; class LoginByID extends \sammo\BaseAPI { + static array $sensitiveArgs = ['password']; + public function validateArgs(): ?string { $v = new Validator($this->args); diff --git a/src/sammo/API/Login/LoginByToken.php b/src/sammo/API/Login/LoginByToken.php index af8a9333..b8ef9a51 100644 --- a/src/sammo/API/Login/LoginByToken.php +++ b/src/sammo/API/Login/LoginByToken.php @@ -14,6 +14,7 @@ use sammo\Validator; class LoginByToken extends LoginByID { + static array $sensitiveArgs = ['hashedToken']; public function getRequiredSessionMode(): int { diff --git a/src/sammo/BaseAPI.php b/src/sammo/BaseAPI.php index 12c7ef75..a605d686 100644 --- a/src/sammo/BaseAPI.php +++ b/src/sammo/BaseAPI.php @@ -10,6 +10,18 @@ abstract class BaseAPI const REQ_GAME_LOGIN = 2; const REQ_READ_ONLY = 4; + static array $sensitiveArgs = []; + + public function getFilteredArgs(): array { + $filteredArgs = $this->args; + foreach (static::$sensitiveArgs as $argName) { + if (isset($filteredArgs[$argName])) { + $filteredArgs[$argName] = '***'; + } + } + return $filteredArgs; + } + protected array $args; protected string $rootPath; public function __construct(string $rootPath, array $args)