mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-13 13:01:14 +00:00
dev: edge rate limit for email share
Docker Image CI / build-and-push-image (push) Waiting to run
Maintain Release Merge PR / update-release-pr (push) Waiting to run
release-please / release-please (push) Waiting to run
test / test (18.x) (push) Waiting to run
test / test (20.x) (push) Waiting to run
test / test (22.x) (push) Waiting to run
Docker Image CI / build-and-push-image (push) Waiting to run
Maintain Release Merge PR / update-release-pr (push) Waiting to run
release-please / release-please (push) Waiting to run
test / test (18.x) (push) Waiting to run
test / test (20.x) (push) Waiting to run
test / test (22.x) (push) Waiting to run
This commit is contained in:
@@ -266,6 +266,11 @@ class ShareService extends BaseService {
|
||||
// featureflag({ feature: 'share' }),
|
||||
],
|
||||
handler: async (req, res) => {
|
||||
const svc_edgeRateLimit = req.services.get('edge-rate-limit');
|
||||
if ( ! svc_edgeRateLimit.check('verify-pass-recovery-token') ) {
|
||||
return res.status(429).send('Too many requests.');
|
||||
}
|
||||
|
||||
const actor = Actor.adapt(req.user);
|
||||
if ( ! (actor.type instanceof UserActorType) ) {
|
||||
throw APIError.create('forbidden');
|
||||
|
||||
@@ -44,6 +44,10 @@ class EdgeRateLimitService extends BaseService {
|
||||
limit: 10,
|
||||
window: 15 * MINUTE,
|
||||
},
|
||||
['share']: {
|
||||
limit: 30,
|
||||
window: 1 * MINUTE,
|
||||
},
|
||||
['send-confirm-email']: {
|
||||
limit: 10,
|
||||
window: HOUR,
|
||||
|
||||
Reference in New Issue
Block a user