48 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
google-labs-jules[bot]
86720090b6
docs: Add GoDoc to pkg and improve markdown files (#3251)
This change adds GoDoc comments to many of the public symbols in the
`pkg/` directory. It also includes various improvements to the
documentation in `README.md` and other markdown files in the `docs/`
directory.

This is a partial documentation effort, as requested by the user, to
get a pull request submitted quickly.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-09-22 19:37:15 +02:00
Daniel Lublin
8522d7d677
Revert "[fix] use WritePassword for secure write (#3200)" (#3234)
This reverts commit a828cada8f19e946d7db785dd0abfd74caf06a82.

The change of mime-type (away from text/plain) of the clipped text that
this causes is problematic, and is not yet supported everywhere. A
change like this needs to be tested more thoroughly. See:
https://github.com/gopasspw/gopass/issues/3233

Signed-off-by: Daniel Lublin <daniel@lublin.se>
2025-09-19 09:35:53 +02:00
Tony Wang
a828cada8f
[fix] use WritePassword for secure write (#3200)
So that for systems that support it, passwords won't be captured by
clipboard managers.

Signed-off-by: Tony Wang <tony@initialcommit.net>
2025-08-27 16:48:21 +02:00
Dominik Schulz
f4ee40ce23
[feat] Replace clipboard library to support wl-copy args (#3123)
* [feat] Replace clipboard library to support wl-copy args

This change should allow us to protect sensitive content
from being captured in some clipboard managers on KDE.

Fixes #2611

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

* [chore] Update clipboard dep

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

* [fix] Update clipboard

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

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-19 14:46:14 +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
AnomalRoil
70c56f9102
[n/a] Correcting mistake in search+replace (#2972)
Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
2024-10-15 16:44:30 +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
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
Mikel Olasagasti Uranga
0fe6b1ba6c
[chore] Update dependency to github.com/godbus/dbus/v5 (#2860)
Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
2024-04-09 09:35:16 +02: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
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
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
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
f58454452f
Increase test coverage (#2461)
RELEASE_NOTES=n/a

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-10 23:05:33 +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
Dominik Schulz
a063275dd5
clipboard: Wait for killed processes to actually exit to avoid zombies (#2354)
Fixes #1666

RELEASE_NOTES=[BUGFIX] Use Wait() to avoid Zombies
2022-09-27 10:42:51 +02:00
Dominik Schulz
57ad454163
Fix linter issues (#2273)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-07-17 18:01:33 +02:00
Dominik Schulz
d51b84bda7
Prevent gopass from silently deleting entries when moving (#2211)
Fixes #2210

RELEASE_NOTES=[BUGFIX] Stop eating secrets on move

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-05-10 20:06:03 +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
Justin Kromlinger
6758797df0
Add env variables for custom clipboard commands (#2091)
* Add env variables for custom clipboard commands

Adds `GOPASS_CLIPBOARD_COPY_CMD` and `GOPASS_CLIPBOARD_CLEAR_CMD`
environment variables which are called instead of the normal
implementation if set. The commands receive the name of the password as
their first parameter and the password or its checksum on `STDIN`.

Resolves #2042.

RELEASE_NOTES=[FEATURE] Add env variables for custom clipboard commands.

Signed-off-by: hashworks <mail@hashworks.net>

* Improve two line test ambiguity

The output might contain the previous value "and". Additionally with the
new values it is now clearer what is tested.

RELEASE_NOTES=[TESTING] Improve two line test ambiguity.

Signed-off-by: hashworks <mail@hashworks.net>

* Use a helper to unset env vars in clipboard tests

RELEASE_NOTES=[TESTING] Use a helper to unset env vars in clipboard tests.

Signed-off-by: hashworks <mail@hashworks.net>
2022-01-11 10:02:08 +01:00
Dominik Schulz
6fd23452e2
Enable golangci-lint nestif checks (#2082)
Co-authored-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
2021-12-29 23:29:03 +01:00
Dominik Schulz
0eff31a8ce
Enable additional golangci-lint godot checks (#2077) 2021-12-29 22:47:53 +01:00
Dominik Schulz
6d86b63ccc
Improve clipboard safety (#2065)
This commit finally incorporates the changes suggested by rianadon in

Additionally it switches the unclip checksum from SHA256 to Argon2id.
Although the risk is close to zero (i.e. if someone can access our
process env we're doomed anyway) but there is just no reason to not
do it properly.

RELEASE_NOTES=[ENHANCEMENT] Hide password on MacOS clipboards

Fixes #1816

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-12-28 22:56:29 +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
13b6c18fe6
Fix fsutil.Shred and other cleanup (#2063)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-12-22 19:05:24 +01:00
Dominik Schulz
8586105f27
Update deps (#1981)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-08-28 16:01:27 +02:00
Dominik Schulz
698ae081d6
Allow overriding clipboard error message helpers (#1851)
This is useful for packaging gopass on some platforms and
a no-op on others.

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-03-20 12:03:31 +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
73ed2c189e
Upgrade to Go 1.16 (#1803)
Remove usage of io/ioutil: https://golang.org/doc/go1.16?s=03#ioutil

RELEASE_NOTES=[ENHANCEMENT] Use Go 1.16

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-02-17 21:39:07 +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
d9759ffec8
Replace github.com/pkg/errors by stdlib errors (#1750)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-26 09:21:52 +01:00
Dominik Schulz
74ea14c323
Remove colored output (#1743)
This confuses some terminals.

Also: fix setup.go condition and validate git setup.

Fixes #1464
Fixes #1467

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-21 10:32:25 +01:00
Dominik Schulz
ddfe7bfc97
Remove final references to internal packages (#1709)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-14 09:15:29 +01:00
Dominik Schulz
5977752c7c
Unexport more internal packages (#1380)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-22 21:38:08 +02:00
Dominik Schulz
d0be4054ca
Unexport more internal packages (#1377)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-22 18:26:01 +02:00
Dominik Schulz
f9f35fa16d
Do not show notifications if disabled (#1339)
Fixes #1335

RELEASE_NOTES=[BUGFIX] Honor notifications setting.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-08 10:34:26 +02:00
Moritz Johner
21ff26d73a
feat: support windows (#1295)
* feat: support windows

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>

* fix: revert unnecessary changes

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>

* fix: remove useless test

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
2020-04-29 00:27:05 +02:00
Simon Krenger
beb22bc105
Catch 'The name is not activatable' DBus error when unclipping (#1247)
On Fedora 31, `gopass unclip` fails with a "Failed to clear clipboard history"
notification. This is because DBus returns the following error message as
`klipper` is not available:

```
The name is not activatable
```

This commit adds this error message to the strings being ignored.

Fixes #1209

Signed-off-by: Simon Krenger <skrenger@redhat.com>
2020-04-24 17:48:19 +02:00
garf1242
895f6072b6
Add notifications when using clipboard (#1263)
* clipboard: fix typo to notification title

Signed-off-by: Simon Latapie <garf1242@gmail.com>

* clipboard: add some notifications in case of password copy

Signed-off-by: Simon Latapie <garf1242@gmail.com>

* show: notify errors only in case of clipping

Notify errors if the show command has been requested with the clip
option. In the other cases, we may not want to be notified (error
printing may be sufficient).

Signed-off-by: Simon Latapie <garf1242@gmail.com>
2020-04-24 17:42:51 +02:00
Christian Muehlhaeuser
f9338ee6c0 Fixed typo in comment (#1146)
"invokation" => "invocation"

Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com>
2019-07-21 19:59:46 +02:00
Dominik Schulz
e2a571e518 Fix cross compile
This commit removes the legacy i386 builds and fixes
some cross compile issue.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2019-03-03 18:52:49 +01:00
Dominik Schulz
b4b8bce270
Improve killPrecedessors in unclip (#1074)
The previous method was poorly optimized. This commit comes with a speedup
on the order of two magnitudes.

goos: linux
goarch: amd64
pkg: github.com/gopasspw/gopass/pkg/clipboard
BenchmarkWalkProc-8            1        1265002845 ns/op
BenchmarkListProc-8          100          17014944 ns/op
PASS
ok      github.com/gopasspw/gopass/pkg/clipboard        4.397s

Fixes #923

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2019-02-24 22:01:19 +01:00
Dominik Schulz
c36481bb97
Improve create wizard (#842) 2018-06-04 13:47:42 +02:00
Dominik Schulz
a3d6a23e1b
Kill any pending gopass unclip processes (#813)
Fix #758
2018-05-30 11:35:18 +02:00
Dominik Schulz
ba281c4942 Rewrite imports paths 2018-05-28 15:51:21 +02:00
Christian Muehlhaeuser
753045fc66 Follow import ordering & grouping conventions (#762)
Grouped in the following order:
1. Packages from the std library
2. golang.org imports
3. github.com/justwatchcom/gopass packages
4. External dependencies

Sorted by gofmt.
2018-05-05 09:40:02 +02:00
Dominik Schulz
da436e6a79
Refactor and cleanup codebase (#715) 2018-03-16 14:22:47 +01:00