Make google_gax compatible with tesla >= 1.18.3#1
Merged
Conversation
Restores compatibility between google_gax and tesla >= 1.18.3 (the CVE-2026-48594 fix made :max_body_size required). Mirrors the upstream fix in googleapis#13328, which was closed unmerged because the repo is being archived. - connection.ex: DecompressResponse gets max_body_size: :infinity; multipart field names atom -> string. - mix.exs: drop the {:mime, "~> 1.0"} cap so mime resolves to 2.x under tesla 1.20. - api_test.exs: assert the accept-encoding header the middleware now adds.
alan
force-pushed
the
tesla-1.18.3-compat
branch
from
July 13, 2026 09:59
5605582 to
4794a5d
Compare
Explicitly covers the atom -> string fix in build_body/3: tesla >= 1.18.3 raises on atom multipart field names, so assert every part's :name disposition is a binary.
shaharz
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fork patch restoring compatibility between
google_gaxandtesla >= 1.18.3, which is otherwise a hard runtime break, so downstream consumers can bump Tesla to 1.20.Why
tesla1.18.3 (the fix for CVE-2026-48594) made:max_body_sizea required option onTesla.Middleware.Compression/DecompressResponse, fetched for every non-HEAD response before any content-encoding check.GoogleApi.Gax.ConnectionplugsDecompressResponsewith[], so every generated Google API client (google_api_storage,google_api_pub_sub,google_api_logging,google_api_ai_platform) raisesArgumentErrorat runtime once Tesla is on 1.18.3+.Upstream fixed this in googleapis#13328, but that PR was closed unmerged on 2026-06-30 because the repo is being archived, and
google_gaxwill get no further Hex releases. This fork carries the identical fix.Changes (mirrors googleapis#13328)
connection.ex—DecompressResponsenow passedmax_body_size: :infinity(see security note below).connection.ex— multipart field names changed from atom (:metadata,body_name) to string ("metadata",to_string(body_name)). Tesla 1.18.3Multipart.add_field/4requires binary field names and raises on atoms via a singleis_binary-guardedassert_quoted_string_safe!/2clause — this would otherwise break GCS multipart uploads.mix.exs— drop the{:mime, "~> 1.0"}dep. The publishedgoogle_gaxnever declaredmime; the repo master added a~> 1.0cap that hard-conflicts with consumers requiringmime ~> 2.0.6 or ~> 2.1(mime resolves to 2.0.7 under Tesla 1.20).google_gaxnever callsMIMEdirectly, so removal is safe and unblocks resolution.connection_test.exs— explicit assertion that multipart field names are stringified.Security note: why
max_body_size: :infinity?This is a security-motivated change that deliberately opts these clients out of the new decompression-bomb protection. That is intentional and, we believe, safe:
:infinitypreserves the exact prior behaviour (google_gaxnever capped decompression), so there is no regression relative to today.max_body_sizecaps to all other outbound HTTP, including untrusted third-party traffic — this exemption is scoped only to the Google clients.Test coverage
api_test.exscompressed/basic response tests (they would raiseArgumentErrorwithout the fix under Tesla >= 1.18.3).connection_test.exsbuild_body tests (they would crash on atom field names without the fix) plus the new explicit string-name assertion.Consumed by
Referenced downstream via a
sparse+overridegit dep onclients/gax.