CGI-Plus
view release on metacpan or search on metacpan
lib/CGI/Plus.pod view on Meta::CPAN
(CSRF) is a technique for breaching a web site's security. CSRF is one of the
most common web-site vulnerabilities. CGI::Plus provides a technique for
protecting
=head2 $cgi->csrf_value()
Returns the string used in CSRF checks. This value must be included in an HTML
form (see L<< /$cgi-E<gt>csrf_value() >>)
=head2 $cgi->csrf_field()
Returns a hidden HTML field with the CSRF check value in it. This field must
be included in HTML forms if you do a CSRF check. The string will look
something like this:
<input type="hidden" name="csrf" value="8hFnVjSr25">
=head2 $cgi->csrf_param()
Returns the URL parameter to use in a URL. The return value will look
something like this:
csrf=8hFnVjSr25
The string will never contain HTML or URL meta characters, so it does not need
to be HTML or URL escaped.
=head2 $cgi->csrf_check()
Checks if a CSRF check value was sent and that it matches the CSRF check
cookie. CSRF checks must be turned on or this method will croak. The
following code is a typical usage of csrf checking:
$cgi->csrf(1);
if (! $cgi->csrf_check) {
die 'security error';
}
=head1 TERMS AND CONDITIONS
Copyright (c) 2012 by Miko O'Sullivan. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same terms
as Perl itself. This software comes with B<NO WARRANTY> of any kind.
=head1 AUTHOR
Miko O'Sullivan
F<miko@idocs.com>
=head1 VERSION
=over 4
=item Version 0.10 November 22, 2012
Initial release
=item Version 0.12 November 28, 2012
Fixing prerequisite lists in CPAN upload.
=item Version 0.13 April 25, 2014
Fixed error in META.yml.
=item Version 0.14 May 23, 2014
Fixed bugs in test script.
=item Version 0.15 January 4, 2015
Gave tests names.
=back
( run in 1.055 second using v1.01-cache-2.11-cpan-b16cb0d3907 )