From 82e39ccf524d77b6ef293bd61da237cf47a37a5b Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 9 Aug 2022 01:12:13 +0530 Subject: [PATCH] feat: review comments --- app/controllers/general.php | 2 +- app/init.php | 1 + src/Appwrite/Utopia/Response/Model/Key.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 265a41ee25..5cdf0f4995 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -302,7 +302,7 @@ App::init() Authorization::setRole('role:' . Auth::USER_ROLE_APP); Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys. - if (time() > ($key->getAttribute('accessedAt', 0) + (24 * 60 * 60))) { + if (time() > $key->getAttribute('accessedAt', 0) + APP_KEY_USAGE) { $key->setAttribute('accessedAt', time()); $sdkValidator = new WhiteList([ 'appwrite:nodejs', diff --git a/app/init.php b/app/init.php index 146a4fc2a7..d09b08a1d8 100644 --- a/app/init.php +++ b/app/init.php @@ -88,6 +88,7 @@ const APP_LIMIT_COMPRESSION = 20000000; //20MB const APP_LIMIT_ARRAY_PARAMS_SIZE = 100; // Default maximum of how many elements can there be in API parameter that expects array value const APP_LIMIT_ARRAY_ELEMENT_SIZE = 4096; // Default maximum length of element in array parameter represented by maximum URL length. const APP_LIMIT_SUBQUERY = 1000; +const APP_KEY_USAGE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 402; const APP_VERSION_STABLE = '0.15.3'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; diff --git a/src/Appwrite/Utopia/Response/Model/Key.php b/src/Appwrite/Utopia/Response/Model/Key.php index 263725996a..811888a87e 100644 --- a/src/Appwrite/Utopia/Response/Model/Key.php +++ b/src/Appwrite/Utopia/Response/Model/Key.php @@ -69,6 +69,7 @@ class Key extends Model 'description' => 'List of SDK user agents that used this key.', 'default' => null, 'example' => 'appwrite:flutter', + 'array' => true ]) ; }