Security Advisories (1)
CVE-2026-121265 (2026-11-07)

SQL::Abstract versions before 2.000003 for Perl allow SQL injection via an arrayref column value in insert and update. With the array_datatypes option off, which is the default, insert(), update() and values() treat an arrayref column value as literal SQL. Its first element goes into the SQL text unescaped and the rest become bind values. A JSON array, or a repeated form field decoded as an arrayref, is such a value. An application that passes request data as column values to insert or update with the default options allows SQL injection. Releases before 2.000003 also treat an arrayref in generate() as literal SQL, including through AUTOLOAD when allow_autoload is on, whatever array_datatypes is set to.

NAME

DBIx::Class::SQLMaker::Role::SQLA2Passthrough - A test of future possibilities

REQUIRES

This module ships inside the SQL-Abstract distribution but requires DBIx::Class at runtime. DBIx::Class is intentionally not a prerequisite of SQL-Abstract - DBIx::Class depends on SQL::Abstract, so declaring the reverse would create a dependency cycle - therefore you must have DBIx::Class installed separately to use this module. It is an experimental proof of concept (see the NAME above).

SYNOPSIS

  • select and group_by options are processed using the richer SQLA2 code

  • expand_join_condition is provided to more easily express rich joins

See examples/sqla2passthrough.pl for a small amount of running code.

SETUP

(on_connect_call => sub {
   my ($storage) = @_;
   $storage->sql_maker
           ->with::roles('DBIx::Class::SQLMaker::Role::SQLA2Passthrough');
})

expand_join_condition

__PACKAGE__->has_many(minions => 'Blah::Person' => sub {
  my ($args) = @_;
  $args->{self_resultsource}
       ->schema->storage->sql_maker
       ->expand_join_condition(
           $args
         );
});

on

__PACKAGE__->has_many(minions => 'Blah::Person' => on {
  { 'self.group_id' => 'foreign.group_id',
    'self.rank' => { '>', 'foreign.rank' } }
});

Or with ParameterizedJoinHack,

__PACKAGE__->parameterized_has_many(
    priority_tasks => 'MySchema::Result::Task',
    [['min_priority'] => sub {
        my $args = shift;
        return +{
            "$args->{foreign_alias}.owner_id" => {
                -ident => "$args->{self_alias}.id",
            },
            "$args->{foreign_alias}.priority" => {
                '>=' => $_{min_priority},
            },
        };
    }],
);

becomes

__PACKAGE__->parameterized_has_many(
    priority_tasks => 'MySchema::Result::Task',
    [['min_priority'] => on {
      { 'foreign.owner_id' => 'self.id',
        'foreign.priority' => { '>=', { -value => $_{min_priority} } } }
    }]
);

Note that foreign/self can appear in such a condition on either side, BUT if you want DBIx::Class to be able to use a join-less version you must ensure that the LHS is all foreign columns, i.e.

on {
  +{
    'foreign.x' => 'self.x',
    'self.y' => { -between => [ 'foreign.y1', 'foreign.y2' ] }
  }
}

is completely valid but DBIC will insist on doing a JOIN even if you have a fully populated row object to call search_related on - to avoid the spurious JOIN, you must specify it with explicit LHS foreign cols as:

on {
  +{
    'foreign.x' => 'self.x',
    'foreign.y1' => { '<=', 'self.y' },
    'foreign.y2' => { '>=', 'self.y' },
  }
}