Skip to content

Close KisteAgent scan findings: signed scan authority, bounded standby, review ownership - #41

Merged
bIackr0se merged 5 commits into
mainfrom
security/scan-fixes
Oct 20, 2026
Merged

bIackr0se merged 5 commits into
mainfrom
security/scan-fixes

Conversation

@bIackr0se

Copy link
Copy Markdown
Owner

Why

A security scan of KisteAgent found that a client could grant itself scan authority by writing originating_indicators into graph state, that standby mode held a worker forever, that the alert which woke standby could be pushed out of the analyzed window (also when a new alert landed in the same rule execution), that non-global addresses such as CGNAT and multicast passed the scan-target check, and that any API client could read and approve another operator's pending review. Two dependencies, langgraph-sdk 0.4.2 and mcp 1.28.1, had published advisories. This PR closes each of these and adds a regression test per finding.

What changed

  • Scan authority: execute_elastic_query signs the retrieved indicators with an HMAC key held by the server and bound to the thread (provenance.py). counter_recon scans only targets that match a verified receipt. The unsigned originating_indicators channel is gone.
  • Standby: a deadline (one poll interval before the server's own BG_JOB_TIMEOUT_SECS) and a per-process capacity cap that always keeps an ordinary worker slot free. Timeout, capacity and error exits end the run without analysis or review.
  • Waking alert: standby takes a baseline of the newest execution's document IDs, then polls for a document outside that baseline. It pins that document's _index and _id and fetches it with get, so the analyzed window always contains it.
  • Targets: _is_denied refuses every non-global or multicast address, including IPv4 embedded in IPv6.
  • API access (auth.py, opt-in with KISTE_API_TOKENS): the server stamps thread ownership from the bearer token, and owners can only see and change their own threads. A token marked as reviewer can resume another owner's pending review_gate_S interrupt, and only that checkpoint. With no tokens configured, local single-user mode is unchanged.
  • Dependencies: langgraph-sdk 0.4.8, mcp 1.30.0 (held below 2 for FastMCP).

Evidence

Each test below was run against the base code (origin/main) and against this branch.

  • Forged state, test_vuln_0005_provenance.py: base fails with AssertionError: Forged graph state reached the scanners, branch passes.
  • Standby deadline, test_vuln_0006_standby_limits.py: base fails with Standby did not terminate within its configured timeout, branch passes.
  • Alert identity, test_vuln_0007_0008_standby_identity.py: base fails with Distinct Elasticsearch documents collapse to identical rule metadata. The same-execution insertion with a lower alert UUID fails on the branch's first fix commit (389b4a9) with Pinned the old top hit instead of the insertion: ['z-old'] and passes now.
  • Targets, test_vuln_0003_targets.py: base fails with Non-global scan allowed: 100.64.0.1 (allowed), branch passes.
  • Review ownership, test_vuln_0009_auth.py (runs a loopback langgraph dev server): base fails with No server authentication handler is registered, and with 200 instead of 404 when a peer reads the owner's review. Branch passes, including owner resume, reviewer approval and no-token local mode.
  • uv run --locked make test: 65 passed. Both CI ruff commands: All checks passed!. Root python3 -m unittest discover -s tests: OK. Browser tests were not run locally; CI runs them.
  • Elasticsearch and the scanners are test doubles in these tests; no live cluster was used.

Merge risk

Door: two-way.
Blast radius: KisteAgent's chat retrieval, counter-recon and standby paths, and the API when KISTE_API_TOKENS is set.
Safe because: with no tokens set, auth.py allows every operation as before, and the compiled-graph tests drive the authorized retrieval, scan, standby and review paths end to end (level 4).

Scope

The reviewer check reads the in-memory runtime used by uv run langgraph dev, the documented runtime; another runtime needs the endpoint tests to pass first. Without KISTE_PROVENANCE_KEY, a server restart requires a fresh retrieval before counter-recon can run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T11:53:17.182329Z 19f377c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@socket-security

socket-security Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedpypi/​langgraph-sdk@​0.4.2 ⏵ 0.4.898 +1100 +16100100100
Updatedpypi/​mcp@​1.28.1 ⏵ 1.30.099 +1100 +2100100100

View full report

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19f377c836

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread KisteGraph/KisteAgent/agent.py Resolved
Comment thread KisteGraph/KisteAgent/agent.py Resolved
Comment thread KisteGraph/KisteAgent/agent.py Resolved
Comment thread KisteGraph/KisteAgent/auth.py Resolved
Comment thread KisteGraph/KisteAgent/auth.py Resolved
@bIackr0se
bIackr0se merged commit 8cce35c into main Oct 20, 2026
4 checks passed
@bIackr0se
bIackr0se deleted the security/scan-fixes branch October 20, 2026 12:20
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