CTFd icon indicating copy to clipboard operation
CTFd copied to clipboard

Can't download files from AWS S3

Open Kool-Koder opened this issue 6 years ago • 1 comments

Environment:

  • CTFd Version/Commit: 2.4.2
  • Operating System: Ubuntu 18.04 LTS
  • Web Browser and Version:

What happened? I can upload and delete files from S3, but I can't download it successfully. There seems to be some issues with the URL

What did you expect to happen? To successfully download the files.

How to reproduce your issue

Any associated stack traces or error logs This is the URL CTFd redirects me to.

https://\<bucketname>.s3-\<region>.amazonaws.com/ **\<bucketname>/** f2645148b96d9aa93a6aa2d14daee58c/<filename>?response-content-disposition=attachment%3B%20filename%3D<filename>&AWSAccessKeyId=\<AccessKey>&Signature=%2FHlDyLpTKWSeynctwoU9ormQU2w%3D&Expires=1589787975

Notice that the bucket name in bold is extra and I can download the file once I remove it. Is this some sort of bug with CTFd URL routing to S3 to download the file? Thanks!

Kool-Koder avatar May 18 '20 06:05 Kool-Koder

I found the issue. It was due to a minor error in the docker compose file for AWS S3. I am suggesting an update of the documentation to make it clear what S3 endpoint URL is as I could not find it on S3 explicitly and had to guess the URL.

- AWS_S3_ENDPOINT_URL=https://<region>.amazonaws.com/

Maybe this can be included in the documentation to assist others in the future. Thanks!

Kool-Koder avatar May 23 '20 16:05 Kool-Koder