Commit Graph

14 Commits

Author SHA1 Message Date
Maciej Lisiewski
7d94f141b7 fix(a2a): put push callbacks behind the shared SSRF guard
is_safe_callback_url compared the host text against private prefixes, so
integer/hex IPv4 literals (http://2852039166/) and DNS names resolving to
metadata or RFC1918 passed; urlopen then followed redirects the check never
saw and re-resolved the name for the socket.

Non-loopback callbacks now go through tools.url_safety: is_safe_url for the
pre-flight (resolves and checks every answer) and create_ssrf_safe_client for
the POST (connect-time re-validation, dials the vetted IP). Redirects are not
followed. Loopback stays allowed only in localhost-only mode, proxy-free.
create_ssrf_safe_client joins the published plugin API next to its async twin.

Fixes #126755
2026-11-13 16:56:09 +01:00
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
Teknium
9788899694 fix(plugins): publish the path-check and YAML helpers reviews tell authors to use
Catalog reviews ask plugin authors to refuse credential paths with
agent.file_safety.get_read_block_error / raise_if_read_blocked and to read
YAML with hermes_yaml (core ships no PyYAML). `hermes plugins validate`
then warned on exactly those imports as "private core imports", so an
author who followed the review got a warning for doing so.

- plugin_api.json lists the four file_safety checks and
  hermes_yaml.safe_load/safe_dump; public-api.md regenerated.
- plugins/index.md gains a short section with the table and an example.
- boundary_lint baseline drops the 7 bundled-plugin crossings that are now
  public (no other line changes).
- Test: the guide's example validates clean, while a whole-module
  `import agent.file_safety` still warns. Red on main.
2026-11-11 22:17:18 -08:00
Teknium
bf77c21427 fix(gateway): picker cards and the /update prompt answer only to their opener
A picker card (/model, /reasoning, /fast, the usage-limit switch offer)
and the /update Yes/No prompt only checked the chat allowlist on a tap,
and a pending /update prompt took the next message ANY admitted member
sent in the session as its answer. In a shared group with
group_allow_admin_from set, a member refused /reasoning or /model could
tap the admin's open card and apply it, and anyone's chat text answered
the admin's "Restore local changes now?".

The gateway now records the opener (sender id, name, chat scope) when it
sends the card (prompt_authority on the selection callback) and in the
/update pending marker. Every renderer refuses another member's tap with
the existing localized "Only <name> can answer this approval." note and
leaves the card open: Telegram mp:/cp:/update_prompt:, Discord
ModelPickerView/ChoicePickerView/UpdatePromptView (one _gate), Slack
model picker (ephemeral), Matrix picker reactions, Feishu choice picker
and update card (toast). A non-opener's typed text during a pending
/update prompt falls through as an ordinary message. The check is
gateway.approval_actor.may_answer, the same rule exec approvals use:
the opener and the chat scope's admins always pass; a sender-less card
(shared observed route) keeps the old anyone-admitted behaviour.

QQBot's update button already accepts only the session's own user.
picker_refusal / update_prompt_refusal join approval_refusal in the
published plugin API so platform plugins can apply the same check.
2026-11-10 14:06:57 -08:00
unsupportedpastels
f0557ff9a6 feat: expose conversation-scoped platform model picker catalogs
Keep raw endpoint matching and config inputs inside core; return detached presentation rows. Share profile-scoped resolution with the display accessor and persisted-pick fallback. Custom endpoint live probes are disabled to avoid config writes.
2026-11-10 09:16:04 -05:00
unsupportedpastels
e0f3723ada feat(platforms): expose read-only session model settings
Add a detached display snapshot for Inline's native conversation settings sheet without exposing credentials or allocating sessions. Keep the legacy override view unchanged.

Verification: canonical focused runner, 4 workers, 51 passed; unchanged base plus new tests: 35 passed, 16 failed for the missing accessor. scripts/check: 15 checks ok; boundary lint: exit 0. Pre-commit hook unavailable (just not installed); equivalent lint gates run directly.
2026-11-10 09:16:04 -05:00
unsupportedpastels
a2eb175f62 feat(plugins): publish the browser-vault seams LoginBackend, VaultItemMeta and BrowserPageBackend on the plugin API
browser-vault-plugin.md tells plugin authors to subclass LoginBackend, return VaultItemMeta and
subclass BrowserPageBackend, and ctx.register_login_backend / register_browser_page_backend accept
only instances of those classes, yet hermes plugins validate warned on all three imports. List them
name-only in plugin_api.json, regenerate public-api.md and drop their docs import seam entries.
LocalEnvironment stays a seam: it is the host implementation class, not a stable base.
2026-11-09 22:18:11 -05:00
Teknium
d1aed60ec1 fix(gateway): slash confirms and clarify questions answer only to their requester
#152125 bound shared-chat exec approvals to the requester (or
approvals.approvers / the platform admins), but the other prompts a chat
member can answer for someone else stayed open: another member could press
"Always" on a relay or native /reload-mcp confirmation and run its handler,
or answer the agent's clarify question (a choice button, "Other", or a typed
reply) for the person who asked.

Both prompts now record the same authority an exec approval records when
raised (tools.approval_context.prompt_authority: the turn's actor, else the
command's sender, plus approvals.approvers and the chat type), and every
chat answer path checks it through gateway.approval_actor.may_answer:

- relay prompt_response (gateway/relay/prompt_resolvers.prompt_refusal),
  with the bot-owning profile's admins as for exec approvals;
- Telegram, Discord, Slack, WhatsApp Cloud and Feishu button callbacks
  (slash_confirm_refusal / clarify_refusal, published on the plugin API
  beside approval_refusal);
- the runner's typed-reply intercepts (/always, "2", free text after
  "Other"); another member's text is routed as their own message.

A refused tap gets the existing "Only <name> can answer this approval."
and the prompt stays pending. A turn merged from two senders records no
requester, so only approvers and admins can answer, as for approvals.
The default approvers ["*"] keeps today's behaviour.

Supersedes the slash_confirm/clarify half of #72008, whose session-owner
mechanism no longer applies on main (main records the requester itself).

Co-authored-by: necoweb3 <65560494+necoweb3@users.noreply.github.com>
2026-11-09 17:07:28 -08:00
Teknium
466591fe65 fix(gateway): opt-in approvals.approvers binds shared-chat exec approvals to the requester on every platform
Some checks failed
Live provider canaries / Live provider canaries (push) Has been cancelled
Carries #144799 rebased onto #151023's request-bound approval cards (one
squashed commit, because #151023 rewrote the same resolver, card and
adapter paths that #144799's eight commits patched one by one).

With `approvals.approvers: []`, an approval raised by one person's message
can only be answered by that person, a listed approver or a platform admin;
anyone else who taps Allow/Deny, reacts or sends /approve gets a private
"Only <name> can answer this approval." and the command stays pending. The
default stays `["*"]` (any admitted member answers), unchanged from main.

How it sits on #151023:
- tools/approval.py::resolve_gateway_approval_card takes #144799's
  signature (actor_id, admin_ids, extra) with #151023's body: a tap with no
  request id resolves nothing, and a Deny-only card can only deny.
- _ApprovalEntry carries both `authority` (#144799) and `card_deny_only`
  (#151023).
- Discord, Matrix and Telegram card handlers check the requester first,
  then settle through the request-bound resolver; the Telegram refusal
  toast goes through #151004's expired-query-safe answer_callback.
- #144799's tests that seeded id-less cards and expected the oldest
  request to settle now seed the real request id.
- Relayed approval answers check the bot-owning profile's admins;
  identical approvals coalesce only under the same answerers.

Fixes #80281
2026-11-08 22:46:20 -08:00
unsupportedpastels
d0b49116ec feat(gateway): a client can name itself on session.create
A third-party client can now say who it is: session.create takes an optional
client {name, version?}. It is attribution only. source still picks the
policy, and no toolset, approval, permission, prompt text or telemetry reads
the label.

- Validated beside the editor check (bounded, safe charset); a malformed value
  is invalid_params on field client.
- Kept inside the frozen creation request, so there is no new column, receipt
  key or policy field: an older owner restores the session, and the label is
  part of the exact-retry identity.
- session.info.client echoes it (absent when none was sent); runtime.describe
  lists client in session_create.parameters and capability session-client-v1.
- Plugins read it with hermes_cli.plugin_session.session_client() (published
  in plugin_api.json) and the client / client_version keys of prompt-section
  session info ("" when none). No PluginContext method, no hook kwarg.
- The classic CLI's /new copies the frozen launch request but never the
  creating client's label: the new session belongs to the terminal.
- Contracts regenerated; docs say the label is self-declared and must never
  grant anything.
2026-11-06 20:48:57 -05:00
alt-glitch
79109635df feat(plugins): redact_sensitive_text is public plugin API
A plugin that sends user text to a model (ctx.llm) needs to mask the
secrets in it first. agent.redact.redact_sensitive_text does that, but
it was a private import, so `hermes plugins validate` warned on it.

List it in hermes_cli/data/plugin_api.json and regenerate the public
API page. A plugin can redact any text with it, which a `redact=` param
on ctx.llm would not give, and it adds no new parameter semantics.
plugin-llm-access.md documents when to pass force=True.
2026-11-06 20:38:46 -05:00
unsupportedpastels
26f1f47fca refactor(plugins): name the PluginContext module plugins_context.py
Rename hermes_cli/plugin_context.py to hermes_cli/plugins_context.py (and its
test to tests/hermes_cli/test_plugins_context.py) so it sits in the
plugins_<topic>.py sibling family that the facade grep convention covers.
Regenerate the plugin_api.json source label and public-api.md.

Stop re-exporting _ignore_after_abandoned_load from hermes_cli.plugins:
nothing reads it through the facade, and internal moves do not get shims.
2026-11-06 12:44:35 -05:00
unsupportedpastels
1f96e0fb03 refactor(plugins): move PluginContext into hermes_cli/plugin_context.py
hermes_cli/plugins.py was 2,163 lines, about 800 of them the PluginContext
class. The class, its setattr-built provider registrars and the
abandoned-load guard loop now live in hermes_cli/plugin_context.py;
plugins.py drops to 1,345 lines.

hermes_cli.plugins keeps re-exporting PluginContext, _UNSET and
_ignore_after_abandoned_load, and every name it imported before is still
imported there. Functions and classes the ctx methods call
(load_config_readonly, _plugin_settings_entry, get_hermes_home, PluginState,
PluginToolOverrideError, ...) are read from hermes_cli.plugins at call time,
so a monkeypatch on the facade still reaches ctx methods. Log records keep
the hermes_cli.plugins logger name, and typing.get_type_hints on
PluginContext.__init__ still resolves PluginManager.

The public plugin API list names the new file as PluginContext's source.
2026-11-06 12:44:35 -05:00
unsupportedpastels
0502fe0597 feat(plugins): one published list of what plugins may import
The public list `hermes plugins validate` checks plugin imports against
was a hardcoded frozenset inside hermes_cli/plugin_validate_private_imports.py,
with no page that showed it to plugin authors.

Move the list, unchanged (89 entries), into hermes_cli/data/plugin_api.json
(already shipped as package data via `data/*.json`) and load it once in the
validator. scripts/gen_plugin_api_docs.py renders
website/docs/developer-guide/plugins/public-api.md from the same file, and a
test fails when the page is stale. Validate output is unchanged for the same
inputs.
2026-11-05 18:47:10 -05:00