Skip to content

Commit

Permalink
fix(proxy): Add image proxy rate limit
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst authored and backportbot-nextcloud[bot] committed Aug 9, 2023
1 parent 3b19f12 commit 89507cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Controller/ProxyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Exception;
use OCA\Mail\Http\ProxyDownloadResponse;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\UserRateLimit;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Http\Client\IClientService;
use OCP\IRequest;
Expand Down Expand Up @@ -93,6 +94,7 @@ public function redirect(string $src): TemplateResponse {
/**
* @NoAdminRequired
* @NoCSRFRequired
* @UserRateThrottle(limit=50, period=60)
*
* @param string $src
*
Expand All @@ -102,6 +104,7 @@ public function redirect(string $src): TemplateResponse {
*
* @return ProxyDownloadResponse
*/
#[UserRateLimit(limit: 50, period: 60)]
public function proxy(string $src): ProxyDownloadResponse {
// close the session to allow parallel downloads
$this->session->close();
Expand Down
5 changes: 5 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<directory name="lib/Vendor" />
</extraFiles>
<issueHandlers>
<UndefinedAttributeClass>
<errorLevel type="info">
<referencedClass name="OCP\AppFramework\Http\Attribute\UserRateLimit" />
</errorLevel>
</UndefinedAttributeClass>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="Doctrine\DBAL\Platforms\MySQLPlatform" />
Expand Down

0 comments on commit 89507cf

Please sign in to comment.