Ruby on Rails security: release support, Gemfile.lock advisories and the settings Rails leaves to you
Rails supplies protections against forged requests, SQL injection, mass assignment and Host header attacks, and each one can be switched off, sidestepped or left unconfigured in your own code.
This guide explains which Rails release series receive security fixes, how to read a Rails advisory against your Gemfile.lock, what the Rails guides say about credentials, HostAuthorization, strong parameters, SQL fragments, CSRF, CSP and mounted admin dashboards, and gives you a register to fill in for your own application.
In this guide
Rails release, Gemfile.lock advisory and configuration register
A five-part register: Rails release and Gemfile.lock versions per environment, an advisory log, eight configuration check blocks, with a Source line naming the Rails or tool page behind each line that states a fact, a two-account controller and object authorisation matrix, and a worked example for an invented application with invented gems and invented advisory ids. Every check reads and records; none changes a setting or reveals a secret.
rails.txt
Introduction15 lines
Part A. Rails release and Gemfile.lock (one block per environment: production, staging, each CI image)14 lines
Part B. Advisory log (one line per advisory and gem)9 lines
Part C. Configuration checks90 lines
Part D. Two-account controller and object authorisation matrix26 lines
Part E. Worked example (invented)51 lines
Whole template220 lines
RAILS RELEASE, GEMFILE.LOCK ADVISORY AND CONFIGURATION REGISTER
TEMPLATE AND ILLUSTRATION. Parts A to D are a blank register to copy into a ticket, a shared document or a spreadsheet. Part E fills it in for an invented application, invented-rails-app. In Part E, every gem whose name ends in -invented, every advisory id that starts with INVENTED-, every host name, person, file location and finding is made up for this example. None of them describes a real gem, a real advisory or a real business. Facts taken from Rails pages, such as the maintenance page entry in E.A.4, the security post in E.A.7 and the defaults quoted in E.C, are real, as read on 14 November 2026.
RULES FOR EVERY LINE
- Each line is a read-only check, run by whoever owns the application or a developer they engage, on systems the owner controls. Read a file, read a setting, run a command that prints information, or request a page of your own application. Nothing here asks you to change a setting, upgrade a gem, rotate or reveal a secret, or send requests to a service you do not own.
- Record secrets by name and location only. Never copy config/master.key, a per-environment key file, the value of RAILS_MASTER_KEY, a credentials value, a token or a password into this register.
- Do not run bin/rails credentials:show or bin/rails credentials:edit to fill in this register. The Rails command line guide describes the show command as a way to view the decrypted credentials file.
- Where you cannot answer a line, write "unknown". An unknown goes on the findings log until someone answers it.
- A "Source" line credits the Rails or tool page that says where a value lives or what it means. Lines marked "this page's advice" give this guide's own recommendation, which is not a Rails rule.
Application:
Environments covered:
Build or commit reviewed:
Filled in by (name and role): Date:
PART A. RAILS RELEASE AND GEMFILE.LOCK (one block per environment: production, staging, each CI image)
A.1 Environment name:
A.2 Rails, Ruby and RubyGems versions, as bin/rails about prints them in that environment.
Source: Rails 8.1 command line guide (bin/rails about displays information such as the Ruby, RubyGems and Rails versions, the database adapter and the schema version, and is useful when you need to check if a security patch might affect you).
A.3 The config.load_defaults value, from config/application.rb or wherever the application sets it.
Source: Rails 8.1 configuring guide (many defaults, including default_protect_from_forgery, depend on the load_defaults target version). Part C.5 uses this line.
A.4 Release series (the first two numbers, such as 8.1), and its entry in the list of supported releases under Security Issues on the Rails maintenance page (rubyonrails.org/maintenance), copied as the page prints it, with the date you read it. If the series is not listed, write "not listed".
Source: Rails maintenance page and maintenance policy (minor releases receive security fixes for two years after the first release in the series; after end-of-life, no new versions are released).
A.5 Each Rails component gem and its version as Gemfile.lock records it: actioncable, actionmailbox, actionmailer, actionpack, actiontext, actionview, activejob, activemodel, activerecord, activestorage, activesupport, rails, railties.
Source: RubyGems guide to dependency management (Bundler writes a snapshot of all the gems and versions it installed to Gemfile.lock); Rails security release post of 4 November 2026 (one gem file per component in each release).
A.6 Gem sources: every source the Gemfile and Gemfile.lock name. Mark any that use http:// or git://.
Source: bundler-audit README (it checks for insecure gem sources, http:// and git://).
A.7 Security announcements since the release in A.2: each post in the Security Announcements section of the Rails forum (discuss.rubyonrails.org/c/security-announcements/9) dated after that release, with the release it names for your series.
Source: Rails security policy (the best way to receive all security announcements is the Rails Security Announcements section of the forum); Rails 8.1 security guide (links its Rails security mailing list to that address).
Findings to log from Part A, as this page's advice: a series whose listed security date is earlier than the day you read the list, or that the page does not list; a component gem below the release a security post names for its series; a gem source on http:// or git://; an environment whose versions differ from production with no reason recorded.
PART B. ADVISORY LOG (one line per advisory and gem)
B.1 The audit you read: the command, the date, the machine or CI job it ran on, and whether the advisory database was updated first. With bundler-audit, bundle-audit check --no-update checks Gemfile.lock without updating the database, bundle-audit update updates the database, and bundle-audit check --format json outputs the results in JSON. If the application has bin/bundler-audit, record that this is what ran.
Source: bundler-audit README; Rails 8.1 release notes (their default CI example runs bin/bundler-audit in a step named "Security: Gem audit").
B.2 One line per advisory, with these fields:
advisory id, as the record gives it (GHSA, CVE or other) | gem | installed version (from Gemfile.lock) | affected versions (from the record's version fields) | patched versions (from the record's version fields) | the conditions the record gives (which feature, which configuration, which callers) | does the condition exist in this application (yes, no or unknown, with where you looked) | decision (upgrade, workaround from the record, or accepted until a date) | owner | review date
Source: the advisory record itself; Ruby Advisory Database README (its schema requires gem, url, title, date and description, and lists cve, ghsa, patched_versions and unaffected_versions among its optional fields).
B.3 Where two records for one advisory disagree on a version range or an id, copy both and note where each appears.
B.4 Ignored advisories: every entry in .bundler-audit.yml and every --ignore flag in scripts and CI files, each with its reason, its owner and the date it will be looked at again. If the application runs Rails LTS, write where the list of CVEs it addresses came from and the date.
Source: bundler-audit README (the ignore key in .bundler-audit.yml is a list of advisory ids to ignore); Ruby Advisory Database README (the Rails LTS maintainers asked it not to track Rails LTS versions, and it advises anyone using Rails LTS with bundler-audit to add the CVEs Rails LTS addresses to the ignore list in .bundler-audit.yml).
Findings to log from Part B, as this page's advice: each advisory with no decision; each condition marked yes or unknown; each ignore entry with no reason, owner or review date.
PART C. CONFIGURATION CHECKS
C.1 CREDENTIALS AND MASTER.KEY
- Which encrypted credentials files exist: config/credentials.yml.enc, and any per-environment file in config/credentials/.
Source: Rails 8.1 configuring guide (config.credentials.content_path defaults to the file for the running environment in config/credentials/ if it exists, otherwise config/credentials.yml.enc).
- Where each environment's key is held: config/master.key, a per-environment key file in config/credentials/, or the RAILS_MASTER_KEY environment variable in the host's or CI's settings. Write the location and the people, roles and services that can read it. Never the value.
Source: Rails 8.1 security guide (Custom Credentials); configuring guide (config.credentials.key_path).
- Is any key file in the repository or in its history? Write yes, no or unknown, and how you checked.
Source: Rails 8.1 security guide ("Do not commit your master key").
- Is config.require_master_key set for production?
Source: configuring guide (with it set, the application will not boot unless a master key is available through RAILS_MASTER_KEY or config/master.key).
- Is config.secret_key_base set anywhere in code or configuration, rather than in the credentials file?
Source: configuring guide (it recommends leaving config.secret_key_base unset and specifying secret_key_base in config/credentials.yml.enc).
- Who decides whether to rotate a key or secret that may have been exposed. Rotation is a planned change, not part of this register. Changing secret_key_base expires active sessions, and encrypted cookies, signed cookies and Active Storage files may also be affected.
Source: Rails 8.1 security guide.
Findings, as this page's advice: a key file in the repository or its history; a key readable by people or services that do not need it; secret_key_base held outside the credentials file with no reason recorded; no named person for rotation.
C.2 HOSTAUTHORIZATION
- config.hosts for production, in config/environments/production.rb and anything else that adds to it. Copy each entry.
Source: configuring guide (outside development, config.hosts is empty and no Host header checks are done); security guide (you have to activate it in production by setting the list of allowed hosts).
- For each regular expression entry, note that Rails anchors it to match the entire host name. For each entry that starts with a dot, note that it permits the domain and all its sub-domains. Compare both with the names the application serves.
Source: configuring guide.
- config.host_authorization: copy any exclude rule and any response_app, and write why each exclusion exists.
Source: configuring guide; security guide.
Findings, as this page's advice: an empty production list; an entry that permits names the application does not serve; an exclusion with no reason recorded.
C.3 STRONG PARAMETERS
- Search app/controllers for permit!, for expect or permit called with an empty hash, and for request parameters passed to new, create, update or assign_attributes without permit or expect. Record each file and line and the model it writes to.
Source: Rails 8.1 Action Controller guide (permit! allows all current and future model attributes to be mass-assigned; expect with an empty hash gets the same warning; permit with an empty hash opens the door to arbitrary input).
- config.action_controller.permit_all_parameters in every environment file and initializer.
Source: Rails 8.1 configuring guide (it sets all parameters for mass assignment to be permitted by default; the default value is false); ActionController::Parameters API, 8.1.4.1 (permit_all_parameters, when true, permits all parameters by default).
- config.action_controller.action_on_unpermitted_parameters for each environment.
Source: configuring guide and the same API page (the default is :log in test and development and false otherwise; :raise raises ActionController::UnpermittedParameters).
- If an advisory in Part B names a Parameters method, search for that method too and record where its result goes.
Findings, as this page's advice: permit! or an empty-hash permit on a model that holds role, owner, price or status fields; permit_all_parameters true in any environment.
C.4 SQL FRAGMENTS
- Search app/ and lib/ for SQL written as strings: where(" and where(' calls, find_by_sql, connection.execute, select_all, and any query string that contains #{ for interpolation. Record each file and line, and where each value comes from: the request, the database or a constant.
Source: Rails 8.1 security guide (in SQL fragments, especially where("..."), connection.execute() and Model.find_by_sql(), the escaping has to be applied by your own code); Active Record query guide (pure string conditions can leave you vulnerable to SQL injection).
- For each fragment that takes a value from a request: is the value passed as a positional ? placeholder, a named :placeholder from a hash, a hash condition, or through sanitize_sql?
Source: security guide.
- For each LIKE condition built from a request value: is the value passed through sanitize_sql_like?
Source: Active Record query guide (placeholder values are escaped, but the % and _ wildcards are not).
Findings, as this page's advice: any request value joined into SQL text; a LIKE pattern built from a request value without sanitize_sql_like.
C.5 CSRF
- config.load_defaults (from A.3), and any explicit config.action_controller.default_protect_from_forgery setting.
Source: configuring guide (default_protect_from_forgery is false originally and true from load_defaults 5.2); security guide (true is the default for newly created applications).
- Every protect_from_forgery call, with its with: option, or "none given".
Source: RequestForgeryProtection API, 8.1.4.1 (without a with: option, :null_session is used, which provides an empty session during the request; when default_protect_from_forgery is true, Rails calls protect_from_forgery with :exception).
- Every skip_forgery_protection and every skip_before_action :verify_authenticity_token, with the controller, the actions it covers and the reason.
Source: same page (skip_forgery_protection is a wrapper for skip_before_action :verify_authenticity_token).
- From bin/rails routes, every GET route whose action creates, changes or deletes data.
Source: same page (GET and HEAD requests are not checked); security guide, which gives the W3C's checklist (use GET when the interaction is more like a question, a safe operation such as a query, read operation or lookup; use POST when the interaction is more like an order, changes the state of the resource in a way the user would perceive, or holds the user accountable for its results; use DELETE, PUT and PATCH like POST).
- If the application is API only, so that its ApplicationController inherits from ActionController::API: any controller that reads a session cookie.
Source: Rails 8.1 Action Controller guide (for API only applications, ApplicationController inherits from ActionController::API); RequestForgeryProtection API (API only applications do not include this module or a session middleware by default).
- Sign-in data kept in a cookie set with cookies.permanent, and what happens to it when a token check fails.
Source: security guide (with persistent cookies such as cookies.permanent, the cookies will not be cleared and the out of the box CSRF protection will not be effective; if you use a different cookie store than the session for this information, you must handle what to do with it yourself).
Findings, as this page's advice: a skip with no reason recorded; a GET route that changes data; load_defaults below 5.2 with no default_protect_from_forgery setting and no protect_from_forgery call in ApplicationController.
C.6 CONTENT SECURITY POLICY AND RESPONSE HEADERS
- Does config/initializers/content_security_policy.rb define a policy in lines that are not commented out? Copy the directives.
Source: Rails 8.1 security guide (Rails provides a DSL to configure the header, defined in that initializer).
- Is content_security_policy_report_only true in configuration, or set in any controller?
Source: security guide (report-only reports violations without enforcing the policy).
- Every controller with content_security_policy false, or with its own content_security_policy block, and the actions it covers.
Source: security guide.
- Is content_security_policy_nonce_generator set, and is its value random per request or taken from the session id? Which directives use nonces?
Source: security guide (with a generator defined, nonces apply to script-src and style-src by default).
- Is config.force_ssl true in production?
Source: security guide (the Strict-Transport-Security header is added when force_ssl is enabled); configuring guide (force_ssl forces all requests to be served over HTTPS).
- In your browser's developer tools, the Content-Security-Policy or Content-Security-Policy-Report-Only header and the Strict-Transport-Security header your production site returns, on its home page and on one signed-in page.
Findings, as this page's advice: no policy; 'unsafe-inline' in script-src; a controller that disables the policy with no reason recorded; a report-only policy that nobody reads the reports from; no Strict-Transport-Security header in production.
C.7 MOUNTED ENGINES AND ADMIN DASHBOARDS
- Every mount line in config/routes.rb, and every route bin/rails routes lists for an engine: the path, the engine, its gem and the gem's version.
Source: Rails 8.1 routing guide (mount); command line guide (bin/rails routes lists all routes, and -g filters them).
- For each engine: how access is restricted. Write which of these applies: a route constraint around the mount line, the engine's own authentication, a base controller you chose, a separate subdomain or address restriction, or none found.
Source: Rails 8.1 engines guide; the engine's own documentation (the Mission Control Jobs README is an example: it documents its own authentication, a base controller and a route constraint).
- Which controller the engine's controllers inherit from, according to the engine's documentation, and whether your login callback reaches them.
Source: engines guide (each engine gets a scoped ApplicationController, and in the guide's example engine the controllers inherit from that scoped controller by default); Rails 8.1 Action Controller guide (callbacks defined in ApplicationController run on every controller in the application because all controllers inherit from it).
- Signed out, from outside your network, request each mounted path on your production site once, and record the status code and where it sent you. This loads one page and submits nothing.
- What each dashboard lets a signed-in user do: read only, or retry, discard, delete or edit records.
Source: the engine's own documentation.
Findings, as this page's advice: an engine that answers a signed-out request with its own pages; an engine whose only protection is a callback in your ApplicationController that its controllers do not inherit; one shared username and password for an engine used by several people.
C.8 ERROR PAGES AND LOGS
- config.consider_all_requests_local for production.
Source: configuring guide (when true, any error dumps detailed debugging information into the HTTP response and /rails/info/properties shows the application's runtime context; it is false in production by default).
- config.filter_parameters: copy the list, and list any parameter names your application uses for secrets that the list does not match.
Source: configuring guide (the default list in config/initializers/filter_parameter_logging.rb includes passw, email, secret, token and _key, matched as partial regular expressions).
Findings, as this page's advice: consider_all_requests_local true in production; a parameter that carries a secret and is not matched by the filter.
PART D. TWO-ACCOUNT CONTROLLER AND OBJECT AUTHORISATION MATRIX
Set-up, on a staging copy built from the same commit as production, with test accounts and test records only:
- Account A and account B: the same role, in two different customer organisations, or two ordinary users where the application has no organisations.
- Account L: a lower role, if the application has one.
- N: no session (signed out).
- For each record type, one test record owned by A and one owned by B. Write down their ids.
- Rows come from bin/rails routes: one row per controller action that reads or changes a record.
Source: Rails 8.1 security guide, Privilege Escalation (query through the user's access rights, as in @current_user.projects.find(params[:id]), instead of Project.find(params[:id])); security guide, Permitted Lists Versus Restricted Lists (prefer before_action except: over only: for security-related actions); Action Controller guide (before_action, skip_before_action, only and except).
Columns:
1. Route: verb, path and controller#action
2. How the action loads the record: scoped (through the signed-in user, an account or a policy object, with the file and line) or bare (such as Model.find(params[:id]))
3. Login callback: inherited, skipped (where), or limited by an only: or except: list
4. A on A's record (expected: allowed)
5. A on B's record (expected: refused or not found)
6. L on A's record (expected: what the role allows)
7. N on A's record (expected: sent to sign-in)
8. Evidence: status code, page title or redirect target, the date and the build
Rules:
- Send requests only for actions that read: show, edit forms, index, search, exports and downloads. Leave out any GET route that C.5 lists as creating, changing or deleting data.
- For create, update and destroy, fill columns 2 and 3 from the code and write "code reading only" in columns 4 to 7. Requests that change records belong in a test with written rules of engagement, not in this register.
- A refusal is a pass. A page, export or search result that shows any of B's data to A is a finding.
- This page's advice: where column 2 says bare, log a finding even if the request was refused, because the refusal then depends on some other layer.
FINDINGS LOG (all parts)
Number | Part and line | What was found | Source or advice behind it | Owner (the person who can make the change) | Decision | Date found | Date closed
PART E. WORKED EXAMPLE (INVENTED)
Application: invented-rails-app, a customer portal for an invented trades business (invented)
Environments covered: production only in this example (invented)
Build or commit reviewed: the release deployed on 12 November 2026 (invented)
Filled in by: Sam, lead developer (invented person) Date: 14 November 2026
E.A PRODUCTION
A.1 production
A.2 Rails 8.0.5.2 (invented value for this example; Ruby and RubyGems versions recorded in the full copy)
A.3 config.load_defaults 5.1. The application was created on an earlier series and upgraded without moving this value (invented).
A.4 Series 8.0. Rails maintenance page, read 14 November 2026, list under Security Issues: 8.0.x, supported until 7 November 2026. The listed date is earlier than the day the list was read, so Part A's rule logs it. Finding E1.
A.5 Every component gem at 8.0.5.2 in Gemfile.lock (invented values).
A.6 rubygems.org over https; one git source over https for pdfmaker-invented (invented).
A.7 The Rails post of 4 November 2026 names 8.0.5.2 for the 8.0 series. The installed version matches it.
E.B ADVISORY LOG
B.1 bundle-audit update, then bundle-audit check --no-update, on Sam's machine, 14 November 2026 (invented).
B.2 Line 1: INVENTED-ADV-0001 (invented) | pdfmaker-invented | 2.3.0 | below 2.3.4 | 2.3.4 | applies when user-supplied HTML is passed to its render method | yes: InvoicesController#download puts customer notes into the PDF | upgrade to 2.3.4 in the next release | Sam | 21 November 2026. Finding E2.
Line 2: INVENTED-ADV-0002 (invented) | csvimport-invented | 1.8.1 | 1.8.0 to below 1.9.0 | 1.9.0 | applies only when the import_formulas option is on | no: the option is not set in config/ or app/ | upgrade planned, not urgent | Sam | 30 January 2027
B.3 Not needed: one record per advisory in this example.
B.4 .bundler-audit.yml ignores INVENTED-ADV-0003 (invented) for mailtemplates-invented, with no reason, owner or date recorded. Finding E3.
E.C CONFIGURATION
C.1 config/credentials.yml.enc and config/credentials/production.yml.enc exist. The production key is held in RAILS_MASTER_KEY in the hosting account's environment settings, readable by the two people with administrator access to that account and by the deploy pipeline. config/master.key is on two developer machines. No key file found in the repository or its history (searched the Git host's file history for config/master.key and config/credentials/production.key). require_master_key is true in production. secret_key_base is not set in code or configuration. Rotation decisions: Sam. All values here are invented.
C.2 config.hosts in production: portal.invented-trades.test and .invented-trades.test (invented host names). The second entry permits every sub-domain, and the application serves one. Finding E4. Exclusion: paths containing healthcheck, for the load balancer's health check (reason recorded; invented).
C.3 One permit! in Admin::SettingsController#update, writing to the Account model, which holds the billing plan field (invented). Finding E5. action_on_unpermitted_parameters is :raise in development and test, not set in production (invented).
C.4 JobsController#search joins the search text into a where string (invented). Finding E6.
C.5 load_defaults 5.1. ApplicationController calls protect_from_forgery with no with: option, so the API page's default, :null_session, applies. WebhooksController skips forgery protection for the payment provider's webhook; reason recorded, and the webhook's signature is checked (invented). GET /jobs/:id/archive changes a job's status (invented). Finding E7.
C.6 The initializer exists, but every line is commented out; the production home page returns no Content-Security-Policy header. force_ssl is true and the Strict-Transport-Security header is present (invented). Finding E8.
C.7 jobsdash-invented, mounted at /jobs (invented engine). Its documentation says its controllers inherit from its own base controller. No constraint or engine authentication found. A signed-out request to /jobs returned the queue list, and the dashboard can retry and discard jobs (invented). Finding E9.
C.8 consider_all_requests_local is false in production. filter_parameters is the default list, which matches every secret-bearing parameter name the application uses (invented).
E.D MATRIX (rows from an invented application; results invented)
Row 1. GET /invoices/:id, InvoicesController#show | bare: Invoice.find(params[:id]) | inherited | allowed | allowed: B's invoice shown | allowed | sent to sign-in | 200 with B's invoice number in the title, 14 November 2026. Finding E10.
Row 2. GET /jobs/:id/edit, JobsController#edit | scoped through the signed-in user's account | inherited | allowed | not found | allowed (field staff may view jobs) | sent to sign-in | 404 for A on B, 14 November 2026
Row 3. PATCH /jobs/:id, JobsController#update | scoped through the signed-in user's account | inherited | code reading only | code reading only | code reading only | code reading only | file and line recorded
Row 4. GET /reports/export.csv, ReportsController#export | bare: filters by the status parameter with no account condition | inherited | allowed | B's jobs included in A's export | allowed | sent to sign-in | the export's row count and the B record ids it contained. Finding E11.
Row 5. DELETE /invoices/:id, InvoicesController#destroy | bare: Invoice.find(params[:id]) | inherited | code reading only | code reading only | code reading only | code reading only | file and line recorded. Finding E12.
E.E FINDINGS LOG (invented)
E1 | A.4 | 8.0 listed security date earlier than the day it was read | Rails maintenance page, as read 14 November 2026 | Sam | plan the move to 8.1 | 14 Nov 2026 | open
E2 | B.2 line 1 | INVENTED-ADV-0001 condition present | the invented advisory | Sam | upgrade pdfmaker-invented | 14 Nov 2026 | open
E3 | B.4 | ignore entry with no reason | this page's advice | Sam | find the reason or remove the entry | 14 Nov 2026 | open
E4 | C.2 | sub-domain entry wider than the names served | this page's advice | Sam | list portal.invented-trades.test only | 14 Nov 2026 | open
E5 | C.3 | permit! on the Account model | Rails Action Controller guide | Sam | replace with expect and a field list | 14 Nov 2026 | open
E6 | C.4 | search text joined into SQL | Rails security guide | Sam | use a placeholder and sanitize_sql_like | 14 Nov 2026 | open
E7 | C.5 | GET route changes data | Rails security guide and API page | Sam | move archive to PATCH | 14 Nov 2026 | open
E8 | C.6 | no Content-Security-Policy | Rails security guide | Sam | write a report-only policy first | 14 Nov 2026 | open
E9 | C.7 | job dashboard open signed out | this page's advice | Sam | add a route constraint for administrators | 14 Nov 2026 | open
E10 | D row 1 | A can read B's invoice | Rails security guide, Privilege Escalation | Sam | load invoices through the account | 14 Nov 2026 | open
E11 | D row 4 | export includes other customers' jobs | this page's advice | Sam | scope the export to the account | 14 Nov 2026 | open
E12 | D row 5 | destroy loads the invoice bare | this page's advice | Sam | load through the account, as in row 1's fix | 14 Nov 2026 | openRuby on Rails security: what the framework handles and what stays with you
Ruby on Rails is a web framework for applications written in Ruby.
The routing guide says its router matches incoming HTTP requests to controller actions based on the URL path, and the Action Controller guide says that in most conventional RESTful applications the controller receives the request, fetches or saves data from a model, and uses a view to create HTML output.
Rails builds protections into those layers: a token check against forged requests, escaping for values passed to its query methods, a permit list for mass assignment, an encrypted session cookie and a set of default response headers.
Several of them can be left out by a call, a setting or a missing line of configuration, and that part belongs to your application.
The Securing Rails Applications guide sets the frame in its introduction. It says that in general there is no such thing as plug-n-play security, that security depends on the people using the framework and sometimes on the development method, and that it depends on all layers of a web application environment: the back-end storage, the web server and the web application itself, and possibly other layers or applications.
Framework advisories and application flaws need keeping apart. A framework advisory is a flaw in a Rails gem, such as actionpack or activestorage, and moving to a release that contains the fix closes it. An application flaw lives in your own code, such as a controller that loads a record by its id without checking who owns it, or a query built by joining strings, and no Rails upgrade touches it.
Keeping gems up to date is also yours. Under Dependency Management and CVEs, the guide says the Rails project does not bump dependencies just to encourage use of new versions, including for security issues, because application owners need to update their gems themselves regardless, and it recommends bundle update --conservative with the gem's name to update vulnerable dependencies.
Every Rails fact on this page is credited to the page it comes from, and each was read on 14 November 2026: the version 8.1 Rails Guides, the Ruby on Rails 8.1.4.1 API documentation, the Rails policy pages and security announcement, the advisory records, and the READMEs of the tools and engines it names.
The configuring guide gives many defaults that depend on the config.load_defaults target version, so read the guides for the series your Gemfile.lock records and check your own load_defaults value.
Which Rails release series receive security fixes
The Rails maintenance policy describes a shifted form of semantic versioning.
A patch release, the Z in X.Y.Z, carries bug fixes only, with no API changes and no new features except as necessary for security fixes. A minor release, the Y, has new features and may contain API changes, and the policy says it serves as a major version would under semver.
Support is counted by minor release series: each one receives bug fixes for one year and security fixes for two years after the first release in the series, after which it reaches its end-of-life.
A security release adds a fourth number. The policy says security releases are built by taking the last released version and applying only the direct security patches, so a theoretical 1.2.2.1 is built from 1.2.2. The releases announced on 4 November 2026, 8.0.5.2 and 8.1.4.1, follow that pattern.
Once a series reaches end-of-life, the policy says dealing with bugs and security issues is your own responsibility: fixes may be backported and merged, but no new versions are released, and if you are not comfortable maintaining your own versions you should upgrade to a supported one.
The list of supported series is on the Rails maintenance page, and each entry carries an end date, so read it on the day you fill in the register. Read on 14 November 2026, its list of supported releases under Security Issues showed 8.1.x supported until 10 October 2027 and 8.0.x supported until 7 November 2026.
The security release announcement of 4 November 2026 said the same about 8.0: security support for the 8.0 series ends on 7 November 2026. It also said older versions of Rails are unsupported and recommended upgrading to at least the 8.0 series.
This page's advice is to record a series whose listed security date is earlier than the day you read the list as a finding, even when no advisory names your version, and to plan the move to a supported series as a project with its own testing, because the policy allows a minor release to contain API changes.
Ruby on Rails vulnerabilities: where advisories appear and how to read one
The Rails security policy sets out how a fix reaches you.
Reports go privately to the security team, and fixes are prepared for every release still supported and held back until an embargo date. On that date the Rails Security mailing list receives a copy of the announcement, the changes go to the public repository, new gems are released to RubyGems, and an announcement of the releases with a link to the advisory is published on the Rails weblog.
The policy names the Rails Security Announcements section of the Rails forum as the best way to receive every announcement, and says nobody outside the security team and the reporter is told before the embargo lifts, with no exceptions for high traffic or important sites.
A Rails release is a set of gems. The announcement of 4 November 2026 gives a SHA-256 hash for each gem file of 8.0.5.2 and 8.1.4.1, from actioncable to railties, and the titles of the advisories it lists name components such as Action Pack, Active Storage and Active Support. This page's advice follows from that: record the version of every Rails component gem in Gemfile.lock, not only the rails line.
An advisory from that announcement shows what to read. GHSA-wm3x-v3qw-4jh3, "Possible Strong Parameters bypass in Parameters#each_key in Action Pack", was published in the rails/rails repository on 4 November 2026 and rated High. Its description says ActionController::Parameters#each_key, called with a block, returns the internal hash that holds the request parameters instead of the Parameters instance, and that Active Model mass assignment accepts that hash without raising ActiveModel::ForbiddenAttributesError.
It says an application that passes that return value to mass assignment could let a remote, unauthenticated attacker set attributes the application does not permit, such as an authorisation flag.
For a register, read these parts of it. First, the version fields, which differ between records. The Rails repository's advisory lists actionpack below 8.0.5.2, and from 8.1 to below 8.1.4.1, as affected, with 8.0.5.2 and 8.1.4.1 as the patched versions, and gives the id CVE-2026-126081.
The GitHub Advisory Database entry starts the second range at 8.1.0.beta1 and gives the same CVE id. The Ruby Advisory Database entry, which bundler-audit reads, records the patched versions as "~> 8.0.5, >= 8.0.5.2" and ">= 8.1.4.1", has no cve field, and carries the note "No CVE".
Second, the conditions: under Affected applications, the advisory says an application is affected if it passes the return value of each_key, called with a block, to mass assignment, and that Rails itself makes no such call.
Third, the workaround it gives: do not use the return value of each_key, call it for its block only, and pass the permitted Parameters instance to mass assignment.
This page's reading of the example: a version match puts an advisory on your register, and its conditions decide how urgent it is and where to look in your code. Here, the place to look is any call to each_key whose result reaches new, assign_attributes or update. The upgrade still goes on the plan, because the next change to that code could meet the condition.
This reading of the advisory is dated 14 November 2026; for advisories published after that, check the Security Announcements section of the Rails forum and the security advisories page of the rails/rails repository.
Checking Gemfile.lock against published advisories
Gemfile.lock is the record to audit.
The RubyGems guide to dependency management says Bundler writes a snapshot of all the gems and versions it installed to Gemfile.lock, and that the file keeps the exact versions of every gem the application used the last time it was known to work, including the gems your listed gems require.
The Rails command line guide says bin/rails about displays information such as the Ruby, RubyGems and Rails versions, the database adapter and the schema version, and describes it as useful when you need to check if a security patch might affect you.
bundler-audit is a tool built for that comparison. Its README says it checks Gemfile.lock for vulnerable versions of gems, checks for insecure gem sources on http:// and git://, allows ignoring advisories that have been worked around, prints advisory information and does not require a network connection.
It reads the Ruby Advisory Database, which its own README calls a community effort to compile the security advisories relevant to Ruby libraries, kept as one folder per gem with one file per advisory, named by its CVE or GHSA id.
The bundler-audit README's commands include bundle-audit check --no-update, which checks Gemfile.lock without updating the database, bundle-audit update, which updates it, and bundle-audit check --format json, which outputs the results in JSON.
The Rails 8.1 release notes describe a default CI declaration, defined in config/ci.rb and run by bin/ci, and their example includes a step named "Security: Gem audit" that runs bin/bundler-audit, beside an importmap audit step and a Brakeman code analysis step. On this page's reading, an application created before 8.1 may have neither file, so the register asks you to record which audit runs, where and when.
Ignored advisories need the same care as open ones. bundler-audit reads an ignore list from .bundler-audit.yml, and the advisory database README says the Rails LTS maintainers asked it not to track Rails LTS versions, and advises anyone using Rails LTS with bundler-audit to add the CVEs Rails LTS addresses to that ignore list.
Because every ignore entry hides a match from later runs, this page's advice is to give each one a line in the register with its reason, its owner and the date it will be looked at again. The dependency security guide covers deciding what to update first.
The settings and calls the Rails guides tell you to watch
Each check in the register matches something a Rails guide or API page says about a protection: what turns it on, what turns it off, and where it lives.
The subsections below give what the documentation says, and Part C of the register turns each one into lines to read and record.
The security guide says Rails stores secrets in config/credentials.yml.enc, which is encrypted, and uses config/master.key or, alternatively, the RAILS_MASTER_KEY environment variable to encrypt it. Because the file is encrypted it can be stored in version control as long as the master key is kept safe, and the guide's instruction is not to commit the master key.
By default the file holds the application's secret_key_base. The guide says the session cookie's encryption key and the key that verifies signed cookies are derived from secret_key_base, and that outside test and development it must be a random key in the credentials file.
The configuring guide adds per-environment files. The credentials path defaults to the file for the running environment in config/credentials/ if it exists, otherwise config/credentials.yml.enc, and the key path likewise to that environment's key file in config/credentials/, otherwise config/master.key. With config.require_master_key set, the application will not boot unless a master key is available through RAILS_MASTER_KEY or config/master.key.
Some of this is worth writing down before anything goes wrong. The security guide says that if your secrets may have been exposed you should strongly consider changing them, and that changing secret_key_base expires active sessions and requires every user to log in again, with encrypted cookies, signed cookies and Active Storage files also possibly affected.
And the Rails 8.1 release notes describe Kamal reading deploy secrets from the credentials store with rails credentials:fetch, which they say only needs the master key available to work.
On this page's reading, anyone who can read an environment's key and its credentials file can read every secret in it, so the register records each place a key is held and who can read it, never the key.
The host header injection guide covers this middleware in depth, so one paragraph here. The security guide recommends ActionDispatch::HostAuthorization to guard against DNS rebinding and other Host header attacks, and says you have to activate it in production by setting the list of allowed hosts.
The configuring guide says that in other environments "Rails.application.config.hosts is empty and no Host header checks will be done." That guide also says Rails anchors a regular expression entry to the whole host name, that a special case permits a domain and all its sub-domains, shown as an entry starting with a dot, and that config.host_authorization can exclude requests, such as a health check path, from the check. The register copies the production list and every exclusion with its reason.
The mass assignment guide covers strong parameters in detail. For the register, the lines to find are the ones that widen them. The Action Controller guide warns that permit! allows all current and future model attributes to be mass-assigned, gives the same warning for expect with an empty hash, and says permit with an empty hash opens the door to arbitrary input.
The API documentation for ActionController::Parameters says permit_all_parameters, when true, permits every parameter by default, with false as the default, and that action_on_unpermitted_parameters defaults to logging in test and development and to no action elsewhere. Add each_key to the search while the advisory above applies to your actionpack version.
The security guide says Rails has a built-in filter that escapes quote characters, the NULL character and line breaks, and that Model.find(id) and dynamic finders such as Model.find_by_something(something) apply it automatically. In SQL fragments, especially condition strings passed to where, and in connection.execute() and Model.find_by_sql(), the guide says the escaping has to be applied by your own code.
Its alternatives are positional placeholders, as in where("zip_code = ? AND quantity >= ?", ...), named placeholders filled from a hash, and chaining a hash condition with a fragment; it notes that these are only available in model instances and that you can try sanitize_sql elsewhere.
The Active Record query guide adds that building conditions as pure strings can leave you vulnerable to SQL injection exploits, and that while condition arguments are escaped, the LIKE wildcards % and _ are not, with sanitize_sql_like to escape them. The SQL injection guide covers sort order, column names and the cases placeholders cannot reach.
The security guide says Rails includes a security token in requests and verifies it on the server, and that this is done automatically when config.action_controller.default_protect_from_forgery is true, which is the default for newly created applications. The configuring guide shows that this default follows config.load_defaults: false originally, and true from 5.2.
The API page for the module states the default differently, saying subclasses of ActionController::Base are protected by default with the :exception strategy. Record what your own configuration says rather than relying on either sentence.
On this page's reading, an application whose load_defaults is below 5.2 and that does not set default_protect_from_forgery gets the check only from an explicit protect_from_forgery call. The API documentation says that call, without a with: option, uses :null_session, which provides an empty session during the request, where the :exception strategy raises ActionController::InvalidAuthenticityToken.
It also says GET and HEAD requests are not checked, and that skip_forgery_protection turns the check off for a controller as a wrapper for skip_before_action :verify_authenticity_token. API-only applications, it says, do not include the module or a session middleware by default.
The security guide gives the W3C's checklist for choosing between GET and POST: GET when the interaction is more like a question, a safe operation such as a query, read operation or lookup, and POST when the interaction is more like an order, changes the state of the resource in a way the user would perceive, or holds the user accountable for its results, with DELETE, PUT and PATCH used like POST.
The CSRF guide covers how the attack works; the register lists every place the check is skipped, with the reason.
The security guide lists the headers Rails returns by default: X-Frame-Options set to SAMEORIGIN, X-XSS-Protection set to 0, X-Content-Type-Options set to nosniff, X-Permitted-Cross-Domain-Policies set to none and Referrer-Policy set to strict-origin-when-cross-origin. Content-Security-Policy is not on that list. The guide recommends defining one to help protect against XSS and injection attacks, using the DSL in config/initializers/content_security_policy.rb, and it says Strict-Transport-Security is added when config.force_ssl is enabled.
A controller can override the global policy, switch it off for some actions with content_security_policy false, or send it as Content-Security-Policy-Report-Only, which reports violations without enforcing the policy. Where a policy would otherwise need 'unsafe-inline', the guide suggests nonces: with a nonce generator configured, nonces apply to script-src and style-src by default, and a per-request random nonce is incompatible with conditional GET caching.
The register records whether a policy is defined, every controller that changes or disables it, and the header your production site returns.
Admin dashboards and job monitors can arrive as Rails engines, mounted in config/routes.rb with mount. The routing guide shows mount for a Rack application, as in mount AdminApp, at: "/admin", and the engines guide shows it for an engine, as in mount Blorgh::Engine, at: "/blog". The engines guide also explains how an engine's controllers relate to yours.
Rails controllers inherit from ApplicationController by default, but engines are scoped to run independently from the main application, so each engine gets a scoped ApplicationController, and in the guide's example engine the controllers inherit from that scoped controller by default.
The Action Controller guide says callbacks defined in ApplicationController run on every controller in the application because all controllers inherit from it. On this page's reading, a login callback there does not reach an engine's controllers unless the engine inherits from your ApplicationController.
Engines make different choices, so read each one's documentation. Mission Control Jobs, from the rails organisation on GitHub, is an example: its README says that at a minimum it lets you inspect job queues and retry or discard failed jobs, and that it comes with HTTP basic authentication enabled and closed by default, with the user and password kept in Rails credentials, and is not accessible when none are configured.
It also says its controllers extend the host application's ApplicationController by default, that base_controller_class can point them at another controller such as an AdminController, and that with a route constraint around the mount line, requests that do not satisfy the constraint never reach the engine.
The security guide calls administration interfaces popular attack targets because they allow privileged access, and names XSS and CSRF as their highest threats. Its precautions include roles within the admin interface, login credentials separate from those for the public part of the application, limiting login to a set of source IP addresses through request.remote_ip, which it says is not bullet-proof, adding that a proxy might be in use, and putting the admin interface on its own subdomain as a separate application with its own user management.
The configuring guide says config.consider_all_requests_local, when true, makes any error dump detailed debugging information into the HTTP response and lets /rails/info/properties show the application's runtime context. It is true by default in development and test and false in production. config.filter_parameters keeps listed parameters out of the logs, and the guide shows the default list Rails adds in config/initializers/filter_parameter_logging.rb, which includes passw, email, secret, token and _key, matched by partial regular expression. The security misconfiguration guide covers verbose errors more widely.
Ruby on Rails security best practices the guides spell out
Beyond the register's checks, the Securing Rails Applications guide gives several practices for sign-in and sessions.
The session management guide covers the general case; these are the Rails-specific points.
- Issue a new session after sign-in. The guide calls issuing a new session identifier and declaring the old one invalid after a successful login the most effective countermeasure against session fixation, and shows reset_session as the way to create a new session in Rails. It says the Devise gem expires sessions on sign in and sign out for you, and that code you write yourself has to do it after its sign-in action.
- Expire sessions on the server. The guide says the client can edit cookies stored in the browser, so expiring sessions on the server is safer than relying on the cookie's expiry time.
- Serve the application over HTTPS. The configuring guide says config.force_ssl forces all requests to be served over HTTPS, and the security guide says it adds the Strict-Transport-Security header.
- Set your own password rules. The guide says has_secure_password checks that a password is present on creation, is no longer than 72 bytes and is confirmed, and does not check minimum length or complexity.
- If you use the authentication generator, which ships from Rails 8.0, build sign-up yourself. The guide says it adds what basic authentication and password reset need, that no code is generated to create new user records or let users sign up, and that the reset link is valid for 15 minutes by default.
- Repeat the advisory check whenever Gemfile.lock changes, and the configuration checks whenever routes, controllers or initializers change. This last point is this page's advice.
How to use the Rails release and advisory register
The register keeps the release, the advisories, the configuration and the authorisation matrix apart because different people answer them.
An upgrade is a release decision, an advisory condition is a code search, a configuration line is a reading of one file, and a matrix row is a request on staging. All the findings share a single log, and each names an owner: whoever can make the change.
- Part A, release and Gemfile.lock: fill one block per environment, because production, staging and CI can run different builds. Copy the series status from the Rails maintenance page on the day, with the date.
- Part B, advisories: one line per advisory and gem, with the versions copied from the record's version fields rather than its description, and the record's conditions checked against your code.
- Part C, configuration: eight blocks covering credentials, HostAuthorization, strong parameters, SQL fragments, CSRF, CSP and headers, mounted engines, and error pages and logs. Each line says where to look, and each line that states a fact names the page that says so.
- Part D, the two-account matrix: one row per controller action that reads or changes a record, with reads requested on staging and writes judged from the code.
- Part E is a worked example for an invented application, with invented gems and invented advisory ids. Nothing in it describes a real advisory.
- Record secrets by name and location only. No key, token, password or credentials value goes into the register, and no step asks you to decrypt the credentials file.
- A line nobody can answer yet is written as unknown and stays on the findings log until it is answered.
What the register cannot tell you about your Rails application
The register is a snapshot: versions, settings and decisions as they stood on the date at its top.
An audit tool's match shows that a gem version falls inside an advisory's range; whether the advisory's condition exists in your code is only as good as the code search behind the B.2 line, as the each_key example shows. The audit compares only what Gemfile.lock records, so code copied into the repository from elsewhere is outside the comparison, and it says nothing about advisories published after the date at the top.
Each ignore entry hides a match, which is why each one has an owner and a review date.
The matrix covers the reads an owner can request with test accounts. It does not send writes, it does not look for flaws in business rules, and a passing row means one request was refused on that day, on that build. Configuration lines show what the files say. The headers and error pages your production site returns are what visitors meet, so the register asks for both.
Where a Clever Ops review fits
Ruby on Rails itself is not tested by anything described here: this guide is for information, and the register belongs to your own team, to fill in again whenever Gemfile.lock, the routes or the initializers change.
Testing your own Rails application, rather than reading its settings, belongs in a scoped web application penetration test: a signed-in test of the application and its API, using test accounts for each role in scope.
A written scope names the routes, roles and environment to be tested, and a filled-in register already lists them. In a secure code review, the lockfile is set beside the package manifest, each new package and version is looked up in published advisories, and whatever runs by itself when the application is installed, built or deployed is read as well. A report records the build and the dates it covers.
Where Clever Ops built or hosts the application, the report says so, naming the builder and the host, and calls the work a security review, not an independent penetration test. Monitoring around the clock and emergency incident response are not part of any Clever Ops service, so if you think a key or an account has already been misused, bring in an incident response specialist first.
Frequently asked questions
Read the list on the Rails maintenance page on the day you check. The policy gives each minor release series security fixes for two years after the first release in the series. Read on 14 November 2026, the page listed 8.1.x as supported for security issues until 10 October 2027 and 8.0.x until 7 November 2026, and the security release announcement of 4 November 2026 said older versions of Rails are unsupported and recommended upgrading to at least the 8.0 series. Once a series reaches end-of-life, the policy says no new versions are released for it.
Its escaping covers some query calls and not others. The Rails security guide says find(id) and dynamic finders such as find_by_something(something) apply its escaping automatically, but that in SQL fragments, such as a condition string passed to where, connection.execute() or find_by_sql(), the escaping has to be applied by your own code. Pass values as positional or named placeholders or as hash conditions, and use sanitize_sql_like for user text inside a LIKE pattern, which the Active Record query guide says is not escaped for its wildcards.
The security guide says the token check is applied automatically when config.action_controller.default_protect_from_forgery is true, which is the default for newly created applications, and the configuring guide ties that default to config.load_defaults 5.2 or later. The API documentation says GET and HEAD requests are not checked, skip_forgery_protection turns the check off for a controller, and API-only applications do not include the module by default. Read your load_defaults value and search for every skip.
The Rails security guide says the credentials file is encrypted, so it can be stored in version control as long as the master key is kept safe. The master key, held in config/master.key or the RAILS_MASTER_KEY environment variable, is the part the guide says not to commit. Record where each environment's key is held and who can read it, and never copy the key into notes, tickets or the register.
Not until you list your hosts. The configuring guide says the middleware is included in development by default, and that in other environments config.hosts is empty and no Host header checks are done. The security guide says you have to activate it in production by setting the list of allowed hosts. Record any exclusions set through config.host_authorization as well.
Compare the version of the gem the advisory names, such as actionpack, in your Gemfile.lock with the advisory's affected and patched version fields, then read its conditions. The Rails repository's advisory GHSA-wm3x-v3qw-4jh3, for example, lists actionpack below 8.0.5.2, and from 8.1 to below 8.1.4.1, as affected, and under Affected applications it says an application is affected if it passes the return value of each_key, called with a block, to mass assignment, and that Rails itself makes no such call. bundler-audit checks Gemfile.lock for vulnerable versions against the Ruby Advisory Database; the conditions still need someone to read your code.
Scope the right test for your application
Tell us what you have built, who uses it and when it needs to launch. You will get a plain-English recommendation: a website audit, a web application test or a referral to a specialist.