Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpg: Log gpg output to LogWriter #2869

Merged
merged 3 commits into from
Jul 7, 2024
Merged

Conversation

doronbehar
Copy link
Contributor

@doronbehar doronbehar commented Apr 16, 2024

Continuation of #2576 .

@doronbehar
Copy link
Contributor Author

Aish I ran make test and it should be better to run make clean && make fulltest... I'm getting a different error though:

>> BUILD, version = 1.15.13/b1cbd097, output = gopass [OK]
mkdir -p ~/.gnupg
>> TEST, "full-mode": race detector off
     ok         github.com/gopasspw/gopass      0.072s  coverage: 47.1% of statements
        github.com/gopasspw/gopass/helpers/changelog            coverage: 0.0% of statements
        github.com/gopasspw/gopass/helpers/man          coverage: 0.0% of statements
        github.com/gopasspw/gopass/helpers/msipkg               coverage: 0.0% of statements
        github.com/gopasspw/gopass/helpers/postrel              coverage: 0.0% of statements
        github.com/gopasspw/gopass/helpers/release              coverage: 0.0% of statements
     ok         github.com/gopasspw/gopass/internal/action      5.093s  coverage: 60.2% of statements
     ok         github.com/gopasspw/gopass/internal/action/exit 0.004s  coverage: 100.0% of statements
     ok         github.com/gopasspw/gopass/internal/action/pwgen        0.007s  coverage: 51.6% of statements
     ok         github.com/gopasspw/gopass/internal/audit       0.043s  coverage: 24.1% of statements
     ok         github.com/gopasspw/gopass/internal/backend     0.079s  coverage: 55.4% of statements
     ?          github.com/gopasspw/gopass/internal/backend/crypto      [no test files]
     ok         github.com/gopasspw/gopass/internal/backend/crypto/age  0.047s  coverage: 2.6% of statements
     ok         github.com/gopasspw/gopass/internal/backend/crypto/gpg  0.003s  coverage: 93.6% of statements
     ok         github.com/gopasspw/gopass/internal/backend/crypto/gpg/cli      0.113s  coverage: 60.8% of statements
     ok         github.com/gopasspw/gopass/internal/backend/crypto/gpg/colons   0.004s  coverage: 39.1% of statements
     ok         github.com/gopasspw/gopass/internal/backend/crypto/gpg/gpgconf  0.003s  coverage: 27.3% of statements
     ok         github.com/gopasspw/gopass/internal/backend/crypto/plain        0.004s  coverage: 85.3% of statements
     ?          github.com/gopasspw/gopass/internal/backend/storage     [no test files]
        github.com/gopasspw/gopass/internal/backend/storage/fossilfs            coverage: 0.0% of statements
     ok         github.com/gopasspw/gopass/internal/backend/storage/fs  0.325s  coverage: 63.6% of statements
     ok         github.com/gopasspw/gopass/internal/backend/storage/gitfs       0.088s  coverage: 48.1% of statements
     ok         github.com/gopasspw/gopass/internal/cache       1.108s  coverage: 78.7% of statements
        github.com/gopasspw/gopass/internal/cache/ghssh         coverage: 0.0% of statements
     ok         github.com/gopasspw/gopass/internal/completion/fish     0.004s  coverage: 100.0% of statements
     ok         github.com/gopasspw/gopass/internal/completion/zsh      0.003s  coverage: 100.0% of statements
     ok         github.com/gopasspw/gopass/internal/config      0.064s  coverage: 68.4% of statements
     ok         github.com/gopasspw/gopass/internal/config/legacy       0.044s  coverage: 64.8% of statements
     ok         github.com/gopasspw/gopass/internal/create      0.040s  coverage: 17.5% of statements
     ok         github.com/gopasspw/gopass/internal/cui 0.007s  coverage: 57.0% of statements
     ok         github.com/gopasspw/gopass/internal/diff        0.002s  coverage: 100.0% of statements
     ok         github.com/gopasspw/gopass/internal/editor      0.007s  coverage: 53.6% of statements
        github.com/gopasspw/gopass/internal/env         coverage: 0.0% of statements
        github.com/gopasspw/gopass/internal/hashsum             coverage: 0.0% of statements
        github.com/gopasspw/gopass/internal/hook                coverage: 0.0% of statements
     ok         github.com/gopasspw/gopass/internal/notify      0.003s  coverage: 56.1% of statements
     ok         github.com/gopasspw/gopass/internal/out 0.003s  coverage: 38.3% of statements
     ok         github.com/gopasspw/gopass/internal/pwschemes/argon2i   0.795s  coverage: 72.7% of statements
     ok         github.com/gopasspw/gopass/internal/pwschemes/argon2id  1.816s  coverage: 72.7% of statements
     ok         github.com/gopasspw/gopass/internal/pwschemes/bcrypt    0.698s  coverage: 75.0% of statements
        github.com/gopasspw/gopass/internal/queue               coverage: 0.0% of statements
     ok         github.com/gopasspw/gopass/internal/recipients  0.004s  coverage: 81.8% of statements
        github.com/gopasspw/gopass/internal/reminder            coverage: 0.0% of statements
     ok         github.com/gopasspw/gopass/internal/set 0.005s  coverage: 92.7% of statements
     ok         github.com/gopasspw/gopass/internal/store       0.003s  coverage: 100.0% of statements
] 2 / 2
❌ Failed to decode public key A3683834: public key "A3683834" not found
git initialized at /tmp/TestGit4192319314/001/sub
git configured at /tmp/TestGit4192319314/001/sub
--- FAIL: TestSet (0.00s)
    write_test.go:25:
                Error Trace:    /home/doron/repos/gopass/internal/store/leaf/write_test.go:25
                Error:          An error is expected but got nil.
                Test:           TestSet
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
[] ❌ Invalid recipients found: Invalid Recipients: john.doe: no valid keys (expired?),
[] ❌ Failed to decode public key john.doe: public key "john.doe" not found
[] ❌ Failed to decode public key john.doe: public key "john.doe" not found
[] ⚠ failed to check "foo/bar":
    [fatal] [non-fatal] Missing recipients on foo/bar: [john.doe]
Run fsck with the --decrypt flag to re-encrypt it automatically, or edit this secret yourself., Extra recipients on foo/bar: [0xDEADBEEF 0xFEEDBEEF]
Run fsck with the --decrypt flag to re-encrypt it automatically, or edit this secret yourself., Run fsck with the --decrypt flag to re-encrypt it automatically, or edit the secret foo/bar yourself.
failed to check "foo/baz":
    [fatal] [non-fatal] Missing recipients on foo/baz: [john.doe]
Run fsck with the --decrypt flag to re-encrypt it automatically, or edit this secret yourself., Extra recipients on foo/baz: [0xDEADBEEF 0xFEEDBEEF]
Run fsck with the --decrypt flag to re-encrypt it automatically, or edit this secret yourself., Run fsck with the --decrypt flag to re-encrypt it automatically, or edit the secret foo/baz yourself.
failed to check "foo/zab":
    [fatal] [non-fatal] Missing recipients on foo/zab: [john.doe]
Run fsck with the --decrypt flag to re-encrypt it automatically, or edit this secret yourself., Extra recipients on foo/zab: [0xDEADBEEF 0xFEEDBEEF]
Run fsck with the --decrypt flag to re-encrypt it automatically, or edit this secret yourself., Run fsck with the --decrypt flag to re-encrypt it automatically, or edit the secret foo/zab yourself.

⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
⚠ No owner key found. Make sure your key is fully trusted.
FAIL
coverage: 53.6% of statements
FAIL    github.com/gopasspw/gopass/internal/store/leaf  8.770s
FAIL
make: *** [Makefile:96: fulltest] Error 1

I'll look into this later today hopefully.

@doronbehar
Copy link
Contributor Author

Fixed the tests. Hopefully now on CI as well.

@doronbehar doronbehar force-pushed the more-logs branch 3 times, most recently from 537bbf9 to 7ab5e0a Compare April 16, 2024 15:08
@doronbehar
Copy link
Contributor Author

Finally green ✔️ :)

internal/backend/crypto/gpg/cli/encrypt.go Show resolved Hide resolved
internal/backend/crypto/gpg/cli/encrypt.go Outdated Show resolved Hide resolved
internal/backend/crypto/gpg/cli/encrypt.go Outdated Show resolved Hide resolved
internal/backend/crypto/gpg/cli/encrypt.go Outdated Show resolved Hide resolved
internal/backend/crypto/gpg/cli/encrypt.go Show resolved Hide resolved
@doronbehar
Copy link
Contributor Author

Don't understand the CI errors unfortuenatly :/ On other PRs it is red also...

@tcodes0
Copy link

tcodes0 commented Jun 27, 2024

@doronbehar hi there, you can find more information on the CI errors by looking for the name between parenthesis on this link; on this PR it's mostly the MND linter complaining about naked numbers in function calls. It's possible to ignore certain functions, like os.OpenFile, the docs should cover the ignore mechanism. Just passing by and saw your question :)

Signed-off-by: Doron Behar <doron.behar@gmail.com>
@doronbehar
Copy link
Contributor Author

Thanks for taking the time to try to help @tcodes0 ! It's nice to understand now the errors, and I'm more convinced that these are not related to my PR, and that fixing them is out of scope for this PR. I pushed a rebase of my commits, but according to the current latest commit that shows the same errors in CI, I don't hope the errors will be fixed.

@doronbehar
Copy link
Contributor Author

I'm still waiting for replies by @AnomalRoil for my old comments 🙏.

Copy link
Member

@dominikschulz dominikschulz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there. Please address my comments and we can finally merge this. Sorry for the delays.

@doronbehar
Copy link
Contributor Author

Almost there. Please address my comments and we can finally merge this. Sorry for the delays.

Thanks for coming back to this.

Return a different error message if no trustable keys were found.

Signed-off-by: Doron Behar <doron.behar@gmail.com>
Signed-off-by: Doron Behar <doron.behar@gmail.com>
AnomalRoil
AnomalRoil previously approved these changes Jul 7, 2024
require.NoError(t, err)

// No recipients are configured so it will fail
require.Error(t, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to add a test with a recipient now to have a "positive" test, but that can be opened as an issue and done in another PR I think,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to add a test with a recipient now to have a "positive" test, but that can be opened as an issue and done in another PR I think,

I wanted to do that, but I didn't find a method to add a recipient to that context / gpg in that test...

@AnomalRoil
Copy link
Member

The error in the Linux build seems like an error caused by the addition to the makefile, no?

--- FAIL: TestGPG (0.01s)
    gpg_test.go:30: 
        	Error Trace:	/home/runner/work/gopass/gopass/internal/backend/crypto/gpg/cli/gpg_test.go:30
        	Error:      	Received unexpected error:
        	            	exit status 2: tru::1:1720345348:0:3:1:5
        	            	|gpg: WARNING: unsafe permissions on homedir '/home/runner/.gnupg'
        	            	gpg: /home/runner/.gnupg/trustdb.gpg: trustdb created
        	            	gpg: [don't know]: invalid packet (ctb=00)
        	            	gpg: keydb_search_first failed: Invalid packet
        	Test:       	TestGPG
FAIL

not sure if it needs the right set of permissions for it to work or not.

@doronbehar
Copy link
Contributor Author

The error in the Linux build seems like an error caused by the addition to the makefile, no?

Could be.. make fulltest worked for me locally. I removed that last commit now. Let's see how CI goes now.

@doronbehar
Copy link
Contributor Author

OK now only the old GOLANGCI-LINT errors are present.

@dominikschulz dominikschulz merged commit 70dbabe into gopasspw:master Jul 7, 2024
7 of 8 checks passed
@doronbehar
Copy link
Contributor Author

doronbehar commented Jul 7, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants