diff --git a/CHANGELOG.md b/CHANGELOG.md index f2ce169dc..b96a19e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed +* `New-URIString` private function now validates `$id` input [Issue 627](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/627) * Changed how `Set-RubrikNASShare` creates the body object [Issue 614](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/614) and added new unit tests for this function * Modified `Set-RubrikAvailabilityGroup` and made `-LogRetentionHours` parameters mandatory while removing default value of -1 * Modified private function `Set-ObjectTypeName.ps1` to support the new `ApplyCustomViewDefinitions`. diff --git a/Rubrik/Private/New-URIString.ps1 b/Rubrik/Private/New-URIString.ps1 index b6b763663..a67832130 100644 --- a/Rubrik/Private/New-URIString.ps1 +++ b/Rubrik/Private/New-URIString.ps1 @@ -17,6 +17,13 @@ An id value to be planted into the path or optionally at the end of the URI to retrieve a single object #> + # Validation of id param + if ($id -match '^@\{') { + Write-Error -Message "Please validate ID input, please only input the ID parameter the object: '$id'" -ErrorAction Stop + } elseif ($id.Length -gt 100) { + Write-Error -Message "Please validate ID input, invalid ID provided: '$id'" -ErrorAction Stop + } + Write-Verbose -Message 'Build the URI' # If we find {id} in the path, replace it with the $id value if ($endpoint.Contains('{id}')) {