fix sub path resource matching in list objects (#2444)
fixes #https://github.com/minio/console/issues/2400 Used the policy to validate the fix. ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::sam-card" ] }, { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::sam-card/*" ] }, { "Effect": "Deny", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::sam-card/aa/*" ] } ] } ```
This commit is contained in:
committed by
GitHub
parent
7b389fc323
commit
e7ec3fe61f
@@ -359,9 +359,26 @@ const ListObjects = () => {
|
||||
const internalPaths = pathSegment.length === 2 ? pathSegment[1] : "";
|
||||
const bucketName = params.bucketName || "";
|
||||
|
||||
const pageTitle = decodeURLString(internalPaths);
|
||||
const currentPath = pageTitle.split("/").filter((i: string) => i !== "");
|
||||
|
||||
let uploadPath = [bucketName];
|
||||
if (currentPath.length > 0) {
|
||||
uploadPath = uploadPath.concat(currentPath);
|
||||
}
|
||||
|
||||
const fileUpload = useRef<HTMLInputElement>(null);
|
||||
const folderUpload = useRef<HTMLInputElement>(null);
|
||||
|
||||
const canDownload = hasPermission(bucketName, [IAM_SCOPES.S3_GET_OBJECT]);
|
||||
const canDelete = hasPermission(bucketName, [IAM_SCOPES.S3_DELETE_OBJECT]);
|
||||
const canUpload = hasPermission(
|
||||
uploadPath,
|
||||
[IAM_SCOPES.S3_PUT_OBJECT],
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (folderUpload.current !== null) {
|
||||
folderUpload.current.setAttribute("directory", "");
|
||||
@@ -1179,9 +1196,6 @@ const ListObjects = () => {
|
||||
dispatch(setLoadingObjectsList(true));
|
||||
};
|
||||
|
||||
const pageTitle = decodeURLString(internalPaths);
|
||||
const currentPath = pageTitle.split("/").filter((i: string) => i !== "");
|
||||
|
||||
const plSelect = filteredRecords;
|
||||
const sortASC = plSelect.sort(sortListObjects(currentSortField));
|
||||
|
||||
@@ -1231,14 +1245,6 @@ const ListObjects = () => {
|
||||
});
|
||||
}
|
||||
};
|
||||
let uploadPath = [bucketName];
|
||||
if (currentPath.length > 0) {
|
||||
uploadPath = uploadPath.concat(currentPath);
|
||||
}
|
||||
|
||||
const canDownload = hasPermission(bucketName, [IAM_SCOPES.S3_GET_OBJECT]);
|
||||
const canDelete = hasPermission(bucketName, [IAM_SCOPES.S3_DELETE_OBJECT]);
|
||||
const canUpload = hasPermission(uploadPath, [IAM_SCOPES.S3_PUT_OBJECT]);
|
||||
|
||||
const onClosePanel = (forceRefresh: boolean) => {
|
||||
dispatch(setSelectedObjectView(null));
|
||||
|
||||
Reference in New Issue
Block a user