remove the get_host_journal MCP tool and its capability
swarm-logs covers every host-tier unit this tool could reach, so the second, capability-gated path into host journald earns nothing and is removed outright rather than disabled behind a flag. Removed end to end: the MCP tool definition + handler, the GetHostJournal/HostJournal wire variants, hive-c0re's dispatch_host_journal handler, the ReadHostJournal capability, and the harness-side capability->--allowedTools gate. get_host_journal was the only capability that mapped to an MCP tool, so allowed_capability_tools could only ever return an empty vec; it goes too rather than linger as a function that provably does nothing. capabilities::has_cap/caps_for stay: #4624 gave ManageRootAgent's bind-mount enforcement (hive-c0re/src/lifecycle/host_config.rs) a second caller of has_cap, so they're no longer callerless once this lands on top of it. hive-sh4re's journal module (JournalPriority) had no consumer outside this tool and is deleted. An existing capabilities.json still naming read_host_journal does not error: capabilities::prune_unknown drops unrecognised names with a warn!, and an agent left with no capabilities has its entry removed. No migration step is needed. Untouched: hive-c0re/src/dashboard/journal.rs's read_host_journal_response, which matches the name but is the private helper behind the operator-only GET /api/journal-host dashboard route and carries no capability check.
This commit is contained in:
parent
eec908bdb7
commit
11097ed336
18 changed files with 21 additions and 401 deletions
|
|
@ -1,41 +0,0 @@
|
|||
//! Journal-priority encoding for `GetHostJournal` (`read_host_journal`
|
||||
//! capability). One small enum, own topic module rather than a
|
||||
//! catch-all — see `hive-sh4re/README.md`'s module list.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Syslog priority levels for `GetHostJournal`. Serialised as lowercase
|
||||
/// strings matching journalctl `-p` accepted values.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, schemars::JsonSchema)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum JournalPriority {
|
||||
Emerg,
|
||||
Alert,
|
||||
Crit,
|
||||
Err,
|
||||
Warning,
|
||||
Notice,
|
||||
Info,
|
||||
Debug,
|
||||
}
|
||||
|
||||
impl JournalPriority {
|
||||
/// Returns the lowercase string journalctl expects for `-p`. Named
|
||||
/// `as_journald_str` (not `as_str`) because this is a specific
|
||||
/// external-tool encoding, not the enum's general wire/db string —
|
||||
/// distinct call sites shouldn't reach for this by accident when they
|
||||
/// actually want the serde wire representation.
|
||||
#[must_use]
|
||||
pub fn as_journald_str(self) -> &'static str {
|
||||
match self {
|
||||
Self::Emerg => "emerg",
|
||||
Self::Alert => "alert",
|
||||
Self::Crit => "crit",
|
||||
Self::Err => "err",
|
||||
Self::Warning => "warning",
|
||||
Self::Notice => "notice",
|
||||
Self::Info => "info",
|
||||
Self::Debug => "debug",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@ pub mod assets;
|
|||
pub mod bash_task;
|
||||
pub mod container;
|
||||
pub mod inbox;
|
||||
pub mod journal;
|
||||
pub mod manager;
|
||||
pub mod paths;
|
||||
pub mod permissions;
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ impl ToolGroup {
|
|||
}
|
||||
|
||||
/// Per-agent capability grants. Stored in `meta/capabilities.json`
|
||||
/// (same shape as `tool-groups.json`: `{ "alice": ["read_host_journal"] }`).
|
||||
/// (same shape as `tool-groups.json`: `{ "alice": ["manage_root_agent"] }`).
|
||||
/// Capabilities control system-level access hive-c0re enforces at
|
||||
/// dispatch time; they are orthogonal to tool groups (which control
|
||||
/// which MCP tools the harness exposes to claude).
|
||||
|
|
@ -382,17 +382,12 @@ pub enum Capability {
|
|||
/// into an unrecognised name that `capabilities::prune_unknown`
|
||||
/// silently drops.
|
||||
ManageRootAgent,
|
||||
/// Agent can read the full host journal via `GetHostJournal`.
|
||||
/// hive-c0re checks this capability before running journalctl.
|
||||
/// MCP tool `get_host_journal` is only registered in the harness
|
||||
/// when this capability is present.
|
||||
ReadHostJournal,
|
||||
}
|
||||
|
||||
impl Capability {
|
||||
/// Every known capability in a stable order. Use this to enumerate
|
||||
/// columns in the permissions UI or validate incoming capability strings.
|
||||
pub const ALL: &'static [Self] = &[Self::ManageRootAgent, Self::ReadHostJournal];
|
||||
pub const ALL: &'static [Self] = &[Self::ManageRootAgent];
|
||||
|
||||
/// Short human-readable description suitable for a tooltip or help text.
|
||||
#[must_use]
|
||||
|
|
@ -401,7 +396,6 @@ impl Capability {
|
|||
Self::ManageRootAgent => {
|
||||
"manage any agent: every agent's state (rw) and config (ro) mounted for recovery"
|
||||
}
|
||||
Self::ReadHostJournal => "read host journald via get_host_journal MCP tool",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue