Skip to content

[Security] Missing timeout handling for outbound fetch requests in OAuth flow #208

@udaycodespace

Description

@udaycodespace

Describe the bug

While reviewing the OAuth authentication flow, I noticed that outbound fetch requests inside apps/dashboard-api/src/controllers/auth.controller.js currently do not use timeout handling through AbortController or similar mechanisms.

Because of this, if an upstream OAuth provider becomes slow or temporarily unresponsive, requests may remain pending for a long time and unnecessarily keep server resources occupied.

Where I found this

File:

apps/dashboard-api/src/controllers/auth.controller.js

Observed in outbound OAuth/profile-related fetch requests.

To Reproduce

  1. Open apps/dashboard-api/src/controllers/auth.controller.js

  2. Locate outbound fetch requests used in the OAuth flow

  3. Observe that the requests currently do not configure:

    • AbortController
    • timeout handling
    • abort signals

Expected behavior

Outbound HTTP requests should include timeout protection so requests can fail gracefully instead of potentially hanging indefinitely when external services fail to respond.

Impact

Without timeout handling:

  • requests may hang indefinitely
  • external provider/network stalls can tie up backend resources
  • auth-related flows may become unreliable during upstream failures

Proposed solution

I plan to add lightweight timeout protection around outbound fetch calls using AbortController.

Proposed changes:

  • add timeout handling for external fetch requests
  • abort long-running requests gracefully after a fixed duration
  • properly clear timers after request completion
  • keep existing auth flow behavior unchanged

ETA

I’ll work on this and try to raise a PR by tonight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions