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

@ -10,9 +10,12 @@
//! token the forge still lists with the same last eight characters and scopes
//! is kept, and a pass whose reads fail queues nothing.
//!
//! ⚠️ The account name is not reserved: an agent may be called `hive-<x>`.
//! Each side refuses an account carrying the other's email, so neither ever
//! locks down, joins the team with, or mints a token for the other's account.
//! A new agent may not be called `hive-<x>`
//! (`hive_types::reserved_agent_prefix_violation`, checked at agent creation),
//! which is the primary guard against an agent claiming a hive's account. An
//! agent created before that rule can still hold such a name, so each side
//! also refuses an account carrying the other's email: neither ever locks
//! down, joins the team with, or mints a token for the other's account.
use std::sync::Arc;