Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

small fix to accomodate symlinked tmp directories.

Change-Id: I5d82e870c362f3e634061b9e1704aaccc65461ef
  • Loading branch information...
commit 5d9831ab4484ac530cac06450bd555e1b7e2dc55 1 parent df09dee
Tal Garfinkel authored Patrick Bozeman committed
11 cloud_controller/app/models/app_package.rb
View
@@ -126,12 +126,13 @@ def unpack_upload
working_dir
end
- #enforce property that any file in resource list must be located in the
- #apps directory e.g. '../../foo' or a symlink pointing outside working_dir
- #should raise an exception.
+ # enforce property that any file in resource list must be located in the
+ # apps directory e.g. '../../foo' or a symlink pointing outside working_dir
+ # should raise an exception.
def resolve_path(working_dir, tainted_path)
- expanded_path = File.realdirpath(tainted_path, working_dir)
- pattern = "#{working_dir}/*"
+ expanded_dir = File.realdirpath(working_dir)
+ expanded_path = File.realdirpath(tainted_path, expanded_dir)
+ pattern = "#{expanded_dir}/*"
unless File.fnmatch?(pattern, expanded_path)
raise ArgumentError, "Resource path sanity check failed #{pattern}:#{expanded_path}!!!!"
end
2  cloud_controller/spec/models/app_package_spec.rb
View
@@ -20,7 +20,7 @@
it 'should succeed if the given path points to a file in the apps directory' do
testpath = File.join(@tmpdir,'testfile')
File.new(testpath, 'w+')
- @app_package.resolve_path(@tmpdir, 'testfile').should == testpath
+ @app_package.resolve_path(@tmpdir, 'testfile').should == File.realdirpath(testpath)
end
it 'should fail if the given path does not resolve to a file in the applications directory' do
Please sign in to comment.
Something went wrong with that request. Please try again.