fix(vault): validate origin and authenticator key as they are typed in `vault add` #136650
All Vouch review confidence checks passed
Residual risk 0.45 = Change Risk (0.78) × (1 − Review Confidence (0.42)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.78 · 511 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.373
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.078
Real PR Conversation Timeline
1 comments
"Review active on #136650"
general
weight: 0.35
PRATHAMESH75
What does this PR do?
hermes vault addvalidates the site origin and the authenticator key only insideVaultStore.add_item(), after every prompt has been answered — including the hidden password and 2FA key. A schemeless origin such asexample.comis accepted at its prompt, and the wizard then fails at the very end, so the user has to retype the whole item.Each validated field is now checked right where it is typed, with the same
normalize_origin/normalize_otp_secretthatadd_item()applies, and the wizard prints the cause and re-asks that field only.add_item()keeps its own validation, so non-interactive callers (Desktop RPC,browser_vault_save_login) are unchanged.Repro (temp
HERMES_HOME, real_cmd_add, scriptedinput/getpassanswers:site,example.com,https://example.com,email,user@example.com, password, empty 2FA):origin/main— the bad origin is accepted, the next answer lands in the wrong prompt, and the error only appears after the password and 2FA key:this branch:
Related Issue
Fixes #136673
Type of Change
Changes Made
hermes_cli/vault.py::_prompt_valid— new helper: reads a field, runs the validator, and onVaultErrorprints the message and re-prompts.hermes_cli/vault.py::_cmd_add— uses it for every fieldadd_item()validates beyond non-empty: the login origin, the authenticator key (still optional, Enter skips), and the payment/address origin.tests/hermes_cli/test_vault_add_inline_validation.py— two invariant tests (bad origin, bad authenticator key), each re-prompted before the next field and the item then stored; both fail onorigin/main.How to Test
1.
hermes vault add→ kindlogin→ enter an origin withouthttps://.2. The error prints immediately and the origin prompt repeats; same for an invalid authenticator key.
3.
scripts/run_tests.sh tests/hermes_cli/test_vault_add_inline_validation.pyChecklist
Code
pytest tests/ -qand all tests pass — viascripts/run_tests.sh: the vault files pass (54/54); on macOS the full suite also has failures in unrelated files (MCP, local jobs, web server, compaction) that fail the same way onorigin/mainor trip the home-I/O guard on a host-installed tool, none touch the vaultpython scripts/checkpassesinput/getpass, no platform-specific codeDocumentation & Housekeeping
cli-config.yaml.example— N/ACONTRIBUTING.mdorAGENTS.md— N/A🤖 Generated with Claude Code