Skip to content

Commit b2f803b

Browse files
Fix parameter validation in login.
1 parent 50bd43c commit b2f803b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/handlers/api.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ def set_cache_header(self, cache_value):
5555
class UserInfoHandler(AuthHandler):
5656
""" "Handler for /user_info endpoint."""
5757

58+
# Override prepare method to bypass parameter validation
59+
def prepare(self):
60+
# Skip the BaseAPIHandler parameter validation
61+
# and just call the basic RequestHandler prepare
62+
super(BaseAPIHandler, self).prepare()
63+
5864
def get(self):
5965
# Check for user cookie
6066
if self.current_user:
@@ -73,11 +79,23 @@ def get(self):
7379

7480

7581
class LoginHandler(AuthHandler):
82+
# Override prepare method to bypass parameter validation
83+
def prepare(self):
84+
# Skip the BaseAPIHandler parameter validation
85+
# and just call the basic RequestHandler prepare
86+
super(BaseAPIHandler, self).prepare()
87+
7688
def get(self):
7789
self.redirect(self.get_argument("next", "/"))
7890

7991

8092
class LogoutHandler(AuthHandler):
93+
# Override prepare method to bypass parameter validation
94+
def prepare(self):
95+
# Skip the BaseAPIHandler parameter validation
96+
# and just call the basic RequestHandler prepare
97+
super(BaseAPIHandler, self).prepare()
98+
8199
def get(self):
82100
self.clear_cookie("user")
83101
self.redirect(self.get_argument("next", "/"))

src/handlers/oauth.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ class GitHubLoginHandler(BaseAPIHandler, GithubOAuth2Mixin):
1111

1212
SCOPES = []
1313
GITHUB_CALLBACK_PATH = "/oauth"
14+
15+
# Override prepare method to bypass parameter validation
16+
def prepare(self):
17+
# Skip the BaseAPIHandler parameter validation
18+
# and just call the basic RequestHandler prepare
19+
super(BaseAPIHandler, self).prepare()
1420

1521
async def get(self):
1622
CLIENT_ID = self.biothings.config.GITHUB_CLIENT_ID

0 commit comments

Comments
 (0)