31 Commits

Author SHA1 Message Date
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
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
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
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
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
Yolan Romailler
61329b3198
Adding support for multiple same keys (#1741)
RELEASE_NOTES=[ENHANCEMENT] KV secrets are now key-values, supporting multiple same key with different values

Fixes #1576

Signed-off-by: Yolan Romailler <yolan@romailler.ch>
2021-01-22 08:50:38 +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
10f89fe39e
Correcting newlines handling (#1579)
Fixes #788
Fixes #1575
Fixes #1574
Fixes #1573
Fixes #1570
Fixes #1592

RELEASE_NOTES=[BUGFIX] Correcting newlines handling
RELEASE_NOTES=[BUGFIX] Show now correctly handles -C and -u together
RELEASE_NOTES=[BUGFIX] Insert is now parsing its stdin input

This is trying to correct the way we display and write newlines.
Newlines are appended by the MIME type after the header but won't be
displayed by show now unless the MIME body is non-empty.

Notice the `mime` setting is significantly changing the way secrets are
handled, written and displayed, also how the newlines are treated.
I've tried to add tests to take this into account.

I've also added unit tests and integration tests accordingly to try and
detect such regressions in the future.

This is changing the behaviour of insert to make it compatible with the new MIME format

This is also refactoring the code a bit, removing dead code such as the
YAML special handling.

Signed-off-by: Yolan Romailler <yolan@romailler.ch>
2020-09-23 19:43:41 +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
0549c36ab0
Cleanup config (#1391)
aka unpopular opinions.

This commit removes a lot of weight and legacy as well as some features.
This wil break some exotic use cases which is regretable, but it is
inevitable and important to clean up these bad past design choices.

It removes some configuration options but most importantly it does
revert the decision to introduce an awkward custom backend URL
schema. This is an important step in the direction of zero configuration
and convention over configuration.

Fixes #569
Fixes #1225

RELEASE_NOTES=[DEPRECATION] Remove askformore, autosync,
check_recipient_hash and concurrency options.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-28 22:35:30 +02:00
Dominik Schulz
be8e8d698c
Always copy passwords to clipboard is autoclip is set (#1316)
Fixes #1255
Fixes #1317

RELEASE_NOTES=[BUGFIX] Simplify autoclip behavior

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-03 19:11:58 +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
Dominik Schulz
0f437fb468
Fix tests (#1281)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-04-25 20:02:44 +02:00
Martin Hoefling
3ba59c0d6b
Windows tests (#1171)
* make tests run on windows and osx

* add osx and windows as test target
* add slow test factor as osx doesn't seem to be fast enough to capture the test interval
* reset buildflags on windows as no PIC code can be built
* append .exe to gopass output
* fix some tests on windows, disable others

Signed-off-by: Martin Hoefling <martin.hoefling@gmx.de>

* kill gpg and test commands on windows after test

Signed-off-by: Martin Hoefling <martin.hoefling@gmx.de>

* disable problematic clipboard and jsonapi tests under windows

Signed-off-by: Martin Hoefling <martin.hoefling@gmx.de>
2020-04-24 17:52:00 +02:00
Yolan Romailler
5c5118553b
Let find support the -force flag (#1251)
Currently when the safecontent option is enable and the find action is
used and returns a single exact match, it will say: "Found exact match
in 'path'. No safe content to display, you can force display with show -f."

This is not accurate, since the -f flag is not supported by the find
action. This commit adds support for it so that it works as intended.

Adding some tests as well.

Signed-off-by: Yolan Romailler <yolan@romailler.ch>
2020-04-24 17:47:12 +02:00
Yolan Romailler
081af2f963 Fixes #667 and correct a few details (#705)
* Fixes #667 and correct a few details

This primarily adds the config option requested in #667.
I've added back the notion or erroring in case of a show action on an
entry with only a password and the safe content option enabled
Also I've fixed the way the String() function of the StoreConfig forgot
to display the Notification value in its output.

* Adding tests for autoclip

* adding a clip flag back

* correcting an old copy-paste mistake

* trying to correct the problem

* Correcting the error caused by #701
2018-03-09 14:33:39 +01:00
Yolan Romailler
1b11c576f9 Auto copy with safecontent (#685)
* Addressing #684

Adapting the integration tests accordingly.
Also adding an integration test to avoid conflict between safecontent and -c in
the show action.

* Adding real unit tests

* Removing all direct color uses

Since we have a package out to handle the output and the formatting and
coloring, there is no reason to directly use the color package.
2018-03-08 15:50:41 +01:00
Dominik Schulz
7c745ff74d Re-enable left over cleanup 2018-03-02 11:50:12 +01:00
Dominik Schulz
c6959fce6f
Avoid auto-search running non-interactively (#483)
Fixes #482
2017-12-01 12:20:49 +01:00
Dominik Schulz
e21a792752 Implement remaining context.TODO fields (#321) 2017-09-12 12:51:13 +02:00
Dominik Schulz
5401f43ecd Add secret type (#314)
This PR introduces a new type Secret which aims to
better encapsulate handling of secrets, especially
one containing YAML.
2017-09-11 20:46:57 +02:00
Dominik Schulz
8ef89b3a59 Improve error handling and propagation (#280)
This commit makes heavy use of github.com/pkg/errors to improve
handling and propagation of errors and to provide more meaningful
error messages. It also fixes some minor issues/wording wrt. error
message. Also it introduces distinct exit codes for different types
of errors.

Fixes #150
2017-08-23 17:38:22 +02:00
Dominik Schulz
f90d667023 Fix tests 2017-08-21 17:44:25 +02:00
Matthias Loibl
5229378b8d Return with an error code when searching after not finding password (#198)
* Return with an error code when searching after not finding password

* Fix integration tests for returning error code when running search
2017-07-19 15:20:48 +02:00
Dominik Schulz
1a05147d89 Release testing for 1.2.0 (#157)
Fixes #156
Fixes #146
2017-06-20 16:18:48 +02:00
Dominik Schulz
92940a7313 If entry was not found start search (#109)
* If entry was not found start search

Fixes #106
2017-05-22 14:23:17 +02:00
Dominik Schulz
906aa22e79 Add megacheck and fix any reported errors (#113) 2017-05-22 11:44:31 +02:00
Yolan Romailler
a6f2ac3403 Adding an option to hide the passwords on show action (#103)
* Adding unit tests for new feature

* Adding a setting to avoid showing password

By default, especially when usernames or comments in password entry are
useful, it may be dangerous to display the password on the terminal.
This commit add a setting to handle this, as well as a way to force
current behaviour.
The default behaviour is changed to this more sane and secure way.
Unit tests for the feature are passing.

* Adding config unit test

To check that the configuration is handled correctly.

* Adding QRcode Show test

* Reverting back default behaviour to pass one

And adding a readme entry in the Show section.
2017-05-17 15:39:34 +02:00