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


##########
hadoop-hdds/docs/content/design/s3-object-lock.md:
##########
@@ -0,0 +1,198 @@
+---
+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
+
+This design document aims to plan and implement the Object Lock mechanism for 
OBS buckets integrated with Ranger.
+The primary objective is to provide data immutability and tamper-proof 
protection through the object locking feature.
+
+## Background
+With growing demands for data security and compliance, ensuring that critical 
data stored in OBS (Object Storage) is
+protected from accidental or malicious deletion and overwriting has become an 
essential system protection requirement.
+To establish a more rigorous data protection mechanism, we plan to introduce 
the Object Lock feature.
+
+Considering the current system architecture and access control strategies,
+this design integrates with existing Apache Ranger to manage Object Lock 
permissions on OBS buckets.
+Meanwhile, to accelerate core feature delivery, we have decided to exclude 
complex multi-version locking (Versioning Lock) 
+and legacy FSO buckets from this initial release. In addition, support for 
Native ACLs is excluded; Native ACLs typically grant permissions 
+at the granular bucket or object level, whereas Object Lock permission 
management favors broad, role-based authorization,
+creating a conflict in design philosophies. Narrowing the scope allows us to 
focus on the core functionality and ensure a rapid, 
+stable rollout of baseline tamper-proof protection.
+
+## Goal & Non-Goal
+### Goal
+
+- Implement the Object Lock feature on standard OBS buckets, fully integrated 
with Ranger for permission and access control. 
+- Support single-version objects only.
+
+### Non-Goal
+
+- Versioning Lock: Support for locking across multiple object versions is 
deferred (multi-version core features are currently under development).
+- FSO Legacy Buckets: Object Lock support for legacy FSO buckets is excluded.
+- Native ACL Support: Native ACLs will not be used for access control or 
advanced configuration such as Retention Mode (Governance); access management 
is centralized exclusively via Ranger.
+
+### Terminology
+#### Legal Hold
+
+- Definition: Applies an indefinite lock status to an object. The object 
remains protected until an administrator explicitly removes the lock (Remove 
Legal Hold). 
+- Restricted Operations:
+  - Put Object 
+  - Delete Object 
+  - Multipart Initial / Complete
+- Allowed Operations:
+  - Get Object
+  - Get Legal Hold 
+  - Put Legal Hold (Depends on permission)
+
+#### Retention
+
+- Definition: Configures a fixed retention duration (specified in days or 
years) for an object and applies a specific retention mode. 
+- Retention Modes:
+  - Compliance Mode: The strictest protection tier. Once applied, no user 
(including root/admin) can remove the lock, shorten the duration, or overwrite 
the object before the retention period expires. 

Review Comment:
   Is it really true for Ozone. In AWS S3, it is being made sure to be 
immutable at all levels or atleast audited or blocked including admin/operators 
users, but in Ozone, this may not be true, currently design talks about a happy 
path using `validateAndUpdateCache` when hit on normal S3/ozone APIs. In Ozone 
there are other ways where someone can directly edit rocksDb or delete a key 
meta for a locked key. Another way, where `ozone repair `command also allows to 
restore OM's DB directory from a ratis snapshot taken before the lock was 
applied.
   
   Probably the design should talk about behavior when such actions can happen 
in Ozone , that what is trusted boundary and upto what extent the data is 
protected because otherwise this design may not suffice the complete compliance 
audit implementation. 
   
   **Can think of below:**
    - Whether `ozone repair` subcommands should refuse to operate on Raft 
indexes that carry lock state changes without an explicit unsafe flag.
    - Whether locked keys should be detected on OM startup via cross-check 
between RocksDB state and a tamper-evident external audit log — so that a 
manual DB-copy recovery that silently removes a lock can at least be detected 
on the next start.
    - an operator can run `skip-ratis-transaction` at the Raft index of a 
SetRetention(compliance) entry across all 3 OMs while stopped, then restart, 
and the audit trail of the lock is gone (though RocksDB may still hold applied 
state



##########
hadoop-hdds/docs/content/design/s3-object-lock.md:
##########
@@ -0,0 +1,198 @@
+---
+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
+
+This design document aims to plan and implement the Object Lock mechanism for 
OBS buckets integrated with Ranger.
+The primary objective is to provide data immutability and tamper-proof 
protection through the object locking feature.
+
+## Background
+With growing demands for data security and compliance, ensuring that critical 
data stored in OBS (Object Storage) is
+protected from accidental or malicious deletion and overwriting has become an 
essential system protection requirement.
+To establish a more rigorous data protection mechanism, we plan to introduce 
the Object Lock feature.
+
+Considering the current system architecture and access control strategies,
+this design integrates with existing Apache Ranger to manage Object Lock 
permissions on OBS buckets.
+Meanwhile, to accelerate core feature delivery, we have decided to exclude 
complex multi-version locking (Versioning Lock) 
+and legacy FSO buckets from this initial release. In addition, support for 
Native ACLs is excluded; Native ACLs typically grant permissions 
+at the granular bucket or object level, whereas Object Lock permission 
management favors broad, role-based authorization,
+creating a conflict in design philosophies. Narrowing the scope allows us to 
focus on the core functionality and ensure a rapid, 
+stable rollout of baseline tamper-proof protection.
+
+## Goal & Non-Goal
+### Goal
+
+- Implement the Object Lock feature on standard OBS buckets, fully integrated 
with Ranger for permission and access control. 
+- Support single-version objects only.
+
+### Non-Goal
+
+- Versioning Lock: Support for locking across multiple object versions is 
deferred (multi-version core features are currently under development).
+- FSO Legacy Buckets: Object Lock support for legacy FSO buckets is excluded.
+- Native ACL Support: Native ACLs will not be used for access control or 
advanced configuration such as Retention Mode (Governance); access management 
is centralized exclusively via Ranger.
+
+### Terminology
+#### Legal Hold
+
+- Definition: Applies an indefinite lock status to an object. The object 
remains protected until an administrator explicitly removes the lock (Remove 
Legal Hold). 
+- Restricted Operations:
+  - Put Object 
+  - Delete Object 
+  - Multipart Initial / Complete
+- Allowed Operations:
+  - Get Object
+  - Get Legal Hold 
+  - Put Legal Hold (Depends on permission)
+
+#### Retention
+
+- Definition: Configures a fixed retention duration (specified in days or 
years) for an object and applies a specific retention mode. 
+- Retention Modes:
+  - Compliance Mode: The strictest protection tier. Once applied, no user 
(including root/admin) can remove the lock, shorten the duration, or overwrite 
the object before the retention period expires. 
+  - Governance Mode: A flexible protection tier. Standard users are restricted 
by locking rules, but users with bypassgovernance permissions can bypass 
restrictions to perform modifications or deletions.
+- Restricted Operations:
+  - Put Object 
+  - Delete Object 
+  - Multipart Initial/Complete 
+  - Set Retention Period
+- Allowed Operations:
+  - Get Object
+
+> _**Note**:
+> - Background & Root Cause: A prerequisite for enabling WORM (Write Once, 
Read Many) in AWS S3 is that Object Versioning must be enabled. Under S3 
architecture, executing a Put on a locked object generates a new version 
without affecting the protected prior version; thus, S3 Object Lock primarily 
restricts Delete Object. 
+> - Ozone Implementation Status: Because Ozone's versioning feature is still 
under development, to guarantee absolute immutability during the lock period, 
Ozone will directly block and reject all overwrite operations (such as any form 
of Put or overwrite) on locked objects.
+
+## Design
+
+### Table Changes
+
+#### Bucket Table
+
+Two new fields: objectLockEnabled & defaultRetention.
+
+```protobuf
+  message BucketInfo {
+  // ... existing fields
+  required bool objectLockEnabled = 24 [default = false];
+  optional RetentionConfig defaultRetention = 25;
+  }
+  
+  message RetentionConfig {
+  optional RetentionMode retentionMode = 23;
+  optional uint64 retainUntilDate = 24;
+  }
+  
+  enum RetentionMode {
+    GOVERNANCE = 1;
+    COMPLIANCE = 2;
+  }
+```
+
+
+
+#### Key Table
+
+Two new fields: retentionConfig & legalHold.
+
+```protobuf
+  message KeyInfo {
+  // ... existing fields
+  optional RetentionConfig retentionConfig = 23;
+  optional bool legalHold = 24 [default = false];
+  }
+```
+
+
+
+### Ranger Access Control
+
+- Legal Hold: Introduces three new Access Types—GET_LEGAL_HOLD, 
PUT_LEGAL_HOLD, and CLEAR_LEGAL_HOLD—and adds them to accessTypeRestrictions 
for Keys.
+- Retention: Introduces the BYPASS_GOVERNANCE Access Type and adds it to 
accessTypeRestrictions for Volumes. 
+
+### New Ozone APIs
+#### ObjectStore
+
+```java
+   public void addRetentionConfig(OzoneObj obj, RetentionArgs retentionArgs);
+   public void addLegalHold(OzoneObj obj, bool hold);
+```
+
+#### OzoneBucket
+
+```java
+public void enableObjectLock(boolean enableObjectLock);
+public void setRetentionConfig(RetentionArgs retentionArgs);
+```
+
+> _**Note**:
+> AWS S3 supports enabling Object Lock and configuring RetentionConfig 
directly during bucket creation. 
+> In Apache Ozone's current design, these settings must be configured via 
dedicated API calls after the bucket has been created.

Review Comment:
   In contrast to AWS S3, how do we present this to compliance auditors? Or 
should there be a "one-way" flag that, once set, cannot be cleared?



##########
hadoop-hdds/docs/content/design/s3-object-lock.md:
##########
@@ -0,0 +1,198 @@
+---
+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
+
+This design document aims to plan and implement the Object Lock mechanism for 
OBS buckets integrated with Ranger.
+The primary objective is to provide data immutability and tamper-proof 
protection through the object locking feature.
+
+## Background
+With growing demands for data security and compliance, ensuring that critical 
data stored in OBS (Object Storage) is
+protected from accidental or malicious deletion and overwriting has become an 
essential system protection requirement.
+To establish a more rigorous data protection mechanism, we plan to introduce 
the Object Lock feature.
+
+Considering the current system architecture and access control strategies,
+this design integrates with existing Apache Ranger to manage Object Lock 
permissions on OBS buckets.
+Meanwhile, to accelerate core feature delivery, we have decided to exclude 
complex multi-version locking (Versioning Lock) 
+and legacy FSO buckets from this initial release. In addition, support for 
Native ACLs is excluded; Native ACLs typically grant permissions 
+at the granular bucket or object level, whereas Object Lock permission 
management favors broad, role-based authorization,
+creating a conflict in design philosophies. Narrowing the scope allows us to 
focus on the core functionality and ensure a rapid, 
+stable rollout of baseline tamper-proof protection.
+
+## Goal & Non-Goal
+### Goal
+
+- Implement the Object Lock feature on standard OBS buckets, fully integrated 
with Ranger for permission and access control. 
+- Support single-version objects only.
+
+### Non-Goal
+
+- Versioning Lock: Support for locking across multiple object versions is 
deferred (multi-version core features are currently under development).
+- FSO Legacy Buckets: Object Lock support for legacy FSO buckets is excluded.
+- Native ACL Support: Native ACLs will not be used for access control or 
advanced configuration such as Retention Mode (Governance); access management 
is centralized exclusively via Ranger.
+
+### Terminology
+#### Legal Hold
+
+- Definition: Applies an indefinite lock status to an object. The object 
remains protected until an administrator explicitly removes the lock (Remove 
Legal Hold). 
+- Restricted Operations:
+  - Put Object 
+  - Delete Object 
+  - Multipart Initial / Complete
+- Allowed Operations:
+  - Get Object
+  - Get Legal Hold 
+  - Put Legal Hold (Depends on permission)
+
+#### Retention
+
+- Definition: Configures a fixed retention duration (specified in days or 
years) for an object and applies a specific retention mode. 
+- Retention Modes:
+  - Compliance Mode: The strictest protection tier. Once applied, no user 
(including root/admin) can remove the lock, shorten the duration, or overwrite 
the object before the retention period expires. 
+  - Governance Mode: A flexible protection tier. Standard users are restricted 
by locking rules, but users with bypassgovernance permissions can bypass 
restrictions to perform modifications or deletions.
+- Restricted Operations:
+  - Put Object 
+  - Delete Object 
+  - Multipart Initial/Complete 
+  - Set Retention Period
+- Allowed Operations:
+  - Get Object
+
+> _**Note**:
+> - Background & Root Cause: A prerequisite for enabling WORM (Write Once, 
Read Many) in AWS S3 is that Object Versioning must be enabled. Under S3 
architecture, executing a Put on a locked object generates a new version 
without affecting the protected prior version; thus, S3 Object Lock primarily 
restricts Delete Object. 
+> - Ozone Implementation Status: Because Ozone's versioning feature is still 
under development, to guarantee absolute immutability during the lock period, 
Ozone will directly block and reject all overwrite operations (such as any form 
of Put or overwrite) on locked objects.
+
+## Design
+
+### Table Changes
+
+#### Bucket Table
+
+Two new fields: objectLockEnabled & defaultRetention.
+
+```protobuf
+  message BucketInfo {
+  // ... existing fields
+  required bool objectLockEnabled = 24 [default = false];
+  optional RetentionConfig defaultRetention = 25;
+  }
+  
+  message RetentionConfig {
+  optional RetentionMode retentionMode = 23;
+  optional uint64 retainUntilDate = 24;

Review Comment:
   Is it possible to move the OM leader's clock forward: The WORM check in 
`validateAndUpdateCache` will compare `retainUntilDate` (stored) against "now". 
"Now" is whatever the OM leader believes the time is. 



-- 
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