FAROS
FAROS copied to clipboard
ConsistencyChecker calls `.json()` without checking `response.ok`
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.