test: close stress/performance/security gaps for migrate + auth key (musehub#221 follow-up)
Audited coverage against test_auth_rotate.py -- the closest sibling command, which has explicit Stress/Performance/Security sections -- and found this session's new work (migrate hub-scoping fixes, muse auth key list/delete) had unit/integration/e2e-by-this-codebase's-definition coverage but no equivalent Stress or Performance sections, and a thinner Security section than the precedent set.
Fixed two real gaps found while writing the security tests: - run_key_delete's non-JSON success print echoed key_id/fingerprint (hub-controlled and CLI-arg values respectively) without sanitize_display -- a malicious/compromised hub could inject terminal escapes via label/key_id text. Same gap in run_key_list's per-key print loop. Both now sanitize every hub-sourced or arg-sourced field before printing, matching how every other auth command already handles hub-controlled display strings.
Added, mirroring test_auth_rotate.py's TestRotateStress/ TestRotatePerformance/TestRotateSecurity structure:
- TestMigrationStress / TestKeyStress: 20 hub entries migrated in one run with no cross-contamination between results; repeated dry-run and key list calls are deterministic; 10 sequential key deletes each target the correct distinct key_id. - TestMigrationPerformance / TestKeyPerformance: dry-run, live-run (stubbed hub), key list, and key delete each complete under 500ms, matching rotate's existing budget. - TestMigrationSecurity / TestKeySecurity: mnemonic never appears in --json output (dry-run and live-run); no PEM ever written by migration or key list/delete; a hub response exceeding the shared 1 MiB bound fails closed rather than being processed (confirms the migration path actually flows through the bounded _json_post_raw/_hub_get, not a bespoke unbounded parse); an ANSI/OSC escape sequence in a hub-controlled key label is stripped from terminal output, not echoed raw.
Docs: added `muse migrate hub-scoping` and `muse migrate domain-integers` to agent-guide.md's command reference table (including --hub and --no-register) -- neither was ever listed there, even before this session's changes; the table is the canonical trigger-phrase lookup every future session loads via CLAUDE.md's @include.
Tests: 173/173 across migrate hub-scoping/domain-integers + auth key + rotate + register-integrity.
Semantic Changes
28 symbols
0 comments
muse hub commit comment sha256:61dbe1cc1d20bde7f272f0eac47aafcf5748b034ca85d052183985e9d2bbaabe --body "your comment"
No comments yet. Be the first to start the discussion.