feat: API에서 민감한 argument 지정

This commit is contained in:
2022-11-05 14:59:52 +09:00
parent 30d99c6fc3
commit e93d9e6cf5
3 changed files with 15 additions and 0 deletions
+2
View File
@@ -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);
+1
View File
@@ -14,6 +14,7 @@ use sammo\Validator;
class LoginByToken extends LoginByID
{
static array $sensitiveArgs = ['hashedToken'];
public function getRequiredSessionMode(): int
{
+12
View File
@@ -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)