Files
hermes-agent/tests/hermes_cli/test_plugin_validate_credentialed_url.py
Teknium 4f2fd3b8c0 fix(plugin api): publish hermes_cli.urllib_security:open_credentialed_url
The redirect-safe opener (drops credential headers when a redirect leaves
the origin) is what plugins sending API keys should use, and the bundled
model providers already do; validate still warned on it as a private
import. List it in plugin_api.json with a short docs section, regenerate
public-api.md, and drop the three now-public crossings from the
boundary-lint baseline.
2026-11-12 22:33:52 -08:00

26 lines
913 B
Python

"""A plugin that sends credentials through ``open_credentialed_url`` — the redirect-safe opener the
plugin docs point to — gets no private-import warning from ``hermes plugins validate``."""
from __future__ import annotations
from pathlib import Path
import hermes_yaml as yaml
from hermes_cli.plugin_validate import validate_plugin_dir
def test_open_credentialed_url_import_is_public(tmp_path: Path):
root = tmp_path / "fetcher"
root.mkdir()
(root / "plugin.yaml").write_text(
yaml.safe_dump({"name": "fetcher", "version": "1.0.0", "description": "x"}), encoding="utf-8")
(root / "__init__.py").write_text(
"from hermes_cli.urllib_security import open_credentialed_url\n"
"def register(ctx):\n"
" pass\n", encoding="utf-8")
report = validate_plugin_dir(root)
assert [w for w in report.warnings if w.startswith("private core imports")] == []