CLI Bug - Item edit fails from within GitHub Action

twoellert
twoellert
Community Member

Hey,

I noticed a bug in the 1password CLI if you use it from within a GitHub Action. The issue occurs when editing an existing item in a 1password vault.

Command to call from within a GitHub Action:
op item edit existingItemName --vault vaultUuid existingValue=newValue

If you do this you will get an error message about an invalid JSON and the value in the item is not updated.

The same command runs fine on Windows and Linux in a regular shell.

Versions affected:
The issue started in 1password CLI version 2.23.0. 2.22.0 works fine. The issue is still present in the current version 2.30.0 and also the latest-beta I tried.

Possibly its due to the GitHub action bash terminal not really being interactive? Not sure.

I tried with several different ways of passing the name of the existingValue and newValue into the command but none worked. All ended up with the same error. In 2.23.0 some stuff shows up in the changelog of the CLI regarding "item edit", I think this caused the problem.

If anyone knows a different workaround than to stick with v2.22.0 for now let me know.

Regards,
Tom


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

Comments

  • Anush008
    Anush008
    Community Member

    Hi @twoellert. I ran into this too while editing and item in GitHub Actions.
    Thanks for suggesting to use v2.22.0. This version works fine.

  • twoellert
    twoellert
    Community Member

    Hey @Anush008

    I am in contact with 1password support and they mentioned a workaround which works.

    You can do it by modifying the downloaded JSON format and uploading it again as JSON. For example this modifies the "value" in the 2nd entry of the "fields" structure in the JSON file and pipes it to the edit command:

    op item get test --vault "MyVault" --format json > newItem.json
    jq '.fields[1].value = "newpassword"' newItem.json >> newItem-modified.json
    cat newItem-modified.json | op item edit test --vault "MyVault"

    Sadly it does not work for all field types. For example if you have a "File" field (so you attached a file to the 1password item) you cannot upload a new file to this field that way. But for all regular fields containing only text it should work.

    Hope that helps in your case.

    Tom

  • Anush008
    Anush008
    Community Member

    Wow. Thanks.
    I'll use this.
    Hope they'll patch this issue in a future version.