一句话:首个大规模实证研究,结合静态分析与 LLM 检测,量化 Hugging Face Spaces 的密钥泄露规模与风险。
论文关注 Hugging Face Spaces(Spaces)平台上敏感信息(API token、数据库凭证等)被意外暴露的安全问题,指出学界对其范围与影响仍缺乏系统认识。作者构建了 2022 年 3 月至 2024 年 12 月间创建的 313,647 个公开 Spaces 仓库数据集,并提出 Secret Reviewer 框架,将静态分析与大语言模型(LLM)辅助检测相结合以识别泄露凭证。检测结果显示,9,149 个仓库存在密钥泄露漏洞,共涉及 11,557 个唯一密钥,其中 76% 来自 OpenAI、Groq 等主流 AI 服务商;30% 的泄露隐藏在提交历史中,另有 1,000 多个非代码文件包含敏感数据。进一步验证表明,30% 的检出密钥仍然有效,包括 140 个有效数据库凭证,以及 50% 具备写权限的访问令牌,凸显了严重安全风险,并呼吁加强平台生态的安全实践。
Hugging Face Spaces (Spaces) has become a leading platform for hosting AI applications, offering developers seamless integration of Git-based repositories and out-of-the-box web service deployment. However, as its adoption continues to expand, security concerns have come to light. Recent reports have pointed to the issue of accidental exposure of sensitive information, such as API tokens and database credentials, within Spaces-hosted code. Despite these concerns, the research community still lacks a comprehensive understanding of the scope and impact of these security risks. To bridge this gap, we present the first large-scale and systematic empirical study to quantify the extent of secret key leakage in Spaces. We begin by compiling a comprehensive dataset of 313,647 public Spaces repositories created between March 2022 and December 2024. To detect exposed secret keys, we introduce Secret Reviewer, an advanced framework that combines static analysis and Large Language Model (LLM)-assisted detection to identify leaked credentials. Applying Secret Reviewer, we identified 9,149 with secret keys leakage vulnerabilities and 11,557 unique keys—76% of which from leading AI service providers such as OpenAI and Groq. Our findings indicate that 30% of leaks were embedded in commit histories, and over 1,000 non-code files contained sensitive data. Further validation revealed that 30% of detected keys remained active, including 140 valid database credentials and 50% of access tokens with write permissions, underscoring significant security risks. Our study sheds light on critical security challenges in AI platform ecosystems and advocates for stronger security practices to mitigate these risks.
@inproceedings{paperbot11570,
title = {A Large-Scale Empirical Study of Secret Key Leakage in Hugging Face Spaces},
author = {Shaoxuan Yun and Yuchao Zhang and Zhikun Shi and Liu Wang and Yi Wang and Yu Bai},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3773117}
}