1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

Merge pull request #2453 from appwrite/fix-missing-encryption-filters

Fix-missing-encryption-filters
This commit is contained in:
Torsten Dittmann 2021-12-09 11:47:49 +01:00 committed by GitHub
commit ec01ab178c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View file

@ -500,7 +500,7 @@ $collections = [
'required' => false,
'default' => null,
'array' => false,
'filters' => ['json'],
'filters' => ['json', 'encrypt'],
],
[
'$id' => 'platforms',
@ -810,12 +810,12 @@ $collections = [
'$id' => 'secret',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 256, // var_dump of \bin2hex(\random_bytes(128)) => string(256)
'size' => 512, // var_dump of \bin2hex(\random_bytes(128)) => string(256) doubling for encryption
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
'filters' => ['encrypt'],
],
],
'indexes' => [
@ -882,12 +882,12 @@ $collections = [
'$id' => 'httpPass',
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'size' => Database::LENGTH_KEY, // TODO will the length suffice after encryption?
'signed' => true,
'required' => true,
'default' => null,
'array' => false,
'filters' => [],
'filters' => ['encrypt'],
],
[
'$id' => 'security',
@ -1155,18 +1155,18 @@ $collections = [
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
'filters' => ['encrypt'],
],
[
'$id' => 'secret',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 64, // https://www.tutorialspoint.com/how-long-is-the-sha256-hash-in-mysql
'size' => 512, // https://www.tutorialspoint.com/how-long-is-the-sha256-hash-in-mysql (512 for encryption)
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
'filters' => ['encrypt'],
],
[
'$id' => 'expire',
@ -1497,7 +1497,7 @@ $collections = [
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
'filters' => ['encrypt'],
],
],
'indexes' => [

View file

@ -332,6 +332,9 @@ Database::addFilter('encrypt',
]);
},
function($value) {
if(is_null($value)) {
return null;
}
$value = json_decode($value, true);
$key = App::getEnv('_APP_OPENSSL_KEY_V'.$value['version']);