The move implementation would always try to commit, even if the caller
did set this to false.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* 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>
* fix(store): Correctly handle moves within mounts
When moving a secret within a mounted store, the destination path was not
correctly stripped of the mount prefix. This lead to the creation of an
unnecessary subdirectory with the name of the mount.
This commit fixes this issue by ensuring the destination path is correctly
handled in the `directMove` function.
Fixes#3164
* fix(store): Correctly handle moves within mounts
When moving a secret within a mounted store, the destination path was not
correctly stripped of the mount prefix. This lead to the creation of an
unnecessary subdirectory with the name of the mount.
This commit fixes this issue by ensuring the destination path is correctly
handled in the `directMove` function.
Fixes#3164
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* 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>
* [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>
* [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>
* [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>
This commit changes the fsck filtering to also allow targeting
a single secret. Previously it would only work on folders and
fail on single files.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* [feat] Add --store option to gopass fsck
This allows limiting fsck to a specific mount-point to
speed up the process for large password stores.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Fix tests
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
---------
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Fsck: Improved message handling and decreased commit spam.
* Merge upstream changes with local changes (part 2: manual fixes)
* pgp keyring: Do not import a pgp public key into the user's private keyring if the key there is identical to the one in the store's keyring
* fsck.go: made the code more go-idiomatic
* more changes to make code more go-idiomatic
* Fsck: fixed misleading messages caused by previous refactor
(also clarified the roles of the values in ErrorSeverity)
* Fsck: even smoother git use (pubkey updates now in the same git commit as the rest of fsck's changes)
Also removed dupeicate check of public keys, and added more tests around commit messages
* Ctxutil: Pruning unused functions, more go idiomaticity (and some tweaks regarding errors)
* Formatted files with gofmt
* fixed misc. error management
* More fixes and formatting
(plus one fixed text for the `link` action)
* unblock CI (attempt 1)
* fix problems discovered by CI
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Co-authored-by: Dominik Schulz <dominik.schulz@gauner.org>
* Check existing recipients before trying to add a new one
Fixes#1918
RELEASE_NOTES=[ENHANCEMENT] Check recipients before adding a new one.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Add test for CheckRecipients with an invalid key.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Add custom error type and a better error message.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Initialize InvalidRecipientsError
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Skip CheckRecipients tests on Windows
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
This PR removes some unnecessary logic in the recipients removal and
adds a shortcut to remove recipients based on the Key ID instead of
looking up key fingerprints over and over again. Also it fixes an
issue where subkeys of the same key wouldn't be displayed in gopass
recipients even if they were actually present in the .gpg-id files.
Fixes#2416
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
This PR adds a new attempt at validating recipients files to prevent
malicious actors from updating them and tricking users into sharing
their new and updated secrets with a wider-than-inteded audience.
This includes two new config options (`recipients.hash` and
`recipients.check`) and one new command `gopass recipients ack`
to update the hash after validating it's content.
Fixes#2478
RELEASE_NOTES=[ENHANCEMENT] Add recipients hash checking.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Maintain secret structure when parsing
This commit introduces a new KV secret type ("AKV") that fully maintains
the secret format when parsing. As such it obsoletes the old KV and
Plain formats and the need for the core.parsing option.
Fixes#2431
RELEASE_NOTES=[ENHANCEMENT] Maintain secret structure when parsing
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Update internal/action/edit.go
Co-authored-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
* Address review comments
This brings back the noparsing flag since we need this to cover some
corners cases.
RELEASE_NOTES=n/a
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Co-authored-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
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#1567Fixes#1764Fixes#1819Fixes#1878Fixes#2387Fixes#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>
* Do not omit shadowed entries in ls output
Fixes#2338
RELEASE_NOTES=[BUGFIX] Do not shadow entries behind folders.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Add shadow marker
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Adjust tests to match the new shadow behaviour
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Update list docs wrt. shadowing
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Do not mark mounts as shadowed. That's already implicit.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Add more comments and some other cleanup
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Do not decrypt secrets when moving or copying them
This PR attempts to avoid decrypting secrets needlessly when they are
only copied or moved. All currently supported backends have a filesystem
backing them so the old workaround of Get and Set shouldn't be necessary
anymore. In case we re-introduce such backends or a direct move fails
for some reason we still fall back to Get and Set if necessary.
Fixes#2181
RELEASE_NOTES=[ENHANCEMENT] Avoid decryption on move or copy
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Fix lint issues
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
* Add debug log statements
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
They are fully defined by the public key.
RELEASE_NOTES=[BUGFIX] Do not print missing public key for age.
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
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>