Skip to content

🐛 Bug: ContributorProfile Uses Unvalidated GitHub API Responses #707

@Tanayajadhav1

Description

@Tanayajadhav1

📜 Description

Description:

The ContributorProfile component fetches GitHub user profile data and pull request data from the GitHub API but does not validate the responses before using them. The component assumes the API always returns data matching the expected structure, which introduces runtime risk.

Problem:
Currently, API responses are parsed and used directly without schema validation or comprehensive response checks.
This creates several reliability and stability issues:

  • No response validation: API responses are assumed to match the expected profile and pull request structures.
  • Runtime crashes: Invalid or malformed responses can break UI rendering.
  • Type safety bypass: TypeScript interfaces do not guarantee runtime data correctness.
  • Error response handling: GitHub error payloads (404, 403, rate-limit responses, etc.) may be processed as valid data.
  • API unpredictability: Changes in GitHub API response formats can cause unexpected failures.
  • Weak fallback behavior: Invalid responses may result in broken or inconsistent UI states.

Expected Behavior:

Before updating component state, the application should:

  • Verify API requests complete successfully.
  • Validate profile data matches the expected structure.
  • Validate pull request data matches the expected structure.
  • Handle invalid or malformed responses gracefully.
  • Display a user-friendly error state when data cannot be loaded.
  • Keep loading, error, and not-found states clearly separated.

Affected Files:

  • src/pages/ContributorProfile/ContributorProfile.tsx

Suggested Implementation Approach:
Manual Validation

  • Add runtime type guards for profile and pull request data.
  • Validate response structure before updating state.
  • Add explicit error handling and fallback UI.

Suggested Labels:
gssoc'26, level:intermediate, bug, type:fix , size:s , area:quality,priority:medium

i would like to work on this issue under gssoc'26

What browsers are you seeing the problem on?

Chrome

📃 Relevant Screenshots (Links)

No response

Metadata

Metadata

Assignees

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