NAME

Maypole::Plugin::AutoUntaint - CDBI::AutoUntaint for Maypole

SYNOPSIS

package BeerDB;
use Maypole::Application qw( AutoUntaint );

# instead of this
#BeerDB::Brewery->untaint_columns( printable => [qw/name notes url/] );
#BeerDB::Style->  untaint_columns( printable => [qw/name notes/] );
#BeerDB::Pub->    untaint_columns( printable => {qw/name notes url/] );
#BeerDB::Beer->   untaint_columns( printable => [qw/abv name price notes/],
#                                  integer    => [qw/style brewery score/],
#                                  date       => [ qw/date/],
#                                  );   

# say this
BeerDB->auto_untaint;
setup

Installs the Class::DBI::Plugin::AutoUntaint::auto_untaint() method into the model class.

auto_untaint( %args )

Takes the same arguments as Class::DBI::AutoUntaint::auto_untaint(), but untaint_columns and skip_columns must be further keyed by table:

untaint_columns
untaint_columns => { $table => { printable => [ qw( name title ) ],
                                 date => [ qw( birthday ) ],
                                 },
                     ...,
                     },
                     
skip_columns
skip_columns => { $table => [ qw( secret_stuff internal_data )  ],
                  ...,
                  },
                  

Accepts two additional arguments. match_cols_by_table is the same as the match_cols argument, but only applies to specific tables:

match_cols_by_table
match_cols_by_table => { $table => { qr(^(first|last)_name$) => 'printable',
                                     qr(^.+_event$)          => 'date',
                                     qr(^count_.+$)          => 'integer',
                                     },
                         ...,
                         },
                         

Column regexes here take precedence over any in <match_cols> that are the same.

untaint_tables

Specifies the tables to untaint as an arrayref. Defaults to <$r-config->{display_tables}>>.

debug

The debug level of the Maypole application is passed on to Class::DBI::Plugin::AutoUntaint. If set to 1, this notes (via warn) each table processed.

If the debug level is set to 2, it will report the untaint type used for each column.

If debug mode is turned off, this module switches on Class::DBI::Plugin::AutoUntaint's 'strict' mode.

TODO

Tests!

SEE ALSO

This module wraps Class::DBI::Plugin::AutoUntaint, which describes the arguments in more detail.

Maypole::Plugin::Untaint.

AUTHOR

David Baird, <cpan@riverside-cms.co.uk>

BUGS

Please report any bugs or feature requests to bug-maypole-plugin-autountaint@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Maypole-Plugin-AutoUntaint. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2005 David Baird, All Rights Reserved.