Skip to content
This repository was archived by the owner on Jun 30, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clients/gax/lib/google_api/gax/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule GoogleApi.Gax.Connection do
)
)

plug(Tesla.Middleware.DecompressResponse, [])
plug(Tesla.Middleware.DecompressResponse, max_body_size: :infinity)

@grzuy grzuy Jun 23, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tesla's max_body_size option here was made required to fix a "decompression bomb" vulnerability in elixir-tesla/tesla@340f75b.

So, setting it to :infinity is not ideal, decompression vuln still present, but it's the more backwards-compatible way to make google_gax compatible with latest tesla, and just keeps previous tesla behavior.

We can set to :infinity, release 0.4.2, then consider setting it to some safer, limited value for a new release that might be backwards-incompatible.

But at least having a patch version that it's compatible with latest tesla can unblock a lot of downstream projects being blocked from updating tesla.


plug(Tesla.Middleware.EncodeJson, engine: Poison)

Expand Down Expand Up @@ -182,7 +182,7 @@ defmodule GoogleApi.Gax.Connection do
nil -> body
_ -> Tesla.Multipart.add_field(
body,
:metadata,
"metadata",
Poison.encode!(meta),
headers: [{:"Content-Type", "application/json"}]
)
Expand All @@ -193,7 +193,7 @@ defmodule GoogleApi.Gax.Connection do
{res, type} = try_encode_multipart_field(data, meta)
Tesla.Multipart.add_field(
b,
body_name,
to_string(body_name),
res,
headers: [{:"Content-Type", type}]
)
Expand Down
1 change: 0 additions & 1 deletion clients/gax/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ defmodule GoogleApi.Gax.MixProject do
defp deps() do
[
{:tesla, "~> 1.2"},
{:mime, "~> 1.0"},
{:poison, ">= 3.0.0 and < 5.0.0"},
{:ex_doc, "~> 0.16", only: :dev},
{:dialyxir, "~> 0.5", only: [:dev], runtime: false}
Expand Down
4 changes: 2 additions & 2 deletions clients/gax/test/gax/api_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Gax.ApiTest do
mock(fn %{
method: :get,
url: "https://example.com/v1/stores/store-1/pets",
headers: [{"x-goog-api-client", ^api_client}]
headers: [{"x-goog-api-client", ^api_client}, {"accept-encoding", "gzip, deflate, identity"}]
} ->
%Tesla.Env{status: 200, body: @pets_json}
end)
Expand All @@ -61,7 +61,7 @@ defmodule Gax.ApiTest do
mock(fn %{
method: :get,
url: "https://example.com/v1/stores/store-1/pets",
headers: [{"x-goog-api-client", ^api_client}]
headers: [{"x-goog-api-client", ^api_client}, {"accept-encoding", "gzip, deflate, identity"}]
} ->
%Tesla.Env{status: 200, body: @pets_json_compressed,
headers: [{"content-encoding", "gzip"}]}
Expand Down