166 Commits

Author SHA1 Message Date
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
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
Parham Alvani
46dfddaef0
Handle referencing in passwords (#3163)
* feat: handle referencing in passwords

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* feat: use seq over slice to improve performance

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* feat: handle error during reference following

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* feat: provide a flag for not following references

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* feat: disable ref following on edit and remove the flag

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* feat: provide a configuration for follow-references

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* fix: correct configuration tests

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* fix: correct tests and document the new flag

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* fix: correct integration test

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

* fix: correct tests

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>

---------

Signed-off-by: Parham Alvani <parham.alvani@gmail.com>
2025-05-28 18:10:54 +02:00
Dominik Schulz
f5c694c08b
[fix] Include git commit hash in tarballs (#3124)
* [fix] Include git commit hash in tarballs

This change should allow builds made from a release tarball to
accurately display the git commit hash it was built from.

It does so by rendering the current short hash when packaging
the tarball. This workaround is necessary since the tarball
won't include the .git directory so we can't extract the
commit information from it.

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

* [fix] Fix TestVersionPrinter

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

* [fix] Fix spacing

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

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-19 14:45:56 +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
Dominik Schulz
2adc544dea
[bugfix] Default to true for core.exportkeys even in substores (#2848)
* [bugfix] Default to true for core.exportkeys even in substores

This PR changes the default for core.exportkeys from false to true
in mounted substores to match the default of the global root store.

It also refactors and simplifies the config package a little bit
by removing special typed lookup methods and replacing them with
conversion helpers that can be applied to any string.

Fixes #2830

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

* Fix config tests

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

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2024-03-29 15:28:26 +01:00
Dominik Schulz
a247d97098
Add fattr pledge (#2689)
See #2683

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2023-11-13 09:57:15 +01:00
Dominik Schulz
c702df1ce1
Add some hooks (#2499)
* Add some hooks

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

* Add generic hooks

Fixes #2500

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

* Address some review comments and fix some tests.

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

* Document options

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

* Error formatting

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-31 13:47:13 +01:00
Dominik Schulz
18ffee354f
Add .gitconfig parser (#2395)
This commit adds yet another config handler for gopass. It is based on
the format used by git itself. This has the potential to address a lot
of long standing issues, but it also causes a lot of changes to how we
handle configuration, so bugs are inevitable.

Fixes #1567
Fixes #1764
Fixes #1819
Fixes #1878
Fixes #2387
Fixes #2418

RELEASE_NOTES=[BREAKING] New config format based on git config.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Co-authored-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>

address comments

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-11-25 10:50:34 +01:00
Tony Wang
5981a5a643
Explicitly pass context to goroutine (#2425)
Previously, the `ctx` when calling ctx.Done() is fetched from main
function stack, which is updated multiple times.

Signed-off-by: Tony Wang <tony@initialcommit.net>

Signed-off-by: Tony Wang <tony@initialcommit.net>
2022-11-24 08:23:41 +01:00
Dominik Schulz
9950bb0285
Enable parsing of combined short flags (#2420)
Fixes #2419

RELEASE_NOTES=[ENHANCEMENT] Support combined short flags

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-11-19 19:11:05 +01:00
Dominik Schulz
670b772350
Fix new lint issues (#2378)
RELEASE_NOTES=n/a

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-10-04 22:17:54 +02:00
Dominik Schulz
16c071a780
Enable golangci-lint on push and pr (#2158)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-03-24 21:58:53 +01:00
Dominik Schulz
117db90478
Update deps (#2168)
Ran 'make upgrade' (includes gofumpt).

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-03-17 20:55:53 +01:00
Dominik Schulz
f2cac9f3b3
Refactor action.ExitError into its own package (#2114)
RELEASE_NOTES=n/a

Fixes #2107

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-01-16 14:34:12 +01:00
Dominik Schulz
c4b54ad310
Fix some TODOs (#2084) 2022-01-03 20:20:35 +01:00
Dominik Schulz
0eff31a8ce
Enable additional golangci-lint godot checks (#2077) 2021-12-29 22:47:53 +01:00
Yolan Romailler
3d3c7d5b77
GCI-ing imports (#2072)
Running gci in order to make sure we have properly deterministic imports

RELEASE_NOTES=n/a

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2021-12-28 13:59:31 +01:00
Dominik Schulz
eaaf88f320
Use runtime/debug.ReadBuildInfo (#2032)
RELEASE_NOTES=[CLEANUP] Use debug.ReadBuildInfo

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-12-21 10:03:17 +01:00
Dominik Schulz
5f641484ba
Add documentation (#2036)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-11-13 21:24:32 +01:00
Dominik Schulz
1131dbf5fb
Remove GOPASS_NOCOLOR (#1937)
Fixes #1936

RELEASE_NOTES=[CLEANUP] Remove GOPASS_NOCOLOR in favor of NO_COLOR

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-08-05 22:33:31 +02:00
Dominik Schulz
7f15bb9f81
Bring back --yes (#1862)
This was lost in a refactoring.

Fixes #1858

RELEASE_NOTES=[BUGFIX] Bring back --yes

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-03-20 21:07:40 +01:00
Dominik Schulz
7cf2f2d810
Do not fail if reminder can not be initialized (#1835)
Fixes #1832

RELEASE_NOTES=[BUGFIX] Do not fail if reminder is unavailable

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-03-12 18:55:11 +01:00
Dominik Schulz
877c3d8f19
Remove useless uses of ctxutil (#1806)
This is a minor cleanup that removes some useless use of ctxutil.
The goal of this series of commits is to reduce amount and
complexity of the code, not features or bugfixes.

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-02-25 16:09:52 +01:00
Dominik Schulz
08b7d56d65
Add suffix f to formating out methods (#1794)
This commit renames the existing out methods that expect
a format string to include the common f suffix and introduces
new out methods without this suffix that don't accept a
format string or variadic arguments.

Fixes #1793

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-02-15 19:38:58 +01:00
Dominik Schulz
d83f943317
Add release helper (#1740)
This PR adds a small release helper along with some documentation.
This should allow anyone with sufficient permissions to cut and push new
releases.

Fixes #1298

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-21 00:24:07 +01:00
Dominik Schulz
2d1b87514c
UX update (#1715)
Streamline command output, add unicode icons and ask for passphrase
during onboarding.

Fixes #1698

RELEASE_NOTES=[ENHANCEMENT] UTF-8 emojis
RELEASE_NOTES=[BUGFIX] Ask passphrase upon key generation


Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-18 13:54:49 +01:00
Dominik Schulz
ff349772ac
Reduce dependencies on internal packages (#1707)
This PR moves some packages from internal to pkg to increase the
independence of binaries in cmd/ from internal packages further.

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-13 18:21:09 +01:00
Dominik Schulz
89ad741044 Tag v1.11.0
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-12 13:05:47 +01:00
Dominik Schulz
55ad6bd394
Reduce usage of internal packages in non-core binaries (#1677)
This commit reduces the usage of internal/ packages in auxiliary
binaries so we can get closer to eventually moving them to their own
repos.

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-02 16:31:41 +01:00
Dominik Schulz
ddc223262e
Remove MIME secrets (#1665)
RELEASE_NOTES=[CLEANUP] Remove MIME

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-02 12:47:58 +01:00
Yolan Romailler
93539afcf0
Output Deprecation warning on StdErr (#1656)
Fixes #1627

RELEASE_NOTES=[BUGFIX] The deprecation warning is now output on stderr

Signed-off-by: Yolan Romailler <yolan@romailler.ch>
2020-11-19 10:50:29 +01:00
Yolan Romailler
333a76a06b
Patch pw prompt on Windows (#1632)
Fixes #1333

RELEASE_NOTES=[BUGFIX] Password insert prompt now works on Windows but
stil not in Git Bash. Only CMD and Powershell.

Signed-off-by: Yolan Romailler <yolan@romailler.ch>
2020-10-30 19:49:05 +01:00
Yolan Romailler
d6e8dd5994
Adding back the global yes flag and bugfix insert (#1596)
Fixes #1595

RELEASE_NOTES=[BUGFIX] Re-adding the global --yes flag
RELEASE_NOTES=[BUGFIX] Insert is not resetting the pw now if a key:value pair is specified inline

This is just adding --yes back since it was mistakingly removed.

Signed-off-by: Yolan Romailler <yolan@romailler.ch>
2020-09-27 20:43:12 +02:00
Dominik Schulz
f78798dcc3
Remove xc backend (#1587)
RELEASE_NOTES=[CLEANUP] Remove the unfinished xc backend

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-09-20 21:51:25 +02:00
Dominik Schulz
8109567a18
Re-introduce gopass -c (#1572)
RELEASE_NOTES=[ENHANCEMENT] Re-introduce gopass -c

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-09-18 20:09:44 +02:00
Dominik Schulz
377d2ab850 Tag 1.10.1
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-08-25 20:46:09 +02:00
Dominik Schulz
922cb1a07a
Add config option to disable MIME (#1546)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-08-22 20:32:40 +02:00
Dominik Schulz
3ba0d3f629
Speed up gpg initialization (#1528)
Fixes #1527

RELEASE_NOTES=[ENHANCEMENT] Cache gpg binary location

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-08-15 18:29:43 +02:00
Dominik Schulz
794feb0d42
Remove config option confirm (#1512)
Fixes #1503

RELEASE_NOTES=[CLEANUP] Remove config option confirm

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-08-13 08:33:39 +02:00
Dominik Schulz
25757ab162 Tag v1.10.0-rc.0
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-08-10 09:08:41 +02:00
Dominik Schulz
4d75c3cb47
Merge Storage and RCS backends into the Storage backend (#1455)
Fixes #1454
Fixes #1457

RELEASE_NOTES=[CLEANUP] Merge Storage and RCS backends

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-07-19 21:32:53 +02:00
Dominik Schulz
fab354b720 Tag v1.9.3-rc.0 2020-07-16 21:20:17 +02:00
Dominik Schulz
ec3abb86f3 Add background queue
This commit adds a synchornous background queue for processing e.g. sync
tasks. These shouldn't be blocking in interactive use but still need to
be done before we terminate.

This might also help improve the git implementation later on.

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-07-14 21:06:07 +02:00
Dominik Schulz
762f62a091
Add ondisk sync backend (#1443)
This commit adds remote sync support to the ondisk backend. It uses
minio to support a number of cloud storage products as well as self
hosted minio servers.

RELEASE_NOTES=[FEATURE] Add remote sync support for the ondisk backend.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-07-10 08:42:56 +02:00
Dominik Schulz
de194f214f
Add REPL (#1425)
This commit adds an interactive REPL as the default action when inoking
gopass without any arguments. The short form of gopass secret is still
retained but might eventually also be removed.

RELEASE_NOTES=[FEATURE] REPL

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-06-18 23:29:47 +02:00
Dominik Schulz
dccfbeb011
Introduce typed MIME Secrets (#1415)
This commit introduces a new MIME-based secrets format that will
eventually replace any existing secret format.

Fixes #1310

RELEASE_NOTES=[BREAKING] New secrets format.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-06-11 16:46:05 +02:00
Dominik Schulz
55082027e6
Properly initialize crypto during onboarding (#1411)
Fixes #1409
Fixes #1220

RELEASE_NOTES=[BUGFIX] Properly initialize crypto during onboarding and
clone

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-06-03 23:31:25 +02:00
Dominik Schulz
0cfa536d28
Add debug package (#1396)
This commit adds a new debug package to gopass.
It is heavily inspired by github.com/restic/restic/internal/debug
and adapted for the gopass use case.

This change allows to further trim down the source code since the
new package doesn't propagate the debug flag in the context anymore.
As such we can now omit passing ctx in most places.

In order to ensure we don't accidentially keep passing ununsed
parameters we also introduce unparam to check for extra arguments.

RELEASE_NOTES=[ENHANCEMENT] New Debug package

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-29 13:47:35 +02:00