@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Raise Webhook URI length limit from 255 to 2048

Summary:
2048 is arbitrary (as 255 was) and only enforced in the UI but not on a DB level.

Closes T16303

Test Plan:
* Run `./bin/storage upgrade`
* Check `./bin/storage status`
* Check `EXPLAIN phabricator_herald.herald_webhook;` and/or http://phorge.localhost/config/database/localhost/phabricator_herald/herald_webhook/ before and after
* Go to http://phorge.localhost/herald/webhook/edit/form/default/ and enter a long URI in the `URI` field before and after

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16303

Differential Revision: https://we.phorge.it/D26462

+6 -4
+2
resources/sql/autopatches/20251024.herald.webhookuri.sql
··· 1 + ALTER TABLE {$NAMESPACE}_herald.herald_webhook 2 + MODIFY COLUMN webhookURI LONGTEXT NOT NULL;
+1 -1
src/applications/herald/storage/HeraldWebhook.php
··· 24 24 self::CONFIG_AUX_PHID => true, 25 25 self::CONFIG_COLUMN_SCHEMA => array( 26 26 'name' => 'text128', 27 - 'webhookURI' => 'text255', 27 + 'webhookURI' => 'text', 28 28 'status' => 'text32', 29 29 'hmacKey' => 'text32', 30 30 ),
+3 -3
src/applications/herald/xaction/HeraldWebhookURITransaction.php
··· 4 4 extends HeraldWebhookTransactionType { 5 5 6 6 const TRANSACTIONTYPE = 'uri'; 7 + private $webhookURIMaxLength = 2048; 7 8 8 9 public function generateOldValue($object) { 9 10 return $object->getWebhookURI(); ··· 40 41 return $errors; 41 42 } 42 43 43 - $max_length = $object->getColumnMaximumByteLength('webhookURI'); 44 44 foreach ($xactions as $xaction) { 45 45 $old_value = $this->generateOldValue($object); 46 46 $new_value = $xaction->getNewValue(); 47 47 48 48 $new_length = strlen($new_value); 49 - if ($new_length > $max_length) { 49 + if ($new_length > $this->webhookURIMaxLength) { 50 50 $errors[] = $this->newInvalidError( 51 51 pht( 52 52 'Webhook URIs can be no longer than %s characters.', 53 - new PhutilNumber($max_length)), 53 + new PhutilNumber($this->webhookURIMaxLength)), 54 54 $xaction); 55 55 } 56 56