Skip to content

KNOX-3595: Ignore delta-sync timestamp clauses in LDAP all-groups search - #1536

Open
handavid wants to merge 1 commit into
apache:masterfrom
handavid:KNOX-3595-ignore-modifytimestamp
Open

handavid wants to merge 1 commit into
apache:masterfrom
handavid:KNOX-3595-ignore-modifytimestamp

Conversation

@handavid

Copy link
Copy Markdown
Contributor

KNOX-3595 - Ignore delta-sync timestamp clauses in LDAP all-groups search

What changes were proposed in this pull request?

A client performing an incremental/delta sync adds a modifyTimestamp (or its Active Directory equivalent whenChanged) clause to a groups search to request only the groups changed since its last sync. The roles service cannot compute a delta, so when enabled this strips such clauses before the filter is classified, making the search fall back to a full all-groups search that returns every role.

  • Strip delta-sync clauses from the search filter, rebuilding AND/OR branch nodes from their surviving children (leaving the caller's filter untouched) and treating a branch with no survivors as "nothing left to match".
  • Add gateway.ldap.interceptor..ignoreDeltaSyncTimestamps (default false, opt-in) to gate the behavior.
  • Add gateway.ldap.interceptor..deltaSyncAttributes, a comma-separated, case-insensitive list of attribute names to strip, defaulting to modifyTimestamp,whenChanged; a configured list replaces the default. A value with no usable names (only commas or whitespace) falls back to the default rather than silently disabling stripping.
  • Add unit tests and a system test, and document both properties.

How was this patch tested?

Added unit tests.

Manually tested using the file-based Roles lookup and reverse lookup classes. Verified that searching while including the modifyTimestamp, whenChanged, or uSNChanged clauses still returned all groups from the roles server.
e.g.,

ldapsearch -v -x -H ldap://localhost:3890  -D 'uid=bind,ou=people,dc=proxy,dc=com' -w bind-password  -E pr=250/noprompt -b 'ou=groups,DC=proxy,DC=com' -s sub '(&(objectClass=groupOfNames)(|(modifyTimestamp>=20261115074418.0Z)(uSNChanged>=2337200000)))' '*' '+'

Integration Tests

An integration test was added that performs a search using (&(objectClass=groupOfNames)(modifyTimestamp>=20261118163513.0Z)) as the search filter and verifies that all expected groups are present in the result.

UI changes

No UI changes

A client performing an incremental/delta sync adds a modifyTimestamp (or its
Active Directory equivalent whenChanged) clause to a groups search to request
only the groups changed since its last sync. The roles service cannot compute a
delta, so when enabled this strips such clauses before the filter is classified,
making the search fall back to a full all-groups search that returns every role.

- Strip delta-sync clauses from the search filter, rebuilding AND/OR branch
  nodes from their surviving children (leaving the caller's filter untouched)
  and treating a branch with no survivors as "nothing left to match".
- Add gateway.ldap.interceptor.<name>.ignoreDeltaSyncTimestamps (default false,
  opt-in) to gate the behavior.
- Add gateway.ldap.interceptor.<name>.deltaSyncAttributes, a comma-separated,
  case-insensitive list of attribute names to strip, defaulting to
  modifyTimestamp,whenChanged; a configured list replaces the default. A value
  with no usable names (only commas or whitespace) falls back to the default
  rather than silently disabling stripping.
- Add unit tests and a system test, and document both properties.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

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.

1 participant