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

Add capability to block user agents #5749

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Conversation

patphongs
Copy link
Member

Summary (required)

  • Resolves #issue_number

(Include a summary of proposed changes and connect issue below)

Required reviewers

(Include who is required to review prior to merge. For example: One designer and two front end developer reviews are required prior to merge)

Impacted areas of the application

General components of the application that this PR will affect:

Screenshots

(Include a screenshot of the new/updated features in context (“in the wild”). If it is an interface change, include both before and after screenshots)

Related PRs

Related PRs against other branches:

branch PR
fix/other_pr link
feature/other_pr link

How to test

(Include any information that may be helpful to the reviewer(s). This might include links to sample pages to test or any local environmental setup that is unusual such as environment variable (never credentials), API version to point to, etc)

System architecture updates (if applicable)

(If this pull request changes our current system diagram, include a description of those changes here and create a new ticket to update the system diagram)

@@ -176,6 +180,10 @@ def limit_remote_addr():
if request_api_key_id not in BYPASS_RESTRICTION_API_KEY_IDS:
# Service unavailable
abort(503, RESTRICT_MESSAGE)
user_agent = request.headers.get('User-Agent')
for blocked_agent in BLOCKED_USER_AGENTS:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if there's a user agent before checking if it's a blocked user agent? It would save a step

@pkfec pkfec marked this pull request as draft May 14, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants