mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
127 stars 41 forks source link

[Bug]: unauthenticated abuse reports don't hit the throttle #14931

Closed ioanarusiczki closed 3 months ago

ioanarusiczki commented 3 months ago

What happened?

I'm trying to test a couple of throttles on -dev for Fastly

I tried from AMO dev frontend, without authentication, and after 20 + attempts I've noticed that I can continue sending reports.

So I tried the following: sent 20+ requests from https://httpie.io/app for https://addons-dev.allizom.org/api/v5/abuse/report/addon/?lang=en-US with a Session id -> I get a 429 {"detail": "Request was throttled. Expected available in 85984 seconds."} Once I remove the authentication I can continue sending new reports.

Same is reproducible on -stage.

What did you expect to happen?

I should hit a 429 without authentication too.

Is there an existing issue for this?

┆Issue is synchronized with this Jira Task

diox commented 3 months ago

Weird that it would happen on stage - can't be related to fastly if that's the case - need to investigate.

diox commented 3 months ago

@ioanarusiczki If you are testing from a third party service like https://httpie.io/app that would explain the problem: there is no guarantee they'd be using the same IP for all requests. You can see the IP used by making a request to https://addons-dev.allizom.org/services/client_info and looking at the REMOTE_ADDR (it's not enabled on stage, but it can confirm that httpie.io is not using the same IP for all requests)

ioanarusiczki commented 3 months ago

I used to test this making unauthenticated requests with abuse report add-on endpoint from Postman and I remember hitting throttle but I left third party apps aside and tried using the frontend:

throttle

collections

ratings

But when I try reporting an extension or a theme I can continue reporting. Same scenario applied on stage has the same results so I think the problem is only with the addon abuse reports endpoint when user is unauthenticated.

diox commented 3 months ago

We chatted about this and discovered it was caused by extensions.addonAbuseReport.url not being set correctly.

Digging further though:

diox commented 3 months ago

With https://github.com/mozilla/addons/issues/14929 fixing the first item from my comment above we should be ok now.

ioanarusiczki commented 2 months ago

Verified on -dev and filed the other problem https://github.com/mozilla/addons/issues/14959

frontend error instead of 429

I see the 429 with browser toolbox

429 on dev