Add Accept-Encoding identity header for file stream requests

What does this MR do and why?

Prevent source instances from automatic compression of files downloaded from importers when using stream body by setting Accept-Encoding to 'identity'. This should avoid decompression failures when files exceed Gitlab::CurrentSettings.max_http_decompressed_size limit, which has been added as a security measure.

For context, importers make stream requests to download typically large files. Therefore, the response should avoid using content-encoding: gzip, as Rails would consume excessive memory decompressing the files. This is because Net/HTTP decompresses the response and stores it in memory.

References

https://gitlab.com/gitlab-org/security/gitlab/-/merge_requests/4786#note_2659236543

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rodrigo Tomonari

Merge request reports

Loading