perl-security

Applies secure coding patterns for Perl covering taint mode, input validation, DBI queries, and web security.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/ibytechaos/claude --skill perl-security-ibytechaos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: perl-security
Source: https://github.com/ibytechaos/claude/tree/main/plugins/everything-claude-code/skills/perl-security
Command: npx skills add https://github.com/ibytechaos/claude --skill perl-security-ibytechaos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Perl applications that handle user input, execute system commands, or query databases are prone to injection attacks, path traversal, and XSS vulnerabilities. This Skill provides concrete secure coding patterns so Perl code resists common attack vectors before it ships. ## Core Features & Use Cases - Taint Mode & Input Validation: Enable -T taint checking, untaint data with strict allowlist regexes, and enforce length constraints on user input. - Injection Prevention: Use three-argument open, list-form system calls, and DBI parameterized queries to block command injection and SQL injection. - Web Security: Apply output encoding with HTML::Entities, CSRF token generation, secure session configuration, and security headers for Mojolicious, Dancer2, and Catalyst apps. - Use Case: When reviewing a legacy CGI script that interpolates user input into SQL and shell commands, use this Skill to rewrite it with taint mode, DBI placeholders, and safe process execution, then verify with perlcritic security policies. ## Quick Start Review my Perl web application code for security vulnerabilities and rewrite unsafe patterns using taint mode, parameterized DBI queries, and proper output encoding.

Frequently Asked Questions about perl-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent SQL injection in Perl DBI queries?

Use DBI placeholders for every query: prepare statements with ? markers and pass values through execute(). Never interpolate variables into SQL strings. For dynamic column names in ORDER BY, validate against an allowlist of permitted columns and directions.

How to safely execute system commands in Perl?

Use the list form of system() or exec(), which bypasses shell interpolation entirely. For capturing output, use IPC::Run3 or Capture::Tiny instead of backticks. Never pass user input into string-form system calls, as that enables shell injection.

What is Perl taint mode and when should I use it?

Taint mode, enabled with the -T flag, marks all external data as tainted and blocks its use in unsafe operations until validated. Enable it for CGI scripts and web-facing code, then untaint inputs with strict allowlist regexes that capture the validated portion.

Does Perl have built-in XSS protection for web frameworks?

Mojolicious auto-escapes output with <%= %> tags, while Template Toolkit requires the html filter. For manual encoding, use HTML::Entities encode_entities() for HTML context and URI::Escape for URL parameters. Avoid raw output tags like <%== %> for untrusted content.

How do I check Perl code for security issues automatically?

Run perlcritic with a security-focused configuration: perlcritic --severity 3 --theme security on your lib directory. Key policies include RequireThreeArgOpen, ProhibitStringyEval, ProhibitBacktickOperators, and RequireTaintChecking, which catch the most dangerous patterns.

Why is two-argument open dangerous in Perl?

Two-argument open interprets special characters in the filename, so a path like '|rm -rf /' executes a shell command. Always use three-argument open with an explicit mode, lexical filehandles, and check the return value for errors.