Broken Object Level Authorization

Broken Object Level Authorization in Ruby on Rails [GHSA-65h8-27jh-q8wv]

[Updated March 2026] Updated GHSA-65h8-27jh-q8wv

Overview

Broken Object Level Authorization (BOLA) in Rails apps can lead to severe data exposure and unauthorized actions. If users can access resources that belong to others, attackers may read, edit, or delete sensitive data, compromising confidentiality and integrity. In multi-tenant SaaS scenarios, this can cascade into cross-tenant data leakage, legal exposure, and damaged trust. Without explicit authorization checks, the attacker only needs a valid resource ID to enumerate and act on other users' records. This vulnerability often occurs when controllers fetch records directly by ID (for example, Resource.find(params[:id])) without scoping to the current user or tenant, or when policies are not consistently enforced across actions. In Rails, RESTful routes and serializers can inadvertently reveal objects if ownership checks are skipped. Attackers can increment or guess IDs via standard routes (e.g., /resources/123) to access or modify data that isn't theirs unless access is restricted. Mitigations include scoping queries, using authorization libraries, and adopting a policy-driven approach. Always verify ownership in the controller, policy, or model layer, and enforce the check for every access path, including APIs, background jobs, and WebSocket streams. Instrument tests to assert that unauthorized requests are rejected and audit logs capture access attempts.

Code Fix Example

Ruby on Rails API Security Remediation
# Vulnerable pattern
class ResourcesController < ApplicationController
  before_action :authenticate_user!

  def show
    @resource = Resource.find(params[:id])
    render json: @resource
  end

  # Other actions...
end

# Fixed pattern (side by side)
class ResourcesController < ApplicationController
  before_action :authenticate_user!

  def show_vulnerable
    @resource = Resource.find(params[:id])
    render json: @resource
  end

  def show_fixed
    @resource = current_user.resources.find(params[:id])
    render json: @resource
  end
end

CVE References

Choose which optional cookies to allow. You can change this any time.