Skip to content

Commit 82629a6

Browse files
reject ls all
1 parent 74c5206 commit 82629a6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

gen3workflow/routes/s3.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ async def s3_endpoint(path: str, request: Request):
180180
# get the name of the user's bucket and ensure the user is making a call to their own bucket
181181
logger.info(f"Incoming S3 request from user '{user_id}': '{request.method} {path}'")
182182
user_bucket = aws_utils.get_safe_name_from_hostname(user_id)
183+
if request.method == "GET" and path == "s3":
184+
err_msg = f"'ls' not supported, use 'ls s3://{user_bucket}' instead"
185+
logger.error(err_msg)
186+
raise HTTPException(HTTP_400_BAD_REQUEST, err_msg)
183187
request_bucket = path.split("?")[0].split("/")[0]
184188
if request_bucket != user_bucket:
185189
err_msg = f"'{path}' (bucket '{request_bucket}') not allowed. You can make calls to your personal bucket, '{user_bucket}'"

0 commit comments

Comments
 (0)