op item edit removes " Character from Password

hayduk
hayduk
Community Member

Hi,

i try to update an item password with 1Password Cli which has a " Character in it. This character is removed from password when the password is written to the vault. I've tried already some variations of passing the password to the CLI but unfortunately it does always remove all " characters from the password.

Any ideas or hints how to get i written correctly?

Regards
Stefan


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided

Comments

  • hayduk
    hayduk
    Community Member
    edited March 2023

    Hi,
    I've found a solution for the mentioned problem. What is strange is, that the behavior is different if you call op item edit in PowerShell 5, Powershell 7 or for example zsh on MacOS.

    In Powershell 5 it is required to Mask the " character with a \. I've came op with the following code that will handle that situation. Maybe it is useful for someone!

    $Password = 'T"e""s"t'

    If ($PSVersionTable.PSVersion.Major -le '5') {
    $Password = $Password.Replace('"','\"')
    }

    $Command = 'op item edit "{0}" ''password={1}''' -f $("TestItem", $Password)

    Invoke-Expression -Command $Command

    Kind regards
    Stefan

  • Hi @hayduk thanks so much for sharing this workaround for Powershell 5.1! 😄

This discussion has been closed.