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

SQL::Abstract::Plugin::BangOverrides - replace a clause of a statement with a !clause key

SYNOPSIS

$sqla->plugin('+BangOverrides');
...
profit();

METHODS

register_extensions

Wraps all currently existing clause based statements such that when a clause of '!name' is encountered, if its value is a coderef, it's called with the original value of the 'name' clause and expected to return a replacement, and if not, it's simply used as a direct replacement.

This allows for passing data through existing systems that attempt to have their own handling for things but whose capabilities are now superseded by SQL::Abstract, and is primarily useful to provide access to experimental feature bundles such as SQL::Abstract::Plugin::ExtraClauses.

As an example of such a thing, given an appropriate DBIC setup (see examples/bangdbic.pl):

$s->storage->sqlmaker->plugin('+ExtraClauses')->plugin('+BangOverrides');

my $rs2 = $s->resultset('Foo')->search({
  -op => [ '=', { -ident => 'outer.y' }, { -ident => 'me.x' } ]
});
# (SELECT me.x, me.y, me.z FROM foo me WHERE ( outer.y = me.x ))

my $rs3 = $rs2->search({}, {
  '!from' => sub { my ($sqla, $from) = @_;
    my $base = $sqla->expand_expr({ -old_from => $from });
    return [ $base, -join => [ 'wub', on => [ 'me.z' => 'wub.z' ] ] ];
  }
});
# (SELECT me.x, me.y, me.z FROM foo me JOIN wub ON me.z = wub.z WHERE ( outer.y = me.x ))

my $rs4 = $rs3->search({}, {
  '!with' => [ [ qw(wub x y z) ], $s->resultset('Bar')->as_query ],
});
# (WITH wub(x, y, z) AS (SELECT me.a, me.b, me.c FROM bar me) SELECT me.x, me.y, me.z FROM foo me JOIN wub ON me.z = wub.z WHERE ( outer.y = me.x ))

my $rs5 = $rs->search({}, { select => [ { -coalesce => [ { -ident => 'x' }, { -value => 7 } ] } ] });
# (SELECT -COALESCE( -IDENT( x ), -VALUE( 7 ) ) FROM foo me WHERE ( z = ? ))

my $rs6 = $rs->search({}, { '!select' => [ { -coalesce => [ { -ident => 'x' }, { -value => 7 } ] } ] });
# (SELECT COALESCE(x, ?) FROM foo me WHERE ( z = ? ))