summaryrefslogtreecommitdiff
path: root/dev-ruby/sinatra
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-23 03:49:35 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-10-23 03:49:35 +0100
commit850d399c4f1568d3c6d013d7f4e2e371c0118bd6 (patch)
tree37fe91f80d4b072d27976558c05df3503c196e85 /dev-ruby/sinatra
parent7b77dd2858b06e4a9367ca16d4c24aacb119b142 (diff)
gentoo auto-resync : 23:10:2022 - 03:49:35
Diffstat (limited to 'dev-ruby/sinatra')
-rw-r--r--dev-ruby/sinatra/Manifest4
-rw-r--r--dev-ruby/sinatra/files/backport-pr-1519.patch122
-rw-r--r--dev-ruby/sinatra/sinatra-2.2.0-r1.ebuild38
-rw-r--r--dev-ruby/sinatra/sinatra-2.2.1.ebuild6
4 files changed, 168 insertions, 2 deletions
diff --git a/dev-ruby/sinatra/Manifest b/dev-ruby/sinatra/Manifest
index 0bebcbdbcb8f..3a11f5ca32d2 100644
--- a/dev-ruby/sinatra/Manifest
+++ b/dev-ruby/sinatra/Manifest
@@ -1,10 +1,12 @@
+AUX backport-pr-1519.patch 3860 BLAKE2B 6bfd7e434af9e3f66517a568fc076eb138e16133b8463c072c3475c0749410f2ba838b825bd07bed14cfd08b7288c4a72e9891976099db10486d86bee0037e4e SHA512 620fb520f36dd2793d52d5472a43731f938438f74b29a4877528210bd06eb831279413692de43539a81b5c1e261f907c2b52c850593d1f4d264376ce46887dcb
DIST sinatra-2.2.0.tar.gz 513752 BLAKE2B e407b9241cab27e326c0a2d4d83593e292de902b6ed19a12f17b0cd114230b0d10f1ffaa8f8b8237d17b547c7e012c57456af357019b228f3d7a88847220cf33 SHA512 be9432a8efa93578accc836cd0fecca128e56989d8596f1b3d33d2d956e90acd80244b98473fff2adae13ed4a1e933c41e73c80755a6f3418a65cdf33c011145
DIST sinatra-2.2.1.tar.gz 513047 BLAKE2B 38cec7c3b2e27ac795044d7d64a00deb09707523a13338328bb1d7657b3d8eee9ab9730c6eb903c04f64acca6d24b8f191f825056baa0e705bf7ebf5594c0d46 SHA512 73f35428e259867a9b9adbf7344dd78dfe3c5ae2749902d438e2bcd95c4e7e9935ecb7761a4c52928e3e05fd99f8497db3fc049c868f9b2e76c653b4271c87b5
DIST sinatra-2.2.2.tar.gz 513056 BLAKE2B 80904850ce577131ecc6c28917772cda6ab606ff1b4a71b733cde98d56e2906bb0dc5b65c83465e65686571e8752ec7935d89734e7d2e45c544fe14a2c8046d4 SHA512 e69a36738a7c1095968a343113ddba414ff685e941a8b55575e4b2ffa5a8e7394d874966d5532643cdfec997ac4c825c293185f6688c715006e37159eedd2be8
DIST sinatra-3.0.1.tar.gz 265781 BLAKE2B e4fc5dec7045f5a906a91fa8d71ea32e4e1491939047cdfece7d27df3c784a5c3779a4e5de243d87f1eb7e272e3aeeda9fbfc560b1cfaf2cf628d30106567825 SHA512 717d4caff1193b158128a22737340329e5d96bea5718702c22b8c8e2c72652b1048352b36454da410a57288c852de2f04bbee6335dfd4ee977eda62093a1a94a
DIST sinatra-3.0.2.tar.gz 265824 BLAKE2B 87739d8863dd9959b8c3530b19a3f52de31636fcdd77fe1558930749498c73ec4cf0ddf998a9f6029c46842656059f8bd76d1781beb277608ccf265577561447 SHA512 57094e00ca8280401ed76f5c52dded82d42a4a81290a9a990f464ac43abbf350e8325b8f60505bfd005b6c7d92283a3f7a9345c0ccbf227530a8c3cb93c0af38
+EBUILD sinatra-2.2.0-r1.ebuild 1178 BLAKE2B 72e9d9cbe13398c4fd717ae69789a40414a5f62c6e0c8beb6e100cc78915532560900c339b34e201a9b349819fd40ac1b75e44d9d30724dd651e18c1eff4b498 SHA512 06d51f06b2845304a7756c0bf7266819fe1c40009889392fac950821d67e17afc266a85b8903316c3ead75c0e1e7c2cdd4fe3f140057242e4667ccb4e701ed0a
EBUILD sinatra-2.2.0.ebuild 1012 BLAKE2B e5748efcee47332e37a741df852b5851956bac34bdc4d50c6bbf23287c143b324a0ede69a14a3153ce3d68aa3ee76244d00ddfb6b0f527c8ae98e4a880a36790 SHA512 a96d186b6330bc65b95643543d6d1816bea49fc5016baa476c75d20fad140ffcd64973a43c7dc3167bfaea4d009f71873d525cbfe6a57bdd551e627ec8eb35d9
-EBUILD sinatra-2.2.1.ebuild 1006 BLAKE2B 681f6b2f9b17b7ac7d9656dcef754dcd1db17f1a42071e132c4ceed0d8af9a0ae15ca52fabcde0a33bae544a4e7dc53b8afcb2989c637935e6002e3fc16ac4b9 SHA512 dad05b778dd62a7d05865452c0de421e68faa80fd7c02f2fab0a1f581b6de98e746dd21e0546ca0f36a98f2ece46ae9fb23d486127b09101641b91713281623c
+EBUILD sinatra-2.2.1.ebuild 1159 BLAKE2B 22a3c11de592a4ac843f24f36313ce98e15a9f6a092e537ee9d59b985f105ea8ce08159c8159d7e178e65d7766d7027ce7185d2f9f648226d8e05404863fd725 SHA512 7cc6aa34ce962441a11e9a3e019e984fa1340c5d28e064d14d0e7c25a6c5e2de9114d0542adcc8bc53c38f8291547862f1529db2c9babf0d710659a199799649
EBUILD sinatra-2.2.2.ebuild 1006 BLAKE2B 02051754d7ceead4327c603836d52b6d4344e9c1ab4d3ae6fc3a7dc2ded7a2ee8540702aaca19f3eb388e064bfa990637776e400b068f1ee0702fc5917da5eb3 SHA512 2552c3e63d0b62838d631551b2a135822df89c2ec6758a34ec058989f47925525cf0c3a984f777166404449c0ec09e16b4cd4d5672a1d01d43769c6e486a483c
EBUILD sinatra-3.0.1.ebuild 1032 BLAKE2B a318d2bb27f201493c9b1b07d741af8f97ad03c6bea074cfc99946f89fb8513770ef3f584beff328767723b954e4f657c5ae64541ebab365fe322e7bba0c78e5 SHA512 43124a035900095395901af2c0e1766987401eaba394e56c8e830214ff7fd3469f1b5f4bc3a1bd0cdc01a03889b6a57b2837aca1db43a5a8fd4dea42c12e480c
EBUILD sinatra-3.0.2.ebuild 1032 BLAKE2B a318d2bb27f201493c9b1b07d741af8f97ad03c6bea074cfc99946f89fb8513770ef3f584beff328767723b954e4f657c5ae64541ebab365fe322e7bba0c78e5 SHA512 43124a035900095395901af2c0e1766987401eaba394e56c8e830214ff7fd3469f1b5f4bc3a1bd0cdc01a03889b6a57b2837aca1db43a5a8fd4dea42c12e480c
diff --git a/dev-ruby/sinatra/files/backport-pr-1519.patch b/dev-ruby/sinatra/files/backport-pr-1519.patch
new file mode 100644
index 000000000000..cc344621c3b6
--- /dev/null
+++ b/dev-ruby/sinatra/files/backport-pr-1519.patch
@@ -0,0 +1,122 @@
+https://github.com/sinatra/sinatra/pull/1519
+
+From 6d34a2a1bee48961c25e1b53edac874a31c42060 Mon Sep 17 00:00:00 2001
+From: Jordan Owens <jkowens@gmail.com>
+Date: Thu, 31 Jan 2019 22:32:45 -0500
+Subject: [PATCH] Internal Sinatra errors now extend Sinatra::Error
+
+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.
+---
+ lib/sinatra/base.rb | 22 ++++++++++++++--------
+ test/mapped_error_test.rb | 6 +++---
+ test/result_test.rb | 15 +++++++++++++++
+ 3 files changed, 32 insertions(+), 11 deletions(-)
+
+diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb
+index 6dbb3ae57..4dfc9a8ae 100644
+--- a/lib/sinatra/base.rb
++++ b/lib/sinatra/base.rb
+@@ -255,11 +255,14 @@ def call(env)
+ end
+ end
+
+- class BadRequest < TypeError #:nodoc:
++ class Error < StandardError #:nodoc:
++ end
++
++ class BadRequest < Error #:nodoc:
+ def http_status; 400 end
+ end
+
+- class NotFound < NameError #:nodoc:
++ class NotFound < Error #:nodoc:
+ def http_status; 404 end
+ end
+
+@@ -1149,14 +1152,17 @@ def handle_exception!(boom)
+ end
+ @env['sinatra.error'] = boom
+
+- if boom.respond_to? :http_status and boom.http_status.between? 400, 599
+- status(boom.http_status)
+- elsif settings.use_code? and boom.respond_to? :code and boom.code.between? 400, 599
+- status(boom.code)
+- else
+- status(500)
++ http_status = if boom.kind_of? Sinatra::Error
++ if boom.respond_to? :http_status
++ boom.http_status
++ elsif settings.use_code? && boom.respond_to?(:code)
++ boom.code
++ end
+ end
+
++ http_status = 500 unless http_status && http_status.between?(400, 599)
++ status(http_status)
++
+ if server_error?
+ dump_errors! boom if settings.dump_errors?
+ raise boom if settings.show_exceptions? and settings.show_exceptions != :after_handler
+diff --git a/test/mapped_error_test.rb b/test/mapped_error_test.rb
+index cb158a268..562e509dc 100644
+--- a/test/mapped_error_test.rb
++++ b/test/mapped_error_test.rb
+@@ -6,15 +6,15 @@ class FooError < RuntimeError
+ class FooNotFound < Sinatra::NotFound
+ end
+
+-class FooSpecialError < RuntimeError
++class FooSpecialError < Sinatra::Error
+ def http_status; 501 end
+ end
+
+-class FooStatusOutOfRangeError < RuntimeError
++class FooStatusOutOfRangeError < Sinatra::Error
+ def code; 4000 end
+ end
+
+-class FooWithCode < RuntimeError
++class FooWithCode < Sinatra::Error
+ def code; 419 end
+ end
+
+diff --git a/test/result_test.rb b/test/result_test.rb
+index cbb781319..67d163fc4 100644
+--- a/test/result_test.rb
++++ b/test/result_test.rb
+@@ -1,5 +1,9 @@
+ require File.expand_path('../helper', __FILE__)
+
++class ThirdPartyError < RuntimeError
++ def http_status; 400 end
++end
++
+ class ResultTest < Minitest::Test
+ it "sets response.body when result is a String" do
+ mock_app { get('/') { 'Hello World' } }
+@@ -73,4 +77,15 @@ def res.each ; yield call ; end
+ assert_equal 205, status
+ assert_equal '', body
+ end
++
++ it "sets status to 500 when raised error is not Sinatra::Error" do
++ mock_app do
++ set :raise_errors, false
++ get('/') { raise ThirdPartyError }
++ end
++
++ get '/'
++ assert_equal 500, status
++ assert_equal '<h1>Internal Server Error</h1>', body
++ end
+ end
diff --git a/dev-ruby/sinatra/sinatra-2.2.0-r1.ebuild b/dev-ruby/sinatra/sinatra-2.2.0-r1.ebuild
new file mode 100644
index 000000000000..4a36cb96c31f
--- /dev/null
+++ b/dev-ruby/sinatra/sinatra-2.2.0-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+USE_RUBY="ruby26 ruby27 ruby30 ruby31"
+
+RUBY_FAKEGEM_TASK_TEST="MT_NO_PLUGINS=true test:core"
+
+RUBY_FAKEGEM_EXTRADOC="README.md AUTHORS.md CHANGELOG.md"
+
+RUBY_FAKEGEM_GEMSPEC="sinatra.gemspec"
+
+inherit ruby-fakegem
+
+DESCRIPTION="A DSL for quickly creating web applications in Ruby with minimal effort"
+HOMEPAGE="http://www.sinatrarb.com/"
+SRC_URI="https://github.com/sinatra/sinatra/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="2"
+KEYWORDS="amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE=""
+
+# https://github.com/sinatra/sinatra/pull/1519 from master.
+# https://github.com/sinatra/sinatra/issues/1774
+PATCHES=( "${FILESDIR}/backport-pr-1519.patch" )
+
+ruby_add_rdepend "
+ dev-ruby/mustermann:1
+ dev-ruby/rack:2.2
+ ~dev-ruby/rack-protection-${PV}
+ dev-ruby/tilt:2"
+ruby_add_bdepend "test? ( >=dev-ruby/rack-test-0.5.6 dev-ruby/erubis dev-ruby/builder <dev-ruby/activesupport-7 )"
+ruby_add_bdepend "doc? ( dev-ruby/yard )"
+
+all_ruby_prepare() {
+ sed -i -e '/active_support\/core_ext\/hash/igem "activesupport", "<7"' test/helper.rb || die
+}
diff --git a/dev-ruby/sinatra/sinatra-2.2.1.ebuild b/dev-ruby/sinatra/sinatra-2.2.1.ebuild
index 20f026413a36..26896805eb10 100644
--- a/dev-ruby/sinatra/sinatra-2.2.1.ebuild
+++ b/dev-ruby/sinatra/sinatra-2.2.1.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-USE_RUBY="ruby27 ruby30"
+USE_RUBY="ruby27 ruby30 ruby31"
RUBY_FAKEGEM_TASK_TEST="MT_NO_PLUGINS=true test:core"
@@ -21,6 +21,10 @@ SLOT="2"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86"
IUSE=""
+# https://github.com/sinatra/sinatra/pull/1519
+# https://github.com/sinatra/sinatra/issues/1774
+PATCHES=( "${FILESDIR}/backport-pr-1519.patch" )
+
ruby_add_rdepend "
dev-ruby/mustermann:1
dev-ruby/rack:2.2