178 Commits

Author SHA1 Message Date
Dominik Schulz
71861e4a8b
chore: Update golangci-lint (#3287)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-11-12 21:09:26 +01:00
Dominik Schulz
792f8b07e2
[chore] Initial fixes and added a warning for CryptFS and JJFS (#3270)
These backends are not ready, yet.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-11-12 21:04:55 +01:00
Dominik Schulz
f84e676ec1
Improve logging and pretty printing (#3286)
* [chore] Add PID to the debug logs

This helps differentiate between gopass foreground and background (e.g.
agent) processes.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Adjust logging severities and improve pretty printing

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-11-12 20:37:52 +01:00
AnomalRoil
ed54973318
Fixing GPG ID related issues (#3275)
* Adding regression test

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* fixing recipient logic to honor subkeys

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* Revert "Adding regression test"

This reverts commit fcb85c9d2ee4ce3b1d53f934338c6a33e18d7d9d.

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* adding comment about noop

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* Linting

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* Addressing review comments

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* avoid noise debug logs

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
2025-10-08 15:14:19 +02:00
Dominik Schulz
0a10134d40
[chore] Logging improvements (#3273)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-10-06 11:59:20 +02:00
google-labs-jules[bot]
882d06e001
feat: Add cryptfs storage backend for filename encryption (#3249)
* feat: Add cryptfs storage backend for filename encryption

This commit introduces a new storage backend called `cryptfs`. This backend encrypts the filenames of secrets to enhance privacy while maintaining compatibility with existing VCS backends like Git.

Key features:
- For each secret, a cryptographically secure hash (SHA-256) of its name is generated and used as the filename for the underlying storage.
- A mapping from the original secret name to the hashed filename is maintained in an encrypted file (`.gopass-mapping.age`) within the repository.
- The mapping file is encrypted using the `age` encryption backend, with recipients read from the store's `.age-recipients` file.
- The `cryptfs` backend is implemented as a wrapper around any existing storage backend (e.g., `gitfs`, `fs`), which can be configured by the user.
- The backend is registered with gopass and can be enabled by setting `storage: cryptfs` in the store's configuration.

This implementation addresses issue #2634.

* [fix] Fix lint errors

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix the remaining tests and add some docs.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-09-24 08:47:09 +02:00
google-labs-jules[bot]
57db06bd94
Add regression test for issue #2571 (#3250)
* feat: Add regression test for issue #2571

This commit adds a regression test for issue #2571. The issue describes a scenario where `gopass sync` incorrectly removes public keys for sub-stores under certain conditions.

The new integration test in `tests/sync_test.go` reproduces the steps outlined in the GitHub issue to ensure that the public key is not deleted after running `gopass sync`.

* [fix] Fix lint errors

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-09-22 17:55:19 +02:00
google-labs-jules[bot]
8c60b17c24
feat(age): Add unlock command to age agent (#3244)
* feat(age): Add unlock command to age agent

This change introduces a proper lock/unlock mechanism for the age agent.

The issue was that after locking the agent with `gopass age lock`, there was no way to unlock it without restarting the agent. This made the lock command mostly useless.

This change introduces a new `unlock` command for the agent and a `locked` state.

- The `lock` command now sets a `locked` flag to `true` in addition to clearing identities.
- The `decrypt` function in the agent now checks this `locked` flag and returns an error if the agent is locked.
- When the gopass client receives the "agent is locked" error, it will ask the user for their passphrase, reload the identities, and send them to the agent.
- A new `gopass age agent unlock` CLI command is added to trigger this new functionality.
- The `gopass age agent status` command is enhanced to report whether the agent is locked.
- The old top-level `gopass age lock` command is hidden, and a new `gopass age agent lock` command is introduced for consistency.

Fixes #3242

* feat(age): Add unlock command to age agent

This change introduces a proper lock/unlock mechanism for the age agent.

The issue was that after locking the agent with `gopass age lock`, there was no way to unlock it without restarting the agent. This made the lock command mostly useless.

This change introduces a new `unlock` command for the agent and a `locked` state.

- The `lock` command now sets a `locked` flag to `true` in addition to clearing identities.
- The `decrypt` function in the agent now checks this `locked` flag and returns an error if the agent is locked.
- When the gopass client receives the "agent is locked" error, it will ask the user for their passphrase, reload the identities, and send them to the agent.
- A new `gopass age agent unlock` CLI command is added to trigger this new functionality.
- The `gopass age agent status` command is enhanced to report whether the agent is locked.
- The old top-level `gopass age lock` command is hidden, and a new `gopass age agent lock` command is introduced for consistency.

I have also addressed the PR comment about the import alias. I have removed the alias and used a dot import instead to avoid the name collision.

Fixes #3242

* feat(age): Add unlock command to age agent

This change introduces a proper lock/unlock mechanism for the age agent.

The issue was that after locking the agent with `gopass age lock`, there was no way to unlock it without restarting the agent. This made the lock command mostly useless.

This change introduces a new `unlock` command for the agent and a `locked` state.

- The `lock` command now sets a `locked` flag to `true` in addition to clearing identities.
- The `decrypt` function in the agent now checks this `locked` flag and returns an error if the agent is locked.
- When the gopass client receives the "agent is locked" error, it will ask the user for their passphrase, reload the identities, and send them to the agent.
- A new `gopass age agent unlock` CLI command is added to trigger this new functionality.
- The `gopass age agent status` command is enhanced to report whether the agent is locked.
- The old top-level `gopass age lock` command is hidden, and a new `gopass age agent lock` command is introduced for consistency.

To avoid name collisions with the imported `filippo.io/age` package, the local `age` package has been renamed to `agecrypto`.

Fixes #3242

* feat(age): Add auto-lock feature to age agent

This change introduces an auto-lock feature for the age agent. The agent will now automatically lock itself after a configurable period of inactivity.

This change also includes the initial fix for issue #3242, which introduced a proper lock/unlock mechanism for the age agent.

- A new config option `age.agent-timeout` is added to specify the inactivity timeout in seconds.
- The agent now has a timer that is reset on every successful decryption operation.
- If the timer expires, the agent locks itself.
- A new `set-timeout` command is added to the agent protocol to configure the timeout.
- The gopass client sends the timeout to the agent when it starts or when it unlocks the agent.
- A new test `TestAgentAutoLock` is added to verify the new functionality.

To avoid name collisions with the imported `filippo.io/age` package, the local `age` package has been renamed to `agecrypto`.

Fixes #3242

* [fix] Fix lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-09-20 17:09:12 +02:00
Dominik Schulz
a4dd48529e
[fix] Update gitconfig to v0.0.3 to pull in Windows fixes (#3236)
This disables path unescaping on Windows.

Fixes #3225

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-09-19 16:39:52 +02:00
google-labs-jules[bot]
01bc3cde22
fix(gpg): Opportunistic key comparison on import (#3230)
* fix(gpg): Opportunistic key comparison on import

When importing keys gopass was already checking if the key was already present.
However, GPG is very flexible in which kind of key IDs it accepts. So it could happen that gopass would ask to import a key that is already present in the keyring, but referenced by a different ID.

This change makes the check more robust by checking the key's fingerprint before asking for import. If a key with the same fingerprint is already present, the import is skipped.

* fix(gpg): Opportunistic key comparison on import

When importing keys gopass was already checking if the key was already present.
However, GPG is very flexible in which kind of key IDs it accepts. So it could happen that gopass would ask to import a key that is already present in the keyring, but referenced by a different ID.

This change makes the check more robust by checking the key's fingerprint before asking for import. If a key with the same fingerprint is already present, the import is skipped.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-09-19 10:54:20 +02:00
google-labs-jules[bot]
ed9d0799d2
feat: Allow to customize commit messages (#3231)
* feat: Allow to customize commit messages

This change introduces the ability for users to customize the commit
message when performing actions that modify the secret store.

It adds two new flags to the `edit`, `insert`, `generate`, `copy`,
`move`, and `delete` commands:
- `--commit-message` (`-m`): to specify the commit message directly.
- `--interactive-commit` (`-i`): to open an editor for the commit
  message.

The default behavior of using a pre-defined commit message is
preserved.

* fix: Use correct commit message from context

This change fixes a bug where the commit message from the context was
not being used correctly in the `delete` function.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-09-19 09:30:19 +02:00
google-labs-jules[bot]
baad47c7ef
feat(age): add agent for passphrase caching (#3218)
* This change introduces an agent for the age backend to cache passphrases for age identities.

The agent is a long-running process that listens on a Unix domain socket. Gopass communicates with the agent to request decryption of secrets. The agent caches the passphrases for the identities and performs the decryption, so the passphrases never leave the agent process. This addresses the security concerns with the initial implementation.

The agent can be controlled with the following commands:
- `gopass age agent`: starts the agent in the foreground.
- `gopass age lock`: locks the agent, clearing all cached passphrases.

The age backend will automatically start the agent if it's not already running and the `age.agent-enabled` configuration option is set to `true` (the default).

This change includes:
- The implementation of the age agent in `internal/backend/crypto/age/agent/`.
- Modifications to the age backend to communicate with the agent.
- A new configuration option `age.agent-enabled`.
- Unit tests for the agent.
- Updated documentation for the age backend.

The integration test for this feature (`TestAgeAgent`) is currently failing. The issue is that the test environment is non-interactive, and the code path for initializing a new age store requires a password for the identity keyring, which triggers a `pinentry` call that fails without a TTY. I have tried several approaches to work around this, including setting the `GOPASS_PASSWORD` environment variable and providing a custom pinentry script, but none have been successful so far. The core implementation of the agent is believed to be correct, but the integration test needs further work to run in a non-interactive environment.

* This change introduces an agent for the age backend to cache passphrases for age identities.

The agent is a long-running process that listens on a Unix domain socket. Gopass communicates with the agent to request decryption of secrets. The agent caches the passphrases for the identities and performs the decryption, so the passphrases never leave the agent process. This addresses the security concerns with the initial implementation.

The agent can be controlled with the following commands:
- `gopass age agent`: starts the agent in the foreground.
- `gopass age lock`: locks the agent, clearing all cached passphrases.

The age backend will automatically start the agent if it's not already running and the `age.agent-enabled` configuration option is set to `true` (the default).

This change includes:
- The implementation of the age agent in `internal/backend/crypto/age/agent/`.
- Modifications to the age backend to communicate with the agent.
- A new configuration option `age.agent-enabled`.
- Unit tests for the agent.
- Updated documentation for the age backend.

* This change introduces an agent for the age backend to cache passphrases for age identities.

The agent is a long-running process that listens on a Unix domain socket. Gopass communicates with the agent to request decryption of secrets. The agent caches the passphrases for the identities and performs the decryption, so the passphrases never leave the agent process. This addresses the security concerns with the initial implementation.

The agent can be controlled with the following commands:
- `gopass age agent`: starts the agent in the foreground.
- `gopass age lock`: locks the agent, clearing all cached passphrases.

The age backend will automatically start the agent if it's not already running and the `age.agent-enabled` configuration option is set to `true` (the default).

This change includes:
- The implementation of the age agent in `internal/backend/crypto/age/agent/`.
- Modifications to the age backend to communicate with the agent.
- A new configuration option `age.agent-enabled`.
- Unit tests for the agent.
- Updated documentation for the age backend.

* This change introduces an agent for the age backend to cache passphrases for age identities.

The agent is a long-running process that listens on a Unix domain socket. Gopass communicates with the agent to request decryption of secrets. The agent caches the passphrases for the identities and performs the decryption, so the passphrases never leave the agent process. This addresses the security concerns with the initial implementation.

The agent can be controlled with the following commands:
- `gopass age agent`: starts the agent in the foreground.
- `gopass age lock`: locks the agent, clearing all cached passphrases.

The age backend will automatically start the agent if it's not already running and the `age.agent-enabled` configuration option is set to `true` (the default).

This change includes:
- The implementation of the age agent in `internal/backend/crypto/age/agent/`.
- Modifications to the age backend to communicate with the agent.
- A new configuration option `age.agent-enabled`.
- Unit tests for the agent.
- Updated documentation for the age backend.

* Fix some test failures and add more logging.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix lint error

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix integration tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-09-15 22:03:33 +02:00
Dominik Schulz
a41fe40556
[feat] Add Jujutsu storage backend (#3202)
This commit adds a new experimental storage backend for the Jujutsu
VCS. It currently is a wrapper around Git and does not add too much
value by itself, but provides an interface that is supposed to be
more stable than git and might eventually evolve to support a
custom storage backend as well. Also I want to test it.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-08-19 21:28:16 +02:00
Dominik Schulz
39dcc4f311
[feat] Add Age custom ssh path options (#3199)
* [feat] Add Age custom ssh path options

This commit adds a new flag `--age-ssh-key-path` and a new config option
`age.ssh-key-path` to specify the path to an additional SSH Key file
directory or file.

Fixes #2933

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix docs

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Remove GetSSHKeyPath

Not needed.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-08-15 18:52:25 +02:00
Ilyas Rahimov
114b62ab95
[fix] Fixes creation template lookup on Windows (#3157)
Fixes #2555

Signed-off-by: RahimovIR <rahimovir@gmail.com>
2025-05-18 09:31:59 +02:00
Tom Payne
7e3c54d1f9
[feat] Remove expensive and unmaintained zxcvbn-go strength checker (#3133)
Signed-off-by: Tom Payne <twpayne@gmail.com>
2025-04-20 20:47:26 +02:00
Dominik Schulz
c5f25acdfc
[chore] Move gitconfig to their own repo (#3131)
This commit finalizes the move of the gitconfig pkg to a
separate repo.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-19 21:37:38 +02:00
Dominik Schulz
1e05f6a618
[chore] Move set from internal to pkg (#3129)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-19 20:29:24 +02:00
Dominik Schulz
7281ca8ab4
[chore] Migrate to golangci-lint v2 (#3104)
* [chore] Migrate to golangci-lint v2

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issue

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Add more package comments.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix golangci-lint config and the remaining checks

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Use Go 1.24

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix container builds

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix more failing tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix test failure

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix another len assertion

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Move location tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix most remaining lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Only run XDG specific tests on linux

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Attempt to address on source of flaky failures

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-17 08:05:43 +02:00
Dominik Schulz
7eaa845da7
[fix] Fix test regressions (#3116)
* [fix] Fix test regressions

This change fixes some tests that did start to fail at some point.
I can't tell for sure when they broke (didn't bisect) and if that
breakage is isolated to my system or not. But I need to fix them
anyway.

Fixes #3115

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Add missing files.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix test failure

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix one more version test

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-16 21:21:00 +02:00
Dominik Schulz
21687eea47
[fix] Fix debug.ModuleVersion (#3079)
* [fix] Fix debug.ModuleVersion

Add tests, fix parsing issues and add a specical case for the main
module.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix two lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-03-05 16:54:17 +01:00
Dominik Schulz
9b72a1c76c
Improve test coverage (#3077)
* [chore] Add more tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix most tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix remaining tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix lint issues.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix more lint issues.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix more lint issues.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix the final lint issue.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-03-04 13:01:01 +01:00
Dominik Schulz
2c0a1a156c
fix: Do not overwrite sshCommand in git config (#3036)
To avoid messing with user settings.

Fixes #2994

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-01-13 12:36:03 +01:00
Tom Payne
7e4f62b1fe
chore(deps): bump github.com/twpayne/go-pinentry from v0.3.0 to v4.0.0 (#3031)
Signed-off-by: Tom Payne <twpayne@gmail.com>
2025-01-08 16:46:18 +01:00
Joel Lau
ecb848ff4b
specify ssh dir (#2981)
* specify ssh dir

Signed-off-by: Joel Lau <joellau@protonmail.com>

* added documentation, prefer GOPASS_SSHDIR

Signed-off-by: Joel Lau <joellau@protonmail.com>

* check for empty path

Signed-off-by: Joel Lau <joellau@protonmail.com>

---------

Signed-off-by: Joel Lau <joellau@protonmail.com>
2024-11-09 10:30:15 +01:00
Eng Zer Jun
7ac2990a9a
[CLEANUP] Replace experimental maps and slices with stdlib (#2993)
The experimental functions are now available in the standard library
in Go 1.23 [1].

[1]: https://go.dev/doc/go1.23#new-unique-package

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2024-11-06 20:23:08 +01:00
Eng Zer Jun
638e577064
test(backend): add unit tests for Registry (#2974)
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2024-10-20 14:40:55 +02:00
AnomalRoil
4c2caf3e9b
[FEATURE] Allow for non-interactive age setup (#2970)
* [FEATURE] Allow for non-interactive age setup

Also updates Go to Go 1.23.2 and get rid of min and max functions

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* [n/a] also renaming clear for Windows

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* [n/a] bumping our GHA to Go 1.23

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* [n/a] make our harden runner softer

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* [n/a] make our harden runner accept go.dev

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* [n/a] applying code review changes

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
2024-10-14 19:32:26 +02:00
AnomalRoil
2c268d25a5
[FEATURE] Adding support for age.Plugin identities (#2960)
* Feat: support age plugin identities, including age-plugin-yubikey ones.

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* Applying code review comments and adding test

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
2024-10-07 13:21:03 +02:00
Ludovic Fernandez
9b6a28f031
[chore] use the same version of golangci-lint (#2948)
* [chore] use the same version of golangci-lint

Signed-off-by: Fernandez Ludovic <ldez@users.noreply.github.com>

* Fixing the new lint issues in 1.61.0

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* Fixing test issue introduced by lint fix

Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

* [chore] show golangci-lint stats

Signed-off-by: Fernandez Ludovic <ldez@users.noreply.github.com>

---------

Signed-off-by: Fernandez Ludovic <ldez@users.noreply.github.com>
Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
Co-authored-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
2024-09-25 15:36:23 +02:00
Dominik Schulz
4d3d95edac
chore: More logging when gpg operations fails (#2914)
Fixes #2898

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2024-07-28 19:51:56 +02:00
Doron Behar
51c2bdc8d0
cli/decrypt: improve debugging of gpg command (#2913)
When gopass-jsonapi is running these functions, the stderr of the gpg
command won't reach anywhere visible without writing it to the log as
well. Also adding 2 --verbose arguments to gpg helps debugging potential
issues.

Signed-off-by: Doron Behar <doron.behar@gmail.com>
2024-07-28 10:31:37 +02:00
Doron Behar
70dbabe018
gpg: Log gpg output to LogWriter (#2869)
* gpg: Log gpg output to LogWriter

Signed-off-by: Doron Behar <doron.behar@gmail.com>

* gpg/cli: Add more log messages

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

Signed-off-by: Doron Behar <doron.behar@gmail.com>

* Make leaf/write test always trust recipients

Signed-off-by: Doron Behar <doron.behar@gmail.com>

---------

Signed-off-by: Doron Behar <doron.behar@gmail.com>
2024-07-07 17:57:51 +02:00
Justen Walker
2761beaa10
feat: on pinentry request, allow password to be cached in os keyring (#2881)
Signed-off-by: Justen Walker <justen.walker+github@gmail.com>
2024-06-10 13:55:26 +02:00
Dominik Schulz
d6669e15e5
chore: Switch to static list of linters (#2882)
* chore: Switch to static list of linters

The old approach was prone to random CI failures when a golangci-lint
was updated and did enable new linters. This approach means we will have
to update the include list from time to time but won't get random CI
failures.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* fix: Update enabled linters to be compatible with GHA

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2024-06-10 13:54:49 +02:00
Mikel Olasagasti Uranga
8b72389ddf
[chore] Update hashicorp/golang-lru to v2 (#2859)
Updates the GPG backend to use version 2 of hashicorp/golang-lru
library.

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
2024-04-09 09:33:51 +02:00
Dominik Schulz
946ccf4ba7
[fix] Disble safecontent parsing if noparsing is requested (#2855)
We can not parse and check the secret for suppressed keys if
we are not supposed to parse the secret.

Fixes #2737

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2024-04-02 18:40:50 +02:00
Dominik Schulz
28d504dbb7
[chore] Use clean filepath in all of the fs.Set operation (#2846)
See #2837

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2024-03-28 17:43:58 +01:00
Ludovic Fernandez
b8f0ff8ff2
[chore]: linting (#2840)
Signed-off-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2024-03-25 19:32:57 +01:00
Dominik Schulz
34567d93ee
[bugfix] Bring back audit summary (#2820)
* [bugfix] Bring back audit summary

This PR brings back the audit summary view and displays only that by
default. This restores the old behaviour before we refactored the
audit implementation. The new view is still available with the
new --full flag.

Fixes #2816

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix tests.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix integration test

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2024-03-13 14:26:06 +01:00
Dominik Schulz
263b78119b
[bugfix] Fix writes to global config from tests (#2727)
* [bugfix] Fix writes to global config from tests

Fixes #2725

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Shorten readonly config creation.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Address review comments

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2023-12-01 14:04:17 +01:00
Dominik Schulz
8dfd7bd864
Add storage.TryAdd and TryCommit methods (#2723)
* Add storage.TryAdd and TryCommit methods

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix lint errors and replace Git with Fossil in the Fossil backend.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2023-11-25 17:48:47 +01:00
Yolan Romailler
5f18942781
[BUGFIX] Try to always honor local config for mounts (#2724)
* [BUGFIX] Try to always honor local config for mounts

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [BUGFIX] Better propagate mount to config

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] CR nit fix

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-11-25 17:48:37 +01:00
Yolan Romailler
d168602f77
Improved config handling and bugfixes (#2716)
* [CLEANUP] Misc changes around debug logging and configs

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [BUGFIX] Handle uninitialized stores with gopass config

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [BUGFIX] Do not always commit upon config changes

Fixes #2673

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] Following code review comments

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] More code review changes

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] Forgot one change

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-11-24 18:00:58 +01:00
Dominik Schulz
edb272a786
[bugfix] Improve git version parsing (#2690)
* [bugfix] Improve git version parsing

See #2686

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2023-11-18 07:37:41 +01:00
Yolan Romailler
d56639fcd7
[CLEANUP] Migration of options to more appropriate sections (#2681)
* [CLEANUP] Moving options to the correct config section

This adds an easy migration path to our config handling, which should
allow us to migrate option names around much more easily in the future.

Any system level config or env variables options are not migrated.

This also fixes a bug in our test code, where the root mount path was
not properly set in our config, because we used "path:" instead of
"path=" to set it.

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [DOCUMENTATION] Document legacy options and their migration path

This also makes sure that legacy options aren't used in the code anymore using the docs test and its regexp

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] Removing weird spaces from changelog

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [DOCUMENTATION] Reformatting our Markdown tables properly

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [TESTING] Patching a timezone bug in tests

This is a fun one where if your Timezone isn't UTC and you are past midnight but it's not past midnight UTC, the tests would fail because you're not using the right date to validate it.

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] Fix a typo and use the correct Env variables in the doc about the custom Env variables

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [BREAKING] Custom Env options moved from GOPASS_CONFIG_CONFIG_KEY_i to GOPASS_CONFIG_KEY_i

As discussed in #2617, this actually reflects the way GIT_CONFIG works.

It also fixes a potential Panic in our codebase when IsSet was called
without any Preset config on a non-existing key.

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [CLEANUP] Patching all of the new linter complaints

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [CLEANUP] Use Go1.21 everywhere

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] Increase our Golangci timeout

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] code review comment and extra regression test

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-11-03 18:40:58 +01:00
Eng Zer Jun
14bc515344
storage/fs: replace bytes.Compare with bytes.Equal (#2639)
Prefer `bytes.Equal` to `bytes.Compare` for equality comparisons, as
suggested by Go example [1]

Besides, `bytes.Equal` is slightly faster than `bytes.Compare` in this
case:

func BenchmarkBytesCompare(b *testing.B)  {
	foo := []byte("foo")
	bar := []byte("bar")

	for i := 0; i < b.N; i++ {
		if bytes.Compare(foo, bar) == 0 {
			b.Fail()
		}
	}
}

func BenchmarkBytesEqual(b *testing.B)  {
	foo := []byte("foo")
	bar := []byte("bar")

	for i := 0; i < b.N; i++ {
		if bytes.Equal(foo, bar) {
			b.Fail()
		}
	}
}

goos: linux
goarch: amd64
pkg: example
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkBytesCompare-16    	188355594	         6.636 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesEqual-16      	240546348	         4.498 ns/op	       0 B/op	       0 allocs/op

[1]: https://github.com/golang/go/blob/go1.20.7/src/bytes/example_test.go#L129-L135

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-08-07 10:02:46 +02:00
Dominik Schulz
d81084c65d
Update dependencies (#2624)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2023-07-30 17:34:16 +02:00
guangwu
acc80494c9
chore: remove refs to deprecated io/ioutil (#2609)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-07-29 01:08:46 +02:00
Dominik Schulz
7d335e15f4
Fix recipients check for age (#2545)
The new recipients check for unusable GPG keys did not work for
age. In fact most age keys can be used as-is. At the same time
this is cleaning up the recipients handling for age a bit.

Fixes #2544

RELEASE_NOTES=[BUGFIX] Fix recipients check for age.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2023-02-09 18:05:18 +01:00