Skip to content

feat(ai): add AI-assisted type detection with GDPR consent - #22

Merged
f3rdy merged 3 commits into
masterfrom
feature/19-detect-types-ai
Mar 13, 2026
Merged

f3rdy merged 3 commits into
masterfrom
feature/19-detect-types-ai

Conversation

@f3rdy

@f3rdy f3rdy commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase 2 of #19: AI-assisted vault entry type detection with security and GDPR compliance.

  • ai_detect.py: AI client module with:
    • Mandatory redaction (all data passes through redact_vault_data())
    • Exception firewall (no secrets in error messages)
    • TLS enforcement (HTTPS required for remote, HTTP only for localhost/Ollama)
    • Untrusted response parsing (JSON string literals only, no eval)
    • Phase 1 / AI result merging (local heuristics take priority)
  • config.py: AIConfig dataclass with endpoint, model, api_key_cmd, consent state
  • CLI flags: --ai, --show-payload, --yes (skip consent for CI)
  • GDPR consent flow: Interactive disclosure of what data is sent, to where, with opt-in
  • Graceful fallback: AI failure falls back to Phase 1 local heuristics

Security measures (from security review):

  • API key resolved via command (never stored in config, never logged)
  • No vault secrets in any error message or exception
  • Payload hash for audit trail
  • Data minimization: only key names, field names, Phase 1 hints sent

Closes #19

Test plan

  • 23 unit tests for ai_detect.py (payload building, endpoint validation, API key, response parsing, result merging)
  • 3 CLI integration tests (show-payload, ai-no-config fallback, consent prompt)
  • No secrets in --show-payload output verified
  • All 174 tests pass
  • mypy strict + ruff clean

f3rdy added 3 commits March 13, 2026 08:20
Phase 2 of #19: AI-assisted vault entry type detection

- ai_detect.py: AI client with mandatory redaction, exception firewall,
  TLS enforcement (HTTPS for remote, HTTP only for localhost/Ollama),
  untrusted response parsing, and Phase 1/AI result merging
- config.py: AIConfig dataclass with endpoint, model, api_key_cmd,
  consent state and timestamp
- cli.py: --ai flag with GDPR consent prompt, --show-payload for
  audit, --yes for CI automation, graceful fallback on AI failure
- Security: no secrets in error messages, API key never logged,
  all data passes through redact_vault_data() before transmission
@f3rdy
f3rdy force-pushed the feature/19-detect-types-ai branch from 9dce27f to 717dc57 Compare March 13, 2026 07:20
@f3rdy
f3rdy merged commit da4a4af into master Mar 13, 2026
2 checks passed
@f3rdy
f3rdy deleted the feature/19-detect-types-ai branch March 13, 2026 07:22
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.

feat: vault entry type auto-detection (local heuristics + AI-assisted with redaction)

1 participant