Bound OAuth state and LDAP cache growth
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 50/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
src/asfquart/generics.py の40行目付近と87-93行目を起点に、コールバック中に保留中の OAuth state がどのように保存および削除されるかを追跡します。issue にあるクリーンアップの代替案を確認し、その後、期限切れのエントリが削除されることを検証する定期クリーンアップ機構とユニットテストを追加します。放棄された state が蓄積されなくなり、長時間実行されるプロセスが安定したメモリ使用量を維持できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Issue: FINDING-276 - No Expiry Cleanup for Stale OAuth State Entries (Memory Leak)
Labels: bug, security, priority:low, asvs-level:L2
ASVS Level(s): L2
Description:
Summary
Expired state entries are only cleaned up when specifically looked up during a callback. If a user initiates an OAuth flow but never completes the callback, the state entry remains in the dictionary indefinitely until process restart, causing gradual memory growth. With ~200 bytes per entry, 1000 abandoned flows would leak ~200 KB. This is a resource leak rather than a security vulnerability, but could impact long-running processes in high-traffic scenarios.
Details
In src/asfquart/generics.py at line 40 and lines 87-93, expired state entries are only cleaned up on lookup, not proactively.
Recommended Remediation
Implement periodic cleanup mechanism.
Option 1: Add async background task that runs every 5 minutes to clean expired states:
async def _cleanup_expired_states():
current_time = time.time()
expired = [s for s, d in pending_states.items() if d['timestamp'] < (current_time - workflow_timeout)]
for state in expired:
pending_states.pop(state, None)
Option 2: Probabilistic cleanup on each request (e.g., 10% of requests trigger cleanup).
Option 3: Migrate to Redis with automatic TTL-based expiry.
Acceptance Criteria
- Periodic cleanup mechanism implemented
- Memory leak eliminated
- Long-running processes maintain stable memory usage
- Unit tests verify cleanup logic
References
- Source reports: L2:10.4.7.md
- Related findings: FINDING-272
- ASVS sections: 10.4.7
Priority
Low
The LDAP_CACHE dictionary is a module-level in-memory cache with no size limit, no eviction policy, and no background cleanup. Entries are only overwritten when the same userid is looked up again. The TTL (3600s) is checked for staleness (to determine if a re-query is needed) but expired entries are never removed from memory. Over the lifetime of the process, the cache grows monotonically as new users are encountered.
- 主要言語
- Python
- スター
- 7
- フォーク
- 13
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/infrastructure-asfquart のほかの issue
-
bug priority
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
Document OAuth callback consistency rules対応中かも @Marrshal15 が 16 日前に担当しました。 オープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
apache/infrastructure-asfquart#126 · コメント 1 件 ·
-
ASVS priority
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
apache/infrastructure-asfquart#85 · コメント 1 件 ·
-
Triage and track asfquart issues対応中かも @sbp が 15 日前に担当しました。 オープン
apache/infrastructure-asfquart#134 · 担当者 1 名 ·
apache/infrastructure-asfquart の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ansys/pyansys-common-mcp#213 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
freedomofpress/dangerzone#1594 ·
メンテナーはふだん 3 日以内に返信
-
priority:P1 status:in-review type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
randomparity/kdive#3317 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:ci
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
mesonbuild/meson#16281 ·
メンテナーはふだん 1 日以内に返信