cfoundry 2.3.6.rc1 → 2.3.6.rc2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ require "multi_json"
3
3
 
4
4
  module CFoundry
5
5
  module TraceHelpers
6
- PROTECTED_ATTRIBUTES = ['Authorization']
6
+ PROTECTED_ATTRIBUTES = ['Authorization', 'credentials']
7
7
 
8
8
  def request_trace(request)
9
9
  return nil unless request
@@ -23,6 +23,7 @@ module CFoundry
23
23
  info << "RESPONSE_BODY:"
24
24
  begin
25
25
  parsed_body = MultiJson.load(response[:body])
26
+ filter_protected_attributes(parsed_body)
26
27
  info << MultiJson.dump(parsed_body, :pretty => true)
27
28
  rescue
28
29
  info << "#{response[:body]}"
@@ -41,5 +42,23 @@ module CFoundry
41
42
  end
42
43
  end
43
44
  end
45
+
46
+ def filter_protected_attributes(hash_or_array)
47
+ if hash_or_array.is_a? Array
48
+ hash_or_array.each do |value|
49
+ filter_protected_attributes(value)
50
+ end
51
+ else
52
+ hash_or_array.each do |key, value|
53
+ if PROTECTED_ATTRIBUTES.include? key
54
+ hash_or_array[key] = "[PRIVATE DATA HIDDEN]"
55
+ else
56
+ if value.is_a?(Hash) || value.is_a?(Array)
57
+ filter_protected_attributes(value)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
44
63
  end
45
64
  end
@@ -63,10 +63,10 @@ module CFoundry
63
63
  end
64
64
 
65
65
  def delete! (options = {})
66
- super (options)
66
+ super(options)
67
67
  @client.base.uaa.delete_user(guid)
68
68
  true
69
69
  end
70
70
  end
71
71
  end
72
- end
72
+ end
@@ -1,4 +1,4 @@
1
1
  module CFoundry # :nodoc:
2
2
  # CFoundry library version number.
3
- VERSION = "2.3.6.rc1".freeze
3
+ VERSION = "2.3.6.rc2".freeze
4
4
  end
@@ -76,6 +76,13 @@ describe CFoundry::TraceHelpers do
76
76
 
77
77
  include_examples "response_trace tests"
78
78
  end
79
+
80
+ context "with credentials in the response body" do
81
+ let(:response_body) { '{"resources": [{"entity": {"credentials": {"super_secret_stuff": "goes here"}, "other_stuff": "still here"}}]}' }
82
+ let(:response_trace) { "RESPONSE: [404]\nRESPONSE_HEADERS:\n\nRESPONSE_BODY:\n#{MultiJson.dump({"resources" => [{"entity" => {"credentials" => "[PRIVATE DATA HIDDEN]", "other_stuff" => "still here"}}]}, :pretty => true)}" }
83
+
84
+ include_examples "response_trace tests"
85
+ end
79
86
 
80
87
  it "returns nil if response is nil" do
81
88
  tracehelper_test_class.new.response_trace(nil).should == nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfoundry
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.6.rc1
4
+ version: 2.3.6.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -414,9 +414,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
414
414
  - - ! '>='
415
415
  - !ruby/object:Gem::Version
416
416
  version: '0'
417
- segments:
418
- - 0
419
- hash: -59622661081407862
420
417
  required_rubygems_version: !ruby/object:Gem::Requirement
421
418
  none: false
422
419
  requirements: