From 918f0eea970c9f0d39b8d470a316ad5109935dae Mon Sep 17 00:00:00 2001 From: Jordan Owens Date: Tue, 12 Jan 2016 14:05:54 -0500 Subject: Prevent attempt to serve a request with a null byte File paths cannot contain null byte characters and methods that do path operations such as Rack::Utils#clean_path_info will raise unwanted errors. --- actionpack/test/dispatch/static_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionpack/test/dispatch/static_test.rb') diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb index 1da57ab50b..ea8b5e904e 100644 --- a/actionpack/test/dispatch/static_test.rb +++ b/actionpack/test/dispatch/static_test.rb @@ -40,6 +40,10 @@ module StaticTests assert_equal "Hello, World!", get("/doorkeeper%E3E4".force_encoding('ASCII-8BIT')).body end + def test_handles_urls_with_null_byte + assert_equal "Hello, World!", get("/doorkeeper%00").body + end + def test_sets_cache_control app = assert_deprecated do ActionDispatch::Static.new(DummyApp, @root, "public, max-age=60") -- cgit v1.2.3