Sites For Teachers Logo
ClassHelper News
About ClassHelper.org
Free Math Resources
Free School Clip Art
Crossword Puzzles
Word Find Puzzles
Cryptogram Puzzles
Word Jumble Puzzles
Class Project Ideas
Resources Directory
 
Wikipedia Affiliate Button

Perl Security Considerations

Keeping Your System Safe

Programmers are often so focused on solving the problem at hand that they don't stop to consider the security implications of the applications they create. This is a particularly common problem in the web development community, where web applications are produced for use by the general public. The first rule of safe web programming is simple: never trust data that comes from an outside source. This includes information submitted via web forms, data read from files or databases that any other program can modify, and values stored in browser cookies.

Always assume the data you're working with could have been modified in some unintended manner. There's nothing stopping a malicious person from changing the length, type, or contents of data submitted to your scripts via HTTP POST or GET methods. Always verify your data; if you're expecting a number, use a regular expression to strip the input of any other characters. If your program is sending an email, verify that the "TO" address is the intended recipient. Never use raw input as part of a file name you're going to read from or write to. Be extremely careful using system and exec calls that you construct on the fly.

This tutorial isn't designed to cover every conceivable threat a public-facing web application could face. For more information on secure programming in Perl, reference these resources:

The last chapter offers some links to resources that will help you continue your Perl programming education.

Continue: Additional Programming Resources

Table of Contents

  1. Introduction and Motivation
  2. System Requirements and Getting Perl
  3. Variables and Data Types
  4. Program Flow Control
  5. File Input/Output
  6. Subroutines and Code Reuse
  7. Your First Web Application
  8. Getting User Input with HTML Forms
  9. Coding Style and Maintenance
  10. Security Considerations
  11. Additional Programming Resources