[midPoint] SSH connector null value handling

Henrik.Schulz at tk.de Henrik.Schulz at tk.de
Mon May 9 11:08:33 CEST 2022


Hello together,

I encountered NullPointerExceptions in the SSH connector if a script argument is null. This happens, because the connector doesn't check for these values and tries to convert them to strings.
Due to this error it is not possible to pass attributes to a script, if the expression or the source for an attribute evaluates to null, "", [], [""] or [null] (all these values will be treated by midPoint as null).
This is needed for optional attributes, e.g. to pass a midPoint user attribute into a script and handle its presence inside the script block, or to enable the scripts to accept empty strings.
A recent use case was, that a user defined string (which could also be an empty string) should be used as parameter for a PowerShell command. This use case could not be implemented due to this error.

To solve this issue, I created a pull request for the SSH connector, that introduces a new configuration property to define the handling of arguments that contain a null value.
You can either choose to handle null values as empty strings (e.g. $a = ""), or to remove the argument completely from the script (which is the shell/bash/cmd/PowerShell equivalent to a null value).
By default they will be handled as empty strings.

Could someone please have a look at the pull request, give feedback and/or merge it?
https://github.com/Evolveum/connector-ssh/pull/2

Best regards,
Henrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220509/9fabde08/attachment.htm>


More information about the midPoint mailing list