[论文解读] APISENSOR: Robust Discovery of Web API from Runtime Traffic Logs
APISensor 是一个黑箱 API 发现框架,通过去噪、路径规范化以及对结构模板和语义行为进行两阶段基于图的聚类,鲁棒地从混合运行时流量中重建网络 API。
Large Language Model (LLM)-based agents increasingly rely on APIs to operate complex web applications, but rapid evolution often leads to incomplete or inconsistent API documentation. Existing work falls into two categories: (1) static, white-box approaches based on source code or formal specifications, and (2) dynamic, black-box approaches that infer APIs from runtime traffic. Static approaches rely on internal artifacts, which are typically unavailable for closed-source systems, and often over-approximate API usage, resulting in high false-positive rates. Although dynamic black-box API discovery applies broadly, its robustness degrades in complex environments where shared collection points aggregate traffic from multiple applications. To improve robustness under mixed runtime traffic, we propose APISENSOR, a black-box API discovery framework that reconstructs application APIs unsupervised. APISENSOR performs structured analysis over complex traffic, combining traffic denoising and normalization with a graph-based two-stage clustering process to recover accurate APIs. We evaluated APISENSOR across six web applications using over 10,000 runtime requests with simulated mixed-traffic noise. Results demonstrate that APISENSOR significantly improves discovery accuracy, achieving an average Group Accuracy Precision of 95.92% and an F1-score of 94.91%, outperforming state-of-the-art methods. Across different applications and noise settings, APISENSOR achieves the lowest performance variance and at most an 8.11-point FGA drop, demonstrating the best robustness among 10 baselines. Ablation studies confirm that each component is essential. Furthermore, APISENSOR revealed API documentation inconsistencies in a real application, later confirmed by community developers.
研究动机与目标
- 为在不断演进的 Web 服务上运行、文档不完整的情境下的LLM驱动代理,提供鲁棒的 API 发现能力的动机。
- 在现实世界的混合流量环境中,解决静态白盒与朴素黑盒方法的局限性。
- 开发一个无监督管道来提取 API 模板,并通过语义聚类对其进行细化,以提高精度和鲁棒性。
提出的方法
- 对运行时流量实施多信号噪声过滤,以去除非 API 请求。
- 通过去除冗余组件和标准化格式来规范化 API 路径。
- 使用两阶段聚类:阶段 1 使用 Drain3 前缀树挖掘结构模板,将路径分组为接口级模板(如 /api/v1/items/*)。
- 阶段 2 在每个模板组内使用轻量特征(路径结构、查询参数、负载复杂性)和基于图的聚类(或降级为 K-means)进行语义细化,以区分行为。
- 在最终目标函数中引入一致性损失 L_cons = ||A − σ(ZZ^T)||_F^2 与聚类正则项 L = L_cons + λ L_clus,以学习嵌入并形成连贯的语义聚类。
实验结果
研究问题
- RQ1RQ1: 与基线相比,APISensor 在不同应用中发现 API 的效果如何?
- RQ2RQ2: APISensor 对于不同 API 流量中的噪声(混合多租户网关)有多鲁棒?
- RQ3RQ3: 每个组件(去噪、模板挖掘、语义图聚类)对整体性能的贡献如何?
主要发现
- APISensor 在六个开源应用中实现了高发现准确率,平均 PGA 95.92%、RGA 94.36%、FGA 94.91%。
- APISensor 展现出对噪声类型与水平的强鲁棒性,在 FGA 与纯度的波动不超过 1% 的情况下,最大下降不超过 8.11 点。
- 在应用与噪声设置下,APISensor 的性能方差在 10 个基线方法中最低。
- 消融实验证实每个组件(噪声过滤、模板挖掘、语义细化、图聚类)对性能都是必需的。
- 研究提供了一个包含 10K+ 流量、199 个真实端点的基准,并指出在社区验证中发现了 Dify 的影子 API。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。