That's easy - apply Filter::Handle to STDOUT and check to see that the data isn't tainted. die() if it happens. This is really about preventing tainted data from going to STDOUT so the name isn't great but hey, it works. Why don't you document it and submit it to CPAN?
package CGI::Taint; use Filter::Handle 'subs'; use Taint; BEGIN { Filter \*STDOUT, sub { # Access $_[0] directly so that tainted() can test # the actual variable. if ( tainted( $_[0] ) ) { die "Tainted output could not be written to STDOUT: $_[0]" +; } $_[0] } }
In reply to Re: writing a "CGI::Taint" module
by diotalevi
in thread writing a "CGI::Taint" module
by cLive ;-)
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |