# rails-version-scoped-ruby-v1

> rails-version-scoped-ruby-v1: 8 Keryn rules for ruby (8 warning).

Source: https://keryn.dev/rules/rails-version-scoped-ruby-v1/

8 rules · Keryn Software Licence · rules 0.8.0 · [all packs](https://keryn.dev/rules/)

**How to read a rule**

- **Severity**: How bad the finding is if it is real: `error` fails a default gate, `warning` and `info` do not.

- **Confidence**: **P0** exploitable as written; **P1** dangerous in context; **P2** a heuristic or a posture check: confirm by reading the code.

- **False-positive risk**: **low**: an exact API or flag, so hits are almost always real; **medium**: the pattern is legitimate in many programs, so check each hit; **high**: it finds a lead to confirm, so expect benign hits.

- **Edge**: The relationship the finding sits on. **reaches**: content or traffic gets to a thing; **calls**: one thing invokes another; **reads**: one thing reads from another; **writes**: one thing writes to another; **sends**: data leaves for another party; **grants**: authority is given or left unchecked; **depends_on**: something relies on a component it does not verify; **trusts**: one party believes another without evidence. The boundary it crosses, when there is one: **user->prompt** (untrusted input reaching a prompt); **model->code** (model output reaching code, a shell, a query or a page); **secret->outside** (a secret leaving the trusted side); **supply-chain** (code, models or prompts pulled in from outside).

- **Taxonomy chips**: References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

## keryn.rails.cve.sanitize-call-cve-2013-1857

`warning` ruby ruby, rails

sanitize or sanitize\_css is called on a Rails version affected by CVE-2013-1857 / CVE-2013-1855: the sanitizers let some javascript: URLs and CSS expressions through, so their output is not safe to render. Upgrade Rails (2.3.18, 3.1.12, 3.2.13 or later).

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-79](https://keryn.dev/taxonomies/cwe/#cwe-79-cross-site-scripting) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Upgrade Rails (or the named gem) to the fixed release in the message; until then avoid passing request values or record attributes to this call.

**References:** [https://nvd.nist.gov/vuln/detail/cve-2013-1857](https://nvd.nist.gov/vuln/detail/cve-2013-1857) · [https://nvd.nist.gov/vuln/detail/cve-2013-1855](https://nvd.nist.gov/vuln/detail/cve-2013-1855)

## keryn.rails.legacy.model-without-attr-accessible

`warning` ruby ruby, rails

A concrete Active Record model using version 3.0 or older declares neither attr\_accessible nor attr\_protected. Every attribute is mass-assignable by default, so Model.new(params[:model]) lets a visitor set any column (admin flags, owner ids). Declare attr\_accessible with the attributes forms may set, or enable whitelist\_attributes.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-915](https://keryn.dev/taxonomies/cwe/#cwe-915) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Add attr\_accessible with the attributes forms may set (or config.active\_record.whitelist\_attributes = true), then move to strong parameters.

**References:** [https://guides.rubyonrails.org/v3.2/security.html#mass-assignment](https://guides.rubyonrails.org/v3.2/security.html#mass-assignment)

## keryn.rails.legacy.model-attr-protected

`warning` ruby ruby, rails

An Active Record model using version 3.0 or older restricts mass assignment with attr\_protected (a deny list). Attributes added later are assignable, and attr\_protected could be bypassed on these versions (CVE-2013-0276). Use attr\_accessible (an allow list) or upgrade Active Record and use strong parameters.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-915](https://keryn.dev/taxonomies/cwe/#cwe-915) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Replace attr\_protected with attr\_accessible, then move to strong parameters.

**References:** [https://nvd.nist.gov/vuln/detail/cve-2013-0276](https://nvd.nist.gov/vuln/detail/cve-2013-0276)

## keryn.rails.cve.model-serialize-cve-2013-0277

`warning` ruby ruby, rails

A model serializes an attribute (serialize) on an Active Record version affected by CVE-2013-0277: a serialized column that a visitor can set through mass assignment is decoded as YAML, which can instantiate arbitrary objects. Upgrade Active Record (2.3.17, 3.1 or later) and keep serialized columns out of mass assignment.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Upgrade Active Record (or Rails when using the full framework) to the fixed release in the message; until then avoid passing request values or record attributes to this call.

**References:** [https://nvd.nist.gov/vuln/detail/cve-2013-0277](https://nvd.nist.gov/vuln/detail/cve-2013-0277)

## keryn.rails.legacy.controller-without-forgery-protection

`warning` ruby ruby, rails

A controller that inherits from ActionController::Base never calls protect\_from\_forgery, on a Rails version (before 5.2) where forgery protection is off unless a controller turns it on. Every state-changing action it and its subclasses serve accepts cross-site requests. Call protect\_from\_forgery with: :exception.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-352](https://keryn.dev/rules/?cwe=CWE-352) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Call protect\_from\_forgery with: :exception in the base controller (or config.load\_defaults 5.2 or later).

**References:** [https://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf](https://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf)

## keryn.rails.cve.nested-attributes-reject-if-cve-2015-7577

`warning` ruby ruby, rails

accepts\_nested\_attributes\_for combines allow\_destroy: false with a reject\_if option on a Rails version affected by CVE-2015-7577: reject\_if is skipped for records marked for destruction, so the destroy restriction can be bypassed. Upgrade Rails (3.2.22.1, 4.1.14.1, 4.2.5.1 or later).

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-284](https://keryn.dev/rules/?cwe=CWE-284) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Upgrade Rails (or the named gem) to the fixed release in the message; until then avoid passing request values or record attributes to this call.

**References:** [https://nvd.nist.gov/vuln/detail/cve-2015-7577](https://nvd.nist.gov/vuln/detail/cve-2015-7577)

## keryn.rails.cve.create-with-cve-2014-3514

`warning` ruby ruby, rails

create\_with receives a value that is neither a literal hash nor permitted parameters on a Rails version affected by CVE-2014-3514: create\_with bypassed strong parameters, so request attributes reach the new record unfiltered. Pass params.permit(...) or upgrade Rails (4.0.9, 4.1.5 or later).

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-915](https://keryn.dev/taxonomies/cwe/#cwe-915) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Upgrade Rails (or the named gem) to the fixed release in the message; until then avoid passing request values or record attributes to this call.

**References:** [https://nvd.nist.gov/vuln/detail/cve-2014-3514](https://nvd.nist.gov/vuln/detail/cve-2014-3514)

## keryn.rails.cve.dynamic-finder-mysql-cve-2012-6496

`warning` ruby ruby, rails, mysql

A dynamic finder on a secret-like column (password, token, code, reset, activation, api\_key, guid, private) takes a request value directly, with the MySQL adapter on a Rails version before 4.2: MySQL casts strings to integers in comparisons and Rails did not type the value, so a crafted parameter can match records it should not (CVE-2012-6496 and the MySQL type-casting issue). Convert the value with to\_s, or upgrade.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-89](https://keryn.dev/taxonomies/cwe/#cwe-89-sql-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Upgrade Rails (or the named gem) to the fixed release in the message; until then avoid passing request values or record attributes to this call.

**References:** [https://nvd.nist.gov/vuln/detail/cve-2012-6496](https://nvd.nist.gov/vuln/detail/cve-2012-6496)
