Skip to content

[repo-monitor] High: HTTP error responses silently retried during status polling — 401/429/500 masked as Timeout #3

@Liohtml

Description

@Liohtml

Summary

In wait_for_status, HTTP error responses (401, 429, 500) are not checked before JSON parsing. Parse failures from error bodies cause silent continue retries, so the function eventually returns Error::Timeout instead of the actual error.

Location

  • File: src/lib.rs
  • Line(s): 247–269

Severity

High

Details

let body = resp.text().await.unwrap_or_default();
let parsed: ApiResp<StatusData> = match serde_json::from_str(&body) {
    Ok(p) => p,
    Err(e) => {
        warn!("status JSON: {e}");
        continue;   // silently retries on 401, 429, 500...
    }
};

A 401 Unauthorized (expired token) or 429 Too Many Requests loops until max_wait expires. The caller receives Timeout with no indication of the actual cause. submit_run and fetch_dataset_items both correctly check status.is_success() — this protection is missing only in wait_for_status.

Suggested Fix

Check HTTP status before parsing:

let status = resp.status();
let body = resp.text().await.unwrap_or_default();
if !status.is_success() {
    return Err(Error::ApiStatus { status: status.as_u16(), body: body.chars().take(400).collect() });
}

Automated finding by repo-monitor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions