fix: Get-TssRpcPasswordType Fields array cast failure on SS 12.0#443
Open
jagger wants to merge 1 commit into
Open
fix: Get-TssRpcPasswordType Fields array cast failure on SS 12.0#443jagger wants to merge 1 commit into
jagger wants to merge 1 commit into
Conversation
When a password type has a non-empty fields array, the outer [Thycotic.PowerShell.Rpc.PasswordType] cast failed because PowerShell could not auto-coerce the array's PSCustomObject elements into PasswordTypeField. FilterTssResponse only filters the outer object's top-level properties and explicitly does not recurse into nested objects or arrays. Pre-coerce each fields element through FilterTssResponse before the outer cast — the same pattern applied to Get-TssConfiguration (thycotic-ps#432) but adapted for an array. After this pass, fields holds typed PasswordTypeField[] values and the outer cast assigns the array as-is without further coercion. Fixes thycotic-ps#440.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On SS 12.0 a password type whose
fieldsarray is non-empty trips:FilterTssResponseonly filters top-level properties of the outer object — it explicitly doesn't recurse into nested arrays or objects (per #427's design). Thefieldsarray survives unfiltered, and PowerShell's outer[PasswordType]cast can't coerce thePSCustomObject[]intoPasswordTypeField[].What changed
$restResponse.fieldsthroughFilterTssResponsebefore the outer cast. After this pass,fieldsalready holds typedPasswordTypeField[]values, so the outer cast assigns the array as-is.#432fix forGet-TssConfiguration, adapted for an array-of-objects rather than a single nested object.Search-TssRpcPasswordTypedoesn't need this change — it returnsPasswordTypeSummary[], which is flat (no nested complex types).Test plan
Invoke-Build -File .\build.ps1 -Task . -Configuration Debug— succeedsGet-TssRpcPasswordType -TssSession $session -Id <id_with_fields>returns a populatedPasswordTypewith a populatedFieldscollection ofPasswordTypeField— no cast errorCloses #440.