13.5. Security

Not long ago, security was still considered optional by many people. Today that attitude is widely recognized as dangerous to others as well as oneself. The issue of security on the Internet has garnered universal attention, and one of the ways a host can be broken into is through a poorly written CGI program.

Don't let yours be one of them.

13.5.1. Taint mode

Perl provides a powerful mechanism for securing your CGI programs. It's called taint mode, and no program you put on the Web should be without it. You invoke it with the -T flag, making the first line of your scripts

#!/usr/bin/perl -wT

(Of course, the path to your perl may differ.)

Taint mode doesn't actually do anything by itself to secure your program. What it does is ...

Get Perl Debugged now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.