zulip/zilencer
Zixuan James Li 26a518267a rate_limit: Replace rate_limit with inlined rate limit checks.
This change incorporate should_rate_limit into rate_limit_user and
rate_limit_request_by_ip. Note a slight behavior change to other callers
to rate_limit_request_by_ip is made as we now check if the client is
eligible to be exempted from rate limiting now, which was previously
only done as a part of zerver.lib.rate_limiter.rate_limit.

Now we mock zerver.lib.rate_limiter.RateLimitedUser instead of
zerver.decorator.rate_limit_user in
zerver.tests.test_decorators.RateLimitTestCase, because rate_limit_user
will always be called but rate limit only happens the should_rate_limit
check passes;

we can continue to mock zerver.lib.rate_limiter.rate_limit_ip, because the
decorated view functions call rate_limit_request_by_ip that calls
rate_limit_ip when the should_rate_limit check passes.

We need to mock zerver.decorator.rate_limit_user for SkipRateLimitingTest
now because rate_limit has been removed. We don't need to mock
RateLimitedUser in this case because we are only verifying that
the skip_rate_limiting flag works.

To ensure coverage in add_logging_data, a new test case is added to use
a web_public_view (which decorates the view function with
add_logging_data) with a new flag to check_rate_limit_public_or_user_views.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-08-17 12:05:38 -07:00
..
lib billing: Move zilencer/lib/stripe to corporate. 2018-10-01 15:43:44 -07:00
management read_receipts: Add support for displaying read receipts. 2022-08-12 13:16:35 -07:00
migrations typing: Use BaseDatabaseSchemaEditor in place of DatabaseSchemaEditor. 2022-05-30 14:18:53 -07:00
README.md docs: Format Markdown with Prettier. 2021-09-08 12:06:24 -07:00
__init__.py
auth.py rate_limit: Replace rate_limit with inlined rate limit checks. 2022-08-17 12:05:38 -07:00
models.py zilencer: Drop the index from RemotePushDeviceToken.user_id. 2022-03-14 17:47:30 -07:00
urls.py rest: Extract remote_server_path from rest_path. 2022-08-13 14:53:52 -07:00
views.py zilencer: Tighten type annotations of views. 2022-08-13 14:53:52 -07:00

README.md

ZILENCER -- The Zulip license manager

This app is the place for storing state about various deployments of Zulip that exist in the world.