Implement clipboard and QR presentation #12

Closed
opened 2026-08-09 18:57:09 +00:00 by hugo · 1 comment
Owner

Objective

Implement the clipboard and QR presentation paths used by base pass and pass-otp without helper processes.

Scope

  • Support show --clip/--qrcode with optional line number and generate --clip/--qrcode.
  • Support OTP code and URI clipboard output plus OTP URI QR output.
  • Generate QR matrices and terminal rendering in Rust; return platform-neutral QR data from crates/storage.
  • Use native clipboard APIs or narrow platform FFI, restore or clear clipboard contents after the configured timeout, and avoid overwriting newer user clipboard content.
  • Ensure CLI output never prints a secret when clipboard or QR mode was requested.

Acceptance criteria

  • Tests cover line selection, invalid lines, mutual exclusion, QR round trips, timeout behavior, cancellation, and clipboard race protection.
  • No xclip, wl-clipboard, pbcopy, qrencode, shell, or other process is launched.
  • Secret values are not logged or retained after presentation completes.

Prerequisites

Read/search commands; secure secret storage.

## Objective Implement the clipboard and QR presentation paths used by base pass and pass-otp without helper processes. ## Scope - Support `show --clip/--qrcode` with optional line number and `generate --clip/--qrcode`. - Support OTP code and URI clipboard output plus OTP URI QR output. - Generate QR matrices and terminal rendering in Rust; return platform-neutral QR data from `crates/storage`. - Use native clipboard APIs or narrow platform FFI, restore or clear clipboard contents after the configured timeout, and avoid overwriting newer user clipboard content. - Ensure CLI output never prints a secret when clipboard or QR mode was requested. ## Acceptance criteria - Tests cover line selection, invalid lines, mutual exclusion, QR round trips, timeout behavior, cancellation, and clipboard race protection. - No `xclip`, `wl-clipboard`, `pbcopy`, `qrencode`, shell, or other process is launched. - Secret values are not logged or retained after presentation completes. ## Prerequisites Read/search commands; secure secret storage.
hugo added this to the 01 - Full Rust pass CLI parity milestone 2026-08-09 18:57:09 +00:00
hugo added the enhancement label 2026-08-09 18:57:09 +00:00
Author
Owner

Implemented in commit b8c614e and pushed to main.

Implementation:

  • added storage-owned clipboard lifecycle with a 45-second pass-compatible default, configurable 1..300 second lease, previous-content restore/clear, cancellation cleanup, and newer-content race protection;
  • added safe native desktop clipboard adapters through arboard with Linux password-manager history exclusion and no helper processes;
  • added storage-owned, zeroizing QR matrices and terminal rendering using pure Rust qrcode encoding;
  • wired show --clip/--qrcode line presentation and generate --clip/--qrcode through the shared service without printing plaintext;
  • exposed the same byte-oriented clipboard/QR primitives for pass-otp code and URI presentation;
  • documented configuration, platform behavior, secret lifecycle, and dependency choices.

Issue-focused verification:

  • presentation tests cover default/configured timeout validation, restore, clear, cancellation, cleanup failures, newer clipboard races, redaction, OTP code/URI clipboard payloads, QR round trips including otpauth URIs and Unicode, empty/oversized errors, and plaintext-free terminal rendering;
  • read/command contract tests cover line selection, invalid lines, and clipboard/QR mutual exclusion;
  • CLI tests cover show and generate clipboard/QR paths, encrypted entry creation, and no plaintext on stdout/stderr;
  • scoped strict clippy passed and the source audit found no xclip, wl-clipboard command, pbcopy, qrencode, shell, or other process launch.

Required gates passed:

  • cargo fmt --all -- --check
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
Implemented in commit b8c614e and pushed to main. Implementation: - added storage-owned clipboard lifecycle with a 45-second pass-compatible default, configurable 1..300 second lease, previous-content restore/clear, cancellation cleanup, and newer-content race protection; - added safe native desktop clipboard adapters through arboard with Linux password-manager history exclusion and no helper processes; - added storage-owned, zeroizing QR matrices and terminal rendering using pure Rust qrcode encoding; - wired show --clip/--qrcode line presentation and generate --clip/--qrcode through the shared service without printing plaintext; - exposed the same byte-oriented clipboard/QR primitives for pass-otp code and URI presentation; - documented configuration, platform behavior, secret lifecycle, and dependency choices. Issue-focused verification: - presentation tests cover default/configured timeout validation, restore, clear, cancellation, cleanup failures, newer clipboard races, redaction, OTP code/URI clipboard payloads, QR round trips including otpauth URIs and Unicode, empty/oversized errors, and plaintext-free terminal rendering; - read/command contract tests cover line selection, invalid lines, and clipboard/QR mutual exclusion; - CLI tests cover show and generate clipboard/QR paths, encrypted entry creation, and no plaintext on stdout/stderr; - scoped strict clippy passed and the source audit found no xclip, wl-clipboard command, pbcopy, qrencode, shell, or other process launch. Required gates passed: - cargo fmt --all -- --check - RUSTFLAGS="-D warnings" cargo check --workspace --all-targets - cargo clippy --workspace --all-targets -- -D warnings - cargo test --workspace
hugo closed this issue 2026-08-10 00:50:40 +00:00
Sign in to join this conversation.