Skip to content

Commit

Permalink
Merge pull request #10994 from sstrigler/EMQX-10003-e-5-0-4-auth-head…
Browse files Browse the repository at this point in the history
…er-value-of-webhook-data-bridge-can-be-found-in-emqx-log

fix(emqx_utils): redact proxy-authorization headers
  • Loading branch information
zmstone committed Jun 10, 2023
2 parents 22df275 + 57d72ed commit f98cdd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
24 changes: 16 additions & 8 deletions apps/emqx_utils/src/emqx_utils.erl
Expand Up @@ -600,15 +600,18 @@ try_to_existing_atom(Convert, Data, Encoding) ->
_:Reason -> {error, Reason}
end.

is_sensitive_key(token) -> true;
is_sensitive_key("token") -> true;
is_sensitive_key(<<"token">>) -> true;
is_sensitive_key(authorization) -> true;
is_sensitive_key("authorization") -> true;
is_sensitive_key(<<"authorization">>) -> true;
is_sensitive_key(aws_secret_access_key) -> true;
is_sensitive_key("aws_secret_access_key") -> true;
is_sensitive_key(<<"aws_secret_access_key">>) -> true;
is_sensitive_key(password) -> true;
is_sensitive_key("password") -> true;
is_sensitive_key(<<"password">>) -> true;
is_sensitive_key('proxy-authorization') -> true;
is_sensitive_key("proxy-authorization") -> true;
is_sensitive_key(<<"proxy-authorization">>) -> true;
is_sensitive_key(secret) -> true;
is_sensitive_key("secret") -> true;
is_sensitive_key(<<"secret">>) -> true;
Expand All @@ -618,9 +621,9 @@ is_sensitive_key(<<"secret_key">>) -> true;
is_sensitive_key(security_token) -> true;
is_sensitive_key("security_token") -> true;
is_sensitive_key(<<"security_token">>) -> true;
is_sensitive_key(aws_secret_access_key) -> true;
is_sensitive_key("aws_secret_access_key") -> true;
is_sensitive_key(<<"aws_secret_access_key">>) -> true;
is_sensitive_key(token) -> true;
is_sensitive_key("token") -> true;
is_sensitive_key(<<"token">>) -> true;
is_sensitive_key(_) -> false.

redact(Term) ->
Expand Down Expand Up @@ -731,9 +734,14 @@ redact_test_() ->

Types = [atom, string, binary],
Keys = [
token,
authorization,
aws_secret_access_key,
password,
secret
'proxy-authorization',
secret,
secret_key,
security_token,
token
],
[{case_name(Type, Key), fun() -> Case(Type, Key) end} || Key <- Keys, Type <- Types].

Expand Down
1 change: 1 addition & 0 deletions changes/ce/fix-10994.en.md
@@ -0,0 +1 @@
Redact `proxy-authorization` headers as used by HTTP connector to not leak secrets into log-files.

0 comments on commit f98cdd4

Please sign in to comment.