• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 30490151628 / 26
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: fix/adversarial-sweep-2026-08
DEFAULT BRANCH: master
Ran 29 Jul 2026 08:54PM UTC
Files 166
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Jul 2026 08:52PM UTC coverage: 95.582% (-0.01%) from 95.595%
30490151628.26

Pull #2838

github

ericproulx
Reject params nested deeper than the array scope declares

`AttributesIterator#do_each` recursed into any element that was an Array.
That recursion is required when the declaration itself nests array scopes —
`map_params` adds one level of nesting per Array-typed scope on the chain, so
the params for the inner scope really are an array of arrays — but nothing
compared the incoming depth against the declared one.

A request could therefore wrap its elements in extra arrays and have them
silently unwrapped:

    params do
      requires :lines, type: Array do
        requires :book_id, type: String
        requires :qty, type: Integer
      end
    end

`{"lines":[[{"book_id":"x","qty":1}]]}` passed validation, and `params[:lines]`
/ `declared` then handed the endpoint `[[{...}]]`. Any ordinary body assuming
the declared shape (`params[:lines].sum { |l| l[:qty] }`) died with a
`TypeError`, i.e. a 500 on malformed input. `[[]]` passed the same way.

Each scope now records, at definition time, how many Array-typed scopes sit on
its chain; the iterator descends that many levels less the one `Array.wrap`
already consumes, and yields anything deeper as-is. The attribute validators
then see a non-hash and fail it exactly as they do for any other unexpected
element type, so these requests get the 400 they always should have.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pull Request #2838: Reject params nested deeper than the array scope declares

1174 of 1289 branches covered (91.08%)

Branch coverage included in aggregate %.

3759 of 3872 relevant lines covered (97.08%)

1124.14 hits per line

Source Files on job run-3.3-Gemfile - 30490151628.26
  • Tree
  • List 166
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 30490151628
  • 0238fd0c on github
  • Prev Job for on fix/nested-array-validation-bypass (#30486032579.1)
  • Next Job for on fix/nested-array-validation-bypass (#30490183440.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc