jsreport / jsreport-fs-store-aws-s3-persistence

Make jsreport fs store persisting entities to aws s3
5 stars 4 forks source link

Allowed to use empty AWS credentials (accessKeyId, secretAccessKey) #3

Closed antonbezpalov-flixbus closed 5 years ago

antonbezpalov-flixbus commented 5 years ago

Hi, in our case we use AWS IAM roles as credentials that don't require to use AWS accessKeyId and secretAccessKey for S3 buckets (and others services). Unfortunately with current implementation if we configure jsreport.config.json like this:

"fs-store-aws-s3-persistence": {
      "accessKeyId": "",
      "secretAccessKey": "",
     ...
    }

it throws an error in fileSystemS3.js:11.

If we use some dummy credentials:

"fs-store-aws-s3-persistence": {
      "accessKeyId": "secret",
      "secretAccessKey": "secret",
     ...
    }

AWS S3 service starts to check accessKeyId and secretAccessKey and forbid to connect.

Our suggestion is to check not for falsy values but for undefined/null values which will allow to use empty strings. So if somebody is using AWS IAM roles as credentials it is possible to configure like that:

"fs-store-aws-s3-persistence": {
      "accessKeyId": "",
      "secretAccessKey": "",
      "bucket": "bucket-name",
     ...
    }
pofider commented 5 years ago

Thanks. You can get this in 1.2.3 npm release.