Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14057858
D12168.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12168.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1844,6 +1844,7 @@
'PhabricatorFilesManagementPurgeWorkflow' => 'applications/files/management/PhabricatorFilesManagementPurgeWorkflow.php',
'PhabricatorFilesManagementRebuildWorkflow' => 'applications/files/management/PhabricatorFilesManagementRebuildWorkflow.php',
'PhabricatorFilesManagementWorkflow' => 'applications/files/management/PhabricatorFilesManagementWorkflow.php',
+ 'PhabricatorFilesOutboundRequestAction' => 'applications/files/action/PhabricatorFilesOutboundRequestAction.php',
'PhabricatorFlag' => 'applications/flag/storage/PhabricatorFlag.php',
'PhabricatorFlagColor' => 'applications/flag/constants/PhabricatorFlagColor.php',
'PhabricatorFlagConstants' => 'applications/flag/constants/PhabricatorFlagConstants.php',
@@ -5160,6 +5161,7 @@
'PhabricatorFilesManagementPurgeWorkflow' => 'PhabricatorFilesManagementWorkflow',
'PhabricatorFilesManagementRebuildWorkflow' => 'PhabricatorFilesManagementWorkflow',
'PhabricatorFilesManagementWorkflow' => 'PhabricatorManagementWorkflow',
+ 'PhabricatorFilesOutboundRequestAction' => 'PhabricatorSystemAction',
'PhabricatorFlag' => array(
'PhabricatorFlagDAO',
'PhabricatorPolicyInterface',
diff --git a/src/applications/files/action/PhabricatorFilesOutboundRequestAction.php b/src/applications/files/action/PhabricatorFilesOutboundRequestAction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/files/action/PhabricatorFilesOutboundRequestAction.php
@@ -0,0 +1,22 @@
+<?php
+
+final class PhabricatorFilesOutboundRequestAction
+ extends PhabricatorSystemAction {
+
+ const TYPECONST = 'files.outbound';
+
+ public function getActionConstant() {
+ return self::TYPECONST;
+ }
+
+ public function getScoreThreshold() {
+ return 60 / phutil_units('1 hour in seconds');
+ }
+
+ public function getLimitExplanation() {
+ return pht(
+ 'You have initiated too many outbound requests to fetch remote URIs '.
+ 'recently.');
+ }
+
+}
diff --git a/src/applications/macro/controller/PhabricatorMacroEditController.php b/src/applications/macro/controller/PhabricatorMacroEditController.php
--- a/src/applications/macro/controller/PhabricatorMacroEditController.php
+++ b/src/applications/macro/controller/PhabricatorMacroEditController.php
@@ -72,6 +72,13 @@
));
} else if ($uri) {
try {
+ // Rate limit outbound fetches to make this mechanism less useful for
+ // scanning networks and ports.
+ PhabricatorSystemActionEngine::willTakeAction(
+ array($user->getPHID()),
+ new PhabricatorFilesOutboundRequestAction(),
+ 1);
+
$file = PhabricatorFile::newFromFileDownload(
$uri,
array(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 7:22 AM (1 d, 18 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6730971
Default Alt Text
D12168.diff (2 KB)
Attached To
Mode
D12168: Rate limit outbound requests in Macros
Attached
Detach File
Event Timeline
Log In to Comment