Skip to content

Commit

Permalink
Filter cnb credentials from log output (#3864)
Browse files Browse the repository at this point in the history
Co-authored-by: Ralf Pannemans <[email protected]>
Co-authored-by: Sam Gunaratne <[email protected]>
  • Loading branch information
3 people authored Jul 17, 2024
1 parent c3ab524 commit 2aeb04f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/messages/app_manifest_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ def manifest_routes_update_message
end

def audit_hash
overrides = original_yaml['env'] ? { 'env' => Presenters::Censorship::PRIVATE_DATA_HIDDEN } : {}
original_yaml.merge(overrides)
override_env = original_yaml['env'] ? { 'env' => Presenters::Censorship::PRIVATE_DATA_HIDDEN } : {}
override_cnb = original_yaml['cnb-credentials'] ? { 'cnb-credentials' => Presenters::Censorship::PRIVATE_DATA_HIDDEN } : {}
original_yaml.merge(override_env).merge(override_cnb)
end

def app_lifecycle_hash
Expand Down
7 changes: 7 additions & 0 deletions spec/unit/messages/app_manifest_message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,12 @@ module VCAP::CloudController
{ 'route' => 'existing.example.com' },
{ 'route' => 'another.example.com' }
],
'cnb-credentials' => {
'example.org' => {
'username' => 'foo',
'password' => 'bar'
}
},
'processes' => [{
'type' => 'type',
'command' => 'command',
Expand All @@ -1349,6 +1355,7 @@ module VCAP::CloudController
{ 'route' => 'existing.example.com' },
{ 'route' => 'another.example.com' }
],
'cnb-credentials' => '[PRIVATE DATA HIDDEN]',
'processes' => [{
'type' => 'type',
'command' => 'command',
Expand Down

0 comments on commit 2aeb04f

Please sign in to comment.