Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: refuse new agents named hive-<anything>

`hive-<hive>` is each hive's read-only forge account, and an agent's forge
account takes the agent's name, so an agent called `hive-<x>` would claim
hive `<x>`'s account. `hive_types::reserved_agent_prefix_violation` names
the rule, and `broken_name_rules` applies it, so both creation paths that
go through it (`POST /api/agents` and placing an undeclared agent on a
hive) refuse such a name for a new agent. An agent already in the roster
keeps its name with a warning, as for every other naming rule.

The email check between hive and agent accounts stays as the second
guard, for agents created before this rule.

Refs #4851
This commit is contained in:
atlas 2026-10-07 21:05:21 +02:00
commit 4e7142ae53
5 changed files with 78 additions and 13 deletions

View file

@ -58,12 +58,13 @@ creates what's missing and re-mints a token that's missing or no longer
matches the forge. A pass whose store or forge reads fail queues nothing, so
an outage never rotates every hive's token.
The account name isn't reserved, so an agent may carry the name `hive-<x>` too.
swarm-controller creates the hive's account with the email
`hive-<hive>@hives.hyperhive.local` and refuses an account by that name with
any other email: it never adds an agent's account to the team or mints a
token for it. An agent's own creation refuses the hive's account the same
way.
swarm-controller refuses to create an agent whose name starts with `hive-`:
these accounts own that prefix. An agent that already had such a
name keeps it, so the accounts are also told apart by email. swarm-controller
creates the hive's account with the email `hive-<hive>@hives.hyperhive.local`
and refuses an account by that name with any other email: it never adds an
agent's account to the team or mints a token for it. An agent's own forge
account setup refuses the hive's account the same way.
hive-c0re reads the token with `forge::reader_token()`, under the hive's own
store certificate, every time it reads the forge. Where the store holds none,