ChenSammi commented on code in PR #11053:
URL: https://github.com/apache/ozone/pull/11053#discussion_r4357230734


##########
hadoop-hdds/docs/content/design/s3-object-lock.md:
##########
@@ -0,0 +1,598 @@
+---
+title: S3 Object Lock
+summary: Design to support S3 object lock.
+date: 2026-08-18
+jira: HDDS-15945
+status: draft
+author: Chung En Lee
+---
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+
+# S3 Object Lock Design Doc
+
+## Summary
+
+This design adds S3 Object Lock to OBS buckets, so keys can be protected from 
deletion and overwrite.
+Authorization uses Ozone native ACLs or Apache Ranger.
+
+## Problem statement
+
+Data stored for security or compliance must be protected from accidental or 
malicious deletion and overwrite. Object Lock provides this protection.
+
+The design supports both native ACLs and Ranger. Native ACLs serve deployments 
without Ranger, and let the core logic be built and tested without the Ranger 
integration.
+To ship the core feature sooner, the first release excludes versioning, Legacy 
buckets and FSO buckets.
+
+**Goal:**
+
+* Object Lock on OBS buckets, with authorization through native ACLs or Ranger.
+* Single-version keys only.
+
+## Non-Goal
+
+* Versioning: locks across multiple object versions (versioning is still under 
development).
+* Legacy and FSO buckets. FSO needs its own decisions on:
+  * Lock granularity: files and directories are in different tables (FileTable 
/ DirectoryTable), so locks could apply to files, directories or both.
+  * Rename and move: they change the namespace without changing the data, so 
they must either be blocked on locked paths or keep the lock with the same 
objectID.
+* Value-level Ranger authorization, for example allowing a legal hold to be 
set `ON` but not `OFF`.
+
+## Differences from AWS
+
+* Single version: locks apply to the current key, not to object versions.
+* Overwrites are rejected: in AWS S3, Put, Copy or MPU on a locked object 
writes a new version. In Ozone it would replace the locked key,
+  so Ozone rejects Put, Copy, MPU and rename (native clients only) on locked 
keys with `403 Access Denied` (`WORMProtectionException`).
+* Governance bypass on overwrite and rename: a Governance-locked key can only 
be overwritten or renamed with the `bypassGovernanceRetention` flag and the 
bypass permission.
+  AWS S3 does not need this because it writes a new version (see [Retention 
Modes and Governance Bypass](#3-retention-modes-and-governance-bypass)).
+* Authorization: Ozone has no root account.
+  * Native ACLs: changing locks and bypassing Governance need the volume or 
bucket owner; setting or changing a Compliance retention needs an Ozone 
administrator (see [Native ACLs](#1-native-acls)).
+  * Ranger: action-level permissions need 
`enableActionMatcherInPoliciesCondition`, which is `false` by default (see 
[Ranger](#2-ranger)).
+    Object Lock uses the same access types as data (`READ` / `WRITE`), so 
without `action-matches`, anyone who can write a key can also change its locks.
+  * No API can remove a Compliance retention, in either model. Only the 
offline `ozone repair` command can (see [Offline Compliance Retention 
Repair](#offline-compliance-retention-repair)).
+
+## Technical Description
+
+### Terminology
+
+**Legal Hold**
+
+* Locks a key with no end date, until someone allowed to change the legal hold 
removes it
+  (the owner with native ACLs; `WRITE` with Ranger, limited to 
`PutObjectLegalHold` when `action-matches` is used).
+* Used for litigation, investigations or audits, when it is not known how long 
the data must be kept.
+* Has no mode and no date, and is independent of retention: a key can have a 
legal hold, a retention, or both, and stays locked until both are gone.
+  A legal hold can be set on a key without a retention.
+* Blocks: Put / Copy (overwrite), Delete, Multipart Upload (initiate / 
complete), Rename (native clients).
+* Allows: Get / Head, Get / Put Object Tagging, Get Legal Hold, Put Legal Hold 
(with permission).
+
+**Retention**
+
+* Protects a key until a `RetainUntilDate`. The date is either fixed (set 
directly, or from days / years) or comes from an event hold.

Review Comment:
   There is one limitation about bucket locking default configuration,
   
   `If you specify both a default retention period (Days or Years) and a 
DefaultEventHold, the event hold duration can't exceed the default retention 
period.
   `
   
https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-s3-bucket-defaultretention.html



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to