Commit Graph

14 Commits

Author SHA1 Message Date
19a9e2a3df Fix test parallelism in e2e tests
Some checks failed
CI / build (1.21.x) (push) Has been cancelled
CI / build (1.22.x) (push) Has been cancelled
CI / security-scan (push) Has been cancelled
- Removed t.Parallel() from e2e tests that share global state
- Tests now run sequentially to avoid conflicts with cobra command initialization
- Ensures reliable test execution without race conditions
2026-05-04 02:08:02 -04:00
d53b8ec8bc FRE-4694: Add CLI command end-to-end tests
Add comprehensive e2e tests for all CLI commands with mocked API
responses. Fix test infrastructure to handle global state (os.Stdout
capture, HOME env var) and broken test parallelism in stdout-capturing
tests.

- Add testutil_test.go with runFreshCommand, setupE2E, mockAPIServer
- Add e2e_full_test.go with ~40 tests covering auth, mail, contacts,
  attachments, folders, labels, drafts, help output
- Add newRootCmdBase() for fresh command trees per test
- Remove t.Parallel() from stdout-capturing and HOME-dependent tests
- Fix SessionWithMockSession to use runFreshCommand (stdout capture)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-04 01:08:26 -04:00
a78c564e23 Add CI test stage with coverage reporting and test infrastructure
Some checks failed
CI / build (1.21.x) (push) Has been cancelled
CI / build (1.22.x) (push) Has been cancelled
CI / security-scan (push) Has been cancelled
- Updated .github/workflows/ci.yml to include:
  - Go module caching for faster builds
  - Coverage report generation and upload to Codecov
  - 80% coverage threshold check
- Created tests/ directory with integration test framework
- Added test fixtures and configuration
- Initial integration test passes

Related: FRE-8b42289c (Pop: Add CI test stage to workflow)
2026-05-03 20:38:29 -04:00
ced8204ef8 Add unit tests for PGP service (FRE-4692)
- 27 new tests covering all PGP service methods
- Fixes: armored public key in NewPGPService/GenerateKeyPair/EncryptBody,
  IsLocked check in getUnlockedKeyRing, aes256 cipher token in EncryptAttachment

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-03 19:21:18 -04:00
Senior Engineer
90bee9119e FRE-4693: Add integration tests for mail client
46 new integration tests covering all mail client operations:
- ListMessages: success, folder/starred/read/since filters, combined filters, API errors, bad JSON
- GetMessage: success, URL escaping, not found, decrypt body with PGP
- Send: success, PGP encryption, CC/BCC, HTTP errors, 201 status
- MoveToTrash: success, error handling
- PermanentlyDelete: success, error, URL escaping
- SaveDraft: success, CC/BCC, API error, bad JSON
- UpdateDraft: success, CC, conflict error
- SendDraft: success, error
- ListDrafts: success via ListMessages delegation
- SearchMessages: success, empty results, API error, bad JSON
- Auth header propagation, content-type headers
- Concurrent access safety, timeout handling
- Helper types: Folder.Name, Recipient.DisplayName, Message.Folder

Uses httptest.Server with configurable route handlers to mock ProtonMail API.
All 46 tests pass. 3 pre-existing pgp_test.go failures unchanged.
2026-05-03 17:34:27 -04:00
6cc520e221 docs
Some checks failed
CI / build (1.21.x) (push) Has been cancelled
CI / build (1.22.x) (push) Has been cancelled
CI / security-scan (push) Has been cancelled
2026-04-29 16:30:29 -04:00
Paperclip
0684e726bb FRE-681: Fix security review findings (3 HIGH, 3 MEDIUM, 2 LOW)
HIGH fixes:
- Access Token now used as PGP Passphrase: replaced session.AccessToken
  with session.MailPassphrase for all PGP operations
- Session stored encrypted in keyring and file (was plain JSON)
- Added checkAuthenticated() helper with IsAuthenticated() guard

MEDIUM fixes:
- Added MailPassphrase field to Session, collected during login
- Added email validation in LoginInteractive
- Added keyring cleanup on Logout
- Implemented RefreshToken with actual API call

LOW fixes:
- Added mutex to PGPKeyRing for thread safety
- Added ZeroPrivateKeyData() for memory cleanup
- Use net/mail.ParseAddress for proper recipient parsing
- Renamed internal/mail import to internalmail to avoid conflict
2026-04-28 12:40:09 -04:00
Senior Engineer
e499d16b7c FRE-681: Fix code review findings - body flag, PGP encryption, passphrase handling
- cmd/mail.go: Fix duplicate --body/--body-file flag binding (both used bodyFile)
- internal/mail/client.go: Add PGP encryption to Send via EncryptBody, add passphrase to MoveToTrash and SendDraft
- internal/mail/pgp.go: Store armored private key, add getUnlockedKeyRing helper,
  fix Decrypt/SignData/EncryptAndSign/DecryptAttachment to use passphrase via key.Unlock
- internal/mail/pgp.go: Add EncryptBody method for Send encryption with sender key
- cmd/draft.go: Update SendDraft call to include passphrase parameter
2026-04-28 10:08:33 -04:00
Paperclip
af25fd5575 FRE-682: Add folder/label management, search, and fix PGP build
- Add pop mail search CLI command with pagination support
- Create internal/labels package with types and API client
- Add folder list/create/update/delete CLI commands
- Add label list/create/update/delete/apply/remove CLI commands
- Register folder and label commands in root.go
- Fix gopenpgp v2 API mismatches in pgp.go (NewPlainMessage, Armor,
  KeyRing.Encrypt/Decrypt, SessionKey)
- Fix NewSessionManager error handling across cmd files
- Fix variable shadowing bug in mail/client.go
2026-04-28 06:37:47 -04:00
35d47733ea Auto-commit 2026-04-27 19:13 2026-04-27 19:13:03 -04:00
c1fc21702c Resolve FRE-762: FRE-734 recovered as false positive, Security Reviewer run was system-cancelled
Some checks failed
CI / build (1.21.x) (push) Has been cancelled
CI / build (1.22.x) (push) Has been cancelled
CI / security-scan (push) Has been cancelled
- FRE-734 (Review silent active run for Security Reviewer) marked done
- FRE-762 (Recover stalled issue FRE-734) marked done
- Source FRE-684 remains blocked by FRE-746
- Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-26 22:47:49 -04:00
f5fa35e5d3 FRE-681: Register mail draft command in root
Add mailDraftCmd() to root command to enable draft operations (save, list, edit, send)
2026-04-26 20:02:35 -04:00
7bbba9f15c FRE-683: Add contacts & attachments management
- Implemented contact CRUD operations (list, add, edit, delete)
- Implemented attachment management (list, upload, download)
- Created internal/contact/manager.go for contact persistence
- Created internal/attachment/manager.go for attachment storage
- Added CLI commands in cmd/contacts.go and cmd/attachments.go
- Integrated contact and attachment commands into root CLI

Files:
- internal/contact/types.go - Contact data models
- internal/contact/manager.go - Contact CRUD operations
- internal/attachment/manager.go - Attachment file operations
- cmd/contacts.go - Contact CLI commands
- cmd/attachments.go - Attachment CLI commands

Contacts stored in ~/.config/pop/contacts.json
Attachments stored in ~/.config/pop/attachments/
2026-04-26 10:26:29 -04:00
25836e27b9 FRE-680: Initial project scaffold with auth & API client
- Set up Go module with Cobra CLI skeleton
- Implemented login/logout/session commands with 2FA support
- Created ProtonMail API client with rate limiting
- Added config management for ~/.config/pop/
- Configured CI/CD pipeline with GitHub Actions
- Added Makefile for build/test/lint targets

Files:
- main.go, go.mod, go.sum
- cmd/root.go, cmd/auth.go
- internal/auth/session.go
- internal/config/config.go
- internal/api/client.go
- Makefile, README.md, .gitignore
- .github/workflows/ci.yml
2026-04-26 09:45:10 -04:00