Skip to content

sn/object: prevent system eACL property spoofing - #4338

Open
End-rey wants to merge 1 commit into
masterfrom
eacl-system-header-spoofing
Open

End-rey wants to merge 1 commit into
masterfrom
eacl-system-header-spoofing

Conversation

@End-rey

@End-rey End-rey commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Closes #4300.

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.31%. Comparing base (baf4d43) to head (43cdba3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4338      +/-   ##
==========================================
+ Coverage   33.28%   33.31%   +0.02%     
==========================================
  Files         673      673              
  Lines       41888    41891       +3     
==========================================
+ Hits        13943    13954      +11     
+ Misses      27945    27937       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@End-rey

End-rey commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

/hal please review

@hal0x9000 hal0x9000 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I found no correctness problems. The fix is the right one, and it is in the right place. Every eACL object-header path in pkg/services/object/acl/eacl/v2/headers.go (binary header, PUT init, GET/HEAD responses, local Head, the first-object lookup for a V2 split) goes through headersFromObject or headersFromBinaryObjectHeader. Both now skip $Object: attributes, and the parent recursion is covered in both. In the binary path, off still advances before the skip.

What I ran

  • go test ./pkg/services/object/acl/...: passes.
  • I restored object.go from the base (a90d01f) and kept the new tests. TestSystemAttributeRules then fails in every forged, absent and unknown-property case, for both object and parent attributes. TestObjectHeaders/child/binary fails too. So the tests catch the bug.

Findings

  1. Test gap (inline): the parent cases never take the V2-split PUT branch. The risk is low, because that branch calls the same fixed function.
  2. Nit, CHANGELOG.md:13: the profile asks for the issue number (#4300), and the line ends with the PR number (#4338). The file is not consistent either: the lines for #4335 and #4302 cite PRs, the line for #4308 cites an issue. Change it only if you follow the issue-number rule.

Out of scope, filed separately
Metabase SEARCH indexing still writes $Object:payloadLength, $Object:objectType and similar user attributes under the system key. Only $Object:expirationTime is skipped (pkg/local_object_storage/metabase/metadata.go:134-157). That needs a different fix and probably a migration, so I filed it as #4339 instead of asking for it here.

Discarded reviewer leads

  • Shared test helper with TestExpirationTimeRule. The new test follows its neighbour, and this is a matter of taste.
  • Wording of the comment on reservedAttributePrefix.
  • A claim that the parent fixture has a zero owner. It is wrong: CopyTo runs after SetOwner.
  • Overlap with SDK UserAttributes(). That uses a different prefix, so there is no duplication.

Generated by hal0x9000 for commit 7ce3613.

{"put request", WithServiceRequest(&protoobject.PutRequest{
Body: &protoobject.PutRequest_Body{
ObjectPart: &protoobject.PutRequest_Body_Init_{
Init: &protoobject.PutRequest_Body_Init{Header: hdr},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test gap: in the parent cases, this request has no Split.SplitId and no V2 split fields. It takes the "V1 split scheme or small object" branch in headers.go:149. The V2 branches are not exercised: splitHeader.GetParentHeader() (headers.go:169-182) and the first-object Head lookup (headers.go:186-203), which a real multi-part PUT of a split object goes through. Both call the fixed headersFromObject, so the risk is low. A case where the init header carries Split{ParentHeader: <parent with forged attr>} would cover the parent-header branch without a mock headerSource.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The parent cases already exercise the V2 PUT branch: SetParent populates Split.ParentHeader while leaving SplitId nil.

Ignore user attributes with the reserved `$Object:` prefix in both eACL header
builders, including parent headers.

Closes #4300.

Signed-off-by: Andrey Butusov <andrey@nspcc.io>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A user attribute can impersonate an $Object system header

1 participant