Skip to content

Operator switching can submit stale survey answers to the newly selected operator #634

Description

@exromany

Locations

Summary

Survey forms can retain the previous operator's answers while their mutation hooks have already rebound to a newly selected operator. Submitting during the new query's loading interval writes the stale answers to the new operator.

Root cause

The forms hydrate React Hook Form with values: data but gate rendering on formObject.formState.isLoading, not the survey query's loading state. When the active operator changes, the new query temporarily supplies undefined; React Hook Form 7.80 retains its existing values, while useOperatorSurvey immediately targets the new operator key.

Impact

A wallet controlling multiple operators can overwrite the newly selected operator's contacts, experience, discovery-source answers, or same-index setup with values reviewed under the previous operator. The result is correctable off-chain survey-data corruption without an on-chain effect, so severity is low.

Scenario

  • A wallet controls operators A and B and opens A's contact survey.
  • The user selects B through the global operator switch, which leaves the current route mounted.
  • B's survey query begins loading, but A's values and the active submit control remain rendered.
  • The user submits before B's response hydrates the form.
  • The request uses B's operator key with A's retained contact payload, overwriting B's record.

Drafted from LidoLens finding SURVEY-DATA-03

Activity

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