Commit Graph
210 Commits
Author SHA1 Message Date
thePR0M3TH3AN 882cd060fa Fix Python 3.10 compatibility for UTC timezone usage 2026-02-25 21:26:32 -05:00
thePR0M3TH3AN c25d1df78d Format files to satisfy CI black check 2026-02-25 21:22:39 -05:00
thePR0M3TH3AN 0f8a54342c Fix profile setup edge cases and TOTP viewer refresh 2026-02-25 20:57:29 -05:00
thePR0M3TH3AN 88c1974ac6 Harden TUI recovery paths and add release integrity gates 2026-02-25 19:18:54 -05:00
thePR0M3TH3AN 72e6e3ba38 Close security item 6 with unlock throttling and policy gates 2026-02-25 18:32:06 -05:00
thePR0M3TH3AN 73a175b93f Harden item 6 API route access controls while locked 2026-02-25 18:29:02 -05:00
thePR0M3TH3AN dd6cbea7de Start security item 6: API lock access control and unlock route 2026-02-25 18:26:43 -05:00
thePR0M3TH3AN 56b68bd0ac Complete security item 3 hardening and redaction sweep 2026-02-25 18:23:40 -05:00
thePR0M3TH3AN fcbe2b2943 Harden security item 2: KDF policy, export safeguards, and tests 2026-02-25 18:15:51 -05:00
thePR0M3TH3AN c3eef44ab7 improved tests 2026-02-25 18:07:22 -05:00
google-labs-jules[bot]andPR0M3TH3AN 4a1529fd1a Fix CI failures: linting and dependency vulnerabilities
- Apply code formatting fixes (black) to resolve test workflow failures.
- Update `pyproject.toml`, `src/requirements.txt`, and lock files to upgrade vulnerable dependencies:
  - aiohttp -> 3.13.3
  - cryptography -> 46.0.5
  - orjson -> 3.11.7 (CVE-2025-67221)
  - pillow -> 12.1.1 (CVE-2026-25990)
  - pynacl -> 1.6.2 (CVE-2025-69277)
  - starlette -> 0.52.1 (CVE-2025-62727)
  - urllib3 -> 2.6.3 (CVE-2025-66418, etc.)
  - cbor2 -> 5.8.0 (CVE-2025-68131)
  - pyasn1 -> 0.6.2 (CVE-2026-23490)
  - python-multipart -> 0.0.22 (CVE-2026-24486)
- Manually sync `requirements.lock` from `poetry.lock` as `pip-compile` is unavailable in the environment.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-25 19:24:01 +00:00
thePR0M3TH3AN 37d0dffdc3 Merge branch 'beta' into main (safe conflict resolution) 2026-02-23 16:38:18 -05:00
thePR0M3TH3AN 3ea37865cb Add landing install copy UX and document remaining security/test TODOs 2026-02-23 16:33:57 -05:00
thePR0M3TH3AN 0789dfcb55 Harden agent policy and API import limits; fix docs links 2026-02-23 16:24:53 -05:00
thePR0M3TH3AN 03958106e1 Add agent mode, hardened TUI harness, coverage gates, and cross-platform installer smoke CI
This commit delivers four related improvements focused on reliability and automation while preserving existing human/TUI workflows.

1) Agent-first CLI mode (additive)
- Added new `seedpass agent` command group (`src/seedpass/cli/agent.py`) and wired it into CLI root.
- Implemented non-interactive profile bootstrap: `seedpass agent init` with `--seed|--seed-file|--generate-seed` and password env injection (`--password-env`).
- Added policy management commands: `agent policy-show` and `agent policy-set` with allow/deny kind controls.
- Added JSON-based secret retrieval: `seedpass -f <fingerprint> agent get <query> --ttl <sec>` with lease metadata and policy enforcement.
- Kept regular human mode fully available; no behavioral changes to interactive TUI entrypoint.

2) TUI agent harness deepening and stabilization
- Refactored harness into scenario profiles: `core`, `extended`, `stress` with `--scenario` selection.
- Added deterministic seeded stress campaigns: `--stress-cycles`, `--stress-seed`.
- Added scenario-specific required coverage keys and report metadata.
- Added post-condition assertions in extended scenario (archive/restore consistency, lock/unlock retrieval recovery).
- Hardened prompt matching for output variants and fail-fast behavior on non-zero SeedPass exit codes.
- Added harness unit tests for helper logic and control flow.

3) Critical module coverage gate tooling
- Added `scripts/check_critical_coverage.py` to enforce per-module thresholds from coverage JSON and report uncovered functions.
- Added override controls (`--threshold`, `--no-default-thresholds`) and optional JSON result output.
- Integrated coverage JSON generation into CI helper script and optional gate execution via `CRITICAL_COVERAGE_GATE=1`.
- Tuned default thresholds using full-suite baseline and increased strictness:
  - `src/main.py >= 50%`
  - `src/seedpass/core/manager.py >= 60%`
  - `src/seedpass/core/encryption.py >= 80%`
  - `src/seedpass/core/migrations.py >= 90%`
- Added tests for coverage gate parser/analysis logic and targeted manager worker path tests.

4) Installer validation framework for beta/main
- Added cross-platform installer smoke scripts:
  - `scripts/installer_smoke_unix.sh`
  - `scripts/installer_smoke_windows.ps1`
- Added GitHub Actions workflow `.github/workflows/installer-smoke.yml` with:
  - reduced PR matrix
  - full scheduled/manual matrix across OS/branch/mode
  - per-job log capture and artifact uploads for failure triage
- Added installer testing documentation and linked from README.

Additional housekeeping
- Added `.venv/` to `.gitignore`.
- Updated docs for new harness scenarios, seeded stress mode, post-condition metadata, coverage gate usage, and installer testing workflow.
2026-02-23 15:47:59 -05:00
thePR0M3TH3AN dd7290e83b Add robust AI TUI harness, docs roadmap, and lock/unlock fix 2026-02-23 14:35:40 -05:00
thePR0M3TH3AN 39d3b72e66 Merge pull request #889 from PR0M3TH3AN/opt-totp-cache-13978863474736758588
⚡ Optimize TOTP display loop by caching derived secrets
2026-02-18 10:23:09 -05:00
google-labs-jules[bot]andPR0M3TH3AN 1f92fe7901 Refactor test fixtures and fix linting issues
- Moved `client` and `dummy_nostr_client` fixtures to `src/tests/conftest.py` to fix F811 redefinition errors and improve test organization.
- Introduced `make_dummy_nostr_client` factory fixture to support tests requiring multiple client instances.
- Updated all affected tests to use the new fixture pattern.
- Removed deprecated `is_flag=True` from Typer boolean options in CLI modules.
- Fixed F541 (f-string without placeholders) in `entry_management.py`.
- Fixed F841 (unused variable) in `manager.py`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:39:55 +00:00
google-labs-jules[bot]andPR0M3TH3AN b0c3a97ce3 perf: Cache derived TOTP secrets in display loops
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 03:39:51 +00:00
google-labs-jules[bot]andPR0M3TH3AN 8e33f9c5e1 Fix formatting, linting, and logic errors from codebase scan
- Apply black formatting to 17 files.
- Fix F821 undefined name errors in:
  - src/main.py: Add missing `queue` import.
  - src/seedpass/core/encryption.py: Fix `JSONDecodeError` reference.
  - src/utils/__init__.py: Fix exception variable scope in fallback code.
  - src/utils/key_derivation.py: Add `TYPE_CHECKING` imports.
  - src/seedpass/core/config_manager.py: Add `TYPE_CHECKING` imports.
- Initialize torch environment and TODO file.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 18:09:48 +00:00
thePR0M3TH3AN 10317aec03 Merge pull request #877 from PR0M3TH3AN/security-fix-token-timing-attack-14331876507002006471
🔒 Fix timing attack vulnerability in API token verification
2026-02-16 12:48:52 -05:00
google-labs-jules[bot]andPR0M3TH3AN e59cc1af2e Fix timing attack vulnerability in token verification
Replaced insecure string comparison with `secrets.compare_digest` in `_check_token` to prevent timing attacks.
Added a test case for missing token to ensure robust error handling.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 17:44:02 +00:00
google-labs-jules[bot]andPR0M3TH3AN afa35a1782 Optimize TOTP derivation in GUI loop by caching secrets
- Add `get_totp_secret` to `EntryManager` and `EntryService` to allow retrieving the secret (derived or imported) without calculating the code.
- Update `TotpViewerWindow` in GUI to cache TOTP secrets locally. This prevents expensive PBKDF2/BIP39 derivation on every UI refresh (every second).
- Clean up unused imports and f-strings in `entry_management.py`.

Benchmarks show a ~9x speedup for 10 frames (50 entries) and >100x speedup for steady state.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 17:37:03 +00:00
thePR0M3TH3AN 46f753a11a Merge pull request #870 from PR0M3TH3AN/fix-key-derivation-salt-12798847451274058286
🔒 Fix Weak Key Derivation by Adding Salt
2026-02-16 12:24:12 -05:00
google-labs-jules[bot]andPR0M3TH3AN 75fe5bc382 Fix weak key derivation by adding salt to parent seed encryption
Introduced a random salt to key derivation for parent seed encryption to prevent rainbow table attacks. The salt is now stored in the `parent_seed.enc` file header (V3 format).

*   Modified `src/utils/key_derivation.py` to accept optional `salt` argument.
*   Modified `src/seedpass/core/encryption.py` to read/write salt in `parent_seed.enc` using V3 format (V3:salt:nonce:ciphertext).
*   Modified `src/seedpass/core/manager.py` to generate salt for new seeds and read salt for existing ones.
*   Added auto-upgrade logic for legacy (no salt) seeds upon access.
*   Updated tests to verify salt usage and backward compatibility.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 17:22:54 +00:00
thePR0M3TH3AN 21c25a0b63 Merge pull request #868 from PR0M3TH3AN/security-fix-path-traversal-17059275168502501133
🔒 Security Fix: Arbitrary File Read via Path Traversal in import_vault
2026-02-16 12:21:21 -05:00
google-labs-jules[bot]andPR0M3TH3AN 9c6b6d221c Fix Arbitrary File Read via Path Traversal in import_vault endpoint
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 17:20:28 +00:00
google-labs-jules[bot]andPR0M3TH3AN 91f39007f0 Fix arbitrary file write via path traversal in backup_parent_seed
The `backup_parent_seed` API endpoint was vulnerable to arbitrary file write via path traversal.
The `path` parameter was used directly to create a `Path` object, which was then passed to `_pm.handle_backup_reveal_parent_seed`.
This allowed an attacker to specify an arbitrary path (e.g., `../../evil_file`), which would be used by `encrypt_and_save_file` to write the encrypted seed to that location.

This commit fixes the vulnerability by validating that the `path` parameter is a valid filename (i.e., does not contain path separators or parent directory references) before processing it. This ensures that the backup file is always created within the intended fingerprint directory.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 17:17:44 +00:00
google-labs-jules[bot]andPR0M3TH3AN 99baf16b1b 🔒 Fix sensitive API token exposure in stdout
Removed the `print` statement in `src/seedpass/api.py` that leaked the
API token to stdout.

Enhanced the API server and CLI to support secure token management:
- Added `SEEDPASS_API_TOKEN` environment variable support in both
  `api.py` and `cli.py`.
- Added a `--token` option to the `api start` CLI command.
- Redirected the auto-generated token output to stderr instead of stdout.
- Updated `api stop` to respect the `SEEDPASS_API_TOKEN` environment
  variable.

These changes prevent the API token from being easily logged in insecure
environments where stdout is captured.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 16:47:51 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0a349df058 chore(ai): style-agent run
- Formatted 8 files with black.
- Ran flake8 and logged warnings.
- Verified with pytest.
- Scheduler operations completed (lock check, lock, complete).
- Wrote task log to torch/task-logs/daily/.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-16 12:54:54 +00:00
thePR0M3TH3AN d030cf9692 Raise InvalidToken-compatible errors 2025-08-23 12:21:56 -04:00
thePR0M3TH3AN bebbca8169 Add test for friendly decryption message? 2025-08-23 12:05:58 -04:00
thePR0M3TH3AN 7b0344739f refactor: restrict console logging and pause during UI 2025-08-22 22:24:04 -04:00
thePR0M3TH3AN d5e0d61db4 Use custom SeedPassError instead of sys.exit 2025-08-22 10:01:14 -04:00
thePR0M3TH3AN ee3d9d8e9d feat: add local backup restore during seed setup 2025-08-22 09:39:38 -04:00
thePR0M3TH3AN a2a663eed1 Default offline mode 2025-08-22 09:10:06 -04:00
thePR0M3TH3AN 4df6ff639e List seed setup choices for readability 2025-08-20 22:33:23 -04:00
thePR0M3TH3AN 505cf1a950 feat: track nostr account index per seed 2025-08-20 22:15:35 -04:00
thePR0M3TH3AN cb9a068e40 Handle config decryption errors gracefully 2025-08-20 21:46:09 -04:00
thePR0M3TH3AN c13742f3f3 Merge pull request #838 from PR0M3TH3AN/codex/add-manual-export-without-encryption
Add option to export and import database without encryption
2025-08-20 21:08:49 -04:00
thePR0M3TH3AN 6c8b1928b8 Add option to export and import database without encryption 2025-08-20 21:00:12 -04:00
thePR0M3TH3AN 492bfba3fb tests: add offline default and kdf slider 2025-08-20 20:51:36 -04:00
thePR0M3TH3AN dd513cf964 Add nonce tracking and V3 encryption format 2025-08-20 19:43:45 -04:00
thePR0M3TH3AN d99af30d9f Switch API token to bcrypt 2025-08-20 19:29:08 -04:00
thePR0M3TH3AN 0315562d80 test: ensure manifest IDs omit fingerprint 2025-08-20 19:11:24 -04:00
thePR0M3TH3AN 619226d336 feat: support random and deterministic TOTP secrets 2025-08-20 18:36:19 -04:00
thePR0M3TH3AN b97d60778b Restore compatibility for key hierarchy 2025-08-20 18:12:02 -04:00
thePR0M3TH3AN bbb26ca55a test: add key hierarchy tests 2025-08-20 17:57:50 -04:00
thePR0M3TH3AN 26632c0e70 Fix KDF metadata handling and headless password prompts 2025-08-20 17:23:10 -04:00
thePR0M3TH3AN 06ca51993a Add KDF config with per-file metadata 2025-08-19 09:53:46 -04:00