Repository navigation
Conversation
|
The CodeQL findings are addressed in this update:
Validation: the targeted Maven run passed 1,171 tests, including the proxy, TLS, bind, and authenticated-user tests. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: Route retirement preserves factories used by active requests.
ProxyBackend.execute:847-869captures factories and incrementsroute.usersunderroutingLock.ProxyBackend.execute:1128-1135releases the route after connections have been returned, then closes retired resources when no users remain.
issue (blocking): Discovery providers outside org.opends.server.discovery cannot override the lifecycle callbacks.
opendj-server-legacy/src/main/java/org/opends/server/discovery/ServiceDiscoveryMechanism.java:62, :72, :79
These methods were public interface methods at BASE and are now package-private base-class methods. A provider in another package cannot override them, even after adapting its source from implements to extends. ServiceDiscoveryMechanismConfigManager:103,141,155 consequently invokes the base implementations: configuration is accepted, provider initialization is skipped, and provider cleanup is skipped. The configurable java-class still accepts external subclasses.
Restore public visibility for isConfigurationAcceptable, initializeMechanism, and finalizeMechanism, widening their matching overrides in both StaticServiceDiscoveryMechanism and ReplicationServiceDiscoveryMechanism as well. Restore public getName visibility to preserve the former interface contract; listener and partition methods are already public.
Pin: configure a provider fixture in a different package and assert that manager validation, initialization, and deletion invoke its callbacks.
suggestion (non-blocking): Successful paging through active DN and attribute mapping has no regression assertion.
opendj-server-legacy/src/test/java/org/opends/server/backends/ProxyBackendTest.java:1495
The paging case expects UNAVAILABLE_CRITICAL_EXTENSION from a remote backend without paging support. It does not exercise successful pages or continuation cookies, although ProxyRewriter:233-234,260-261 preserves paging controls. ProxyBackendTest passed 26/26 under JDK 11.0.25; no mutation was executed for this coverage observation.
Pin: with a paging-capable remote and active mapping, request page size one, assert a rewritten entry and nonempty cookie, resume with that cookie, and verify each expected entry appears once before an empty terminal cookie. Deferred to the author's discretion.
suggestion (non-blocking): Pre-read request and response rewriting have no proxy regression assertions.
opendj-server-legacy/src/main/java/org/opends/server/backends/ProxyRewriter.java:225, :252
The shared LDAP assertions exercise post-read controls, which use separate OID branches. No proxy/discovery test requests pre-read to check mapped attribute names or the returned entry. This is a static coverage observation; no mutation was executed.
Pin: add a critical pre-read control requesting mapped description and manager to the shared modify scenario. Assert the old values, local entry DN, and local DN-valued manager in the pre-read response. Deferred to the author's discretion.
issue (non-blocking): Failed discovery connection construction leaves factory cleanup to finalization.
opendj-server-legacy/src/main/java/org/opends/server/discovery/ReplicationServiceDiscoveryMechanism.java:280
ConnectionWrapper:153-154 creates an LDAPConnectionFactory and then acquires a connection without failure cleanup. A failed constructor cannot be closed by the caller's try-with-resources. The new periodic discovery calls repeat this path; shared resources remain acquired until ReferenceCountedObject.Reference.finalize() releases them. This is delayed cleanup, not a demonstrated permanent leak; resource growth was not measured.
Close the factory when acquisition fails, preserving successful construction ownership:
connectionFactory = new LDAPConnectionFactory(hostPort.getHost(), hostPort.getPort(), options);
try {
connection = connectionFactory.getConnection();
} catch (LdapException | RuntimeException e) {
connectionFactory.close();
throw e;
}a60fbd9 to
23ebc7d
Compare
|
Addressed in 23ebc7d:
Validation: the targeted JDK 11 Maven integration run passed 33 tests with no skips, including the OpenLDAP container tests. Both lifecycle and factory cleanup regression tests failed on the original implementation before the fixes. |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The update addresses the previous lifecycle, cleanup and rewrite-test findings with concrete fixes and assertions.
- Public discovery callbacks and
ExternalDiscoveryProviderTestcover dispatch from a different package through the configuration manager. - Failed connection acquisition now closes its factory; paging and pre-read tests assert mapped results and continuation behavior.
question (blocking): Is porting and rebuilding existing discovery providers an intentional upgrade requirement?
opendj-server-legacy/src/main/java/org/opends/server/discovery/ServiceDiscoveryMechanism.java:38, opendj-server-legacy/src/main/java/org/opends/server/discovery/ServiceDiscoveryMechanismConfigManager.java:74,131-141
BASE declares an interface; HEAD declares an abstract class and replaces getPartitions(Collection<DN>) with getPartition(). The same old implementing binary cannot load against HEAD: it encounters IncompatibleClassChangeError, outside the manager's catch (Exception). The new lifecycle fixture recompiles against HEAD, so it does not cover this upgrade input.
The ABI incompatibility is established, but an affected supported installation is not: BASE configuration metadata references an absent class, and no deployed provider or valid BASE startup fixture was established. Are providers implementing the former SPI supported upgrade inputs? If yes, preserve an interface/adapter path; if deliberately incompatible, document the required migration and rebuild. The answer decides whether a blocking remedy is required. No verified supported-upgrade blocker is claimed today.
Pin: after declaring the policy, exercise the same old-provider binary through the supported upgrade path, or assert the declared unsupported-provider diagnostic. No current test pins that policy.
issue (non-blocking): Proxy search results have an empty internal object-class map.
opendj-server-legacy/src/main/java/org/opends/server/backends/ProxyBackend.java:1083-1097
The conversion puts objectClass in userAttributes and passes null for the Entry object-class map. An internal search returning objectClass: person consequently yields an empty getObjectClasses() and false hasObjectClass(person): SearchResultEntry and the internal delivery path preserve that empty map. This is a verified representation defect; a concrete failing production consumer was not established, and no group-discovery failure is claimed.
Decode object classes separately, as LDIFReader.java:732-749 does. Within this conversion, keep the existing user/operational maps and replace the loop and constructor with:
final Schema localSchema = serverContext != null
? serverContext.getSchema() : Schema.getDefaultSchema();
final Map<org.forgerock.opendj.ldap.schema.ObjectClass, String> objectClasses =
new LinkedHashMap<>();
for (org.forgerock.opendj.ldap.Attribute attr : rewritten.getAllAttributes()) {
final AttributeType type = attr.getAttributeDescription().getAttributeType();
if (type.isObjectClass()) {
for (ByteString value : attr) {
final String name = value.toString().trim();
objectClasses.put(localSchema.getObjectClass(name), name);
}
continue;
}
final AttributeBuilder builder = new AttributeBuilder(attr.getAttributeDescription());
for (ByteString value : attr) {
builder.add(value);
}
final Map<AttributeType, List<Attribute>> attributes =
type.isOperational() ? operationalAttributes : userAttributes;
attributes.computeIfAbsent(type, ignored -> new ArrayList<>()).add(builder.toAttribute());
}
request.sendSearchEntry(new org.opends.server.types.SearchResultEntry(
new Entry(rewritten.getName(), objectClasses, userAttributes, operationalAttributes),
convertResponseControls(sr.getControls(), mapping)));Pin: an internal proxy search returning objectClass: person must satisfy both getObjectClasses() and hasObjectClass(person), rather than checking only LDAP attributes. The suggested code was checked against HEAD APIs but was not compiled or run.
suggestion (non-blocking): Include the two container integration classes in normal CI test selection.
opendj-server-legacy/src/test/java/org/opends/server/discovery/ProxyBackendOpenLdapIT.java:59, opendj-server-legacy/pom.xml:1241-1247, .github/workflows/build.yml:115-118,156
Explicit Failsafe includes match neither ProxyBackendOpenLdapIT nor ProxyBackend389IT. Linux CI runs verify -P precommit without an it.test override, so its green result cannot establish the OpenLDAP paging or 389 Directory Server assertions. The author's targeted manual runs are separate evidence. Deferred test-strength follow-up: add this alongside the existing includes, or rename both classes to an included convention.
<include>**/*IT.java</include>Pin: a container-capable default CI run must produce report XML naming both classes, with no skips. Selection was verified statically; Maven was not run in this round.
note (non-blocking): Review execution deviated from the reserved-run protocol.
Five sweeps and independent verification completed with no failed or budget-skipped tasks. Budget use is 7/12 agents and 2/3 runs. The verifier compiled and executed a synthetic BASE/HEAD ABI probe before reserving either run; both were retrospectively charged. It used actual SPI sources with dependency stubs, but captured neither JDK identity nor raw logs and did not validate the execution environment. Its output supports only ABI incompatibility, not deployed configuration/startup behavior. No Maven test class was executed in this round. Details: agents/abi-probe-round-2-evidence.md.
23ebc7d to
e9fa1c1
Compare
|
@maximthomas Addressed the remaining review points in e9fa1c1.
Validation: the targeted JDK 11 Maven reactor run passed all 67 server tests across 12 classes with zero failures, errors, or skips. It retained the normal Failsafe includes, used exclusions to limit unrelated classes, and did not set The proxy guide and upgrade considerations passed Asciidoctor's attribute check, and the workflow step and |
maximthomas
left a comment
There was a problem hiding this comment.
praise: The revised implementation and CI address the previous review findings.
ExternalDiscoveryProviderTestexercises an unchanged legacy provider binary, migration diagnostics, continued startup and safe deletion; the upgrade guide declares the rebuild requirement.- Internal search results now populate
Entry.getObjectClasses(), and normal Failsafe selection includes both external-directory integration classes.
suggestion (non-blocking): The internal-search regression lacks a remote-only object class.
opendj-server-legacy/src/test/java/org/opends/server/backends/ProxyBackendTest.java:836-858, :744-745
The fixture contains only locally known classes. Changing the lookup at ProxyBackend.java:1088 to asStrictSchema() would preserve these assertions while rejecting a remote-only class. HEAD correctly resolves unknown classes through placeholders; this is a deferred test-strength follow-up, with no change requested in this PR. The mutation was assessed statically, not executed.
With a fixture returning an auxiliary remoteAux class absent from the local schema, assert successful search and its preservation:
assertThat(entry.getObjectClasses().values()).contains("remoteAux");Pin: The extended case must fail when the lookup uses asStrictSchema(). Merely removing asNonStrictSchema() is insufficient because SchemaHandler already supplies a non-strict schema. The assertion uses existing HEAD APIs; the extended fixture was not compiled or run during review.
|
@maximthomas Addressed the remote-only object-class coverage suggestion in b55b3c6. The new This test also exposed a delivery regression: populating the internal object-class map removed Validation under JDK 11 passed all 35 targeted tests: The PR description now includes the schema compatibility coverage and distinguishes this verification from the earlier broader run. Please review the updated head. |
|
@maximthomas Since the previous reviewed head, commit 33c50d5 corrects access-log search entry counts, and 441e91d adds proxy request/response access records and pool statistics. The proxy records retain the client operation identifiers and report the responding endpoint, identity mode, remote identity when known, per-attempt result and elapsed time. Pool state is included when available. If connection acquisition ultimately fails, the attempt timer stops before subordinate backends execute; deferred responses retain the result of their own attempt. The guide documents the fields, including the no-response and direct-bind cases. On OpenJDK 11.0.33, 29 SDK tests and 158 server tests passed without failures, errors, or skips. The deferred-failure regression failed before its fix and passed afterward. The saturated-pool test checks the acquisition wait and logged result; a separate slow-subordinate timing integration test was not run. Please review the updated head, particularly the proxy logging and per-operation routing context. |
|
@maximthomas The fork CI exposed failures in existing load-balancer tests after the proxy logging update: factories without a routing context were called through the new context-aware methods, which the existing mock factories did not implement. Commit c284640 retains the existing synchronous and asynchronous factory calls when the context is absent; proxy operations still use the context-aware path. The tests were not changed. On OpenJDK 11.0.33, the full |
|
praise: The proxy records preserve client operation identifiers, and matching-head CI exercises the logging and external-directory scenarios without skips. |
c284640 to
c923d42
Compare
Summary
Add an LDAP proxy backend that routes LDAP requests to equivalent remote directories using static or OpenDJ replication discovery. It supports primary/secondary failover, TLS certificate validation, DN and attribute mapping, and forwarding of LDAP operations and controls. Client-facing remote transport failures are normalized to LDAP
UNAVAILABLE (52), rather than exposing LDAP SDK client-side result codes.The proxy preserves client authorization using client-bound connections or LDAP Proxied Authorization V2, with an explicit, configurable policy for choosing the remote operation identity. Search results retain
objectClassin both the internal object-class map and the LDAP attribute maps, including class names absent from the local schema. Types-only searches preserve empty attribute types. The proxy can also expose a remote attribute under an additional read-only client name without removing the original attribute.Search result accounting records entries after successful delivery, including entries forwarded by the proxy and internal search results. Access logs therefore report the number of entries delivered to the client; a regression covers zero, one, and multiple proxy entries and a local backend search.
Proxy access logging
The file-based text access log records
PROXY_REQandPROXY_RESfor forwarded operations. The records retain the client operation'sconn,op, andmsgID, with a localproxyOpto distinguish forwarding attempts. They include the identity mode, shard and rewritten request details, and the endpoint that actually returned the LDAP response. Remote identities and authorization DNs are included when known. These identifiers are not sent to the remote server.PROXY_RESreports the attempt's result, remote search entry count, and elapsed time measured locally from connection acquisition through completion, including pool wait and network time. If no response is received, the record distinguishes the selected endpoint from a responding server. Pool statistics are included beforeresultwhen available, without additional configuration; the snapshot is best-effort under concurrent updates. Direct binds do not use a pool. The guide documents the fields and examples. JSON, CSV, and external access publishers do not emit these proxy records.Operation identity modes
Service discovery exposes
operation-identity-mode:auto(default) selectsclientwithout service credentials; with credentials it selectsproxy-authonly when every route server advertises Proxied Authorization V2, otherwisespecific. Unknown or failed capability probes returnUNAVAILABLErather than changing the remote identity.clientalways uses a connection authenticated by the client through this proxy.specificalways uses the service account without a proxied authorization control.proxy-authrequires a service account and Proxied Authorization V2 on every route server; it never falls back to another identity.The configuration schema registers
ds-cfg-operation-identity-modeunder the 3A Systems PEN. Static discovery rejectsspecificandproxy-authwhen service credentials are absent.The administration guide explains configuration, authorization and audit consequences, connection-pool limits, fail-closed availability behavior, and server-specific requirements. It includes OpenDJ, OpenLDAP, 389 Directory Server, and Microsoft Active Directory guidance. AD DS does not implement RFC 4370 Proxied Authorization, so AD routes use
specificorclient, notproxy-auth.Tier load balancing
Static and replication discovery mechanisms provide independent
primary-load-balancing-algorithmandsecondary-load-balancing-algorithmproperties. Both default toaffinity; the available values areaffinity,round-robin,least-requests,failover, anddistribution.The transition between groups is unchanged: every primary connection candidate is exhausted before the secondary policy is used. The selected policy applies both to service-account operations and to client-mode binds. SDK load balancers periodically recheck connection factories marked offline and return recovered members to selection. Client-mode binds use a separate path; an existing client session remains pinned to its selected server and must bind again after losing its connections.
distributionconsistently hashes normalized full target DNs across fully replicated servers. It is not LDAP data partitioning and searches are not broadcast.least-requestsis local to one proxy and, while recovering from a failed primary candidate, accounts for the selected strict-priority route rather than the finally connected physical server. It is therefore not an exact per-server measure during that case. The implementation deliberately does not add weighted routes, per-operation routing priorities, configurable health probes, or cross-proxy coordination.The optional, multi-valued
server-priorityproperty assigns a non-negative integer to a remote LDAP address; omitted addresses default to0, and lower numbers are preferred.failoverselects in priority order, whileleast-requestsuses priority to break equal active-request counts. Static discovery requires the address to belong to the configured primary or secondary group; replication discovery also accepts addresses not yet discovered. Priorities do not reorderaffinity,round-robin, ordistribution. The primary group still takes precedence over the secondary group. Changing priorities replaces routes and client-mode sessions must bind again.The administration guide describes each algorithm, its configuration requirements, and its operational risks. Server insertion order is not an administrator-controlled priority. Distribution uses discovery order for its hash-ring server IDs, which can remap DNs when that order changes.
Remote connections and pools
The proxy backend exposes connection, request, heartbeat, reconnect, and service-account pool settings. Remote request timeout defaults to 30 seconds; the service pool retains up to four idle core connections per remote server and has a maximum of 1,024. A saturated pool waits up to 10 seconds by default, then returns
BUSYwithout marking the server offline or failing over. Core connections are created lazily, not preallocated. Time settings have a maximum of one hour; zero disables the request timeout or selects the operating-system connection timeout where applicable.Heartbeat settings include the remote search base and filter. Heartbeats operate on existing connections; reconnect checks apply to SDK factories already marked offline. They are not independent proactive availability probes for every remote server, and a heartbeat filter returning no entries is not a PingDS-style availability check. Client-bound pools remain separate; their connections are not automatically reauthenticated or moved after a failure. Capability-probe and replication-discovery administrative timeouts remain separate.
Reconfiguring a backend creates new routes while allowing in-flight operations to finish on retired routes. Client-mode sessions tied to a replaced route must bind again. New settings use existing PingDS OIDs where applicable and 3A Systems OIDs for OpenDJ-specific properties. The administration guide documents defaults, limits, usage, and these distinctions.
Attribute aliases
Proxy backends expose multi-valued
attribute-alias, usingclient-alias=remote-attribute. Unlikeattribute-mapping, an alias retains the remote attribute and returns the same values under both names. Multiple aliases may refer to one remote attribute.Aliases are rewritten in search filters, compare requests, assertion controls, pre-read and post-read attribute lists, and requested-attribute lists. They are read-only: using an alias in an add, modify, DN, or RDN request returns
UNWILLING_TO_PERFORM. Overlaps with mappings or other aliases are rejected. Administrators must define custom aliases in the proxy schema with compatible syntax and matching rules. The proxy search path does not enforce local entry or attribute ACIs on returned values; access to the remote source attribute must be enforced through remote-directory ACLs and the configured operation identity. An alias is not a separate security boundary.Virtual or templated attributes, including values derived from another attribute such as
{$uid}@example.com, are intentionally not part of this change.Discovery provider compatibility
Providers implementing the former
ServiceDiscoveryMechanisminterface must be ported to extend the current abstract class and rebuilt against the target OpenDJ version. The upgrade guide documents the lifecycle and partition API changes; the upgrade tool does not adapt extension JARs. Incompatible provider binaries produce an actionable configuration diagnostic. Startup logs a rejected mechanism and continues initializing other mechanisms, and rejected configurations can be deleted safely.CI coverage
The normal Failsafe includes both
ProxyBackendOpenLdapITandProxyBackend389IT. Linux CI passes the running Docker daemon's API version to Testcontainers, avoiding the obsolete client API rejected in the previous run. These two integration classes fail setup when Docker is unavailable in CI, rather than silently skipping their assertions.Follow-up work
Per-operation routing priorities, proactive availability checks and monitoring, full directory federation, virtual attributes, and LDIF fallback are deferred to separate issues. Further work is also needed for interrupted-write and recovery tests, global writability enforcement, search cancellation and other result-accounting behavior, and RDN attribute mapping without a remote base DN.
Validation
Local verification after the connection factory compatibility fix: OpenJDK 11.0.33 passed all 8,274
opendj-coretests and 158 server tests (ProxyBackendTest,SearchOperationTestCase, andAbstractTextAccessLogPublisherTest), with no failures, errors, or skips. Without a routing context the load balancer uses the existing connection factory methods; with a context it uses the context-aware methods.git diff --checkpassed.Local targeted verification after proxy access logging: OpenJDK 11.0.33 passed 29 SDK tests (
ConnectionPoolTestCase,ConnectionsTestCase) and 158 server tests (ProxyBackendTest,SearchOperationTestCase,AbstractTextAccessLogPublisherTest) with no failures, errors, or skips. A regression for distinct deferred proxy failure results failed before the fix and passed afterward. The test for a saturated pool checks the logged result and acquisition wait; a separate slow-subordinate timing integration test was not run.git diff --checkpassed.The earlier update handles CodeQL alert #1697 by reporting the full server address when its port cannot be parsed. The regression checks that an overflowing static server port is rejected with an actionable diagnostic.
Local targeted verification after the search entry count fix:
ProxyBackendTestscenarios and all 75SearchOperationTestCasetests. The new access-log regression failed before the fix withnentries=0for one delivered entry and passed afterward.git diff --checkpassed.Local targeted verification after the priority and review updates:
After the port-diagnostic update, OpenJDK 11.0.33 passed 57 server tests across
ProxyBackendTest,ReplicationDiscoveryRoutingTest, andReplicationTopologyTest, with no failures, errors, or skips. The new diagnostic regression failed before the fix and passed afterward.git diff --checkpassed.OpenJDK 11.0.33: 26 SDK tests (
ConnectionPoolTestCaseandConnectionsTestCase), plus 56 server tests acrossProxyBackendTest,ReplicationDiscoveryRoutingTest, andReplicationTopologyTest, all passing with no skips.OpenJDK 21.0.12.1: 26 SDK tests and 49 server tests (
ProxyBackendTestandReplicationDiscoveryRoutingTest), all passing with no skips. The round-robin bind test now checks a four-request alternating cycle without assuming discovery's initial server order.OpenJDK 27: 26 SDK tests passed with no skips. Documentation tests passed 26/26 under JDK 11.
git diff --checkpassed.The pool tests hold publication after dequeue to verify cancelled-delivery reclamation, and separately force completion to win cancellation after an interrupt. Removing the corresponding cleanup in each case caused the respective regression to time out; the production code was restored.
The configuration test observes the SDK's connection timeout and reconnect interval. A real replication-discovery proxy test observes the configured heartbeat,
BUSYwith its sole service connection held, and reuse after release. A combined mutation suppressing both timeout settings and both replication-route settings triggered all four corresponding assertions; the production code was restored.Priority tests cover both discovery mechanisms, primary and secondary selection, client binds, tie-breaking versus active load, validation, live updates, and IPv6 zone identifiers. The OpenLDAP and 389 Directory Server container suites were not rerun during this latest targeted verification.
Closes #1283