Internal Sinatra errors now extend Sinatra::Error#1519
Merged
jkowens merged 1 commit intosinatra:unstablefrom Oct 4, 2021
Merged
Internal Sinatra errors now extend Sinatra::Error#1519jkowens merged 1 commit intosinatra:unstablefrom
jkowens merged 1 commit intosinatra:unstablefrom
Conversation
Member
Author
|
@namusyaka, @mwpastore any thoughts on the impact of this change? |
Member
Author
|
This is an alternative solution to #1236. |
|
(I opened #1518.) I don't know Sinatra's internals, but from the diff this does seem to address exactly the issue I was reporting! |
Member
|
I need to take a closer look at the implementation and consider unintended side effects, but at first blush this is a much better approach than what I've proposed in #1236. |
By extending Sinatra::Error, an error class can set the http status code on the response to a value other than 500. This commit fixes issues sinatra#1204 and sinatra#1518 where an error raised by a third party library that responded to http_status could set the status on the response. Any error outside of Sinatra errors will now always return a 500 status. This fixes an issue where an exception could leak sensitive data in the message to the browser. Errors that have http_status code 400 or 404 use the message as the body of the response. This is why it is imperative that these errors extend Sinatra::Error so that this is an explicit decision.
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Jun 14, 2022
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Jun 15, 2022
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Jun 15, 2022
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Jun 18, 2022
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Jun 20, 2022
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Jun 25, 2022
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Jul 11, 2022
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Jul 13, 2022
See: sinatra/sinatra#1774 See: sinatra/sinatra#1519 Signed-off-by: matoro <[email protected]>
Member
|
This is in master as bda8c29 (this was merged into the unstable branch that we don't use anymore so GitHub doesn't have the correct reference here) |
Member
Author
|
@dentarg is there something that needs to be done here? |
Member
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Sep 29, 2022
See: sinatra/sinatra#1774 See: sinatra/sinatra#1519 Signed-off-by: matoro <[email protected]>
matoro
added a commit
to matoro/gentoo
that referenced
this pull request
Sep 29, 2022
Upstream determined this will go into 3.0.0 release, so it's still required for 2.2.1. See: sinatra/sinatra#1774 See: sinatra/sinatra#1519 Signed-off-by: Matoro Mahri <[email protected]>
gentoo-bot
pushed a commit
to gentoo/gentoo
that referenced
this pull request
Oct 22, 2022
See: sinatra/sinatra#1774 See: sinatra/sinatra#1519 Signed-off-by: matoro <[email protected]> Signed-off-by: Matt Turner <[email protected]>
gentoo-bot
pushed a commit
to gentoo/gentoo
that referenced
this pull request
Oct 22, 2022
Upstream determined this will go into 3.0.0 release, so it's still required for 2.2.1. See: sinatra/sinatra#1774 See: sinatra/sinatra#1519 Signed-off-by: Matoro Mahri <[email protected]> Signed-off-by: Matt Turner <[email protected]>
tadast
added a commit
to tadast/sequenceserver
that referenced
this pull request
Feb 21, 2024
Upgrading Sinatra has broken HTTP status codes for some errors. There was a Sinatra change sinatra/sinatra#1519 in V3 (SequenceServer has gone from v2 -> V4 recently) that made the http status code setting from the exception class more explicit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By extending
Sinatra::Error, an error class can set the http status code on the response to a value other than 500. This commit fixes issues #1204 and #1518 where an error raised by a third party library that responded to http_status could set the status on the response. Any error outside of Sinatra errors will now always return a 500 status.This fixes an issue where an exception could leak sensitive data in the message to the browser. Errors that have http_status code 400 or 404 use the message as the body of the response. This is why it is imperative that these errors extend Sinatra::Error so that this is an explicit decision.