[ 
https://issues.apache.org/jira/browse/CAMEL-27704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27704:
--------------------------------
    Fix Version/s: 4.25.0
                       (was: 4.24.0)

> camel-milo: unawaited read races, anonymous auth refused, ignored policies, 
> wrong metadata
> ------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27704
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27704
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-milo
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-milo for CAMEL-23832 
> (PR (commit 
> https://github.com/apache/camel/commit/b67b0ecf0fef25972dc5c95b5b12619a24bcee5f)).
> These are separate problems of the component; the descriptions commit only 
> documents the current behavior.
> h4. 1. milo-client: a read without await sets the body after the exchange has 
> gone on
> In {{MiloClientProducer.process()}}, a read with the {{CamelMiloNodeIds}} 
> header sets the body in {{thenApply}} of the read future. Without the 
> {{CamelMiloAwait}} header or {{defaultAwaitWrites=true}}, the producer calls 
> {{async.done(true)}} at once, so the body is set later from another thread 
> while the route already works on the exchange. A failed write, method call or 
> read is then only logged at DEBUG level by {{SubscriptionManager}}, and the 
> route never sees it.
> Proposed change: do not touch the exchange after {{async.done(true)}}, for 
> example fail or warn when a read is not awaited, and log a failed request 
> that nobody waits for.
> h4. 2. milo-server: enableAnonymousAuthentication=true does not let anonymous 
> clients in
> In {{MiloServerComponent.buildServerConfig()}}, when 
> {{enableAnonymousAuthentication}} is set or {{userAuthenticationCredentials}} 
> has users, the endpoints get the Anonymous token policy (if enabled), but the 
> identity validator is a {{UsernameIdentityValidator}}. Its base class 
> {{AbstractIdentityValidator.validateAnonymousToken()}} throws 
> {{Bad_IdentityTokenInvalid}}, so a client that connects anonymously is 
> refused although the endpoint offers the Anonymous policy. The tests of the 
> module connect with a user name and password, so they do not see it.
> Proposed change: use an identity validator that accepts anonymous tokens when 
> {{enableAnonymousAuthentication=true}}, and add a test that connects without 
> credentials.
> h4. 3. milo-server: security policies other than None and Basic256Sha256 are 
> ignored
> {{securityPolicies}} and {{securityPoliciesById}} accept every 
> {{SecurityPolicy}}, but {{MiloServerComponent.createEndpointConfigs()}} only 
> creates endpoints for {{None}} and {{Basic256Sha256}}. A policy such as 
> {{Aes256_Sha256_RsaPss}} gives no endpoint and no message; with only that 
> policy the server has just its {{/discovery}} endpoint.
> Proposed change: create endpoints for the other policies too, or fail at 
> startup for a policy that is not supported.
> h4. 4. milo-browse: includeSubTypes=false finds nothing
> {{SubscriptionManager}} browses with the reference type 
> {{NodeIds.References}}, which is abstract. With {{includeSubTypes=false}} 
> (and {{recursive=false}}), the server only returns references of the type 
> {{References}} itself, which do not exist, so the result is empty.
> Proposed change: let the user choose the reference type (for example 
> {{HierarchicalReferences}}), or deprecate {{includeSubTypes}}.
> h4. 5. milo-browse: wrong metadata defaults of node and filter
> The metadata default of {{node}} is {{ns=0;id=84}}, which {{NodeId.parse}} 
> refuses ({{invalid identifier type: id}}); the real default is 
> {{NodeIds.RootFolder.toParseableString()}}, which is {{i=84}}. The metadata 
> default of {{filter}} is {{None}}, but the field is null (no filter); 
> {{filter=None}} would keep only the nodes whose ID matches the regular 
> expression {{None}}.
> Proposed change: set the default of {{node}} to {{i=84}} and remove the 
> default of {{filter}}.
> h4. 6. Missing metadata defaults
> These options have a default in the code but none in the metadata: 
> {{keyStoreType}} (PKCS12) of milo-client and milo-browse, and 
> {{applicationName}} (Apache Camel Milo Server), {{applicationUri}} 
> (urn:org:apache:camel:milo:server), {{productUri}} 
> (urn:org:apache:camel:milo), {{bindAddresses}} (localhost) and 
> {{usernameSecurityPolicyUri}} (Basic256Sha256) of milo-server.
> Proposed change: add the {{defaultValue}} to the metadata.
> h4. 7. milo-client: missing consumer and producer labels
> {{samplingInterval}}, {{queueSize}}, {{omitNullValues}}, 
> {{monitorFilterType}}, {{dataChangeFilterDeadbandType}}, 
> {{dataChangeFilterDeadbandValue}} and {{dataChangeFilterTrigger}} are only 
> used by {{MiloClientConsumer}}, and {{method}} and {{defaultAwaitWrites}} 
> only by {{MiloClientProducer}}, but they have no consumer or producer label.
> Proposed change: add the labels.
> h4. 8. milo-server: usernameSecurityPolicyUri takes a name, not a URI
> The configurer calls {{setUsernameSecurityPolicyUri(SecurityPolicy)}}, so the 
> option takes a {{SecurityPolicy}} name such as {{Basic256Sha256}} and its 
> metadata type is the enum, while the getter returns the URI as a String.
> Proposed change: accept both a URI and a name, as {{securityPoliciesById}} 
> does, and make the getter and setter types match.
> h4. 9. milo-client: unused monitorFilterType field in MiloClientEndpoint
> {{MiloClientEndpoint}} has a {{monitorFilterType}} field with getter and 
> setter that nothing reads; the generated configurer sets 
> {{MonitorFilterConfiguration.setMonitorFilterType()}} instead.
> Proposed change: remove the field from the endpoint.
> h4. 10. milo-client doc page names Eclipse Milo 1.0.5
> {{milo-client-component.adoc}} says that the component uses Eclipse Milo 
> 1.0.5; {{parent/pom.xml}} has {{milo-version}} 1.1.8.
> Proposed change: update the note.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to