mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-21 07:55:08 +00:00
Addresses review findings: - Remove insecure automatic encrypted-file credential-store fallback. now only uses real OS/keyctl-backed stores, or remains unavailable. Headless users must use explicit HERMES_KEYSTORE_PASSPHRASE if desired. - Add shared wallet runtime so tools/CLI/approval use the same configured providers and persisted policy state. - Inject keystore-backed secrets into gateway/headless startup too, so migrated .env stubs don't break messaging deployments. - Persist wallet policy state (freeze, daily totals, rate-limit timestamps, cooldown timestamps) across invocations. - Persist transaction history to disk across invocations. - Make owner-approved sends execute through the same runtime/policy path and record policy state after successful approved sends. - Fix wallet export by allowing explicit CLI export reads of sealed keys via dedicated requester path () instead of generic CLI reads. - Make CLI wallet sends evaluate policy before execution and honor freeze. - Align docs with actual crypto primitive (XSalsa20-Poly1305 via SecretBox) and current policy-config scope. Validation: - 129 tests passing - freeze persistence verified manually - wallet export verified manually
32 lines
1 KiB
Python
32 lines
1 KiB
Python
"""Security-focused tests for credential store behavior."""
|
|
|
|
import importlib
|
|
from unittest.mock import patch
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _reset_cache():
|
|
import keystore.credential_store as cs
|
|
cs._cached_backend = None
|
|
cs._detection_done = False
|
|
yield
|
|
cs._cached_backend = None
|
|
cs._detection_done = False
|
|
|
|
|
|
def test_no_insecure_encrypted_file_auto_fallback_when_no_real_backend():
|
|
"""If keyring/keyctl are unavailable, remember backend must be unavailable.
|
|
|
|
An automatically selected machine-derived encrypted file would be derivable
|
|
by the same-user agent process and would collapse the keystore boundary.
|
|
"""
|
|
import keystore.credential_store as cs
|
|
|
|
with patch.dict("sys.modules", {"keyring": None}):
|
|
with patch("subprocess.run", side_effect=OSError("not found")):
|
|
importlib.reload(cs)
|
|
assert cs.backend_name() is None
|
|
assert cs.is_available() is False
|
|
assert cs.store_passphrase("secret") is False
|