Loading
ldb: Don't let the bitwise matching rules match inaccessible attributes (bug 16214)
Fix for https://bugzilla.samba.org/show_bug.cgi?id=16214.
ldb_match_message() suppresses matches on attributes the caller may not read, but leaves extended matches to do that themselves. ldb_match_bitmask(), which implements the bitwise AND and OR matching rules (1.2.840.113556.1.4.803 and 1.2.840.113556.1.4.804), did not. A user without the right to read a confidential integer attribute could still learn its value bit by bit from which searches returned the object.
- Commit 1 treats an inaccessible element as not matching in
ldb_match_bitmask(), as the other filter types do. - Commit 2 adds
test_search_with_bitwise_matching_rulestosource4/dsdb/tests/python/confidential_attr.py. An ordinary user can matchuidNumberwith both rules while it is readable, and can no longer match it once it is made confidential; the administrator still can.
Testing:
- Without the fix, against a Samba 4.25.1 AD DC, the new test fails at its first search after the attribute is made confidential:
1 results, not 0 for search (uidNumber:1.2.840.113556.1.4.803:=2). The test stops there, so its later assertions were not reached in that run. - With both commits, the pipeline on my fork passes: https://gitlab.com/ZackaryLoevseth/samba/-/pipelines/3047892098.
samba4.ldap.confidential_attr.python(ad_dc_slowtests)ran in thesamba-ad-dc-6job, which endedALL OK.
I kept the fix-then-test order used in !4801. I can reorder it as test first with a knownfail entry if you prefer.
Add a description of the new feature/bug fix. Reference any relevant bugs.
Checklist
- Commits have
Signed-off-by:with name/author being identical to the commit author - (optional) This MR is just one part towards a larger feature.
- (optional, if backport required) Bugzilla bug filed and
BUG:tag added - Test suite updated with functionality tests
- Test suite updated with negative tests
- Documentation updated
- CI timeout is 3h or higher (see Settings/CICD/General pipelines/ Timeout)
Reviewer's checklist:
- There is a test suite reasonably covering new functionality or modifications
- Function naming, parameters, return values, types, etc., are consistent
and according to
README.Coding.md - This feature/change has adequate documentation added
- No obvious mistakes in the code