Sandor Molnar created KNOX-3609:
-----------------------------------
Summary: LDAP proxy: follow-ups to KNOX-3604, KNOX-3595 and
KNOX-3605
Key: KNOX-3609
URL: https://issues.apache.org/jira/browse/KNOX-3609
Project: Apache Knox
Issue Type: Improvement
Components: LDAP
Affects Versions: 3.1.0
Reporter: Sandor Molnar
Assignee: David Han
Fix For: 3.1.0
Follow-up items from the review of KNOX-3604 (#1534), KNOX-3595 (#1536) and
KNOX-3605 (#1535). None of them blocked the merges. Items 1 and 2 are
correctness or documentation gaps; the rest are cleanup.
h3. KNOX-3604: Fallback matching rules for imported remote attributes
# *Docs describe the wrong fallback.* In {{service_ldap_server.md}}
(extraAttributes, "Unrecognised syntaxes and matching rules fall back"), the
docs say an unresolvable equality rule always falls back to
{{octetStringMatch}}. The code uses
{{octetStringMatch}}/{{octetStringOrderingMatch}} only for octet-string syntax.
Human-readable syntaxes fall back to {{caseIgnoreMatch}} and get no synthesised
ordering rule. The docs need updating to match.
# *Binary detection only looks at the octet-string OID.*
{{LdapProxyBackend.toStandaloneAttributeType}} treats a syntax as binary only
when it equals {{1.3.6.1.4.1.1466.115.121.1.40}}. Other non-human-readable
syntaxes in the bundled schema (Binary {{.5}}, Certificate {{.8}}, JPEG
{{.28}}, Audio {{.4}}, Fax {{.23}}) fall back to {{caseIgnoreMatch}}. That
brings back the ClassCastException in {{RemoteSchemaConverter.copyAttribute}}
that the PR fixed for octet strings. Proposal: decide using
{{schemaManager.getLdapSyntaxRegistry().lookup(syntaxOid).isHumanReadable()}},
and add a test for one of these syntaxes.
# *Log noise.* {{ldapRemoteAttributeOrderingFallback}} logs a WARN for every
octet-string import, including attributes that never declared or needed an
ordering rule; it usually prints "declared null". Log at INFO/DEBUG, or WARN
only when the remote declared a rule that could not be resolved.
# _Nit:_ {{LdapProxyBackendTest}} uses raw non-ASCII string literals; use
{{\u}} escapes.
h3. KNOX-3595: Ignore delta-sync timestamp clauses in the all-groups search
# *AD delta sync isn't covered by the defaults.* {{deltaSyncAttributes}}
defaults to {{modifyTimestamp,whenChanged}}. AD-mode delta clients (e.g. Ranger
usersync) filter with {{(|(modifyTimestamp>=X)(uSNChanged>=Y))}}, the same
shape as the PR's manual test. With the defaults, the {{uSNChanged}} branch
survives, so the search is not treated as an all-groups search. Either add
{{uSNChanged}} to the defaults, or document that AD needs
{{deltaSyncAttributes=modifyTimestamp,whenChanged,uSNChanged}} plus
{{extraAttributes=uSNChanged}} (KNOX-3604) so the filter can be parsed. Add a
unit test for the OR shape.
# *The integration test may pass for the wrong reason.*
{{test_search_all_groups_by_objectclass_proxy_dn_ignores_delta_timestamp}} uses
{{modifyTimestamp>=20261118163513.0Z}}, which is close to the CI run date. If
the backend sets {{modifyTimestamp}} when it loads the LDIF, the groups match
even without stripping. Use a far-future value (e.g. {{29991231235959Z}}) so
the test only passes if the clause is stripped.
# _Optional:_ {{isDeltaSyncClause}} matches on the attribute name only, so a
client that sends the OID (e.g. {{2.5.18.2}}) is not stripped. Consider
matching on the resolved AttributeType's OID and aliases.
h3. KNOX-3605: Skip role lookup when memberOf is not requested
# Remove the unused {{usernameCapture}} in
{{LDAPRolesLookupInterceptorTest.testRolesLookupSkipsRolesForUserWhenMemberOfNotRequested}}.
# {{memberOfRequested}} is applied twice: when counting user entries and again
in {{preferListStrategy}}. Keep one, and fix the double space in the
{{preferListStrategy(...)}} call.
# {{test_search_user_without_memberof_attribute}} also passes without the
change, because unrequested attributes were already stripped from the result.
Either check that the roles service was not called (if the mock exposes request
counts), or say in the test that it only covers the response shape. Use the
existing {{attribute_names()}} helper instead of {{'memberOf' in entry}}.
# _Optional:_ when {{memberOf}} is not requested, there's no need to add
{{uid}} to the requested attributes for user entries. {{objectClass}} is still
needed.
h3. Acceptance
* Docs match the actual fallback and delta-sync behaviour.
* The binary/human-readable decision uses the syntax's human-readable flag,
with a test covering a non-octet-string binary syntax.
* The KNOX-3595 integration test fails if the delta-sync clause is not stripped.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)