From 6e5217dc3a664a585168cba423514b0438099ee3 Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Tue, 25 Aug 2020 16:06:37 +0300 Subject: [PATCH] [Foreign_link] Change the type of "credentials" to blob TwitterOAuthClient::packToken uses \0 as a delimeter which can cause issues on TEXT or VARCHAR. --- classes/Foreign_link.php | 4 ++-- plugins/TwitterBridge/actions/twitterauthorization.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php index b4265f1820..a12a5f4a69 100644 --- a/classes/Foreign_link.php +++ b/classes/Foreign_link.php @@ -29,7 +29,7 @@ class Foreign_link extends Managed_DataObject public $user_id; // int(4) primary_key not_null public $foreign_id; // bigint(8) primary_key not_null unsigned public $service; // int(4) primary_key not_null - public $credentials; // varchar(191) not 255 because utf8mb4 takes more space + public $credentials; // blob public $noticesync; // tinyint(1) not_null default_1 public $friendsync; // tinyint(1) not_null default_2 public $profilesync; // tinyint(1) not_null default_1 @@ -48,7 +48,7 @@ class Foreign_link extends Managed_DataObject 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'link to user on this system, if exists'), 'foreign_id' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'link to user on foreign service, if exists'), 'service' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to service'), - 'credentials' => array('type' => 'varchar', 'length' => 191, 'description' => 'authc credentials, typically a password'), + 'credentials' => array('type' => 'blob', 'description' => 'authc credentials, typically a password'), 'noticesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies'), 'friendsync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 2, 'description' => 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'), 'profilesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'), diff --git a/plugins/TwitterBridge/actions/twitterauthorization.php b/plugins/TwitterBridge/actions/twitterauthorization.php index 25d4c46296..1ca9b5792b 100644 --- a/plugins/TwitterBridge/actions/twitterauthorization.php +++ b/plugins/TwitterBridge/actions/twitterauthorization.php @@ -228,7 +228,7 @@ class TwitterauthorizationAction extends FormAction $creds = TwitterOAuthClient::packToken($access_token); - $flink->credentials = $creds; + $flink->credentials = DB_DataObject_Cast::blob($creds); $flink->created = common_sql_now(); // Defaults: noticesync on, everything else off