Skip to content

Commit 568ded5

Browse files
committed
Fix for bucket_path security vulnerability
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. Conflicts: lib/puppet/network/http/api/v1.rb spec/unit/network/http/api/v1_spec.rb Conflicts resolved by modifying the patch to fit the use of Puppet::Indirector::Request in the code.
1 parent 6bef2e6 commit 568ded5

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

lib/puppet/network/http/api/v1.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def uri2indirection(http_method, uri, params)
2828
method = indirection_method(http_method, indirection)
2929

3030
params[:environment] = environment
31+
params.delete(:bucket_path)
3132

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

spec/unit/network/http/api/v1_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ class V1RestApiTester
4343
@tester.uri2indirection("GET", "/env/foo/bar", {:environment => "otherenv"}).environment.should == Puppet::Node::Environment.new("env")
4444
end
4545

46+
it "should not pass a buck_path parameter through (See Bugs #13553, #13518, #13511)" do
47+
@tester.uri2indirection("GET", "/env/foo/bar", { :bucket_path => "/malicious/path" }).options.should_not include({ :bucket_path => "/malicious/path" })
48+
end
49+
50+
it "should pass allowed parameters through" do
51+
@tester.uri2indirection("GET", "/env/foo/bar", { :allowed_param => "value" }).options.should include({ :allowed_param => "value" })
52+
end
53+
4654
it "should use the second field of the URI as the indirection name" do
4755
@tester.uri2indirection("GET", "/env/foo/bar", {}).indirection_name.should == :foo
4856
end

0 commit comments

Comments
 (0)