Skip to content

Resolve gopass:// password references - #965

Open
1995parham wants to merge 1 commit into
agrahn:developfrom
1995parham:feat/gopass-password-references
Open

Resolve gopass:// password references#965
1995parham wants to merge 1 commit into
agrahn:developfrom
1995parham:feat/gopass-password-references

Conversation

@1995parham

Copy link
Copy Markdown

What

Adds support for gopass-style cross-secret password references. An entry whose password is gopass://<path> now resolves, at read time, to the password of the entry at <path> (relative to the store root), so a canonical credential need not be duplicated. Rotating the canonical entry automatically updates every reference.

Behaviour

  • Substitutes the referenced entry's password into the referencing entry.
  • Falls back to the referenced entry's username / OTP only when the referencing entry does not define its own; any other fields on the referencing entry are preserved.
  • Recursive (a target may itself be a reference), with cycle detection, a depth limit, and path-traversal guards.
  • Works in both the decrypt screen and autofill. Editing an entry still shows the raw gopass:// reference rather than the resolved password.
  • Referenced entries that require a different PGP key/passphrase are unlocked interactively, reusing the existing passphrase/biometric/PIN flow. Non-reference entries are completely unaffected.

Implementation

  • PasswordEntry.isReference() / referencePath() — pure detection in format:common.
  • PasswordReferenceResolver — UI/crypto-agnostic orchestration + a pure, unit-tested merge step. Decryption of the referenced file is injected by the caller.
  • BasePGPActivity gains a reference-decrypt sink so the shared unlock state machine can decrypt an arbitrary referenced file and hand back its plaintext; decryptWithPassphrase and the passkey/creation activities are untouched.
  • DecryptActivity and AutofillDecryptActivity resolve references before rendering/filling.

Tests

  • PasswordEntryTest — reference detection (scheme case-insensitivity, first-line-only, non-references).
  • PasswordReferenceResolverTest — password substitution, username/OTP fallback vs. origin's own fields, nested chains, cycle detection, depth limit, path-traversal rejection, aborted-unlock fallback.

All unit tests and spotlessCheck pass. Runtime flows (different-key prompt, circular reference, edit-shows-reference) should be verified on device.

@agrahn
agrahn force-pushed the develop branch 5 times, most recently from 96cc5ae to f10d4ea Compare July 21, 2026 21:10
Add support for gopass-style cross-secret password references: an entry
whose password is `gopass://<path>` now resolves at read time to the
referenced entry's password, so a canonical credential need not be
duplicated. Rotating the canonical entry updates every reference.

- Detect references on PasswordEntry (isReference/referencePath).
- PasswordReferenceResolver substitutes the referenced entry's password
  and, only when the origin lacks them, inherits its username/OTP.
  Resolution is recursive with cycle detection, a depth limit, and
  path-traversal guards.
- Reuse the existing interactive unlock flow (passphrase/biometric/PIN)
  to decrypt referenced entries requiring a different key, via a
  reference-decrypt sink in BasePGPActivity; non-reference entries are
  unaffected.
- Resolve references in the decrypt screen (editing still shows the raw
  gopass:// reference) and in autofill.
@1995parham
1995parham force-pushed the feat/gopass-password-references branch from 05d129d to c42eca6 Compare July 22, 2026 11:19
@agrahn
agrahn force-pushed the develop branch 4 times, most recently from 79f8aaf to 8c172aa Compare July 23, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant