StorageImage Component can't access the content of protected
level other user created
#4990
Closed
4 tasks done
protected
level other user created
#4990
Before creating a new issue, please confirm:
On which framework/platform are you having an issue?
React
Which UI component?
Storage (Storage Manager)
How is your app built?
Create React App
What browsers are you seeing the problem on?
Chrome
Which region are you seeing the problem in?
No response
Package version
"@aws-amplify/ui-react-storage": "^3.0.12"
Please describe your bug.
Hi,
I think I found a bug about the StorageImage Component in Amplify UI Library.
Could you check and fix this bug?
Storage Image
https://ui.docs.amplify.aws/react/connected-components/storage/storageimage
Bug Description
We can specify
identityId
as arguments in StorageImage Component. But thisidentityId
argument doesn't seem to apply to the url to access to S3.I believe if I specify "ap-northeast-1:abcdefghijk" in
identityId
and "protected" in accessLevel, the url to access should behttps://<Storage Bucket Name>-<env>.s3.ap-northeast-1.amazonaws.com/protected/ap-northeast-1%3Aabcdefgh/<imagekey>
.But, the url StorageImage Component access seems to be
https://<Storage Bucket Name>-<env>.s3.ap-northeast-1.amazonaws.com/protected/ap-northeast-1%3A<user_identity_id about login user >/<imagekey>
when I checked the HAR file. Even if theidentityId
argument is specified, this argument is never used.I think the content of
protected
level should be able to read by all user. So, I believe we can read theses content ofprotected
if I specify correct identityId.File access levels
https://docs.amplify.aws/javascript/build-a-backend/storage/configure-access/
My Investigation
It seems StorageImage Component use getUrl method in aws-amplify/storage for creating url to access to S3. Also, the arguments(options) pass to getUrl() method are same arguments about StorageImage Component.[1][2]
But, the
identityId
argument does not seem to be correct as an argument for getUrl() method. The argument namedtargetIdentityId
seems to be correct.[3]Could you fix
identityId
argument[4] totargetIdentityId
argument?[1] packages/react-storage/src/components/StorageImage/StorageImage.tsx
amplify-ui/packages/react-storage/src/components/StorageImage/StorageImage.tsx
Line 11 in ef95e35
[2] packages/react/src/hooks/useStorageURL.ts
amplify-ui/packages/react/src/hooks/useStorageURL.ts
Line 15 in ef95e35
[3] Generate a download URL
https://docs.amplify.aws/javascript/build-a-backend/storage/download/#generate-a-download-url
[4] Storage Image - Props
https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props
What's the expected behaviour?
We can read theses content of
protected
if I specify correct identityId.Help us reproduce the bug!
N/A
Code Snippet
No response
Console log output
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: