浏览代码

the conversion OAuthGrantType(parsed_args["grant_type"]) can raise ValueError for invalid values which is not caught and will produce a 500 (#24854)

tags/1.8.1
NeatGuyCoding 2 个月前
父节点
当前提交
2e6e414a9e
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4
    3
      api/controllers/console/auth/oauth_server.py

+ 4
- 3
api/controllers/console/auth/oauth_server.py 查看文件

@@ -122,7 +122,10 @@ class OAuthServerUserTokenApi(Resource):
parser.add_argument("refresh_token", type=str, required=False, location="json")
parsed_args = parser.parse_args()

grant_type = OAuthGrantType(parsed_args["grant_type"])
try:
grant_type = OAuthGrantType(parsed_args["grant_type"])
except ValueError:
raise BadRequest("invalid grant_type")

if grant_type == OAuthGrantType.AUTHORIZATION_CODE:
if not parsed_args["code"]:
@@ -160,8 +163,6 @@ class OAuthServerUserTokenApi(Resource):
"refresh_token": refresh_token,
}
)
else:
raise BadRequest("invalid grant_type")


class OAuthServerUserAccountApi(Resource):

正在加载...
取消
保存