Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
d83771b
fix(security): carve the account dir's secrets and privilege files ou…
mysma-9403 Oct 9, 2026
01d6e11
fix(security): report the approval gate's real arming state at boot
mysma-9403 Oct 9, 2026
040b607
fix(security): key the account-dir carve-out on the configured root, …
mysma-9403 Oct 9, 2026
09446ec
fix(security): take the account root through one constructor, and sco…
mysma-9403 Oct 11, 2026
a1a0939
Merge remote-tracking branch 'upstream/main' into fix/account-dir-int…
mysma-9403 Oct 11, 2026
8466344
fix(security): carry the account root through the call sites main add…
mysma-9403 Oct 11, 2026
34c0858
fix(security): describe the gate's arming by outcome, and carry the r…
mysma-9403 Oct 19, 2026
8ded193
test(security): assert the account root on the existing reload cycle,…
mysma-9403 Oct 19, 2026
0bc3e25
Merge upstream/main into fix/account-dir-internal-boundary
mysma-9403 Oct 19, 2026
f2bf195
fix(cron): drop the unreferenced scheduler retry file this branch res…
mysma-9403 Oct 19, 2026
b7f6b66
refactor(security): drop the account-root call this branch already ma…
mysma-9403 Oct 20, 2026
309e17b
Merge upstream/main into fix/account-dir-internal-boundary
mysma-9403 Oct 31, 2026
2f5eee0
test(security): import the pub(super) account constants explicitly
mysma-9403 Oct 31, 2026
0a5be68
Merge main into fix/account-dir-internal-boundary
M3gA-Mind Nov 9, 2026
f962944
Pass config straight to SecurityPolicy::for_config in write_dispatch
M3gA-Mind Nov 9, 2026
84eec3d
Build every config policy through for_config so none loses the accoun…
M3gA-Mind Nov 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,11 @@ impl SessionHostBuilder {
});
let hosted_base = definitions.map(|definitions| {
Arc::new(crate::agent::tinyagents::host::OpenHumanHostBase {
// A caller-supplied policy wins. Otherwise `hosted_config`'s own dirs
// were just set from these two, so this is the same policy plus the
// config's account root.
security_policy: security_policy.clone().unwrap_or_else(|| {
Arc::new(crate::security::SecurityPolicy::from_config(
&hosted_config.autonomy,
&workspace_dir,
&action_dir,
))
Arc::new(crate::security::SecurityPolicy::for_config(&hosted_config))
}),
config: Arc::clone(&hosted_config),
definitions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ impl OpenHumanSessionHost {
let runtime: Arc<dyn host_runtime::RuntimeAdapter> = Arc::from(
host_runtime::create_runtime(&config.runtime, config.shell.hide_window)?,
);
let security = Arc::new(SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
));
let security = Arc::new(SecurityPolicy::for_config(config));
let audit = crate::security::get_or_create_workspace_audit_sink(
config.audit.clone(),
config.workspace_dir.clone(),
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/artifacts/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,7 @@ async fn regenerate_presentation(

// A fresh policy from the live config — cheap, sync, and mirrors how
// the agent harness builds the same tool (see `tools::ops`).
let security = std::sync::Arc::new(SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
));
let security = std::sync::Arc::new(SecurityPolicy::for_config(config));
// The regenerate target is an explicit constructor argument of the tool
// that produces the artifact: its `create_artifact_regenerating` call
// reuses this id instead of minting a new one.
Expand Down
2 changes: 1 addition & 1 deletion crates/openhuman-core/src/attachments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub(crate) async fn thread_action_dir(
}

fn policy(config: &Config, root: &Path) -> SecurityPolicy {
let policy = SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, root);
let policy = SecurityPolicy::for_config_in(config, root);
*policy
.media_files_roots
.lock()
Expand Down
12 changes: 2 additions & 10 deletions crates/openhuman-core/src/attachments/provider_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ impl AttachmentModel {
.parent()?
.join(".openhuman-derived")
.join("readout.txt");
let policy = crate::security::SecurityPolicy::from_config(
&self.config.autonomy,
&self.config.workspace_dir,
&root,
);
let policy = crate::security::SecurityPolicy::for_config_in(&self.config, &root);
if !policy
.path_allowed(crate::security::policy::PathKind::ResolvedWrite, &cache)
.await
Expand Down Expand Up @@ -132,11 +128,7 @@ impl AttachmentModel {
};
let parent = cache.parent().expect("derivative parent");
let root = super::super::action_root(&self.config, scope);
let policy = crate::security::SecurityPolicy::from_config(
&self.config.autonomy,
&self.config.workspace_dir,
&root,
);
let policy = crate::security::SecurityPolicy::for_config_in(&self.config, &root);
if policy
.validate_parent_path(&cache.to_string_lossy())
.await
Expand Down
12 changes: 2 additions & 10 deletions crates/openhuman-core/src/attachments/provider_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,7 @@ impl AttachmentModel {
.join(id)
.join(super::super::filename(name));
let root = super::super::action_root(&self.config, scope);
let preliminary = crate::security::SecurityPolicy::from_config(
&self.config.autonomy,
&self.config.workspace_dir,
&root,
);
let preliminary = crate::security::SecurityPolicy::for_config_in(&self.config, &root);
preliminary
.validate_parent_path(&root.join(&relative).to_string_lossy())
.await
Expand All @@ -224,11 +220,7 @@ impl AttachmentModel {
let root = tokio::fs::canonicalize(root)
.await
.map_err(|e| tinyinference_llm::Error::Model(e.to_string()))?;
let policy = crate::security::SecurityPolicy::from_config(
&self.config.autonomy,
&self.config.workspace_dir,
&root,
);
let policy = crate::security::SecurityPolicy::for_config_in(&self.config, &root);
let path = root.join(&relative);
policy
.validate_parent_path(&path.to_string_lossy())
Expand Down
6 changes: 2 additions & 4 deletions crates/openhuman-core/src/channels/providers/relay/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,8 @@ pub(crate) async fn run_relay_turn(
}
};

let security = Arc::new(
SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir)
.with_privacy_mode(config.privacy.mode),
);
let security =
Arc::new(SecurityPolicy::for_config(&config).with_privacy_mode(config.privacy.mode));
let parts = match build_channel_turn_parts(
&dispatch_ctx,
&config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,9 @@ async fn start_channels_inner(mut config: Config, session: CancellationToken) ->
// and picked up by the next session.
let security = crate::security::live_policy::install(
Arc::new(
SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
)
.with_privacy_mode(config.privacy.mode),
SecurityPolicy::for_config(&config)
// `for_config` already attaches the config's account root.
.with_privacy_mode(config.privacy.mode),
),
config.workspace_dir.clone(),
config.action_dir.clone(),
Expand Down
7 changes: 4 additions & 3 deletions crates/openhuman-core/src/core/runtime/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ pub(crate) async fn bootstrap_core_runtime(
&workspace_dir,
&action_dir,
)
.with_privacy_mode(cfg.privacy.mode),
.with_privacy_mode(cfg.privacy.mode)
.with_account_dir(cfg.config_path.parent()),
),
workspace_dir.clone(),
action_dir,
Expand Down Expand Up @@ -345,8 +346,8 @@ pub(crate) async fn bootstrap_core_runtime(
let _ =
crate::security::approval::ApprovalGate::init_global(cfg.clone(), session_id.clone());
log::info!(
"[runtime] approval gate installed (on by default; set OPENHUMAN_APPROVAL_GATE=0 to disable, session_id={session_id}) — \
Prompt-class external-effect tool calls park for approval in interactive chat turns"
"[runtime] approval gate installed (on by default; set OPENHUMAN_APPROVAL_GATE=0 to disable, session_id={session_id}) — {}",
crate::security::approval::gate::arming_note(cfg.autonomy.enabled)
);
// (The approval/plan-review surface bridge is registered unconditionally
// above — it must run even when this gate-install branch is skipped.)
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/cron/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ pub async fn cron_update(
crate::core::runtime::components::require_config(config, "tinyflows")?;

if let Some(command) = &patch.command {
let security = SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
);
let security = SecurityPolicy::for_config(config);
crate::cron::scheduler::shell_job::authorize_shell_command(config, &security, command)
.await?;
}
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/cron/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ pub async fn run(ctx: &crate::core::runtime::DispatchCtx, config: Config) -> Res

let poll_secs = config.reliability.scheduler_poll_secs.max(5);
let mut interval = time::interval(Duration::from_secs(poll_secs));
let security = Arc::new(SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
));
let security = Arc::new(SecurityPolicy::for_config(&config));

BUS.publish(DomainEvent::SystemStartup {
component: "scheduler".to_string(),
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/cron/scheduler/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ async fn own_manual_run(
// Keep the invocation's CoreContext strongly pinned while Binding itself
// retains only a Weak reference. The task is the acyclic lifetime owner.
let _context_pin = ctx.core().cloned();
let security = Arc::new(SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
));
let security = Arc::new(SecurityPolicy::for_config(&config));
let binding = Binding::new(&ctx, &config, security);
let host = bus_host::register(binding.clone())
.await
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/cron/schemas/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ pub(super) fn handle_add(ctx: DispatchCtx, params: Map<String, Value>) -> Contro
let job = match job_type {
"shell" => {
let cmd = command.ok_or("'command' is required for shell jobs")?;
let security = crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
);
let security = crate::security::SecurityPolicy::for_config(&config);
crate::cron::scheduler::shell_job::authorize_shell_command(
&config, &security, &cmd,
)
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/flows/authoring_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,7 @@ impl ApprovalCallbacks {
use crate::security::SecurityPolicy;
use tinyflows_bus::catalog::{ManifestCandidate, ManifestClass};

let security = SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
);
let security = SecurityPolicy::for_config(&config);
async fn gated(
security: &SecurityPolicy,
class: CommandClass,
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/flows/caps_host/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,7 @@ pub(crate) async fn serve(
},
};
let ctx = ctx.with_turn_origin(origin);
let security = Arc::new(crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
));
let security = Arc::new(crate::security::SecurityPolicy::for_config(&config));
let approval = crate::security::approval::ApprovalTurnContext {
flow_run: Some(crate::security::approval::FlowRunContext {
flow_id: flow_id.clone(),
Expand Down
8 changes: 2 additions & 6 deletions crates/openhuman-core/src/hooks/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ async fn admit_command_hooks(ctx: &DispatchCtx, loaded: &mut HookConfig) {
// The configured privacy mode, not only the live one: hooks load
// before the live policy is installed, and with security off the
// local-only refusal of network commands reads the policy's mode.
crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
)
.with_privacy_mode(config.privacy.mode)
crate::security::SecurityPolicy::for_config(&config)
.with_privacy_mode(config.privacy.mode)
})
.map_err(|error| error.to_string());
let mut refused = Vec::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,7 @@ async fn validated_tts_output_path(
let candidate_string = candidate
.to_str()
.ok_or_else(|| "invalid output_path".to_string())?;
let mut policy = crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
);
let mut policy = crate::security::SecurityPolicy::for_config(config);
policy.trusted_roots.push(crate::security::TrustedRoot {
path: config.workspace_dir.display().to_string(),
access: crate::security::TrustedAccess::ReadWrite,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,7 @@ impl OpenHumanTurnPrelude {
.mcp_tools
.configured
.clone();
let security = Arc::new(crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
));
let security = Arc::new(crate::security::SecurityPolicy::for_config(config));
crate::tools::implementations::network::configured_server_tools_from_presentations(
config,
presentations,
Expand Down
6 changes: 2 additions & 4 deletions crates/openhuman-core/src/mcp/server/tools/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ async fn enforce_read_policy(ctx: &DispatchCtx, tool_name: &str) -> Result<(), T
)));
}
};
let policy =
SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir);
let policy = SecurityPolicy::for_config(&config);
// A policy denial *is* something the caller can act on (toggle autonomy,
// approve the tool) — keep that as `InvalidParams` so clients surface the
// reason text instead of a generic internal-error banner.
Expand All @@ -205,8 +204,7 @@ async fn enforce_act_policy(ctx: &DispatchCtx, tool_name: &str) -> Result<(), To
)));
}
};
let policy =
SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir);
let policy = SecurityPolicy::for_config(&config);
policy
.enforce_tool_operation(ToolOperation::Act, tool_name)
.await
Expand Down
3 changes: 1 addition & 2 deletions crates/openhuman-core/src/mcp/server/write_dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ pub(super) async fn enforce_write_policy_for_config(
tool_name: &str,
config: &Config,
) -> Result<(), ToolCallError> {
let policy =
SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir);
let policy = SecurityPolicy::for_config(config);
match policy
.enforce_tool_operation(ToolOperation::Act, tool_name)
.await
Expand Down
9 changes: 2 additions & 7 deletions crates/openhuman-core/src/mcp/ui/schemas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,8 @@ fn handle_tool_call(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerF
let arguments = params.get("arguments").cloned();
let confirmed = read_optional::<bool>(&params, "confirmed")?.unwrap_or(false);
let config = ctx.load_config().await?;
let security = crate::security::live_policy::current().unwrap_or_else(|| {
Arc::new(SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
))
});
let security = crate::security::live_policy::current()
.unwrap_or_else(|| Arc::new(SecurityPolicy::for_config(&config)));
let port = HostUiPort::new(Arc::new(config));
let outcome =
ops::tool_call(&port, &security, server_id, tool_name, arguments, confirmed).await?;
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/memory/brain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,7 @@ pub struct BrainIngestView {
///
/// [`SecurityPolicy::validate_path`]: crate::security::SecurityPolicy::validate_path
async fn ingest_path(config: &Config, path: &str) -> Result<std::path::PathBuf> {
let policy = crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
);
let policy = crate::security::SecurityPolicy::for_config(config);
policy.validate_path(path.trim()).await.map_err(|error| {
tracing::warn!("[memory:brain] ingest path refused by the security policy");
Error::InvalidRequest(format!("cannot read the file: {error}"))
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/profiles/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,7 @@ impl ProfileCapabilities {
// profile. The named packs narrow registration within those domains.
let assembly =
ctx.derive_with(ContextOverlay::new(config.clone(), ctx.domains(), groups));
let security = Arc::new(crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
));
let security = Arc::new(crate::security::SecurityPolicy::for_config(config));
let native = CoreContext::scope(assembly, async {
crate::tools::ops::all_tools(
Arc::new(config.clone()),
Expand Down
6 changes: 1 addition & 5 deletions crates/openhuman-core/src/profiles/cron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ pub async fn sweep(host: &ProfileHost, now: DateTime<Utc>) -> SweepReport {
let profile_config = profile.config.clone();
let profile_ctx = Arc::clone(profile.context());
let outcome = CoreContext::scope(Arc::clone(&profile_ctx), async move {
let security = Arc::new(crate::security::SecurityPolicy::from_config(
&profile_config.autonomy,
&profile_config.workspace_dir,
&profile_config.action_dir,
));
let security = Arc::new(crate::security::SecurityPolicy::for_config(&profile_config));
let dispatch = crate::core::runtime::DispatchCtx::new(Arc::clone(&profile_ctx));
let mut dispatcher =
JobDispatcher::new(&dispatch, &profile_config, &security).agent_only();
Expand Down
7 changes: 1 addition & 6 deletions crates/openhuman-core/src/profiles/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,12 +670,7 @@ pub(super) fn create_dirs(layout: &ProfileLayout) -> Result<(), String> {
/// its workspace and sandbox, never the operator's live policy.
fn profile_policy(config: &Config) -> Arc<crate::security::SecurityPolicy> {
Arc::new(
crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
)
.with_privacy_mode(config.privacy.mode),
crate::security::SecurityPolicy::for_config(config).with_privacy_mode(config.privacy.mode),
)
}

Expand Down
7 changes: 1 addition & 6 deletions crates/openhuman-core/src/sandbox/spawn_plan/facts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,7 @@ fn configured(config: &Config) -> bool {
/// chose for this spawn (its workspace and the mounts it resolved). The module still
/// refuses the protected floor and the core's internal state under every root.
fn paths(config: &Config, policy: &SandboxPolicy) -> PathPolicy {
let mut paths = crate::security::SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
&config.action_dir,
)
.native_path_policy();
let mut paths = crate::security::SecurityPolicy::for_config(config).native_path_policy();
// Reserved names protect internal files from the path tools (`.env`, `SOUL.md`...)
// wherever they sit under the action dir. A jail's workspace grant is the whole
// action dir by design, so under that rule no workspace could ever be granted.
Expand Down
Loading
Loading