Skip to content

Upgrading sinatra 3 to 4

Breaking3.2.0 → 4.2.1Breaking4Security3Platform1New3Changed3Fixed12

BreakingUpgrade verdict

4 breaking changes and a platform requirement change and 2 security fixes.

  • Sinatra no longer works with Rack 2, and if you use Sinatra to start the web server you must install the rackup gem.
  • Code that created an IndifferentHash with an initializer no longer works.
  • The protection against session hijacking is now off unless you turn it on.
  • The EncryptedCookie protection class is gone, but session cookies remain encrypted through Rack's session cookie support.
Top 5 of 7 that need code or config changes

Ruby requirement changed in 4.0.0: >= 2.6.0 → >= 2.7.8.

Breaking4
Drops support for Rack 2; starting the web server now requires the rackup gem.
rackup
Removes the IndifferentHash initializer.
IndifferentHash
Disables session_hijacking protection by default.
session_hijacking
Removes Rack::Protection::EncryptedCookie; cookies are still encrypted by Rack::Session::Cookie.
Rack::Protection::EncryptedCookieRack::Session::Cookie
Security2
Sinatra is vulnerable to ReDoS through ETag header value generation
etag_matches?Low
The host_authorization setting addresses CVE-2024-21510.
Moderate · CVSS 5.4
Platform1
Requires Ruby 2.7.8 as the minimum Ruby version.