rack 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rack might be problematic. Click here for more details.
- data/README +125 -4
- data/lib/rack/session/cookie.rb +9 -0
- data/lib/rack/utils.rb +1 -1
- data/rack.gemspec +1 -1
- data/test/spec_session_cookie.rb +19 -0
- data/test/spec_utils.rb +22 -0
- metadata +6 -5
data/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Rack, a modular Ruby webserver interface
|
1
|
+
= Rack, a modular Ruby webserver interface {<img src="https://secure.travis-ci.org/rack/rack.png" alt="Build Status" />}[http://travis-ci.org/rack/rack] {<img src="https://gemnasium.com/rack/rack.png" alt="Dependency Status" />}[https://gemnasium.com/rack/rack]
|
2
2
|
|
3
3
|
Rack provides a minimal, modular and adaptable interface for developing
|
4
4
|
web applications in Ruby. By wrapping HTTP requests and responses in
|
@@ -27,8 +27,11 @@ These web servers include Rack handlers in their distributions:
|
|
27
27
|
* Fuzed
|
28
28
|
* Glassfish v3
|
29
29
|
* Phusion Passenger (which is mod_rack for Apache and for nginx)
|
30
|
+
* Puma
|
30
31
|
* Rainbows!
|
31
32
|
* Unicorn
|
33
|
+
* unixrack
|
34
|
+
* uWSGI
|
32
35
|
* Zbatery
|
33
36
|
|
34
37
|
Any valid Rack app will run the same on all these handlers, without
|
@@ -313,7 +316,7 @@ run on port 11211) and memcache-client installed.
|
|
313
316
|
* Rename spec/ to test/ to not conflict with SPEC on lesser
|
314
317
|
operating systems
|
315
318
|
|
316
|
-
* March 13th, 2011: Twelfth public release 1.2.2/1.1.
|
319
|
+
* March 13th, 2011: Twelfth public release 1.2.2/1.1.2.
|
317
320
|
* Security fix in Rack::Auth::Digest::MD5: when authenticator
|
318
321
|
returned nil, permission was granted on empty password.
|
319
322
|
|
@@ -341,13 +344,131 @@ run on port 11211) and memcache-client installed.
|
|
341
344
|
* Pulled in relevant bug fixes from 1.3
|
342
345
|
* Fixed 1.8.6 support
|
343
346
|
|
347
|
+
* July 13, 2011: Fifteenth public release 1.3.1
|
348
|
+
* Fix 1.9.1 support
|
349
|
+
* Fix JRuby support
|
350
|
+
* Properly handle $KCODE in Rack::Utils.escape
|
351
|
+
* Make method_missing/respond_to behavior consistent for Rack::Lock,
|
352
|
+
Rack::Auth::Digest::Request and Rack::Multipart::UploadedFile
|
353
|
+
* Reenable passing rack.session to session middleware
|
354
|
+
* Rack::CommonLogger handles streaming responses correctly
|
355
|
+
* Rack::MockResponse calls close on the body object
|
356
|
+
* Fix a DOS vector from MRI stdlib backport
|
357
|
+
|
358
|
+
* July 16, 2011: Sixteenth public release 1.3.2
|
359
|
+
* Fix for Rails and rack-test, Rack::Utils#escape calls to_s
|
360
|
+
|
361
|
+
* Not Yet Released: Seventeenth public release 1.3.3
|
362
|
+
* Fix bug with broken query parameters in Rack::ShowExceptions
|
363
|
+
* Rack::Request#cookies no longer swallows exceptions on broken input
|
364
|
+
* Prevents XSS attacks enabled by bug in Ruby 1.8's regexp engine
|
365
|
+
* Rack::ConditionalGet handles broken If-Modified-Since helpers
|
366
|
+
|
344
367
|
* September 16, 2011: Eighteenth public release 1.2.4
|
345
368
|
* Fix a bug with MRI regex engine to prevent XSS by malformed unicode
|
346
369
|
|
347
|
-
*
|
370
|
+
* October 1, 2011: Nineteenth public release 1.3.4
|
371
|
+
* Backport security fix from 1.9.3, also fixes some roundtrip issues in URI
|
372
|
+
* Small documentation update
|
373
|
+
* Fix an issue where BodyProxy could cause an infinite recursion
|
374
|
+
* Add some supporting files for travis-ci
|
375
|
+
|
376
|
+
* October 17, 2011: Twentieth public release 1.3.5
|
377
|
+
* Fix annoying warnings caused by the backport in 1.3.4
|
378
|
+
|
379
|
+
* December 28th, 2011: Twenty first public release: 1.1.3.
|
348
380
|
* Security fix. http://www.ocert.org/advisories/ocert-2011-003.html
|
349
381
|
Further information here: http://jruby.org/2011/12/27/jruby-1-6-5-1
|
350
382
|
|
383
|
+
* December 28th, 2011: Twenty fourth public release 1.4.0
|
384
|
+
* Ruby 1.8.6 support has officially been dropped. Not all tests pass.
|
385
|
+
* Raise sane error messages for broken config.ru
|
386
|
+
* Allow combining run and map in a config.ru
|
387
|
+
* Rack::ContentType will not set Content-Type for responses without a body
|
388
|
+
* Status code 205 does not send a response body
|
389
|
+
* Rack::Response::Helpers will not rely on instance variables
|
390
|
+
* Rack::Utils.build_query no longer outputs '=' for nil query values
|
391
|
+
* Various mime types added
|
392
|
+
* Rack::MockRequest now supports HEAD
|
393
|
+
* Rack::Directory now supports files that contain RFC3986 reserved chars
|
394
|
+
* Rack::File now only supports GET and HEAD requests
|
395
|
+
* Rack::Server#start now passes the block to Rack::Handler::<h>#run
|
396
|
+
* Rack::Static now supports an index option
|
397
|
+
* Added the Teapot status code
|
398
|
+
* rackup now defaults to Thin instead of Mongrel (if installed)
|
399
|
+
* Support added for HTTP_X_FORWARDED_SCHEME
|
400
|
+
* Numerous bug fixes, including many fixes for new and alternate rubies
|
401
|
+
|
402
|
+
* January 22nd, 2012: Twenty fifth public release 1.4.1
|
403
|
+
* Alter the keyspace limit calculations to reduce issues with nested params
|
404
|
+
* Add a workaround for multipart parsing where files contain unescaped "%"
|
405
|
+
* Added Rack::Response::Helpers#method_not_allowed? (code 405)
|
406
|
+
* Rack::File now returns 404 for illegal directory traversals
|
407
|
+
* Rack::File now returns 405 for illegal methods (non HEAD/GET)
|
408
|
+
* Rack::Cascade now catches 405 by default, as well as 404
|
409
|
+
* Cookies missing '--' no longer cause an exception to be raised
|
410
|
+
* Various style changes and documentation spelling errors
|
411
|
+
* Rack::BodyProxy always ensures to execute its block
|
412
|
+
* Additional test coverage around cookies and secrets
|
413
|
+
* Rack::Session::Cookie can now be supplied either secret or old_secret
|
414
|
+
* Tests are no longer dependent on set order
|
415
|
+
* Rack::Static no longer defaults to serving index files
|
416
|
+
* Rack.release was fixed
|
417
|
+
|
418
|
+
* January 6th, 2013: Twenty sixth public release 1.1.4
|
419
|
+
* Add warnings when users do not provide a session secret
|
420
|
+
|
421
|
+
* January 6th, 2013: Twenty seventh public release 1.2.6
|
422
|
+
* Add warnings when users do not provide a session secret
|
423
|
+
* Fix parsing performance for unquoted filenames
|
424
|
+
|
425
|
+
* January 6th, 2013: Twenty eighth public release 1.3.7
|
426
|
+
* Add warnings when users do not provide a session secret
|
427
|
+
* Fix parsing performance for unquoted filenames
|
428
|
+
* Updated URI backports
|
429
|
+
* Fix URI backport version matching, and silence constant warnings
|
430
|
+
* Correct parameter parsing with empty values
|
431
|
+
* Correct rackup '-I' flag, to allow multiple uses
|
432
|
+
* Correct rackup pidfile handling
|
433
|
+
* Report rackup line numbers correctly
|
434
|
+
* Fix request loops caused by non-stale nonces with time limits
|
435
|
+
* Fix reloader on Windows
|
436
|
+
* Prevent infinite recursions from Response#to_ary
|
437
|
+
* Various middleware better conforms to the body close specification
|
438
|
+
* Updated language for the body close specification
|
439
|
+
* Additional notes regarding ECMA escape compatibility issues
|
440
|
+
* Fix the parsing of multiple ranges in range headers
|
441
|
+
|
442
|
+
* January 6th, 2013: Twenty ninth public release 1.4.2
|
443
|
+
* Add warnings when users do not provide a session secret
|
444
|
+
* Fix parsing performance for unquoted filenames
|
445
|
+
* Updated URI backports
|
446
|
+
* Fix URI backport version matching, and silence constant warnings
|
447
|
+
* Correct parameter parsing with empty values
|
448
|
+
* Correct rackup '-I' flag, to allow multiple uses
|
449
|
+
* Correct rackup pidfile handling
|
450
|
+
* Report rackup line numbers correctly
|
451
|
+
* Fix request loops caused by non-stale nonces with time limits
|
452
|
+
* Fix reloader on Windows
|
453
|
+
* Prevent infinite recursions from Response#to_ary
|
454
|
+
* Various middleware better conforms to the body close specification
|
455
|
+
* Updated language for the body close specification
|
456
|
+
* Additional notes regarding ECMA escape compatibility issues
|
457
|
+
* Fix the parsing of multiple ranges in range headers
|
458
|
+
* Prevent errors from empty parameter keys
|
459
|
+
* Added PATCH verb to Rack::Request
|
460
|
+
* Various documentation updates
|
461
|
+
* Fix session merge semantics (fixes rack-test)
|
462
|
+
* Rack::Static :index can now handle multiple directories
|
463
|
+
* All tests now utilize Rack::Lint (special thanks to Lars Gierth)
|
464
|
+
* Rack::File cache_control parameter is now deprecated, and removed by 1.5
|
465
|
+
* Correct Rack::Directory script name escaping
|
466
|
+
* Rack::Static supports header rules for sophisticated configurations
|
467
|
+
* Multipart parsing now works without a Content-Length header
|
468
|
+
* New logos courtesy of Zachary Scott!
|
469
|
+
* Rack::BodyProxy now explicitly defines #each, useful for C extensions
|
470
|
+
* Cookies that are not URI escaped no longer cause exceptions
|
471
|
+
|
351
472
|
== Contact
|
352
473
|
|
353
474
|
Please post bugs, suggestions and patches to
|
@@ -428,7 +549,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
428
549
|
|
429
550
|
== Links
|
430
551
|
|
431
|
-
Rack:: <http://rack.
|
552
|
+
Rack:: <http://rack.github.com/>
|
432
553
|
Official Rack repositories:: <http://github.com/rack>
|
433
554
|
Rack Bug Tracking:: <http://github.com/rack/rack/issues>
|
434
555
|
rack-devel mailing list:: <http://groups.google.com/group/rack-devel>
|
data/lib/rack/session/cookie.rb
CHANGED
@@ -27,6 +27,15 @@ module Rack
|
|
27
27
|
@app = app
|
28
28
|
@key = options[:key] || "rack.session"
|
29
29
|
@secret = options[:secret]
|
30
|
+
warn <<-MSG unless @secret
|
31
|
+
SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
|
32
|
+
This poses a security threat. It is strongly recommended that you
|
33
|
+
provide a secret to prevent exploits that may be possible from crafted
|
34
|
+
cookies. This will not be supported in future versions of Rack, and
|
35
|
+
future versions will even invalidate your existing user cookies.
|
36
|
+
|
37
|
+
Called from: #{caller[0]}.
|
38
|
+
MSG
|
30
39
|
@default_options = {:domain => nil,
|
31
40
|
:path => "/",
|
32
41
|
:expire_after => nil}.merge(options)
|
data/lib/rack/utils.rb
CHANGED
@@ -548,7 +548,7 @@ module Rack
|
|
548
548
|
|
549
549
|
token = /[^\s()<>,;:\\"\/\[\]?=]+/
|
550
550
|
condisp = /Content-Disposition:\s*#{token}\s*/i
|
551
|
-
dispparm = /;\s*(#{token})=("(?:\\"|[^"])*"|#{token})
|
551
|
+
dispparm = /;\s*(#{token})=("(?:\\"|[^"])*"|#{token})/
|
552
552
|
|
553
553
|
rfc2183 = /^#{condisp}(#{dispparm})+$/i
|
554
554
|
broken_quoted = /^#{condisp}.*;\sfilename="(.*?)"(?:\s*$|\s*;\s*#{token}=)/i
|
data/rack.gemspec
CHANGED
data/test/spec_session_cookie.rb
CHANGED
@@ -8,6 +8,25 @@ describe Rack::Session::Cookie do
|
|
8
8
|
Rack::Response.new(env["rack.session"].inspect).to_a
|
9
9
|
end
|
10
10
|
|
11
|
+
before do
|
12
|
+
@warnings = warnings = []
|
13
|
+
Rack::Session::Cookie.class_eval do
|
14
|
+
define_method(:warn) { |m| warnings << m }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
Rack::Session::Cookie.class_eval { remove_method :warn }
|
20
|
+
end
|
21
|
+
|
22
|
+
it "warns if no secret is given" do
|
23
|
+
cookie = Rack::Session::Cookie.new(incrementor)
|
24
|
+
@warnings.first.should =~ /no secret/i
|
25
|
+
@warnings.clear
|
26
|
+
cookie = Rack::Session::Cookie.new(incrementor, :secret => 'abc')
|
27
|
+
@warnings.should.be.empty?
|
28
|
+
end
|
29
|
+
|
11
30
|
it "creates a new cookie" do
|
12
31
|
res = Rack::MockRequest.new(Rack::Session::Cookie.new(incrementor)).get("/")
|
13
32
|
res["Set-Cookie"].should.include("rack.session=")
|
data/test/spec_utils.rb
CHANGED
@@ -603,6 +603,28 @@ describe Rack::Utils::Multipart do
|
|
603
603
|
params["files"][:tempfile].read.should.equal "contents"
|
604
604
|
end
|
605
605
|
|
606
|
+
|
607
|
+
it "should parse very long unquoted multipart file names" do
|
608
|
+
data = <<-EOF
|
609
|
+
--AaB03x\r
|
610
|
+
Content-Type: text/plain\r
|
611
|
+
Content-Disposition: attachment; name=file; filename=#{'long' * 100}\r
|
612
|
+
\r
|
613
|
+
contents\r
|
614
|
+
--AaB03x--\r
|
615
|
+
EOF
|
616
|
+
|
617
|
+
options = {
|
618
|
+
"CONTENT_TYPE" => "multipart/form-data; boundary=AaB03x",
|
619
|
+
"CONTENT_LENGTH" => data.length.to_s,
|
620
|
+
:input => StringIO.new(data)
|
621
|
+
}
|
622
|
+
env = Rack::MockRequest.env_for("/", options)
|
623
|
+
params = Rack::Utils::Multipart.parse_multipart(env)
|
624
|
+
|
625
|
+
params["file"][:filename].should.equal('long' * 100)
|
626
|
+
end
|
627
|
+
|
606
628
|
it "rewinds input after parsing upload" do
|
607
629
|
options = multipart_fixture(:text)
|
608
630
|
input = options[:input]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 6
|
10
|
+
version: 1.2.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christian Neukirchen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-01-07 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bacon
|
@@ -284,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
284
|
requirements: []
|
285
285
|
|
286
286
|
rubyforge_project: rack
|
287
|
-
rubygems_version: 1.8.
|
287
|
+
rubygems_version: 1.8.24
|
288
288
|
signing_key:
|
289
289
|
specification_version: 3
|
290
290
|
summary: a modular Ruby webserver interface
|
@@ -331,3 +331,4 @@ test_files:
|
|
331
331
|
- test/spec_urlmap.rb
|
332
332
|
- test/spec_utils.rb
|
333
333
|
- test/spec_webrick.rb
|
334
|
+
has_rdoc: true
|