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

Customize user agents to flag #86

Open
nitrocode opened this issue May 3, 2024 · 0 comments · May be fixed by #102
Open

Customize user agents to flag #86

nitrocode opened this issue May 3, 2024 · 0 comments · May be fixed by #102

Comments

@nitrocode
Copy link
Contributor

nitrocode commented May 3, 2024

It would be nice to flag additional user agents using an environment variable

self.USER_AGENTS_RE = [
"signin.amazonaws.com(.*)",
"^S3Console",
"^\[S3Console", # noqa: W605
"^Mozilla/",
"^console(.*)amazonaws.com(.*)",
"^aws-internal(.*)AWSLambdaConsole(.*)",
]

One example is the aws-cli

"[aws-cli/2.22.28 md/awscrt#0.23.4 ua/2.0 os/macos#24.2.0 md/arch#arm64 lang/python#3.12.8 md/pyimpl#CPython cfg/retry-mode#standard md/installer#source md/prompt#off md/command#s3api.put-bucket-policy]",

This useragent can be caught using ^\[aws-cli\/ regex

It would be nice to pass this in as a var to the module

  additional_user_agents_re = [
    "^\[aws-cli\/",
  ]

or be allowed to override them completely

  user_agents_re = [
    "signin.amazonaws.com(.*)", 
    "^S3Console", 
    "^\[S3Console",  # noqa: W605 
    "^Mozilla/", 
    "^console(.*)amazonaws.com(.*)", 
    "^aws-internal(.*)AWSLambdaConsole(.*)", 
    "^\[aws-cli\/",
  ]

or both

  user_agents_re = [
    "signin.amazonaws.com(.*)", 
    "^S3Console", 
    "^\[S3Console",  # noqa: W605 
    "^Mozilla/", 
    "^console(.*)amazonaws.com(.*)", 
    "^aws-internal(.*)AWSLambdaConsole(.*)", 
  ]

  additional_user_agents_re = [
    "^\[aws-cli\/",
  ]

Maybe even customizing the non regex user agents would be nice too

self.USER_AGENTS = {"console.amazonaws.com", "Coral/Jakarta", "Coral/Netty4"}

@nitrocode nitrocode changed the title Also notify on awscli events Customize user agents to flag (such as awscli) May 3, 2024
@nitrocode nitrocode linked a pull request Jan 30, 2025 that will close this issue
@nitrocode nitrocode changed the title Customize user agents to flag (such as awscli) Customize user agents to flag Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant