Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable2.2] fix(proxy): Add image proxy rate limit #8693

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading