Skip to content

Commit

Permalink
Fix for bucket_path security vulnerability
Browse files Browse the repository at this point in the history
This is a fix for Bugs #13553, #13418, #13511. The bucket_path parameter
allowed control over where the filebucket will try to read and write to.
The only place available to stop this parameter is in the resolution
from a URI to an indirectory terminus. The bucket_path is used
internally for local filebuckets and so cannot be removed completely
without a larger change to the design.
  • Loading branch information
zaphod42 authored and haus committed Apr 3, 2012
1 parent 19bd30a commit 0d6d299
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/puppet/network/http/api/v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def uri2indirection(http_method, uri, params)
method = indirection_method(http_method, indirection)

params[:environment] = Puppet::Node::Environment.new(environment)
params.delete(:bucket_path)

raise ArgumentError, "No request key specified in #{uri}" if key == "" or key.nil?

Expand Down
8 changes: 8 additions & 0 deletions spec/unit/network/http/api/v1_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ class V1RestApiTester
@tester.uri2indirection("GET", "/env/foo/bar", {:environment => "otherenv"})[3][:environment].to_s.should == "env"
end

it "should not pass a buck_path parameter through (See Bugs #13553, #13518, #13511)" do
@tester.uri2indirection("GET", "/env/foo/bar", { :bucket_path => "/malicious/path" })[3].should_not include({ :bucket_path => "/malicious/path" })
end

it "should pass allowed parameters through" do
@tester.uri2indirection("GET", "/env/foo/bar", { :allowed_param => "value" })[3].should include({ :allowed_param => "value" })
end

it "should return the environment as a Puppet::Node::Environment" do
@tester.uri2indirection("GET", "/env/foo/bar", {})[3][:environment].should be_a Puppet::Node::Environment
end
Expand Down

0 comments on commit 0d6d299

Please # to comment.