AOSSIE-Org / AOSSIE-Org/OrgExplorer

Fix: Unbounded concurrent API requests in explore() causes Secondary Rate Limit (Abuse) bans

未關閉 適合新手
#124 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
34
分支
92
平均合併
8 天 7 小時
30 天內合併 PR
12

描述

### Bug Description
In `src/context/AppContext.jsx`, when a user explores an organization with a Personal Access Token (PAT) connected, the application attempts to fetch the contributors for **all** repositories simultaneously without batching or concurrency limits.

If a user explores a large organization (e.g., one with 200+ repositories), the `explore()` function fires hundreds of concurrent requests to the `/contributors` endpoint via `Promise.allSettled(top.map(...))`.

This triggers GitHub's Secondary Rate Limits (abuse mechanisms), resulting in immediate `403 Forbidden` errors and temporarily banning the user's PAT/IP address. Additionally, queuing this many simultaneous requests can freeze browser networking.

### Steps to Reproduce
1. Add a Personal Access Token in Settings.
2. Search for a very large organization (e.g., `google`, `facebook`, or `microsoft`).
3. Open the Network tab in DevTools.
4. Notice that hundreds of `/contributors` requests are dispatched at the exact same time, eventually failing with `403` abuse blocks.

### Expected Behavior
The `explore()` function should fetch contributors in small, manageable batches (e.g., 5 at a time) to respect GitHub's concurrency guidelines, similar to how the `runAudit()` function already handles issue fetching.

### Proposed Fix
Replace the unbounded `.map` block in `explore()` (around line 112) with a batching loop:

```javascript
// Process in safe batches of 5 to prevent abuse bans
for (let i = 0; i < top.length; i += 5) {
const batch = top.slice(i, i + 5);
await Promise.allSettled(batch.map(async repo => {
contribsPerRepo[`${org.login}/${repo.name}`] = await fetchContributors(org.login, repo.name, pat);
}));
}
```

I would love to open a PR to implement this fix!

貢獻指南

開啟貢獻指南

研究方向

Start in src/context/AppContext.jsx at explore(), around the contributor-fetching block, and compare it with runAudit()'s existing issue-fetching concurrency handling. Done means contributor requests are processed in small batches of five instead of all at once, while settled requests continue to be handled; verify the request pattern with a large organization in the browser Network tab.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
github, javascript
領域
api, frontend
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
冷清
描述清晰度
描述清楚
新手友好度
82/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。