Skip to content

Design for Yahoo Mail integration#93

Open
hughdbrown wants to merge 2 commits intowesm:mainfrom
hughdbrown:feature-yahoo-mail
Open

Design for Yahoo Mail integration#93
hughdbrown wants to merge 2 commits intowesm:mainfrom
hughdbrown:feature-yahoo-mail

Conversation

@hughdbrown
Copy link
Contributor

PRD: docs/design/yahoo-mail-prd.md
detailed task breakdown: docs/design/yahoo-mail-tasks.md

PRD: docs/design/yahoo-mail-prd.md
detailed task breakdown: docs/design/yahoo-mail-tasks.md
- **Functions:**
- `SelectFolder(ctx context.Context, folder string) (*FolderStatus, error)` — SELECT folder, return message count + UIDVALIDITY
- `SearchUIDs(ctx context.Context, criteria *SearchCriteria) ([]uint32, error)` — SEARCH command, returns UIDs
- `FetchMessages(ctx context.Context, opts FetchOptions) ([]*RawMessage, error)` — FETCH BODY.PEEK[] + INTERNALDATE + FLAGS + RFC822.SIZE for UIDs in batches
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 App password stored in plaintext in config file (high severity)

The PRD specifies storing Yahoo App Passwords in plaintext in ~/.msgvault/config.toml. This creates a second location (beyond tokens/) where credentials exist unencrypted. If the config file has incorrect permissions (not 0600), this exposes full IMAP access. The implementation should either encrypt app passwords at rest or exclusively store them in the tokens/ directory with enforced 0600 permissions, never in the config file.


Automated security review by Claude 4.5 Sonnet - Human review still required

- **File:** `cmd/msgvault/cmd/addaccount.go` (modify)
- **Changes:**
- Add `--provider` flag (string, default `"gmail"`, choices: `"gmail"`, `"yahoo"`)
- Add `--app-password` flag (string, hidden from help output for security)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ App password accepted via CLI flag without warning (medium severity)

The --app-password CLI flag allows passing credentials on the command line, which exposes them in shell history and process listings visible to other users. The implementation should print a security warning when this flag is used and recommend using environment variables or the config file instead. Consider marking the flag as deprecated in favor of more secure methods.


Automated security review by Claude 4.5 Sonnet - Human review still required

{
"folders": {
"INBOX": {"uidvalidity": 12345, "last_uid": 67890},
"Sent": {"uidvalidity": 12346, "last_uid": 45678}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Environment variable may expose password in logs (medium severity)

MSGVAULT_YAHOO_APP_PASSWORD as an environment variable can leak credentials if the process environment is logged during error handling or debugging. The design should explicitly document that this variable must never be logged and implement environment variable sanitization in all logging code paths to strip credentials before output.


Automated security review by Claude 4.5 Sonnet - Human review still required

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Security Review: 3 High/Medium Issues Found

Claude's automated security review identified potential security concerns. Please review the inline comments.

Note: This is an automated review. False positives are possible. Please review each issue carefully and use your judgment.


Powered by Claude 4.5 Sonnet

Remove plaintext password from config file, remove --app-password CLI
flag, use interactive terminal prompt with echo suppression instead.
Add security callout for credential-at-rest storage as open issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- **Encrypted token file** — encrypt the token file with a user-supplied passphrase or a machine-derived key. Adds UX friction (passphrase prompt on every sync) unless a key agent is used.
- **Status quo** (0600 file permissions) — acceptable for single-user machines, insufficient for shared systems.

This is a pre-existing concern that also applies to Gmail OAuth refresh tokens, but adding a second credential type makes it more pressing to resolve.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 App Password stored as plaintext in token file (high severity)

The design stores Yahoo App Passwords as plaintext JSON in ~/.msgvault/tokens/ with only 0600 file permissions. While the PRD acknowledges this as an open issue, the current design proceeds with plaintext storage. This exposes credentials to any process running as the same user, malware with user-level access, or backup systems. Consider implementing OS keyring integration (macOS Keychain, GNOME Keyring, Windows Credential Manager) before merging, or at minimum encrypt token files with a key derived from user credentials.


Automated security review by Claude 4.5 Sonnet - Human review still required

- **Changes:**
- Add `--provider` flag (string, default `"gmail"`, choices: `"gmail"`, `"yahoo"`)
- **No `--app-password` CLI flag** — CLI flags are visible in shell history and process listings, exposing credentials to other users. This is a deliberate omission.
- When `provider == "yahoo"`:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Environment variable exposes credentials in process list (medium severity)

MSGVAULT_YAHOO_APP_PASSWORD environment variable can leak credentials through /proc filesystem, Docker logs, CI logs, or shell command history when exported. While the design prints a warning, environment variables are inherently insecure for secrets. Consider requiring the interactive prompt for all non-automation use cases and documenting secure alternatives like reading from stdin for scripts (e.g., echo "$PASSWORD" | msgvault add-account --provider yahoo --password-stdin).


Automated security review by Claude 4.5 Sonnet - Human review still required


## Stage 5: Testing and Polish

**Deliverable:** Production-ready feature with integration tests, documentation, and error handling hardening.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Log sanitization requirement not enforced architecturally (medium severity)

Task 5.3 requires manual log sanitization to prevent App Password leakage, but relies on developer discipline rather than structural protection. The imap.Config struct should use a custom type (e.g., SecretString) that implements String() as "[REDACTED]" to prevent accidental logging via fmt.Printf, error wrapping, or panic traces. Without this, any future developer adding logging statements could inadvertently expose credentials.


Automated security review by Claude 4.5 Sonnet - Human review still required

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Security Review: 3 High/Medium Issues Found

Claude's automated security review identified potential security concerns. Please review the inline comments.

Additionally:

  • 1 low severity issue(s) were skipped to reduce noise

Note: This is an automated review. False positives are possible. Please review each issue carefully and use your judgment.


Powered by Claude 4.5 Sonnet

@wesm
Copy link
Owner

wesm commented Feb 6, 2026

Feel free to not take the security review very seriously, I set this up to protect against malicious code

@hughdbrown
Copy link
Contributor Author

@wesm heh. I am using it as motivation to make changes in roborev:

  • adding a design review skill
  • getting roborev review to evaluate design docs and code

See a coming PR.

@roborev-ci
Copy link

roborev-ci bot commented Feb 9, 2026

roborev: Combined Review

Summary: Security-relevant design gaps remain; address storage-at-rest and env var guidance before proceeding.

Critical

  • None.

High

  • docs/design/yahoo-mail-prd.md (“⚠️ Open issue — Credential storage at rest” section): Plaintext storage of Yahoo App Passwords in ~/.msgvault/tokens/{email}.json (0600) is a concrete risk for local compromise or backup leakage. The design calls it out but doesn’t commit to mitigation. Recommended: mandate secure storage (OS keyring or encrypted store) and scope it into the plan.

Medium

  • docs/design/yahoo-mail-prd.md (“Security considerations” under Authentication): MSGVAULT_YAHOO_APP_PASSWORD is allowed for automation, but guidance only warns for interactive use. Env vars can leak in CI/CD via logs, dumps, or process lists. Recommended: add explicit CI/CD guidance and recommend platform secrets managers.

Low

  • docs/design/yahoo-mail-tasks.md (“5.3 Error handling hardening”): Log redaction is planned but lacks explicit tests. Recommended: add a unit test that forces an error and asserts the password never appears in logs/errors.

Synthesized from 4 reviews (agents: codex, gemini | types: security, review)

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.

2 participants