Skip to content

Show exposure findings in the graph inspector - #48

Merged
JetSquirrel merged 8 commits into
mainfrom
feat/exposure-window
Nov 3, 2026
Merged

JetSquirrel merged 8 commits into
mainfrom
feat/exposure-window

Conversation

@JetSquirrel

@JetSquirrel JetSquirrel commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Shows plugin analyses in the desktop window, so an investigator can see why a resource was flagged without leaving it. The window knows nothing about AWS: it shows whatever a plugin declares (#55).

Merge order: #47, then this. This branch is built on it, so its diff shows that work until it lands. It targets main. Please merge these with merge commits, not squash or rebase, or each later branch stops containing the one before it (#55).

How the window stays generic

  • It asks plugins what they offer, and shows an analysis on nodes with a label the plugin declared. There's no check for Instance, and a test fails if the window's code names a provider's labels or rules.
  • All the words come from the plugin, including the Chinese. A verdict's tone sets how it's shown.
  • It holds the graph only while reading, not while the plugin works, and Stop ends a run. A plugin not approved as it is now isn't started just to ask what it offers.
  • The same findings as the command. A test compares the command with the library calls the window makes. The window's own wrapper around those calls isn't under test.

What changes

Selecting an instance on a graph canvas adds an Exposure section to the inspector, with a Run analysis button. Each finding shows:

  • the verdict and rule
  • each condition's status, with the AWS fields and values it read
  • the candidate path
  • what wasn't checked

There are two actions on each finding:

  • Show path on canvas narrows the canvas to the path, as a walk. Back returns to the earlier view, Path Explorer can go on from it, and selecting a node on the path shows its evidence.
  • Copy finding as JSON copies the same record as the CLI.

The check covers the whole graph, not just the canvas. It runs only when asked, and the result is dropped when the canvas gets a new result.

Checked in the real window

I ran the top of this chain (#54) on Windows against plugins/aws/tests/fixture-exposure, after moving the rules:

Case Result
Selecting db-1 Exposure and Run analysis appear, from the plugin's declaration
Run analysis Lateral finding is Potential exposure, and the direct one Not indicated, with conditions, fields and the claim
Show path on canvas The five hops are listed, the path draws, Back appears, and the button hides while that path shows
Chinese interface Verdicts, rule titles and condition statements switch, using the plugin's translations

Not checked in the window:

  • After the move: web-1 and legacy-1, clicking Back, Stop, and Copy finding as JSON. Stop's cancellation has an end-to-end test below the window, and the rest were checked before the move, except the clipboard.
  • macOS: I didn't run the window there.
  • khonsu open --cypher ... --run right after launch: it reported delivered, but the query tab didn't change. I didn't look into it. It may be the known problem of a second open being dropped during startup, so I ran the query by hand.

Limits

  • Partly English in Chinese: verdicts, rule titles and condition statements are translated. Each condition's detail and the "not checked" list come from the plugin in English.
  • Only from a selected node: there's no account-wide findings list in the window, so you need a node with a label the analysis declares on the canvas first. khonsu plugin analyze gives the whole list.
  • Path Explorer's copy button: on a shown finding, "Copy path evidence" has rule_id unknown, because it copies the walk. Copy finding as JSON has the rule.
  • Scroll position: the inspector keeps its scroll position when you select another node, so a new selection can open partway down. It already behaved this way, but the longer section makes it easier to notice.

Testing

  • cargo test --locked --workspace passes on Windows, and CI will cover macOS.
  • New tests check that a plugin's words are used with its own as the fallback, that findings match the selected node, that a new result drops them and stops a running analysis, and that a finding becomes a walk drawing only its own path. In the AWS plugin, a test checks that every rule, verdict and condition has a translation.
  • The rendering itself has no automated test.

Issue status

For #35, the walkthrough still hasn't been timed with a new engineer, so I'm leaving the issue open for that criterion.

Refs #55, #35

🤖 Generated with Claude Code

JetSquirrel and others added 5 commits November 2, 2026 15:25
The canvas could only add a node's neighbors, one hop and untyped, with no
sign when the fixed limit cut the result. An investigator following a
suspected chain needs direction, types and caps, and needs to know when
the answer is incomplete.

Graph::explore walks breadth-first with one parameterized query per step,
so caps and cancellation are enforced between queries, and says which cap
cut the result. khonsu explore offers it to agents and scripts, and the
inspector gets a panel with the hops to the selected node.

gpui-graph cannot highlight a set of nodes, so showing a path narrows the
canvas to it, and Back returns to earlier views.

Refs #32

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A relationship on the canvas said nothing about where it came from. An
investigator needs the source, the time and whether it was reported or
worked out, and needs missing values stated rather than filled in.

Each provenance field is explicitly known or unknown. khonsu evidence and
explore --to give stable IDs, and the inspector shows the same record with
buttons to copy it as JSON. Exports hold no source configuration, and
secret-looking names and values are masked and listed.

A sync does not rewrite an unchanged relationship, so its timestamp is
named record_written_at, separate from the source's last successful sync.

Refs #33

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add evidence records: what supports a node, relationship or path
An open security group rule or a walkable path isn't an actionable finding.
An investigator needs to know why a resource was flagged, which fields say
so, and what was never checked.

khonsu exposure evaluates three documented rules. Each condition is met,
not met or unknown and names the fields it read. The verdict follows from
those alone: potential_exposure, insufficient_data or not_indicated. There
is no score, and no verdict says reachable.

The AWS plugin now reads route tables and IPv6 addresses, because a public
address and an open rule mean little without a route. A record that should
exist and doesn't gives unknown, not a clear result, since a missing saved
response reads as empty (#38).

A finding carries its path as a derived evidence record with its rule ID,
plus the arguments to reopen it in khonsu explore.

The new cases live in their own fixture, so the shop fixture's answers and
the HawDB snapshot stay as they were.

Refs #35, #33, #36

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rules could only be read as JSON, so someone investigating in the window
had to leave it to learn why an instance was flagged.

Selecting an instance now offers a check. Each finding shows its verdict,
rule, conditions with their AWS fields, candidate path and what wasn't
checked. Showing a path narrows the canvas to it as a walk, so Back, Path
Explorer and each record's evidence carry on working from there.

Refs #35

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JetSquirrel and others added 3 commits November 3, 2026 20:50
KhonsuGraph is a general graph workbench, but its core held AWS semantics:
EC2, security group, load balancer and route table rules, and a general
`khonsu exposure` command for them. Every new provider would have added more.

Plugins can now offer analyses, an optional part of the protocol. The host
reads a bounded part of the graph and sends it with stable references to each
record. The plugin answers with findings that point at those records. The host
checks every reference, looks up field values itself, and rebuilds each path
from the graph, so a plugin can't misquote a record or claim a connection that
isn't there. A bad answer is refused whole, since dropping a finding would read
as that resource having none. Nothing in the host names a provider's labels,
rules or verdicts.

The three rules, their field mappings, assumptions and verdict policy are now in
plugins/aws/src/exposure.rs, run with `khonsu plugin analyze aws exposure`.
Finding IDs, rule IDs, verdicts, order and condition text are unchanged. In the
output, `aws_field` is now `source_field`, `instances` is now `subjects`, and a
relationship's end reads as the field `@to`.

Three false readings found in review are fixed, with regression tests:

- Missing balancer group data read as "the target's rules don't allow it",
  clearing the finding. It's now unknown.
- A TCP_UDP target group was treated as TCP only, so a UDP rule didn't count.
- The target's security group membership wasn't in the rule's evidence.

An example analyzer with nothing to do with AWS shows the interface, and tests
how the host handles an answer that misbehaves.

Refs #55, #35

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inspector called the exposure evaluator in core, matched AWS rule constants
to find its titles, and only appeared on nodes labelled Instance.

It now asks plugins what they offer and shows each analysis on nodes with a
label it declares. Titles, verdicts, rules and condition text all come from the
plugin, including their Chinese, and a verdict's tone sets how it is shown. The
graph is held only while its records are read, so a plugin that takes a while
doesn't block the window, and Stop ends one. A plugin not approved as it is now
isn't started just to ask what it offers.

"Show path on canvas" draws what the host rebuilt from the plugin's references,
which also replaces the fields that were skipped in JSON. A test checks that the
command and the library the window calls give the same findings, and another
that the window's code names no provider's labels or rules.

Refs #55, #35

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JetSquirrel
JetSquirrel merged commit 9b6caba into main Nov 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant