Skip to content

[Medium] Analysis edits are persisted without validating the payload shape #12

Open

Description

@adilei

Severity

Medium — untrusted-shape data persisted and consumed downstream without validation.

Location

  • electron/ipc.ts:173 (updateAnalysis handler) validates only input.sessionId; it forwards title / intent / steps unchecked.
  • electron/describer/describer.ts:142 (edit) persists the edited analysis.

Mechanism

The renderer-supplied steps (and title/intent) are written to the persisted analysis with no schema validation of the array/step shape. Malformed or partial structures reach bundle/builder consumers that assume a well-formed Analysis.

Impact

A malformed edit can corrupt the persisted analysis and cause downstream builder failures or bad output — and, because it's persisted, the corruption survives restarts.

Suggested fix

Validate the payload against the Analysis/step schema (types, required fields, step shape) in the handler or in describer.edit before persisting; reject with a clear error otherwise.

Regression test to add (npm test)

Unit test updateAnalysis/edit with a malformed payload (missing/typo'd step fields); assert it's rejected and nothing is persisted. Deterministic; the evals/ suites score model output, not this IPC validation.

Activity

  1. newbpydev commented on Aug 12, 2026

    @newbpydev

    Hi adilei — while I wait for release/0.6.0 for #13, I reviewed this issue and would be happy to take it as a separate small fix if useful.

    I verified the problem is still present in v0.5.0. My proposed boundary is to validate the edit patch at Describer.edit, using the existing Zod analysis-step schema before anything is persisted. I’d add deterministic tests showing that malformed title, intent, or step data is rejected with the existing analysis left unchanged, while valid partial edits continue to work. Persisted-file migration and historical repair would remain out of scope.

    Would you be comfortable with me taking this on as well once release/0.6.0 exists, or would you prefer that I keep my focus on #13? I have good availability over the next two weeks and can give both fixes focused attention if that would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions