Bound OAuth state and LDAP cache growth
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 50/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
调研方向
从 src/asfquart/generics.py 第 40 行附近以及第 87-93 行开始,跟踪待处理的 OAuth 状态在回调期间是如何存储和移除的。查看 issue 中的清理方案,然后添加定期清理机制和单元测试,以验证过期条目会被移除。完成的标准是:被放弃的状态不再累积,并且长时间运行的进程能够保持稳定的内存使用量。
由索引模型根据 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
- 派生
- 14
- 平均合并
- 11 小时 58 分钟
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/infrastructure-asfquart 的其他 Issue
-
Set connection and total timeouts for OAuth token exchange可能已有人在做 @AnKiT-GaRG2 于 4 天前认领。 未关闭bug priority
难度 2/5 1-3 小时 新手友好度 72/100
apache/infrastructure-asfquart#130 ·
维护者通常 1 天内回复
-
Document external service endpoints and failure behavior可能已有人在做 @AnKiT-GaRG2 于 8 天前认领。 未关闭documentation
难度 2/5 1-3 小时 新手友好度 68/100
apache/infrastructure-asfquart#129 ·
维护者通常 1 天内回复
-
Document OAuth callback consistency rules可能已有人在做 @Marrshal15 于 26 天前认领。 未关闭documentation
难度 2/5 1-3 小时 新手友好度 74/100
apache/infrastructure-asfquart#126 · 1 条评论 ·
维护者通常 1 天内回复
-
ASVS priority
难度 2/5 1-3 小时 新手友好度 70/100
apache/infrastructure-asfquart#85 · 1 条评论 ·
维护者通常 1 天内回复
-
Triage and track asfquart issues可能已有人在做 @sbp 于 25 天前认领。 未关闭
apache/infrastructure-asfquart#134 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 apache/infrastructure-asfquart 的全部 Issue
相似的 Issue
-
[oblt-aw][autodoc] Document new required `shared-org-key` input for `obs-aw-dependency-review`可能已有人在做 @github-actions 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
getchaintips leaves out the active tip once a header is staged on it, where Core always lists it未关闭
难度 2/5 1-3 小时 新手友好度 88/100
btclib-org/btclib-node#2158 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
dbt-msft/dbt-sqlserver#897 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
Gathin23/cleanyourtv#2770 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
Dao-AILab/flash-attention#3097 ·
维护者通常 3 天内回复