mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Address PR comments
This commit is contained in:
@@ -146,7 +146,7 @@ const MAX_OUTPUT_CHUNK_SIZE = 10 * 1024 * 1024; // 10MB
|
||||
const APP_FUNCTION_LOG_LENGTH_LIMIT = 1000000;
|
||||
const APP_FUNCTION_ERROR_LENGTH_LIMIT = 1000000;
|
||||
// Function headers
|
||||
const FUNCTION_ALLOWLIST_HEADERS_REQUEST = ['content-type', 'agent', 'content-length', 'host'];
|
||||
const FUNCTION_ALLOWLIST_HEADERS_REQUEST = ['content-type', 'agent', 'content-length', 'host', 'x-appwrite-client-ip'];
|
||||
const FUNCTION_ALLOWLIST_HEADERS_RESPONSE = ['content-type', 'content-length'];
|
||||
// Message types
|
||||
const MESSAGE_TYPE_EMAIL = 'email';
|
||||
|
||||
@@ -270,7 +270,6 @@ class Functions extends Action
|
||||
$headers['x-appwrite-event'] = $event ?? '';
|
||||
$headers['x-appwrite-user-id'] = $user->getId() ?? '';
|
||||
$headers['x-appwrite-user-jwt'] = $jwt ?? '';
|
||||
$headers['x-appwrite-client-ip'] = '';
|
||||
|
||||
$headersFiltered = [];
|
||||
foreach ($headers as $key => $value) {
|
||||
@@ -408,7 +407,6 @@ class Functions extends Action
|
||||
$headers['x-appwrite-country-code'] = '';
|
||||
$headers['x-appwrite-continent-code'] = '';
|
||||
$headers['x-appwrite-continent-eu'] = 'false';
|
||||
$headers['x-appwrite-client-ip'] = '';
|
||||
|
||||
/** Create execution or update execution status */
|
||||
$execution = $dbForProject->getDocument('executions', $executionId ?? '');
|
||||
|
||||
@@ -1538,6 +1538,9 @@ class FunctionsCustomServerTest extends Scope
|
||||
$this->assertEquals(204, $lastExecution['responseStatusCode']);
|
||||
$this->assertStringContainsString($userId, $lastExecution['logs']);
|
||||
$this->assertStringContainsString('Event User', $lastExecution['logs']);
|
||||
$this->assertNotEmpty($lastExecution['$id']);
|
||||
$headers = array_column($lastExecution['requestHeaders'] ?? [], 'value', 'name');
|
||||
$this->assertEmpty($headers['x-appwrite-client-ip'] ?? '');
|
||||
}, 10000, 500);
|
||||
|
||||
$this->cleanupFunction($functionId);
|
||||
|
||||
@@ -62,6 +62,9 @@ class FunctionsScheduleTest extends Scope
|
||||
$this->assertNotEmpty($asyncExecution['logs']);
|
||||
$this->assertNotEmpty($asyncExecution['errors']);
|
||||
$this->assertGreaterThan(0, $asyncExecution['duration']);
|
||||
$this->assertNotEmpty($asyncExecution['$id']);
|
||||
$headers = array_column($asyncExecution['requestHeaders'] ?? [], 'value', 'name');
|
||||
$this->assertEmpty($headers['x-appwrite-client-ip'] ?? '');
|
||||
}, 60000, 500);
|
||||
|
||||
$this->cleanupFunction($functionId);
|
||||
|
||||
Reference in New Issue
Block a user