git-secret icon indicating copy to clipboard operation
git-secret copied to clipboard

All files are revealed but decrypted files are not displayed when I excute with github action

Open tamtmh opened this issue 2 years ago • 10 comments

What are the steps to reproduce this issue?

  1. test.yml
name: import-gpg

on:
  push:
    branches: main

jobs:
  import-gpg:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: import gpg private key
        run: |
          echo "${{ secrets.GPG_PRIVATE_KEY }}" > ./private_key.gpg
          gpg --batch --yes --pinentry-mode loopback --import private_key.gpg
      -
        name: reveal secret
        run: |
          sudo apt install git-secret
          git secret --version
          git secret reveal -p ${{ secrets.GPG_PASSPHRASE }}
          ls

What happens?

  • this action was run successfully and give notice "All 2 files are revealed" but decrypted files are not displayed Screen Shot 2022-05-25 at 11 35 19

What were you expecting to happen?

Decrypted files are not displayed

test.txt
testsss.txt

I don't know what step I did wrong. Has anyone had the same problem as me? please give me the solution. Thanks a lot

tamtmh avatar May 25 '22 04:05 tamtmh

I think it's showing the names of the encrypted files it decrypted. Can you add code to check if the decrypted files are present?

Edit: oh I see, the ls should do that. Can you try with the latest master branch from git-secret please? There have been a lot of changes since 0.2.2, some related to error messages.

Edit: Please see my comment below too.

joshrabinowitz avatar May 25 '22 13:05 joshrabinowitz

I have the same issue @tamtmh. Did you find the solution?

Thanks.

DragosRomaniuc avatar May 27 '22 13:05 DragosRomaniuc

There is a bug in older versions of git-secret that causes git-secret not to issue any error in some cases if it's unable to decrypt the secrets. Please try again with the latest master branch of git-secret and let us know if this resolves your issues, @DragosRomaniuc and @tamtmh

joshrabinowitz avatar May 27 '22 13:05 joshrabinowitz

Also, using the verbose -v option in the latest versions of git-secret should show details about what is happening with gnupg to cause those files not to be decrypted.

joshrabinowitz avatar May 27 '22 13:05 joshrabinowitz

@joshrabinowitz Thanks. I tried it with latest version but now i get this error:

git-secret: abort: cannot find decrypted version of file:

How can i solve this ? Thanks a lot.

DragosRomaniuc avatar May 27 '22 13:05 DragosRomaniuc

This is difficult to debug remotely with so little data.

Can you confirm what 'latest version' you're using? Also can you replicate from the command line on your local machine with the master branch, show the output of git-secret --version, and the complete output of git-secret reveal -v {filename.secret}. It may also be useful to show the output of git secret hide -v from your machine and confirm that the secret key needed for decryption is available to the github action.

Basically we need a lot more data specific to your problem to help debug this.

Edit: Also you show git-secret: abort: cannot find decrypted version of file:, which should show a filename, and therefore looks like it is unable to figure out the name of the encrypted file. Something is wrong in the setup.

joshrabinowitz avatar May 27 '22 15:05 joshrabinowitz

it would be helpful to see the output from using bash -x to run git-secret as described in #594

I also suspect some hints about what's going wrong would show up if git-secret's -v option was used to show output from gnupg commands

Also please check that your .gitignore and .gitsecret/paths/mapping.cfg files look sane.

joshrabinowitz avatar Jun 10 '22 16:06 joshrabinowitz

Im having the same issue: cannot find decrypted version of file: {FILENAME}

richarddd avatar Sep 20 '22 19:09 richarddd

Hey Richard. I think i solved this by making sure I have the same GPG version on both encrypting and decrypting sides. In my case Local vs Github Actions.

DragosRomaniuc avatar Sep 20 '22 20:09 DragosRomaniuc

Hey Richard. I think i solved this by making sure I have the same GPG version on both encrypting and decrypting sides. In my case Local vs Github Actions.

That solved it!

richarddd avatar Sep 21 '22 20:09 richarddd