Repository navigation
deps: Update dependency ecto to v3.14.3 [SECURITY] - #87
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/hex-ecto-vulnerability
branch
from
December 3, 2026 10:36
a3ebdb4 to
ecc65de
Compare
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.
This PR contains the following updates:
3.10.1→3.14.3Unbounded query cache growth from interpolated JSON paths and splice lists in Ecto
CVE-2026-118391 / EEF-CVE-2026-118391 / GHSA-cxjx-vmm2-qr8r
More information
Details
Summary
Allocation of Resources Without Limits or Throttling vulnerability in elixir-ecto ecto allows an unauthenticated remote attacker to exhaust memory in the application and in the database server by sending requests with distinct JSON keys or list lengths where the application interpolates them into
json_extract_path/2,field[^key]orsplice/1. Ecto caches prepared queries per repository in an ETS table with no size limit and no eviction. Interpolated JSON path elements become part of the query expression instead of its parameters, andsplice/1expands into one placeholder per element, so every distinct key or list length creates a new cache entry. With ecto_sql each entry is also a new prepared statement on the database connection that runs it. None of this memory is released until the processes restart.This issue affects ecto: from 3.4.0 before 3.14.3.
Details
1. Cache keys (
lib/ecto/query/builder.ex,lib/ecto/query/planner.ex)escape_json_path/2checks interpolated path elements withjson_path_element!/1, and a whole interpolated path withjson_path!/1, at runtime and places the resulting strings and integers in the{:json_extract_path, [], [field, path]}expression instead of in the query parameters.Ecto.Query.Plannerbuilds the cache key from the query expressions, so every distinct path is a distinct key.splice(^list)keeps the values as parameters but expands into one placeholder per element.cast_and_merge_params/5marks{:in, _}parameters as not cacheable but keeps{:splice, _}parameters cacheable, so every distinct list length is a distinct key, and the entry grows with the length.2. Cache storage (
lib/ecto/query/planner.ex,lib/ecto/repo/supervisor.ex)Ecto.Query.Planner.query/6stores each new query with:ets.insert_new/2in the table thatEcto.Repo.Supervisorcreates withnew_query_cache/1, and nothing removes entries. ecto_sql renders the path into the SQL text, for exampleWHERE ((i0."meta"#>array['color']::text[]) = $1), and Postgrex prepares a named statement for each new SQL text on the connection that runs it.3. Effect
Each request with a new key or list length adds memory that is never released, in the BEAM, where the cache is shared by the whole repository, and with ecto_sql in the database server, where prepared statements are kept per connection. Large keys amplify this: every 1 MB of request data retained about 2 MB in the application and 3 MB in PostgreSQL. The query cache was disabled for
values/2sources after a similar report, but not for these two cases.Proof of concept
Reproduced on Ecto main (
ad8fda5) with ecto_sql 3.14.0, Postgrex 0.22.4 and PostgreSQL 18.4, on Elixir 1.20.4 and Erlang/OTP 29, withpool_size: 1.Repo.all(from i in Item, where: json_extract_path(i.meta, ^[key]) == ^value, select: i.id).fragment("? IN (?)", i.id, splice(^ids))with list lengths 1 to 300 adds 300 cache entries, whilei.id in ^idswith the same lengths adds 1.Impact
An unauthenticated client can make the application and its database keep memory from every request that carries a new JSON key or list length, when the application passes it into an interpolated JSON path or
splice/1. Nothing frees that memory until the processes restart. In the proof of concept, 200 requests with 100 MB of keys in total left 191 MB in the BEAM and 289 MB in the PostgreSQL backend of one connection. Sustained requests exhaust memory in the application node, the database server, or both.Workarounds
Pass the path as a query parameter so it is not part of the cache key. With PostgreSQL:
fragment("? #> ?", i.meta, type(^path, {:array, :string})). Alternatively, disable the cache for these queries withRepo.all(query, query_cache: false), or restrict keys and list lengths to a known set before building the query.Configurations
The application must pass request data into an interpolated JSON path (
json_extract_path(field, ^path),json_extract_path(field, [^key])orfield[^key]), or a request-controlled list intosplice/1, and run the query through a repository with the defaultquery_cache: true.Solutions
Upgrade Ecto to 3.14.3 or later. Queries with interpolated JSON path elements or an interpolated
splice/1list are no longer cached, the same as running them withquery_cache: false, so distinct keys and list lengths don't add cache entries.Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:HReferences
This data is provided by OSV.
Release Notes
elixir-ecto/ecto (ecto)
v3.14.3Compare Source
Bug fixes
joinin the query cache keyjoin, as well as the hints given to the join itselfsplice/1, andconstant/1, as each distinct value would create a new query cache entry (CVE-2026-118391)or_wheredepends onv3.14.2Compare Source
Enhancements
:writableand:on_writable_violationfor the:inserted_atfield generated bytimestamps/1Bug fixes
changed?/3for removed one-to-one relationsbelongs_tokeys inapply_changes/1prepare_changescallbacks inmerge/2:on_castfunction in relation type metadataprepare_changescallbacks@deriveDateTimecasts to UTC (note: reverted in the next release)v3.14.1Compare Source
Enhancements
embedded_schemato have non-virtual:anyfields:on_writable_violationoption for fields (a default can be specified with@on_writable_violation)Bug fixes
fromsource is a{fragment, schema}tuple:writablein returned structinsert_allwith placeholdersv3.14.0Compare Source
Enhancements
counteroption inprepare_query/3Ecto.Changeset.reorder_assoc/2{fragment, Schema}source:replace_changedon upserts to enable HOT updates in PostgreSQL:query_cacheoption to selectively bypass query cache:on_join_through_conflictoption forEcto.Type.trim/2and allow developers to configure how values are trimmed on cast with the:trim_valuesoptionBug fixes
order_bynow take precedence over:preload_order. The:preload_orderoption is now only applied when no custom query with ordering is provided.v3.13.6Compare Source
Enhancements
v3.13.5Compare Source
Enhancements
v3.13.4Compare Source
Bug fixes
:incomposite typesv3.13.3Compare Source
Enhancements
excludeBug fixes
v3.13.2Compare Source
Bug fixes
overclause'sorder_byv3.13.1Compare Source
Bug fixes
replace. It is the user responsibility to make sure they do not overlapv3.13.0Compare Source
Requires Elixir v1.14+.
Enhancements
Ecto.Enum.cast_value/3valueslist typesfield/2identifier/1in queriesconstant/1in queriesexclude/2to remove windowsjson_extract_pathEcto.Repo.prepare_transaction/2user callbackEcto.Repo.all_by/3Ecto.Repo.transact/2replace_all_except@schema_redact: :all_except_primary_keysmodule attributeBug fixes
map/2in queries now always returns a map on joins, even on left joins, for consistency withfromsourcesSoft deprecations (no warnings emitted)
Ecto.Repo.transaction/2is soft-deprecated in favor ofEcto.Repo.transact/1literal/1is deprecated in favor ofidentifier/1v3.12.6Compare Source
Fix deprecations on Elixir v1.19.
v3.12.5Compare Source
Bug fixes
values/2dynamic/2with interpolated named bindings:allow_staleoptions to assocsv3.12.4Compare Source
Enhancements
:pool_countoptionBug fixes
Ecto.Repo.reloadrespectsourcev3.12.3Compare Source
Bug fixes
v3.12.2Compare Source
Bug fixes
:prefixto be set to any termv3.12.1Compare Source
Enhancements
Ecto.Type.parameterized?/2Bug fixes
v3.12.0Compare Source
Enhancements
{message, opts}to be given as message for several validation APIsis_named_bindingguarddistinct,group_by,order_byandwindowexpressionsselect_mergeto be used in moreinsert_alland subquery operations by merging distinct fieldsdynamic/2order_byfromandjoinselectinreplace_allinsert_allsupports queries with only sourceinsert_allsupports queries with the update syntax:allow_staleon Repo struct/changeset operations:writableoption:defaults_to_structoption toembeds_one:durationtype which maps to Elixir v1.17 duration{:map, type}and{:array, type}Ecto.Type.cast!/2Bug fixes
preloadwhen a through association is used in a join and has a nested separate query preload. Now the association chain is no longer preloaded and we simply preload directly onto the loaded through association.map/structmodifiersvalueslistsinsert_all{:replace, fields}:prefixis a string/binary, warn otherwise:preload_orderMFA inhas_manyAdapter changes
distinct,group_by,order_byandwindowexpressions use the newEcto.Query.ByExprstruct rather than the old
Ecto.Query.QueryExprstructPotential incompatibilities
{:parameterized, {mod, state}}. While this representation is private, projects may have been relying on it, and therefore they need to adapt accordingly. UseEcto.ParameterizedType.init/2to instantiate parameterized types.:array_joinjoin type. It was added for Clickhouse support but it is no longer used:prefixis a string/binary (this was reverted in v3.12.2)v3.11.2Compare Source
Bug fixes
v3.11.1Compare Source
Enhancements
inoperatorBug fixes
havingv3.11.0Compare Source
Enhancements
preload_orderto take MFAs formany_to_manyassociations. This allows ordering by the join table:operationoption towith_cte/3. This allows CTEs to perform updates and deletessplice(^...)infragmentprepend_order_by/3selected_as/1andselected_as/2to take interpolated namesnilvalues inselectunsafe_fragmentvalues/2lists:on_preload_spawnoption topreload/3:load_in_queryoption for embeds:returningoption for deleteBug fixes
on_deletequeriesArgumentErrorwhen specifying an autogenerated:idprimary keybelongs_toassociation if foreign key update results in a mismatchAdapter changes
nilfor encoding/decodingtypeinstead of{:maybe, type}as the first argument toloaders/2Deprecations
unsafe_fragmentinside of hints insteadv3.10.3Compare Source
Enhancements
field/2intype/2Bug fixes
v3.10.2Compare Source
Enhancements
cast_assocandcast_embedvalidate_length/3:nulls_distinctoption tounsafe_validate_uniquearray_jointype for ClickHouse adapterBug fixes
Repo.aggregatejson_extract_pathDeprecations
:withConfiguration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.