Skip to content

Conversation

kbrock
Copy link
Contributor

@kbrock kbrock commented Sep 16, 2025

I did not dive into what active record change caused this change in behavior,
nor when a simple parameter is passed. But after upgrading to rails 7.1,
this started showing up for many queries for me.

Old Rails

The binds parameters, passed to sql are of the following forms:

  • ["parameter_name", "parameter_value"]
  • ActiveRecord::Relation::QueryAttribute

Rails 7.1 (or maybe 7.0?)

The binds parameters, passed to sql are of the following forms:

  • ["parameter_name", "parameter_value"]
  • ActiveRecord::Relation::QueryAttribute
  • Simple class like Date, String

The simple types caused an issue when trying to call String#name or String#value.

After this commit

It is able to handle when simple objects are passed into rails
If a password is passed as a simple parameter, that will get leaked,
since the name of the parameter is no longer passed by rails.

I did not dive into what active record change caused this change in behavior,
nor when a simple parameter is passed. But after upgrading to rails 7.1,
this started showing up for many queries for me.

Old Rails
=========

The `binds` parameters, passed to sql are of the following forms:

- ["parameter_name", "parameter_value"]
- ActiveRecord::Relation::QueryAttribute

Rails 7.1 (or maybe 7.0?)
==============

The `binds` parameters, passed to sql are of the following forms:

- ["parameter_name", "parameter_value"]
- ActiveRecord::Relation::QueryAttribute
- Simple class like Date, String

The simple types caused an issue when trying to call String#name or String#value.

After this commit
=================

It is able to handle when simple objects are passed into rails
If a password is passed as a simple parameter, that will get leaked,
since the name of the parameter is no longer passed by rails.
@kbrock kbrock changed the title Support simple sql bind parameters Fix simple sql bind parameters throwing errors Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant