Skip to content

Editing a finding in a stale browser tab overwrites another tab's changes to fields the user did not edit #3736

Open

Description

@romanlutz

Describe the bug

A stale finding edit submits a full old record, so changing only the title in one tab silently overwrites a newer description saved in another tab.

Steps/Code to Reproduce

Open the same finding's edit dialog in two tabs. In tab 1 change only description to ROUND6 TAB 1 IMPORTANT NEW DESCRIPTION and save. In stale tab 0 change only title to ROUND6 TAB 0 TITLE ONLY EDIT and save. Read the finding through the API.

Additional reproduction details

Run the UI/backend locally with an in-memory database; create a synthetic operation/finding and open its Edit dialog in two tabs before saving. Tab 1 changes only Description to ROUND6 TAB 1 IMPORTANT NEW DESCRIPTION and saves; stale tab 0 changes only Title to ROUND6 TAB 0 TITLE ONLY EDIT and saves. The API then shows the title edit but description reverted to Local fixture for editing and deletion recovery. No real user data or external service is involved.

Expected Results

A title-only edit must preserve the newer description, or report a stale-write conflict without discarding either draft.

Actual Results

After the second save, title changed but description reverted to Local fixture for editing and deletion recovery. API responses prove the persisted description was lost with no conflict message.

Verified references: FindingDialog, operation update route.

Proposed fix/regression: send changed fields only and add optimistic concurrency for same-field conflicts. Test two-tab title/description edits and same-field conflict preservation.

Screenshots

The screenshot is a local evidence artifact, not attached here.

Versions

Tested commit d3446e0, PyRIT 1.2.0.dev0, offline browser with real local APIs. Evidence: files/evidence/round6/concurrent-finding-after-tab0.json and concurrent-finding-overwritten.png; local paths are not attachments.

Activity

  1. added
    help wanted
    on Oct 31, 2026
  2. pcbeingused33 commented on Nov 2, 2026

    @pcbeingused33
    Contributor

    Confirmed on current main: OperationDetailPage.save sends the whole draft through updateFinding, and the memory layer validates it as a full FindingCreate and writes every column (memory_interface.py, the update(FindingEntry)...values(**validated.model_dump(...)) call). A stale tab therefore overwrites fields it never touched.

    Proposal for a first PR: add a PATCH endpoint whose body has every field optional and which applies only the fields that are set. The frontend would send just the fields that differ from the finding it loaded. PUT stays as it is for compatibility. Detecting a same-field conflict (a version or updated_at check that returns 409) needs a schema change, so I would leave it for a second PR. Does that split work for you?

    This comment was prepared with AI assistance (Claude Code).

  3. its-amann commented on Nov 6, 2026

    @its-amann
    Contributor

    Hi! I'd like to work on this. Roman Lutz (@romanlutz), could you assign it to me? I'll follow up with a PR that includes a fix and tests.

    Noting @pcbeingused333 offered on Nov 2 with no PR since then, so I'd like to take it if still open.

  4. romanlutz commented on Nov 19, 2026

    @romanlutz
    ContributorAuthor

    Still reproduces on current main. The whole chain is full-record replace with no staleness check: FindingDialog sends the entire draft, updateFinding PUTs every field, FindingUpdateRequest inherits FindingCreate with no version precondition (pyrit/backend/models/operations.py L108), and FindingEntry.set_fields overwrites every editable column unconditionally (memory_models.py L390-399). The 409 added in #4111 only covers parent-move cycles, not stale writes. A fix should follow the optimistic-concurrency pattern we already use for scenario presets/suites (api.ts L899): add a version or updated_at to FindingEntry, require it on update, 409 on mismatch — plus a regression test for the two-tab title/description scenario.

  5. its-amann commented on Nov 25, 2026

    @its-amann
    Contributor

    Opened a fix for this in #4640, would appreciate a look when you get a chance Roman Lutz (@romanlutz)

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

Metadata

Metadata

Labels

help wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions