Skip to content

Commit

Permalink
special handling for token removed
Browse files Browse the repository at this point in the history
  • Loading branch information
rbamberger committed Apr 19, 2023
1 parent f73c65b commit b44919f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
13 changes: 2 additions & 11 deletions lib/java_buildpack/util/sanitizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,8 @@ def handle_params(params)

query_params = ''

params.each do |key, value|
match = key.match(keywords)

if match
params[key] = if match[0] == 'Api-Token' && value =~ /dt\w*/
value.gsub(/(dt\w*\.\w*)\.\w*/, '\1.REDACTED')
else
'***'
end
end

params.each do |key, _|
params[key] = '***' if key.match(keywords)
query_params += key + '=' + params[key] + '&'
end

Expand Down
2 changes: 1 addition & 1 deletion spec/java_buildpack/util/sanitize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'&password=***'\
'&include=java'\
'&bitness=64'\
'&Api-Token=dt0c01.H67ALCXCXK7PWAAOQLENSRET.REDACTED'\
'&Api-Token=***'\
'&secret-token=***'\
'&token=***')
end
Expand Down

0 comments on commit b44919f

Please sign in to comment.