Skip to content

ConsistencyChecker calls .json() without checking response.ok #163

Description

@hazelp343

ConsistencyChecker calls .json() without checking response.ok

Severity: High
File: frontend/src/pages/Review/ConsistencyChecker.tsx:387

The loadHistoryFindings function fetches findings and review details, then immediately calls .json() on both responses without checking if they succeeded. If the backend returns 404 or 500, .json() throws a SyntaxError when trying to parse the error HTML.

const [findingsResp, detailResp] = await Promise.all([
  fetch(`${API_BASE_URL}/api/v1/reviews/reviewx/${reviewId}/findings`),
  fetch(`${API_BASE_URL}/api/v1/reviews/reviewx/${reviewId}`),
])
const findingsData = await findingsResp.json()
const detailData = await detailResp.json()

Why it matters

When a review record is deleted or the backend is down, the page crashes with an unhandled promise rejection. Users see an error boundary instead of a "not found" message.

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