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

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

> camel-cyberark-vault: password auth, path encoding, secretId/label path, 
> headers undocumented
> ---------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27691
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27691
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-cyberark-vault for 
> CAMEL-23832 (commit 
> https://github.com/apache/camel/commit/e5349618d455247639969cdc989d50b519d6e329).
> These are separate problems of the component; the descriptions commit only 
> documents the current behavior.
> h4. 1. Username/password authentication sends the password to the API key 
> endpoint
> {{ConjurClientImpl.authenticate()}} posts the password as the body of {{POST 
> /authn/\{account\}/\{login\}/authenticate}}, when no API key is set. That 
> request only accepts an API key. With a password, the client first has to 
> call {{GET /authn/\{account\}/login}} with HTTP Basic auth, which returns the 
> API key. Against a real Conjur server, an endpoint or the {{cyberark:}} 
> properties function configured with {{username}} and {{password}} is likely 
> to fail with HTTP 401. The unit tests use a fake server that accepts any body.
> Proposed change: for a password, call the login request first, then 
> authenticate with the returned API key. Keep the API key for 
> re-authentication.
> h4. 2. The secret ID and the login are form-encoded in the URL path
> {{ConjurClientImpl.retrieveSecret()}}, {{createSecret()}} and 
> {{authenticate()}} encode the path segment with {{URLEncoder.encode()}}. That 
> is form encoding, so a space becomes {{+}} instead of {{%20}}, and Conjur 
> reads the {{+}} as a plus sign. A request for a variable ID or a login with a 
> space then fails.
> Proposed change: percent-encode the path segment (encode with {{URLEncoder}} 
> and replace {{+}} with {{%20}}, or use a path-segment encoder).
> h4. 3. The component-level secretId option has no effect
> {{CyberArkVaultComponent.createEndpoint()}} copies the component 
> configuration and then calls {{setSecretId(remaining)}}. The path is 
> required, so the path value always replaces a {{secretId}} that is set on the 
> component.
> Proposed change: use the path value only when no secretId is configured, or 
> remove secretId from the component options.
> h4. 4. The label path is never set
> {{CyberArkVaultComponent.createEndpoint()}} stores the path value as 
> {{secretId}}, so {{CyberArkVaultConfiguration.getLabel()}} always returns 
> null. The doc page says the path is "a logical name for the endpoint", but 
> the producer uses it as the secret ID when {{secretId}} is not set.
> Proposed change: decide whether the path is the secret ID (then rename it to 
> {{secretId}} in the syntax) or a label, and fix the doc page to match.
> h4. 5. getServiceProtocol() always returns https
> {{CyberArkVaultEndpoint.getServiceProtocol()}} returns {{https}} also when 
> {{url}} is an {{http://}} URL.
> Proposed change: take the scheme from {{url}}.
> h4. 6. The headers are not documented
> {{CyberArkVaultConstants}} is the {{headersClass}} of the endpoint, but its 
> constants have no {{@Metadata}}, so the catalog and the doc page list no 
> headers. {{CyberArkVaultProducer.process()}} reads 
> {{CamelCyberArkVaultOperation}}, {{CamelCyberArkVaultSecretId}}, 
> {{CamelCyberArkVaultSecretVersion}} and {{CamelCyberArkVaultSecretValue}}, 
> and sets {{CamelCyberArkVaultSecretId}} and 
> {{CamelCyberArkVaultSecretVersion}}.
> Proposed change: add {{@Metadata}} with a description and javaType to each 
> constant.
> h4. 7. conjurClient has no label
> The {{conjurClient}} option of {{CyberArkVaultConfiguration}} has no label, 
> so it shows among the common options, and it is not marked {{autowired}}. 
> Client options of other components use the {{advanced}} label.
> Proposed change: set {{label = "advanced"}}, and consider 
> {{@Metadata(autowired = true)}}.
> _Claude Code on behalf of davsclaus_



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

Reply via email to