You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/03/13 17:53:04 UTC

[GitHub] [couchdb] jaydoane commented on a change in pull request #2661: Enhance alg check

jaydoane commented on a change in pull request #2661: Enhance alg check
URL: https://github.com/apache/couchdb/pull/2661#discussion_r392382793
 
 

 ##########
 File path: src/jwtf/src/jwtf.erl
 ##########
 @@ -139,10 +139,11 @@ validate_alg(Props, Checks) ->
     case {Required, Alg} of
         {undefined, _} ->
             ok;
-        {true, undefined} ->
+        {Required, undefined} when Required /= undefined ->
             throw({bad_request, <<"Missing alg header parameter">>});
-        {true, Alg} ->
-            case lists:member(Alg, valid_algorithms()) of
+        {Required, Alg} when Required == true; is_list(Required) ->
+            AllowedAlg = if Required == true -> true; true -> lists:member(Alg, Required) end,
 
 Review comment:
   This logic is a bit awkward, but I assume it's being done for backward compatibility.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services