429 too many request using share API (NC31, oc_ratelimit_entries involved)

Hi

I have 37 folders in USER1 and I want to share all of them to USER2, I’m using for that a small app that uses the share API (ocs/v2.php/apps/files_sharing/api/v1/shares) because I have three instances and one of them is going to have >1000 folders and I can’t do the job manually.

The firsts folders are shared right but after that the API response is 429 too may request and after that I’m not able to send new requests (I’ve waited 10 times but the 429 error is still there).

If I try to share any folder manually from the web interface the error is “Error quitando el recurso compartido” (unable to delete the share). Seems that something is “disabling” the share feature due my API requests.

The server is hosted locally, which could be the problem?

Thks

EDIT: I’ve found that with every request a line is inserted in oc_ratelimit_entries, when it reachs 20 rows the api stops. If I clear manually that table the api works again (for 20 more queries). Any way to override that? What is the use of that table?

This does not happen in NC27 (I’ve executed same script in an old instance and no lines are inserted in oc_ratelimit_entries so the API works without problem with >50 calls)

Hi, the rate limiting (20 new shares per 10 minutes) is new in 30.0.10: fix(files_sharing): rate limit share creation 20 times per 10 minutes by skjnldsv · Pull Request #50905 · nextcloud/server · GitHub (the linked pr is for main, it was also backported to 31 and 30).

May I configure some IP/user to override that feature?

Hi, there’s a configuration flag for 31 to obey the brute force protection allow list: fix(ratelimit): Allow to bypass rate-limit from bruteforce allowlist by nickvergessen · Pull Request #50234 · nextcloud/server · GitHub