drupal-security

Enforce secure coding patterns for Drupal 10/11 forms and queries.

45|9|Updated Jan 6, 2026
One-click install
npx skills add https://github.com/madsnorgaard/agent-resources --skill drupal-security
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drupal-security
Source: https://github.com/madsnorgaard/agent-resources/tree/main/.claude/skills/drupal-security
Command: npx skills add https://github.com/madsnorgaard/agent-resources --skill drupal-security

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Drupal development often introduces security vulnerabilities when implementing forms, queries, or rendering user-provided data. This Skill provides real-time guidance and secure coding patterns to prevent issues like XSS, SQL injection, and improper access checks as code is authored.

Core Features & Use Cases

  • Real-time secure coding prompts for Drupal forms, controllers, plugins, and routing
  • Safe defaults for access control, input handling, and output escaping
  • Example-driven guidance with canonical Drupal security patterns and anti-patterns
  • Use Case: A developer adds a new form; the Skill suggests parameterized queries, proper escaping, and access checks

Quick Start

Review the sample Drupal form that accepts user input and apply secure coding patterns.

Frequently Asked Questions about drupal-security

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

FAQPage Schema
How do I prevent SQL injection when writing custom Drupal forms?

To prevent SQL injection in custom Drupal forms, you must use parameterized queries instead of concatenating raw user input. This approach ensures that submitted data is treated strictly as parameters rather than executable SQL code.

What is the best way to handle output escaping for user input in Drupal 10?

Output escaping in Drupal 10 involves sanitizing user-provided data before rendering it to prevent XSS attacks. You should apply proper output escaping patterns to ensure submitted data is safely encoded for the browser context.

How do I add access checks and CSRF protection to a custom Drupal controller?

Adding access checks and CSRF protection to a Drupal controller requires enforcing safe routing defaults and validating tokens. This ensures only authorized users execute controller actions and prevents cross-site request forgery vulnerabilities.

Can I use secure coding patterns for plugins and routing in Drupal 11 environments?

Yes, you can apply secure coding patterns for plugins and routing in Drupal 11 environments. The guidance covers building forms, controllers, and plugins with safe defaults for access control and input handling.

Why does my Drupal file upload implementation lack proper access control?

Your Drupal file upload implementation lacks access control because secure routing and input handling defaults were not applied. You need to enforce proper access checks during development to prevent unauthorized file submissions.

When do I need to validate user input in Drupal plugin development?

You need to validate user input in Drupal plugin development whenever accepting external data. Establishing safe defaults for input handling ensures submitted data is properly sanitized, preventing injection and access control bypasses.