Skip to content

Three permissions, one refusal

Nika v0.124.0 follows untrusted content into child workflows and through files, so splitting a workflow no longer hides the lethal trifecta.

Some workflows are dangerous because of their shape, not their intent. The engine README puts it in one sentence: "A workflow that can read your private data, take in content nobody vetted (a web page, a tool's answer, a command's output) and send data out is one injected instruction away from a leak." The README credits Simon Willison with its name, the lethal trifecta.

Nika's checker has a rule for it, NIKA-SEC-009. It reads the three legs from the workflow's permits: block: a private read, an untrusted way in, an external way out. Then it follows the untrusted content from task to task. When all three meet on one path and no person has to say yes first, nika check refuses the file before a model is called.

Before v0.124.0, that following stopped at two edges a workflow author could cross without noticing. A flow split across a child workflow could pass the check while the same tasks written inline were refused, and so could untrusted content passed through a file that a built-in tool read back. v0.124.0 follows through both.

The rule on one file #

Two dates need keeping apart here. The check itself shipped in v0.124.0 on 27 October. The worked example below landed in the README on main the next day, 28 October, after that release, and first reached a release tag with v0.124.2 on 10 November. "This workflow reads a note, fetches a public page, asks a local model for a digest and posts it to Slack":

page-digest.nikaOpen in the playground
nika: page-digest

model: ollama/llama3.2:3b

permits:
  fs: { read: ["./notes/today.md"] }
  net: { http: ["news.ycombinator.com", "hooks.slack.com"] }
  tools: ["nika:fetch", "nika:read", "nika:notify"]

tasks:
  page:
    invoke:
      tool: "nika:fetch"
      args: { url: "https://news.ycombinator.com/" }

  notes:
    invoke:
      tool: "nika:read"
      args: { path: "./notes/today.md" }

  digest:
    with: { page: "${{ tasks.page.output }}", notes: "${{ tasks.notes.output }}" }
    infer:
      prompt: "Pick the three stories that matter for my notes.\nNotes: ${{ with.notes }}\nPage: ${{ with.page }}"
      max_tokens: 400

  post:
    with: { digest: "${{ tasks.digest.output }}" }
    invoke:
      tool: "nika:notify"
      args: { target: "https://hooks.slack.com/services/T000/B000/XXXX", message: "${{ with.digest }}" }

The page never reaches Slack directly, only through the model's digest. The check follows it anyway and refuses the file with exit code 2:

output
nika check · page-digest.nika
 ✔ PLAN     3 waves · 4 tasks · max parallelism 2
 …
 ✖ TRIFECTA [NIKA-SEC-009] lethal trifecta complete · human gate required — untrusted content from `page` reaches egress task `post` while private read + untrusted ingress + external egress are all permitted …

Drop any one of the three permissions and there is nothing to refuse. To keep all three, the README puts a question in front of them: a nika:prompt with no default, whose answer the fetch, the read and the post each require. This fragment shows the gate and the first task that waits for it:

fragment
  approve:
    invoke:
      tool: "nika:prompt"
      args: { message: "Read my notes, fetch Hacker News and post a digest to Slack?" }

  page:
    with: { go: "${{ tasks.approve.output }}" }
    when: ${{ with.go == true }}
    invoke:
      tool: "nika:fetch"
      args: { url: "https://news.ycombinator.com/" }

With nika:prompt added to permits.tools, and the same go binding and when: line on notes and post, the check passes with exit code 0:

output
 ✔ TRIFECTA no lethal trifecta over the declared permits: without a human gate
 layers · valid ✔ · access ready ✔ · capacity fit ✔ · run ready ✔

The README says "Every verdict here was captured from nika 0.124.0."

Edge one: a child workflow #

A task can run another workflow with invoke: { workflow: "./child.nika" }. That is how workflows are reused. Before v0.124.0 the trifecta rule did not see through the call. The 0.124.0 notes describe the result: "A parent that read a private file and sent data out passed nika check and ran when part of the flow sat in a child reached through invoke: workflow:, while the same tasks written inline were refused."

Now nika check and nika run judge each call as the tasks it stands for, through every workflow below it. The call counts as a way in when content the child brings in (a nika:fetch, an exec:, an mcp: tool, an agent: whose tools admit one) reaches its outputs or a file it writes. It counts as a way out when untrusted content reaches an egress task inside it, including through the call's own arguments. The finding names the child task behind the call. check --json lists every direct call under composed_calls, resolved or not.

A child the check cannot read, parse or resolve counts as all of these. The check fails closed.

One consequence changes how gates are placed. In the notes' words: "a gate inside the child does not count for its caller: put the gate in front of the call." The same notes say a blocking nika:prompt "that dominates the path still clears it", and the changelog adds that it must be the parent's own, "as for the inline form". This post reads dominates as: the content cannot reach the call without passing that gate.

The consent rule moved the same way. NIKA-SEC-014 refuses a step that still runs after a person answered no. v0.124.0 applies it to a child workflow call: "a bare after: { ask: success } edge still runs the child on « no », so bind the answer on the call (with: { go: "${{ tasks.ask.output }}" } and when: ${{ with.go == true }})". It is the same binding the README uses on its page task.

Edge two: a file #

The second gap ran through the disk. The notes again: "A gate could clear the task that saved untrusted content to a file, and a nika:read of that file then fed an ungated egress: the trifecta counted only an earlier exec: as a reader of such files, so nika check passed the workflow."

Now a built-in read of a path the write may have reached carries the untrusted content on. The notes list the readers: nika:read, nika:grep, nika:glob, nika:edit, a nika:decide bundle, the files nika:image_fx, nika:chart and nika:image_generate read, and a nika:fetch multipart upload. This holds inline and inside a child workflow. When the write's path is literal, order does not matter: a read in the same wave as the writer, or even before it in the run, counts too, because the next run reads the file.

Paths compare lexically: folded and case-blind, /private/tmp is /tmp, and a templated path may be any file. A read whose path cannot reach the written one stays clean.

The run side got a matching guard. An embedder that pairs the library's check with its own runner used to be able to run a fetching child into an ungated egress when the check's report did not list the call. A call missing from the report now counts as unresolved, and the run refuses with NIKA-1707.

These changes are breaking, and the notes say so: "Some workflows that 0.123.2 checked clean or ran unattended are now refused or paused."

Why it matters #

A safety rule that a refactor can switch off is weak. Before v0.124.0, moving three tasks into a reusable child workflow, or routing fetched content through a file that a built-in tool reads back, could change the verdict without changing what the run did. Now the verdict follows the flow of content, not the layout of the files. When nika check or nika run reads the whole set of files, an author can split a workflow into parts without the split removing the refusal.

What it does not do #

  • "The trifecta check judges permits and flow, not words. It does not read a page or a model's answer for injected instructions, and a person who answers yes approves what follows." (README)
  • A check of the source alone, in an editor or through the MCP nika_check tool, reads no child. Its trifecta judges the parent's own tasks only.
  • Under the consent rule (NIKA-SEC-014), when the only gate in front of an effect sits in a child and the check cannot decide it from the caller (a when: on an input the caller may bind to its answer), the call gets an advisory hint instead of the refusal.
  • A gate only counts if it really asks. The README: "a prompt with a default: answers itself and guards nothing".
  • A clean check describes structure and boundary. In the README's words, "it does not prove that model output is right".

Read the v0.124.0 release, or continue with The prompt injection that goes nowhere.