Skip to content

S3 provider with private ACL continues to request items after signed URL has expired #16925

@timbarclay

Description

@timbarclay

Bug report

Required System information

  • Node.js version: 16
  • NPM version: 8.3.1
  • Strapi version: 4.10.5
  • Database: Postgres
  • Operating system: linux (node alpine docker)
  • Is your project Javascript or Typescript: Typescript

Describe the bug

The AWS S3 provider plugin appears to use expired pre-signed URLs.

Also the readme is unclear about what the default expiry value is. Within the readme it says variously:

  • "Defaults to 15 minutes"
  • "The default value is 7 days"

Steps to reproduce the behavior

  1. set up the AWS S3 provider plugin with ACL: 'private' and without explicitly setting signedUrlExpires
  2. upload an image to the media library
  3. insert that image into a rich text block and save it (the image should render correctly in the preview at this point)
  4. wait 20 minutes
  5. reload the rich text block
  6. the inserted image is broken because the presigned url has expired

Expected behavior

On reloading the saved text block, you should still see the inserted image.

Screenshots

image
A text block with a broken image

image
The response returned by AWS showing that the url expired after 15 minutes (900 seconds).

Code snippets

plugins.ts

export default ({ env }) => ({
  upload: {
    config: {
      provider: env.bool('IS_LOCAL') ? 'local' : 'aws-s3',
      providerOptions: {
        region: env('AWS_REGION', 'eu-west-2'),
        sslEnabled: true,
        params: {
          Bucket: env('CMS_S3_BUCKET', 'iwsr-test-strapi-media-library'),
          ACL: 'private',
        },
      },
      actionOptions: {
        upload: {
          ServerSideEncryption: 'AES256',
        },
        uploadStream: {
          ServerSideEncryption: 'AES256',
        },
      },
    },
  },
});

Metadata

Metadata

Labels

issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundsource: core:uploadSource is core/upload packagestatus: pending reproductionWaiting for free time to reproduce the issue, or more information

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions