# Bug OP-8063 - S3 presigned URL cached for 7 days does not work with IAM roles and is a security issue

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-8063

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | High |
| Module |  |
| Target versions | 11.1.3 |
| Observed in versions | 11.1.0 |
| Sprint | 11.1.3 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 11.1.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### **Environment**:

Your OpenProject Version: 11.1

Operating System / Browser / OpenProject language: Windows, Chrome, German

### **Logs**

n/a

### **Steps to reproduce:**

1.  Deploy OpenProject on AWS.
2.  Create IAM role to grant access to S3 bucket.
3.  Configure S3 backend. Do not use IAM user credentials but IAM role for authentication/authoriziation (`OPENPROJECT_FOG_CREDENTIALS_USE__IAM__PROFILE` = true).
4.  Create wiki page and upload an image.
5.  Display wiki page.
6.  Come back after 6 hours with the same browser (cache).
7.  Image fetched from S3 with pre-signed URL does not work any more (token expired).

### **Actual Behavior**

OpenProject tells the browser to cache presigned URL for images stored on S3 for 7 days. As mentioned at [https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html](https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html) this does only work when an IAM user is used to create the presigned URL. When using an IAM role instead of a user - which is a security best practice - a presigned URL is only valid for 6 hours. Therefore, accessing the images via the presigned URL fails after 6 hours.

In my opinion, it is also a security issue to create presigned URLs for S3 valid for 7 days. A user can use the presigned URL to access data even if the session timed out long before.

### **Expected Behavior**

OpenProject should tell browsers to cache presigned URLs for S3 no longer than 1-6 hours.
