Skip to main content
Platform security guideReviewed

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.

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

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:

Ruby 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.

Credentials and master.key

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. 1 min read

HostAuthorization and config.hosts

The host header injection guide covers this middleware in depth, so one paragraph here. 1 min read

Strong parameters

The mass assignment guide covers strong parameters in detail. 1 min read

SQL fragments

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. 1 min read

CSRF protection

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. 1 min read

Content Security Policy and default headers

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. 1 min read

Mounted engines and admin dashboards

Admin dashboards and job monitors can arrive as Rails engines, mounted in config/routes.rb with mount. 2 min read

Error pages and logs

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. 1 min read

Controller and object authorisation: the part no setting covers

None of the settings above decides whether one customer can open another customer's record.

The security guide's section on privilege escalation takes up the same kind of problem with projects. It says Project.find(params[:id]) is not good enough if the user is not allowed to see every project, because a user who changes the id reaches the record anyway, and its fix is to query through the user's access rights, as in @current_user.projects.find(params[:id]).

It adds that every parameter may be changed no matter how it is hidden, and that JavaScript validation does not stop a request sent with unexpected values.

Login checks have a matching trap. The Action Controller guide says callbacks defined in ApplicationController run on every controller in the application, since all controllers inherit from it, and that skip_before_action lets specified actions skip a given before_action. The security guide prefers permitted lists for security callbacks: use before_action with except: rather than only:, so that newly added actions are not left without the check.

That is why the register's matrix uses two accounts. Account A and account B hold the same role in two different customer organisations, or are two ordinary users where there are no organisations, and a third account holds a lower role. bin/rails routes lists every route with its verb, path and controller action, which gives the matrix its rows.

For each action that loads a record by id, account A asks for B's record. The broken access control guide explains the method and its variations; this register keeps to what an owner can do without changing data.

Every request in the matrix is a read: show pages, edit forms, indexes, searches and exports requested with the other account's ids, on a staging copy with test accounts. Actions that change data, such as update and destroy, are judged from the code, by whether the controller finds the record through the signed-in user's scope or through the bare model.

Sending those requests changes records, so it belongs in a test with written rules of engagement rather than in this register.

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.