devblackops / PasswordState

PowerShell module for interacting with ClickStudio's PasswordState password management application
Apache License 2.0
40 stars 14 forks source link

Some special characters in Passwords will result in an error #4

Open Claustn opened 8 years ago

Claustn commented 8 years ago

Expected Behavior

If you use special chars like ¤$ in your password, Invoke-Webrequest will give you an error, this is because powershell uses UniCode wheres as the web request expects UTF8

Current Behavior

Possible Solution

$result = Invoke-RestMethod -Uri $uri -Method Post -ContentType "application/$Format" -Headers $headers -Body ([System.Text.Encoding]::UTF8.GetBytes($json))

Force the json to be loaded as UTF8.

Steps to Reproduce (for bugs)

  1. New-PasswordStatePassword -ApiKey $ADUserListCred -PasswordListId 49 -Username ctn -Password ('1dsdsdsdfsdsd¤234' | ConvertTo-SecureString -AsPlainText -Force) -ExpiryDate '15-10-2020 14:37:30' -Title test1234 -Verbose 2. 3. 4.

    Context

I am adding some extra stuff, so will do a PR when I get that worked out.

Your Environment

devblackops commented 8 years ago

Awesome. Thanks for finding this!