feat: add remote trust and server identity pinning
Testing / remote-protocol-compat (0.16.0) (push) Successful in 1m1s
Testing / remote-protocol-compat (0.15.0) (push) Successful in 1m3s
Testing / test (push) Failing after 1m15s
Build & Publish Package / publish (push) Successful in 51s
Package Extension / package-extension (push) Successful in 1m6s
Testing / remote-protocol-compat (0.16.0) (push) Successful in 1m1s
Testing / remote-protocol-compat (0.15.0) (push) Successful in 1m3s
Testing / test (push) Failing after 1m15s
Build & Publish Package / publish (push) Successful in 51s
Package Extension / package-extension (push) Successful in 1m6s
- Add SSH-style server identity keys and known-host verification for remote serve endpoints. - Add remote add/list/remove commands for explicit endpoint persistence. - Fix remote clients listing to fan out through target discovery instead of ambiguous auto-routing. - Add URL glob matching for tabs filter and count with extension tests. - Add n8n credential pinning for server public keys or SHA256 fingerprints. - Remove obsolete compat shim behavior while keeping empty compat seams for future protocol changes. - Bump browser-cli to 0.16.4 and n8n node to 0.3.1. - Cover known-hosts, remote registry, compat seams, n8n protocol verification, and URL matching with tests.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import json
|
||||
|
||||
from click.testing import CliRunner
|
||||
|
||||
from browser_cli.commands.remote import remote_group
|
||||
from browser_cli.remote import registry as remote_registry
|
||||
|
||||
def test_save_remote_persists_endpoint_without_key(monkeypatch, tmp_path):
|
||||
path = tmp_path / "remotes.json"
|
||||
monkeypatch.setattr(remote_registry, "REMOTE_REGISTRY_PATH", path)
|
||||
|
||||
remote_registry.save_remote("browser-host.example:443")
|
||||
|
||||
assert json.loads(path.read_text(encoding="utf-8")) == {"browser-host.example": {}}
|
||||
|
||||
def test_save_remote_with_key_and_remove(monkeypatch, tmp_path):
|
||||
path = tmp_path / "remotes.json"
|
||||
monkeypatch.setattr(remote_registry, "REMOTE_REGISTRY_PATH", path)
|
||||
|
||||
remote_registry.save_remote("browser-host.example", "agent")
|
||||
|
||||
assert remote_registry.load_remotes() == {"browser-host.example": {"key": "agent"}}
|
||||
assert remote_registry.remove_remote("browser-host.example:443") is True
|
||||
assert remote_registry.load_remotes() == {}
|
||||
|
||||
def test_remote_add_list_remove_cli(monkeypatch, tmp_path):
|
||||
path = tmp_path / "remotes.json"
|
||||
monkeypatch.setattr(remote_registry, "REMOTE_REGISTRY_PATH", path)
|
||||
runner = CliRunner()
|
||||
|
||||
add_result = runner.invoke(remote_group, ["add", "browser-host.example", "--key", "agent"])
|
||||
list_result = runner.invoke(remote_group, ["list"])
|
||||
remove_result = runner.invoke(remote_group, ["remove", "browser-host.example"])
|
||||
|
||||
assert add_result.exit_code == 0
|
||||
assert "Added remote browser-host.example with key agent" in add_result.output
|
||||
assert list_result.exit_code == 0
|
||||
assert "browser-host.example" in list_result.output
|
||||
assert "agent" in list_result.output
|
||||
assert remove_result.exit_code == 0
|
||||
assert "Removed browser-host.example" in remove_result.output
|
||||
assert remote_registry.load_remotes() == {}
|
||||
Reference in New Issue
Block a user