From 9c5e2fd5e60cfd3f5d4d3c71251ef8cb0defc8ff Mon Sep 17 00:00:00 2001 From: Vitalii Date: Wed, 31 Aug 2022 17:25:59 +0300 Subject: [PATCH] web/satellite: fix access grants used for sharing objects and buckets Fix access grants used for linksharing. Allow only List and Download. Change-Id: I6123eb63af1ebefa0d771505632250c1c098a3b3 --- .../src/components/modals/ShareBucketModal.vue | 4 ++-- web/satellite/src/components/objects/UploadFile.vue | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/web/satellite/src/components/modals/ShareBucketModal.vue b/web/satellite/src/components/modals/ShareBucketModal.vue index e00e40aec35f..ede55f31a288 100644 --- a/web/satellite/src/components/modals/ShareBucketModal.vue +++ b/web/satellite/src/components/modals/ShareBucketModal.vue @@ -125,9 +125,9 @@ export default class ShareBucketModal extends Vue { this.worker.postMessage({ 'type': 'RestrictGrant', 'isDownload': true, - 'isUpload': true, + 'isUpload': false, 'isList': true, - 'isDelete': true, + 'isDelete': false, 'paths': [path], 'grant': grantData.value, }); diff --git a/web/satellite/src/components/objects/UploadFile.vue b/web/satellite/src/components/objects/UploadFile.vue index 6776db92e84d..8829c4ff72d8 100644 --- a/web/satellite/src/components/objects/UploadFile.vue +++ b/web/satellite/src/components/objects/UploadFile.vue @@ -122,7 +122,7 @@ export default class UploadFile extends Vue { const cleanAPIKey: AccessGrant = await this.$store.dispatch(ACCESS_GRANTS_ACTIONS.CREATE, LINK_SHARING_AG_NAME); try { - const credentials: EdgeCredentials = await this.generateCredentials(cleanAPIKey.secret, path, true); + const credentials: EdgeCredentials = await this.generateShareCredentials(cleanAPIKey.secret, path, true); path = encodeURIComponent(path.trim()); @@ -211,9 +211,9 @@ export default class UploadFile extends Vue { } /** - * Generates gateway credentials. + * Generates share gateway credentials. */ - private async generateCredentials(cleanApiKey: string, path: string, isPublic: boolean): Promise { + private async generateShareCredentials(cleanApiKey: string, path: string, isPublic: boolean): Promise { const satelliteNodeURL = MetaUtils.getMetaContent('satellite-nodeurl'); this.worker.postMessage({ @@ -235,9 +235,9 @@ export default class UploadFile extends Vue { this.worker.postMessage({ 'type': 'RestrictGrant', 'isDownload': true, - 'isUpload': true, + 'isUpload': false, 'isList': true, - 'isDelete': true, + 'isDelete': false, 'paths': [path], 'grant': grantData.value, });