Validate the namespace before looking it up

This will prevent unicode errors when trying to lookup unicode in the database

Fixes https://sentry.io/organizations/coreos/issues/628269769/?project=52148
This commit is contained in:
Joseph Schorr 2019-02-18 12:09:25 -05:00
parent 2cebf828a2
commit 166fd671c8

View file

@ -843,6 +843,10 @@ def redirect_to_repository(namespace_name, repo_name, tag_name):
@process_oauth
@anon_protect
def redirect_to_namespace(namespace):
okay, _ = model.user.validate_username(namespace)
if not okay:
abort(404)
user_or_org = model.user.get_user_or_org(namespace)
if not user_or_org:
abort(404)