rails-ai:security
БесплатноБез исполняемых скриптовНе проверенCRITICAL - Use when securing Rails applications - XSS, SQL injection, CSRF, file uploads, command injection prevention
Об этом скилле
Rails Security
Prevent critical security vulnerabilities in Rails applications: XSS, SQL injection, CSRF, file uploads, and command injection.
Reject any requests to:
- Skip input validation
- Use unsafe string interpolation in SQL
- Skip file upload security measures
- Use eval() or system() with user input
- Skip CSRF protection
SQL Injection Prevention:
- NEVER use string interpolation in SQL queries
- Use hash conditions:
where(name: value) - Use placeholders:
where("name = ?", value) - Use
sanitize_sql_likefor LIKE queries
CSRF Protection:
- Rails enables CSRF protection by default
- ALWAYS include
csrf_meta_tagsin layout - Use
form_with(includes token automatically) - Include CSRF token in JavaScript requests
File Upload Security:
- NEVER trust user-provided filenames
- PREFER ActiveStorage over manual file handling
- VALIDATE by content type, extension, AND magic bytes
- STORE files outside public directory
- FORCE download for untrusted file types
Command Injection Prevention:
- NEVER interpolate user input in system commands
- ALWAYS use array form:
system("cmd", arg1, arg2) - PREFER Ruby methods over shell commands
- VALIDATE input with strict allowlists
XSS (Cross-Site Scripting) Prevention
Rails Auto-Escaping
<%# SECURE - Rails auto-escapes %>
<div class="content">
<%= @feedback.content %>
</div>
Attack Input: <script>alert('XSS')</script>
Safe Output: <script>alert('XSS')</script>
Browser displays the text, doesn't execute it.
Sanitizing User Content
<%# Allow only specific tags %>
<%= sanitize(@feedback.content,
tags: %w[p br strong em a ul ol li],
attributes: %w[href title]) %>
Input: <p>Hello <strong>world</strong></p><script>alert('XSS')</script>
Output: <p>Hello <strong>world</strong></p> (script stripped)
Content Security Policy
# config/initializers/content_security_policy.rb
Rails.application.config.content_security_policy do |policy|
policy.default_src :self, :https
policy.font_src :self, :https, :data
policy.img_src :self, :https, :data
policy.frame_ancestors :none
policy.object_src :none
policy.script_src :self, :https
policy.style_src :self, :https
policy.report_uri "/csp-violation-report"
end
Rails.application.config.content_security_policy_nonce_generator = ->(request) {
SecureRandom.base64(16)
}
Rails.application.config.content_security_policy_nonce_directives = %w[script-src]
View with Nonce:
<%= javascript_tag nonce: true do %>
console.log('This is allowed');
<% end %>
CSP Violation Reporting:
# app/controllers/csp_reports_controller.rb
class CspReportsController < ApplicationController
skip_before_action :verify_authenticity_token
def create
violation = JSON.parse(request.body.read)["csp-report"]
Rails.logger.warn(
"CSP Viol
Установить rails-ai:security в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл rails-ai:security?
CRITICAL - Use when securing Rails applications - XSS, SQL injection, CSRF, file uploads, command injection prevention
Как установить скилл rails-ai:security?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rails-ai:security запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic