feat(daemon): run each workflow as its declared identity

Every attempt checks that the identity that started the task and the
identity the workflow declares may both run it, recording a denial for
either. A workflow that declares no identity is refused rather than
running as its starter or the root. A workflow.call callee is started by
its caller's declared identity instead of inheriting the caller's row.
The workflow settings panel marks the identity as required and offers
the agent identities.
This commit is contained in:
sam committed 2026-10-11 14:49:38 +00:00
1 parent d66dca44e0
commit f765e23812
11 files changed
+162 -79

No files matched your search

+15 -2
View File
@@ -5,7 +5,9 @@ import { Plus, Trash2, X } from "@lucide/vue";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { Switch } from "@/components/ui/switch";
import { cn } from "@/lib/utils";
import { statusKind, statusLabel, type Binding } from "@/bindings/binding-draft";
import { useIdentitiesStore } from "@/stores/identities";
import BindEvent from "./BindEvent.vue";
import { setWorkflowField, workflowField } from "./workflow-edit";
import type { WorkflowTrigger } from "./workflow-triggers";
@@ -53,6 +55,12 @@ function addSpec(key: "inputs" | "outputs", list: [string, Spec][]): void {
setSpec(key, [...list, [`${key.slice(0, -1)}_${n}`, { type: "string" }]]);
}
// The identity a run acts as must be an agent, never a person; a workflow
// naming none is refused when it runs.
const identities = useIdentitiesStore();
identities.watch();
const agents = computed(() => identities.identities.filter((i) => i.kind !== "user" && i.lifecycle === "active"));
const MODES = [
{ value: "required", label: "Repository", hint: "Clones the task's repository" },
{ value: "optional", label: "If given", hint: "Clones one when the run names it" },
@@ -145,10 +153,15 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
<span class="flex-1 text-[13px]">Identity</span>
<input
:value="text('identity')"
placeholder="whoever starts it"
class="h-7 w-44 rounded-md border border-input bg-background px-2 text-[13px]"
list="workflow-identities"
placeholder="required"
title="Every run acts as this identity; a workflow naming none is refused."
:class="cn('h-7 w-44 rounded-md border border-input bg-background px-2 text-[13px]', !text('identity') && 'border-danger/60')"
@change="set('identity', ($event.target as HTMLInputElement).value.trim())"
/>
<datalist id="workflow-identities">
<option v-for="agent in agents" :key="agent.id" :value="agent.id">{{ agent.display_name }}</option>
</datalist>
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Container profile</span>