supabase
Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...
rails-security
Specialized skill for Rails security, authorization, and data protection. Use when implementing Pundit policies, Lockbox encryption, Blind Index searches, authentication, secure configuration, or fixing security vulnerabilities. Includes security best practices and common pitfall prevention.
Full skill instructions
Comprehensive security implementation with Lockbox, Blind Index, and Pundit.
# Gemfile
gem "lockbox" # Encryption at rest
gem "blind_index" # Searchable encryption
gem "pundit" # Authorization
gem "devise" # Authentication (optional)
gem "brakeman" # Security scanner
gem "bundler-audit" # Dependency vulnerabilities
# Install
$ rails lockbox:install
# Creates config/master.key (DO NOT COMMIT!)
# app/models/user.rb
class User < ApplicationRecord
# Encrypt sensitive fields
has_encrypted :email, :ssn, :phone, :credit_card_number
# Lockbox creates:
# - email_ciphertext (stored in DB)
# - email (virtual, decrypted)
end
class AddEncryptedFieldsToUsers < ActiveRecord::Migration[7.1]
def change
add_column :users, :email_ciphertext, :text
add_column :users, :ssn_ciphertext, :text
add_column :users, :phone_ciphertext, :text
end
end
# Writing
user = User.create!(email: "[email protected]") # Auto-encrypted
# Reading
user.email # => "[email protected]" (auto-decrypted)
# Database stores encrypted
user.email_ciphertext # => "encrypted_string..."
# app/models/user.rb
class User < ApplicationRecord
has_encrypted :email, :phone
# Add blind indexes for searchable fields
blind_index :email
blind_index :phone
end
class AddBlindIndexesToUsers < ActiveRecord::Migration[7.1]
def change
add_column :users, :email_bidx, :string
add_column :users, :phone_bidx, :string
add_index :users, :email_bidx, unique: true
add_index :users, :phone_bidx
end
end
# Find by encrypted field (works!)
user = User.find_by(email: "[email protected]")
# Where clause
users = User.where(email: "[email protected]")
# Limitations
User.where("email LIKE ?", "%partial%") # Won't work
User.where("email > ?", "[email protected]") # Won't work (no range queries)
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
include Pundit::Authorization
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
private
def user_not_authorized
flash[:alert] = "You are not authorized to perform this action."
redirect_to(request.referrer || root_path)
end
end
# app/policies/article_policy.rb
class ArticlePolicy < ApplicationPolicy
def index?
true # Anyone can view list
end
def show?
record.published? || user_is_author?
end
def create?
user.present?
end
def update?
user_is_author? || user&.admin?
end
def destroy?
user_is_author? || user&.admin?
end
class Scope < Scope
def resolve
if user&.admin?
scope.all
elsif user
scope.where(published: true).or(scope.where(user: user))
else
scope.where(published: true)
end
end
end
private
def user_is_author?
user && record.user == user
end
end
class ArticlesController < ApplicationController
def index
@articles = policy_scope(Article)
end
def show
@article = Article.find(params[:id])
authorize @article
end
def update
@article = Article.find(params[:id])
authorize @article
if @article.update(article_params)
redirect_to @article
else
render :edit
end
end
end
<% if policy(@article).update? %>
<%= link_to "Edit", edit_article_path(@article) %>
<% end %>
<% if policy(@article).destroy? %>
<%= button_to "Delete", article_path(@article), method: :delete %>
<% end %>
# config/initializers/devise.rb
Devise.setup do |config|
# Strong passwords
config.password_length = 12..128
# Paranoid mode (don't reveal if email exists)
config.paranoid = true
# Account lockout
config.lock_strategy = :failed_attempts
config.maximum_attempts = 5
config.unlock_strategy = :time
config.unlock_in = 1.hour
# Session timeout
config.timeout_in = 30.minutes
end
# .gitignore
/.env
/config/master.key
/config/credentials/*.key
# Edit credentials
$ EDITOR=vim rails credentials:edit
# In file:
aws:
access_key_id: YOUR_KEY
secret_access_key: YOUR_SECRET
# Access in code
Rails.application.credentials.aws[:access_key_id]
# config/environments/production.rb
config.force_ssl = true
# VULNERABLE
def create
User.create(params[:user]) # Allows ANY attribute!
end
# SAFE
def create
User.create(user_params)
end
private
def user_params
params.require(:user).permit(:name, :email, :password)
end
# VULNERABLE
User.where("name = '#{params[:name]}'")
# SAFE
User.where("name = ?", params[:name])
User.where(name: params[:name])
<%# VULNERABLE %>
<%= raw @article.body %>
<%= @article.body.html_safe %>
<%# SAFE - Escape by default %>
<%= @article.body %>
<%# Or sanitize allowed HTML %>
<%= sanitize @article.body, tags: %w[p br strong em] %>
# VULNERABLE - No authorization
def show
@article = Article.find(params[:id])
end
# SAFE - Authorize first
def show
@article = Article.find(params[:id])
authorize @article
end
# Or scope to current user
def show
@article = current_user.articles.find(params[:id])
end
# VULNERABLE
def valid_api_key?(provided_key)
provided_key == stored_key # Timing reveals info
end
# SAFE
def valid_api_key?(provided_key)
ActiveSupport::SecurityUtils.secure_compare(provided_key, stored_key)
end
Before deploying:
# Security scan
bundle exec brakeman --no-pager
# Dependency audit
bundle exec bundle-audit check --update
# Both should pass before merge
For comprehensive security patterns:
security.md (detailed examples and advanced patterns)Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...
Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.
Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.
A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.
Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.
Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
Send, read, and manage Gmail messages, drafts, labels, and account settings.
Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.
Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.
Discover your celebrity doppelgänger with StarByFace!
GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams
Detect AI-generated voices to protect against audio fraud.
Ensure Your Content's Originality with AI Plagiarism Checker
Upscale images by 400% without quality loss
Protect your social media from copyright disputes
Accurately Detect AI-Generated Content with TheChecker.AI
Chrome extension that detects and flags AI-generated content