From 7ea731d496962e973bc83347259787235e991326 Mon Sep 17 00:00:00 2001 From: "exe.dev user" Date: Thu, 12 Nov 2026 16:04:37 +0000 Subject: [PATCH 1/2] GEN-2917 restrict manual invocation to project --- packages/api-client/src/schema.d.ts | 4 ++-- packages/api/src/api-contract.ts | 4 ++-- packages/api/src/flow-service.ts | 13 +++++++++---- .../manual-invocation-permissions.test.ts | 19 +++++++++++++++---- packages/app/src/features/jobs/editor.tsx | 2 +- .../jobs/invocation-permission-editor.tsx | 6 +++--- packages/app/test/editor.browser.test.mjs | 12 ++++++------ packages/docs/llms-full.txt | 4 ++-- packages/docs/openapi.yaml | 4 ++-- .../work/manual-invocation-permissions.mdx | 4 ++-- 10 files changed, 44 insertions(+), 28 deletions(-) diff --git a/packages/api-client/src/schema.d.ts b/packages/api-client/src/schema.d.ts index a910f642..a14e7359 100644 --- a/packages/api-client/src/schema.d.ts +++ b/packages/api-client/src/schema.d.ts @@ -1566,7 +1566,7 @@ export interface paths { get: operations["get_api_v1_jobs_jobId_invocation_permissions"]; /** * Replace a source job's manual invocation destinations - * @description Requires an owner session, scoped API key, or authorized OAuth client with jobs:write. Destinations must exist in the same tenant. A source job may include itself to opt in to explicitly requested successor runs; this does not schedule runs automatically. Lifecycle subscriptions do not create permissions. + * @description Requires an owner session, scoped API key, or authorized OAuth client with jobs:write. Destinations must belong to the source job's project; self-invocation is allowed. A run token may invoke a configured destination only while both jobs remain in the same project. Lifecycle subscriptions do not create permissions. * * Requires the jobs:write scope. * @@ -6656,7 +6656,7 @@ export interface operations { }; requestBody?: never; responses: { - /** @description Configured tenant-local destination jobs */ + /** @description Configured destination jobs in the same project */ 200: { headers: { [name: string]: unknown; diff --git a/packages/api/src/api-contract.ts b/packages/api/src/api-contract.ts index aa6e4b45..db819a4c 100644 --- a/packages/api/src/api-contract.ts +++ b/packages/api/src/api-contract.ts @@ -829,8 +829,8 @@ export const API_ROUTES: RouteContract[] = [ description: "Returns the verified calling identity and effective scopes without credentials. Requires a verified active identity but no application-resource scope; callers with zero scopes can inspect only their own identity. Execution provisioning uses this operation to verify the dedicated run proxy. Execution VMs must not have additional shared Factorize proxy attachments.", responses: { "200": { description: "Verified runtime identity", content: { "application/json": { schema: jsonSchema(runtimeContextResponse, "output") } } } } }, service => service.getRuntimeContext()), - route("GET", "/api/v1/jobs/{jobId}/invocation-permissions", "jobs:read", { summary: "List a source job's manual invocation destinations", responses: { "200": { description: "Configured tenant-local destination jobs", content: { "application/json": { schema: jsonSchema(invocationPermissionsResponse, "output") } } } } }, (service, { params }) => service.getInvocationPermissions(params.jobId)), - route("PUT", "/api/v1/jobs/{jobId}/invocation-permissions", "jobs:write", { summary: "Replace a source job's manual invocation destinations", description: "Requires an owner session, scoped API key, or authorized OAuth client with jobs:write. Destinations must exist in the same tenant. A source job may include itself to opt in to explicitly requested successor runs; this does not schedule runs automatically. Lifecycle subscriptions do not create permissions.", responses: { "200": { description: "Saved manual invocation permissions", content: { "application/json": { schema: jsonSchema(invocationPermissionsResponse, "output") } } } } }, (service, { params, body }) => service.setInvocationPermissions(params.jobId, body.destinationJobIds), { body: invocationPermissionsInput }), + route("GET", "/api/v1/jobs/{jobId}/invocation-permissions", "jobs:read", { summary: "List a source job's manual invocation destinations", responses: { "200": { description: "Configured destination jobs in the same project", content: { "application/json": { schema: jsonSchema(invocationPermissionsResponse, "output") } } } } }, (service, { params }) => service.getInvocationPermissions(params.jobId)), + route("PUT", "/api/v1/jobs/{jobId}/invocation-permissions", "jobs:write", { summary: "Replace a source job's manual invocation destinations", description: "Requires an owner session, scoped API key, or authorized OAuth client with jobs:write. Destinations must belong to the source job's project; self-invocation is allowed. A run token may invoke a configured destination only while both jobs remain in the same project. Lifecycle subscriptions do not create permissions.", responses: { "200": { description: "Saved manual invocation permissions", content: { "application/json": { schema: jsonSchema(invocationPermissionsResponse, "output") } } } } }, (service, { params, body }) => service.setInvocationPermissions(params.jobId, body.destinationJobIds), { body: invocationPermissionsInput }), route( "GET", "/api/v1/jobs/{jobId}/events", diff --git a/packages/api/src/flow-service.ts b/packages/api/src/flow-service.ts index 93a390fe..ab12641d 100644 --- a/packages/api/src/flow-service.ts +++ b/packages/api/src/flow-service.ts @@ -459,6 +459,8 @@ export class ApiService { if (!this.auth.runId || !this.auth.runJobId) throw new ServiceError(401, "invalid_token", "A verified run identity is required."); const permission = await databaseFor(this.env).pool.query(`SELECT 1 FROM app.run_credentials c JOIN app.job_runs r ON r.tenant_id=c.tenant_id AND r.id=c.run_id + JOIN app.jobs source ON source.tenant_id=r.tenant_id AND source.id=r.job_id + JOIN app.jobs destination ON destination.tenant_id=source.tenant_id AND destination.id=$3 AND destination.project_id=source.project_id JOIN app.manual_invocation_permissions p ON p.tenant_id=c.tenant_id AND p.source_job_id=r.job_id AND p.destination_job_id=$3 WHERE c.tenant_id=$1 AND c.run_id=$2 AND c.digest=$4 AND c.expires_at>now() AND r.state IN ('reserved','starting','running','blocked','stopping')`, [this.auth.tenantId, this.auth.runId, jobId, this.auth.runCredentialDigest]); if (!permission.rowCount) throw new ServiceError(403, "forbidden", "This run is no longer active or its source job is not authorized to invoke the destination."); @@ -473,7 +475,10 @@ export class ApiService { async getInvocationPermissions(sourceJobId: string) { await this.authorize("jobs:read"); if (!await this.jobs().getJob(sourceJobId)) throw new ServiceError(404, "not_found", "Job not found"); - const rows = await databaseFor(this.env).pool.query<{ destination_job_id: string }>("SELECT destination_job_id FROM app.manual_invocation_permissions WHERE tenant_id=$1 AND source_job_id=$2 ORDER BY destination_job_id", [this.auth.tenantId, sourceJobId]); + const rows = await databaseFor(this.env).pool.query<{ destination_job_id: string }>(`SELECT p.destination_job_id FROM app.manual_invocation_permissions p + JOIN app.jobs source ON source.tenant_id=p.tenant_id AND source.id=p.source_job_id + JOIN app.jobs destination ON destination.tenant_id=p.tenant_id AND destination.id=p.destination_job_id AND destination.project_id=source.project_id + WHERE p.tenant_id=$1 AND p.source_job_id=$2 ORDER BY p.destination_job_id`, [this.auth.tenantId, sourceJobId]); return publicValue(invocationPermissionsResponse, { sourceJobId, destinationJobIds: rows.rows.map(row => row.destination_job_id) }); } async setInvocationPermissions(sourceJobId: string, destinationJobIds: string[]) { @@ -485,11 +490,11 @@ export class ApiService { if (unique.length !== destinationJobIds.length) throw new ServiceError(400, "invalid_request", "Destination jobs must be unique."); const db = databaseFor(this.env); await db.transaction(async client => { - const sources = await client.query("SELECT 1 FROM app.jobs WHERE tenant_id=$1 AND id=$2 FOR UPDATE", [this.auth.tenantId, sourceJobId]); + const sources = await client.query<{ project_id: string }>("SELECT project_id FROM app.jobs WHERE tenant_id=$1 AND id=$2 FOR UPDATE", [this.auth.tenantId, sourceJobId]); if (!sources.rowCount) throw new ServiceError(404, "not_found", "Source job not found"); if (unique.length) { - const found = await client.query("SELECT id FROM app.jobs WHERE tenant_id=$1 AND id=ANY($2::uuid[])", [this.auth.tenantId, unique]); - if (found.rowCount !== unique.length) throw new ServiceError(400, "invalid_request", "Every destination must be an existing job in this tenant."); + const found = await client.query("SELECT id FROM app.jobs WHERE tenant_id=$1 AND project_id=$3 AND id=ANY($2::uuid[])", [this.auth.tenantId, unique, sources.rows[0].project_id]); + if (found.rowCount !== unique.length) throw new ServiceError(400, "invalid_request", "Every destination must be an existing job in the source job's project."); } await client.query("DELETE FROM app.manual_invocation_permissions WHERE tenant_id=$1 AND source_job_id=$2", [this.auth.tenantId, sourceJobId]); if (unique.length) await client.query("INSERT INTO app.manual_invocation_permissions(tenant_id,source_job_id,destination_job_id) SELECT $1,$2,unnest($3::uuid[])", [this.auth.tenantId, sourceJobId, unique]); diff --git a/packages/api/test/manual-invocation-permissions.test.ts b/packages/api/test/manual-invocation-permissions.test.ts index 32de0bee..550907ec 100644 --- a/packages/api/test/manual-invocation-permissions.test.ts +++ b/packages/api/test/manual-invocation-permissions.test.ts @@ -9,20 +9,22 @@ const tenantId = "00000000-0000-4000-8000-000000000001"; const sourceId = "00000000-0000-4000-8000-000000000002"; const destinationId = "00000000-0000-4000-8000-000000000003"; const foreignId = "00000000-0000-4000-8000-000000000004"; +const crossProjectId = "00000000-0000-4000-8000-000000000005"; +const projectA = "00000000-0000-4000-8000-000000000020"; function fixture(options: { member?: boolean; activeToken?: boolean } = {}) { const persisted: string[] = []; const query = async (sql: string, values: unknown[] = []) => { if (sql.includes("SELECT m.user_id,m.email")) return { rows: options.member === false ? [] : [{ user_id: "owner", email: "owner@example.com", role: "owner", session_version: 1 }], rowCount: options.member === false ? 0 : 1 }; if (sql.includes("SELECT 1 FROM app.access_tokens")) return { rows: options.activeToken === false ? [] : [{ ok: 1 }], rowCount: options.activeToken === false ? 0 : 1 }; - if (sql.includes("SELECT 1 FROM app.jobs")) return { rows: values[1] === sourceId ? [{ ok: 1 }] : [], rowCount: values[1] === sourceId ? 1 : 0 }; + if (sql.includes("SELECT project_id FROM app.jobs")) return { rows: values[1] === sourceId ? [{ project_id: projectA }] : [], rowCount: values[1] === sourceId ? 1 : 0 }; if (sql.includes("SELECT id FROM app.jobs")) { - const ids = (values[1] as string[]).filter(id => id === destinationId || id === sourceId); + const ids = values[2] === projectA ? (values[1] as string[]).filter(id => id === destinationId || id === sourceId) : []; return { rows: ids.map(id => ({ id })), rowCount: ids.length }; } if (sql.includes("DELETE FROM app.manual_invocation_permissions")) { persisted.length = 0; return { rows: [], rowCount: 1 }; } if (sql.includes("INSERT INTO app.manual_invocation_permissions")) { persisted.push(...values[2] as string[]); return { rows: [], rowCount: persisted.length }; } - if (sql.includes("SELECT destination_job_id")) return { rows: persisted.map(destination_job_id => ({ destination_job_id })), rowCount: persisted.length }; + if (sql.includes("SELECT p.destination_job_id")) { const ids = persisted.filter(id => id === destinationId || id === sourceId); return { rows: ids.map(destination_job_id => ({ destination_job_id })), rowCount: ids.length }; } throw new Error(`Unexpected SQL: ${sql}`); }; const database = { pool: { query }, transaction: async (work: (client: any) => Promise) => work({ query }) } as any; @@ -64,7 +66,7 @@ describe("manual invocation permission management", () => { } }); - it.each(["session", "access_token", "oauth"] as const)("authorizes %s at the service and preserves tenant-local destination checks", async method => { + it.each(["session", "access_token", "oauth"] as const)("authorizes %s at the service and enforces same-project destination checks", async method => { const f = fixture(); const service = new ApiService(f.env, auth(method, ["jobs:write"], method === "access_token" ? "token-id" : undefined)); await expect(service.setInvocationPermissions(sourceId, [sourceId, destinationId])).resolves.toEqual({ sourceJobId: sourceId, destinationJobIds: [sourceId, destinationId] }); @@ -72,6 +74,15 @@ describe("manual invocation permission management", () => { await expect(service.setInvocationPermissions(sourceId, [destinationId])).resolves.toEqual({ sourceJobId: sourceId, destinationJobIds: [destinationId] }); expect(f.persisted).toEqual([destinationId]); await expect(service.setInvocationPermissions(sourceId, [foreignId])).rejects.toMatchObject({ status: 400, code: "invalid_request" }); + await expect(service.setInvocationPermissions(sourceId, [crossProjectId])).rejects.toMatchObject({ status: 400, code: "invalid_request" }); + }); + + it("returns only same-project destinations and rejects cross-project grants", async () => { + const f = fixture(); + f.persisted.push(destinationId, crossProjectId); + const service = new ApiService(f.env, auth("session", ["jobs:read", "jobs:write"])); + await expect(service.getInvocationPermissions(sourceId)).resolves.toEqual({ sourceJobId: sourceId, destinationJobIds: [destinationId] }); + await expect(service.setInvocationPermissions(sourceId, [crossProjectId])).rejects.toMatchObject({ status: 400, code: "invalid_request" }); }); it("rejects missing scopes, missing credentials, invalid or revoked owner credentials, and run tokens", async () => { diff --git a/packages/app/src/features/jobs/editor.tsx b/packages/app/src/features/jobs/editor.tsx index 75a179da..38b71940 100644 --- a/packages/app/src/features/jobs/editor.tsx +++ b/packages/app/src/features/jobs/editor.tsx @@ -114,7 +114,7 @@ function EditorForm({ initial, section }: { initial?: Job; section?: string }) { }{show("context") &&
{(draft.executionType ?? "agent") === "agent" ? <>

Context

Skills

Ordered global instructions are composed before this job context. Bodies remain literal.

{(draft.skillIds ?? []).map((id, index) => { const skill = skills.data?.items.find(item => item.id === id); return
{index + 1}. {skill?.key ?? "Unavailable skill"}
; })}
Create or edit skills

Prompt and context

Write instructions using context supplied by your triggers.

update("promptTemplate", value)} triggers={draft.triggers} /> update("runNameTemplate", value)} triggers={draft.triggers} /> Template variables{metadata.error &&

{metadata.error.message}

}{Object.entries(metadata.data ?? {}).map(([kind, fields]) =>

{kind}

    {fields.map(field =>
  • {field.path} — {field.description}
  • )}
)}
-
:

Context

Context settings are available for agent jobs.

}
}{show("permissions") &&
update("runScopes", value)} />{initial && }
}{show("triggers") &&

Triggers

Choose the events that start this job.

update("triggers", value)} onValidityChange={setInvalidForm} /> +
:

Context

Context settings are available for agent jobs.

}
}{show("permissions") &&
update("runScopes", value)} />{initial && }
}{show("triggers") &&

Triggers

Choose the events that start this job.

update("triggers", value)} onValidityChange={setInvalidForm} /> {initial?.triggers.map(trigger => trigger.kind === "webhook" && trigger.config.provider === "cloudflareTail" && trigger.config.destination ?

{trigger.slug} · Tail webhook destination

{trigger.config.destination}
: null)}
}{save.error &&

{save.error.message}

} {!initial && } diff --git a/packages/app/src/features/jobs/invocation-permission-editor.tsx b/packages/app/src/features/jobs/invocation-permission-editor.tsx index 94004723..c0a02086 100644 --- a/packages/app/src/features/jobs/invocation-permission-editor.tsx +++ b/packages/app/src/features/jobs/invocation-permission-editor.tsx @@ -5,21 +5,21 @@ import { Button, Input, Label } from "../../shared/ui"; import { selectorQuery } from "./editor-queries"; import { messageOf } from "../auth/session"; -export function InvocationPermissionEditor({ jobId }: { jobId: string }) { +export function InvocationPermissionEditor({ jobId, projectId }: { jobId: string; projectId: string }) { const [search, setSearch] = useState(""), [selected, setSelected] = useState([]); const configured = useQuery({ queryKey: ["job-invocation-permissions", jobId], queryFn: async ({ signal }) => { const { data, error } = await api.GET("/api/v1/jobs/{jobId}/invocation-permissions", { params: { path: { jobId } }, signal }); if (!data || error) throw new Error(messageOf(error)); return data; } }); useEffect(() => { if (configured.data) setSelected(configured.data.destinationJobIds); }, [configured.data]); - const jobs = useQuery(selectorQuery(search)); + const jobs = useQuery(selectorQuery(search, undefined, projectId)); const save = useMutation({ retry: false, mutationFn: async () => { const { data, error } = await api.PUT("/api/v1/jobs/{jobId}/invocation-permissions", { params: { path: { jobId } }, body: { destinationJobIds: selected } }); if (!data || error) throw new Error(messageOf(error)); return data; }, onSuccess: value => { setSelected(value.destinationJobIds); void configured.refetch(); } }); return

Manual invocation permissions

-

Choose jobs this job may manually invoke during a run. Lifecycle triggers are managed separately.

+

Choose jobs in this project that this job may manually invoke during a run. Lifecycle triggers are managed separately.

{configured.isPending &&

Loading permissions…

}{configured.error &&

{configured.error.message}

} {jobs.isPending &&

Loading jobs…

}{jobs.error &&

{jobs.error.message}

} diff --git a/packages/app/test/editor.browser.test.mjs b/packages/app/test/editor.browser.test.mjs index ed1accc9..775d84d8 100644 --- a/packages/app/test/editor.browser.test.mjs +++ b/packages/app/test/editor.browser.test.mjs @@ -63,11 +63,11 @@ test("All runs complete source jobs stay within the edited job project during se assert.ok(selectorRequests.filter(url => url.searchParams.has("projectId")).every(url => url.searchParams.get("projectId") === projectA)); assert.ok(selectorRequests.some(url => url.searchParams.get("q") === "Alpha")); assert.deepEqual(saved.triggers[0].config.sourceJobIds, [sameProjectJob]); - const manualSelector = page.waitForResponse(response => { const url = new URL(response.url()); return url.pathname === "/api/v1/job-selector" && !url.searchParams.has("projectId"); }); + const manualSelector = page.waitForResponse(response => { const url = new URL(response.url()); return url.pathname === "/api/v1/job-selector" && url.searchParams.get("projectId") === projectA; }); await page.goto(origin + `/jobs/${id}/settings/permissions`); await page.getByRole("heading", { name: "Manual invocation permissions" }).waitFor(); await manualSelector; - assert.ok(selectorRequests.some(url => !url.searchParams.has("projectId")), "manual permission selector lists tenant jobs across projects"); + assert.ok(selectorRequests.some(url => url.searchParams.get("projectId") === projectA), "manual permission selector is limited to the source job's project"); assert.equal(projectA, current.projectId); assert.notEqual(projectA, projectB); await context.close(); }); @@ -92,7 +92,7 @@ test("run permission scopes autosave and survive reload", async () => { assert.deepEqual(saved.runScopes, ["jobs:read", "runs:read"]); await context.close(); }); -test("manual invocation permissions include the current job and tenant jobs from other projects", async () => { +test("manual invocation permissions include the current job and jobs in the same project", async () => { const { context, page } = await setup(); const projectA = "00000000-0000-4000-8000-000000000020", destination = "00000000-0000-4000-8000-000000000024"; let saved, selectorUrl; @@ -101,14 +101,14 @@ test("manual invocation permissions include the current job and tenant jobs from if (route.request().method() === "GET") return route.fulfill({ json: { sourceJobId: id, destinationJobIds: [] } }); saved = route.request().postDataJSON(); return route.fulfill({ json: { sourceJobId: id, ...saved } }); }); - await page.route("**/api/v1/job-selector?**", route => { selectorUrl = new URL(route.request().url()); return route.fulfill({ json: { items: [{ id: destination, name: "Cross project destination", slug: "cross-project", enabled: true }], nextCursor: null } }); }); + await page.route("**/api/v1/job-selector?**", route => { selectorUrl = new URL(route.request().url()); return route.fulfill({ json: { items: [{ id: destination, name: "Same project destination", slug: "same-project", enabled: true }], nextCursor: null } }); }); await page.goto(origin + `/jobs/${id}/settings/permissions`); await page.getByLabel("Current job (allow this job to invoke itself)", { exact: true }).check(); - await page.getByLabel("Cross project destination", { exact: true }).check(); + await page.getByLabel("Same project destination", { exact: true }).check(); await page.getByRole("button", { name: "Save permissions" }).click(); await page.getByRole("status").filter({ hasText: "Manual invocation permissions saved." }).waitFor(); assert.deepEqual(saved, { destinationJobIds: [id, destination] }); - assert.equal(selectorUrl.searchParams.has("projectId"), false); + assert.equal(selectorUrl.searchParams.get("projectId"), projectA); await context.close(); }); test("create uses bounded lifecycle selector, lazy provider reads, schedule preview and typed form submission on mobile", async () => { diff --git a/packages/docs/llms-full.txt b/packages/docs/llms-full.txt index 39133485..4591b998 100644 --- a/packages/docs/llms-full.txt +++ b/packages/docs/llms-full.txt @@ -294,9 +294,9 @@ Available states are `succeeded`, `failed`, `stopped`, and `edited`. **Edited** ## Manual job invocation permissions Source: https://docs.factorize.sh/work/manual-invocation-permissions -Manual invocation permissions are separate from lifecycle subscriptions. Configure the allowed destination jobs in a source job's editor. The public API can read them with `GET /api/v1/jobs/{jobId}/invocation-permissions` and replace them with a `PUT` containing `{"destinationJobIds":["..."]}`. The write requires `jobs:write` and accepts a browser owner session, scoped API key, or authorized OAuth client. Destinations must exist in the same tenant. A job can include itself as a destination to opt in to explicitly requested successor runs; this does not schedule another run automatically. Deleting either job removes its permission edges. Revocation takes effect on the next invocation request. +Manual invocation permissions are separate from lifecycle subscriptions. Configure the allowed destination jobs in a source job's editor. The public API can read them with `GET /api/v1/jobs/{jobId}/invocation-permissions` and replace them with a `PUT` containing `{"destinationJobIds":["..."]}`. The write requires `jobs:write` and accepts a browser owner session, scoped API key, or authorized OAuth client. Destinations must belong to the source job's project; a job can include itself to opt in to explicitly requested successor runs. A run token can invoke a configured destination only while the source and destination remain in the same project. Deleting either job removes its permission edges. Revocation takes effect on the next invocation request. -Permissions are tenant-local. A destination may be in another project in the same tenant; graph consumers should render that as a cross-project edge. Existing lifecycle, edited, idle, schedule, and webhook triggers remain independent and do not grant manual invocation. +Permissions are project-local. The editor searches only the source job's project, and the API rejects cross-project permission writes. Existing cross-project permission rows are hidden from reads and cannot authorize run-token invocation. Existing lifecycle, edited, idle, schedule, and webhook triggers remain independent and do not grant manual invocation. For each execution VM, Factorize creates an exe.dev HTTP proxy named `fz-run-`. Its credential is installed by the Factorize control plane and held by exe.dev; it is never placed in the guest environment, prompt, or files. The integration is attached only to that VM for at most 24 hours. Discover its URL through `https://reflection.int.exe.xyz/integrations`, using the name supplied in the run instructions. No API URL configuration or client-supplied Authorization header is needed. diff --git a/packages/docs/openapi.yaml b/packages/docs/openapi.yaml index 62e4f652..652141b8 100644 --- a/packages/docs/openapi.yaml +++ b/packages/docs/openapi.yaml @@ -9937,7 +9937,7 @@ paths: summary: List a source job's manual invocation destinations responses: "200": - description: Configured tenant-local destination jobs + description: Configured destination jobs in the same project content: application/json: schema: @@ -9995,7 +9995,7 @@ paths: put: summary: Replace a source job's manual invocation destinations description: |- - Requires an owner session, scoped API key, or authorized OAuth client with jobs:write. Destinations must exist in the same tenant. A source job may include itself to opt in to explicitly requested successor runs; this does not schedule runs automatically. Lifecycle subscriptions do not create permissions. + Requires an owner session, scoped API key, or authorized OAuth client with jobs:write. Destinations must belong to the source job's project; self-invocation is allowed. A run token may invoke a configured destination only while both jobs remain in the same project. Lifecycle subscriptions do not create permissions. Requires the jobs:write scope. diff --git a/packages/docs/work/manual-invocation-permissions.mdx b/packages/docs/work/manual-invocation-permissions.mdx index 54f4effd..565a78c9 100644 --- a/packages/docs/work/manual-invocation-permissions.mdx +++ b/packages/docs/work/manual-invocation-permissions.mdx @@ -3,9 +3,9 @@ title: Manual job invocation permissions description: Authorize jobs to start other jobs with run-scoped credentials and manage destination permissions. --- -Manual invocation permissions are separate from lifecycle subscriptions. Configure the allowed destination jobs in a source job's editor. The public API can read them with `GET /api/v1/jobs/{jobId}/invocation-permissions` and replace them with a `PUT` containing `{"destinationJobIds":["..."]}`. The write requires `jobs:write` and accepts a browser owner session, scoped API key, or authorized OAuth client. Destinations must exist in the same tenant. A job can include itself as a destination to opt in to explicitly requested successor runs; this does not schedule another run automatically. Deleting either job removes its permission edges. Revocation takes effect on the next invocation request. +Manual invocation permissions are separate from lifecycle subscriptions. Configure the allowed destination jobs in a source job's editor. The public API can read them with `GET /api/v1/jobs/{jobId}/invocation-permissions` and replace them with a `PUT` containing `{"destinationJobIds":["..."]}`. The write requires `jobs:write` and accepts a browser owner session, scoped API key, or authorized OAuth client. Destinations must belong to the source job's project; a job can include itself to opt in to explicitly requested successor runs. A run token can invoke a configured destination only while the source and destination remain in the same project. Deleting either job removes its permission edges. Revocation takes effect on the next invocation request. -Permissions are tenant-local. A destination may be in another project in the same tenant; graph consumers should render that as a cross-project edge. Existing lifecycle, edited, idle, schedule, and webhook triggers remain independent and do not grant manual invocation. +Permissions are project-local. The editor searches only the source job's project, and the API rejects cross-project permission writes. Existing cross-project permission rows are hidden from reads and cannot authorize run-token invocation. Existing lifecycle, edited, idle, schedule, and webhook triggers remain independent and do not grant manual invocation. For each execution VM, Factorize creates an exe.dev HTTP proxy named `fz-run-`. Its credential is installed by the Factorize control plane and held by exe.dev; it is never placed in the guest environment, prompt, or files. The integration is attached only to that VM for at most 24 hours. Discover its URL through `https://reflection.int.exe.xyz/integrations`, using the name supplied in the run instructions. No API URL configuration or client-supplied Authorization header is needed. From 511d17b92820b052e3eae78b520bd517e8d18f4c Mon Sep 17 00:00:00 2001 From: "exe.dev user" Date: Thu, 12 Nov 2026 16:07:12 +0000 Subject: [PATCH 2/2] GEN-2917 fix permission test source lookup --- packages/api/test/manual-invocation-permissions.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/api/test/manual-invocation-permissions.test.ts b/packages/api/test/manual-invocation-permissions.test.ts index 550907ec..10053302 100644 --- a/packages/api/test/manual-invocation-permissions.test.ts +++ b/packages/api/test/manual-invocation-permissions.test.ts @@ -81,6 +81,7 @@ describe("manual invocation permission management", () => { const f = fixture(); f.persisted.push(destinationId, crossProjectId); const service = new ApiService(f.env, auth("session", ["jobs:read", "jobs:write"])); + (service as any).jobs = () => ({ getJob: async () => ({ id: sourceId, projectId: projectA }) }); await expect(service.getInvocationPermissions(sourceId)).resolves.toEqual({ sourceJobId: sourceId, destinationJobIds: [destinationId] }); await expect(service.setInvocationPermissions(sourceId, [crossProjectId])).rejects.toMatchObject({ status: 400, code: "invalid_request" }); });