Skip to content

Commit

Permalink
Merge pull request #654 from TeskaLabs/feature/no-tenant-in-both-path…
Browse files Browse the repository at this point in the history
…-and-query

Disallow using `tenant` parameter in path and query at the same time
  • Loading branch information
byewokko authored Dec 9, 2024
2 parents d3ef542 + a4ae732 commit e18ddd1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions asab/web/tenant/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ async def _tenant_context_from_url_path_wrapper(*args, **kwargs):
request = args[-1]
tenant = request.match_info["tenant"]

if "tenant" in request.query:
L.warning("Parameter `tenant` cannot be present in URL path and query at the same time.")
raise aiohttp.web.HTTPBadRequest(reason="Tenant query parameter not allowed.")

if not tenant_service.is_tenant_known(tenant):
L.warning("Tenant not found.", struct_data={"tenant": tenant})
raise aiohttp.web.HTTPNotFound(reason="Tenant not found.")
Expand Down

0 comments on commit e18ddd1

Please sign in to comment.