Skip to content

Commit

Permalink
Limit max entries for checkAcls
Browse files Browse the repository at this point in the history
  • Loading branch information
k5342 committed Jan 25, 2024
1 parent 91a080a commit 65d2f7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,9 @@ private OMConfigKeys() {
public static final String OZONE_OM_LISTSTATUS_RATELIMIT_TIMEOUT_KEY =
"ozone.om.liststatus.ratelimit-timeout";
public static final int OZONE_OM_LISTSTATUS_RATELIMIT_TIMEOUT_DEFAULT = 8; // seconds

// Limit for child entries on Ozone ACL check
public static final String OZONE_OM_ACL_CHECK_MAX_CHILDREN =
"ozone.om.acls.max-children";
public static final int OZONE_OM_ACL_CHECK_MAX_CHILDREN_DEFAULT = 300; // entries
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL_DEFAULT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ACL_CHECK_MAX_CHILDREN;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL_DEFAULT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT;
Expand All @@ -128,6 +129,7 @@
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.KEY_NOT_FOUND;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.SCM_GET_PIPELINE_EXCEPTION;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_NOT_FOUND;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.TIMEOUT;
import static org.apache.hadoop.util.MetricUtil.captureLatencyNs;
import static org.apache.hadoop.ozone.om.lock.OzoneManagerLock.Resource.BUCKET_LOCK;
import static org.apache.hadoop.ozone.security.acl.OzoneObj.ResourceType.KEY;
Expand Down Expand Up @@ -1113,6 +1115,11 @@ private boolean checkChildrenAcls(OzoneObj ozObject, RequestContext context)
directories.add(ozoneFileStatus);
}
while (!directories.isEmpty() && hasAccess) {
if (directories.size() >
ozoneManager.getConfiguration()
.getInt(OZONE_OM_ACL_CHECK_MAX_CHILDREN, 300)) {

This comment has been minimized.

Copy link
@kuenishi

kuenishi Jan 26, 2024

Member

ここセキュリティ的にはちょい微妙なので、踏んだらログを出すみたいなのあってもいいかも? OMException ってどうハンドルされるんだっけ

throw new OMException("Too much entries for ACL check", TIMEOUT);
}
ozoneFileStatus = directories.pop();
String keyPath = ozoneFileStatus.getTrimmedName();
Iterator<? extends OzoneFileStatus> children =
Expand Down

1 comment on commit 65d2f7d

@kuenishi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

帯域脱出するので再帰削除できない挙動。必要なら個別にけす(?)

Please sign in to comment.