Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Set User Agent Header for S3 Requests #2136

Closed
ajschmidt8 opened this issue Mar 22, 2024 · 3 comments · Fixed by #2137
Closed

Set User Agent Header for S3 Requests #2136

ajschmidt8 opened this issue Mar 22, 2024 · 3 comments · Fixed by #2137
Labels

Comments

@ajschmidt8
Copy link
Contributor

ajschmidt8 commented Mar 22, 2024

Feature Request

As defined by MDN (src):

The User-Agent request header is a characteristic string that lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent.

I'd like to request that sccache set a user-agent header for requests to AWS/S3. The user-agent header should include the sccache version.

Use Case

AWS supports writing IAM policies that block access to resources based on the user-agent header: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-useragent.

I'd like to write a policy that denies access to an S3 bucket for versions of sccache that are affected by #2038.

@ajschmidt8
Copy link
Contributor Author

cc: @Xuanwo in case this option needs to be exposed in opendal

@ajschmidt8 ajschmidt8 changed the title Set User Agent String for S3 Requests Set User Agent Header for S3 Requests Mar 23, 2024
@Xuanwo
Copy link
Collaborator

Xuanwo commented Mar 25, 2024

As mentioned in apache/opendal#4389 (comment), this should already be simple. Let me mark this as good first issue and help wanted. Feel free to take this if you want to implement it too.

ajschmidt8 added a commit to ajschmidt8/sccache that referenced this issue Mar 25, 2024
Closes mozilla#2136.

This PR configures the S3 backend to use a custom HTTP client
which has a user agent header set.

The user agent header enables `sccache` users to write AWS policies to
accept or reject `sccache` requests to an S3 bucket based on their `sccache`
version.
@ajschmidt8
Copy link
Contributor Author

@Xuanwo, thanks. PR here: #2137.

sylvestre pushed a commit that referenced this issue Mar 25, 2024
* Set User Agent Header for S3 Requests

Closes #2136.

This PR configures the S3 backend to use a custom HTTP client
which has a user agent header set.

The user agent header enables `sccache` users to write AWS policies to
accept or reject `sccache` requests to an S3 bucket based on their `sccache`
version.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants