Skip to content

rgw/s3: honor object lock fields in POST object and validate CopyObject - #73214

Open
jzhu116-bloomberg wants to merge 3 commits into
ceph:mainfrom
jzhu116-bloomberg:wip-82248
Open

jzhu116-bloomberg wants to merge 3 commits into
ceph:mainfrom
jzhu116-bloomberg:wip-82248

Conversation

@jzhu116-bloomberg

Copy link
Copy Markdown
Contributor

On a bucket with object lock enabled, POST object (browser-based upload) ignores the x-amz-object-lock-mode, x-amz-object-lock-retain-until-date and x-amz-object-lock-legal-hold form fields. The object is stored with only the bucket's default retention, or with no protection at all if the bucket has no default, and the request still returns 204. A client that asks for a retention period or a legal hold gets an object with no or wrong protection silently.

AWS does not document object lock fields for POST object, however, RGW accepts the same values as headers on PutObject, CopyObject and CreateMultipartUpload. This PR changes the POST object behavior to match with what PutObject, CopyObject and CreateMultipartUpload do.

This PR moves the object lock header parsing for PutObject, CopyObject, CreateMultipartUpload and POST object into a shared helper. CopyObject then gets the same InvalidRequest check as PutObject and CreateMultipartUpload when copying to an unlocked bucket with object lock headers.

Fixes: https://tracker.ceph.com/issues/82248
Signed-off-by: Jane Zhu [email protected]

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@smanjara

Copy link
Copy Markdown
Contributor

treating POST just as PUT for object lock sounds fine to me. related, but doesn't have to block this PR, I noticed that AWS requires s3:PutObjectRetention or s3:PutObjectLegalHold in addition to s3:PutObject when those headers are set. that is under Object operations and permissions for PutObject, CopyObject and CreateMultipartUpload. but it looks like RGW only enforces those actions on the dedicated PutObjRetention and PutObjLegalHold api's.

cc @cbodley

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@jzhu116-bloomberg

Copy link
Copy Markdown
Contributor Author

treating POST just as PUT for object lock sounds fine to me. related, but doesn't have to block this PR, I noticed that AWS requires s3:PutObjectRetention or s3:PutObjectLegalHold in addition to s3:PutObject when those headers are set. that is under Object operations and permissions for PutObject, CopyObject and CreateMultipartUpload. but it looks like RGW only enforces those actions on the dedicated PutObjRetention and PutObjLegalHold api's.

cc @cbodley

Thanks Shilpa for the review! The s3:PutObjectRetention / s3:PutObjectLegalHold requirement for PutObject, CopyObject and CreateMultipartUpload is tracked separately and fixed in #73508 .

@jzhu116-bloomberg

Copy link
Copy Markdown
Contributor Author

rebased

@anrao19

anrao19 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao8-testing-2026-11-13-0837-main.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@anrao19

anrao19 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This PR has been removed from wip-anrao8-testing-2026-11-13-0838-main.

@jzhu116-bloomberg

Copy link
Copy Markdown
Contributor Author
  • rebased with main
  • wrapped the tests in try .. finally... to make sure legal holds will always be released even the tests fail so the nuke_bucket() can properly deletes the versions -- please see 7a36385

@anrao19

anrao19 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao14-testing-2026-12-02-0603-main.

@jzhu116-bloomberg

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants