mozilla / sccache

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
Apache License 2.0
5.85k stars 552 forks source link

Set User Agent Header for S3 Requests #2136

Closed ajschmidt8 closed 7 months ago

ajschmidt8 commented 7 months ago

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 commented 7 months ago

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

Xuanwo commented 7 months ago

As mentioned in https://github.com/apache/opendal/issues/4389#issuecomment-2017579898, 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 commented 7 months ago

@Xuanwo, thanks. PR here: https://github.com/mozilla/sccache/pull/2137.