Exposed API keys in the public code repositories of healthcare large language model research
The rapid adoption of large language models (LLMs) in healthcare research has created a new class of security vulnerability, as researchers may inadvertently expose API credentials in publicly shared code repositories, enabling unauthorized access and financial liability. We quantified the prevalence and temporal trends of such exposures. In a cross-sectional analysis of 55,817 healthcare-related LLM research papers returned by a PMC search restricted to 2018 to 2025, we scanned repositories linked to 5,322 papers, examining both the latest snapshot and the complete commit history for hardcoded API credentials using service-specific regular expressions with multi-stage false-positive filtering and manual verification. Exposures were confirmed in 22 papers (0.41%), predominantly OpenAI-format (50%) and HuggingFace (32%) credentials. Exposure rates rose from 0.142% (2018 to 2023) to 0.203% in 2024 and 0.698% in 2025, a 3.4-fold year-over-year increase (Cochran-Armitage test for trend, P = .005). Scanning the complete commit history revealed more than twice as many exposures as the latest snapshot (52 vs. 22 papers), with 30 (58%) recoverable only from deleted commits. Because key validity was not tested, this low-frequency but growing vulnerability poses a risk to patient data and finances that is at present theoretical; as code-sharing mandates expand, integrating security safeguards into publishing workflows warrants consideration.
Authors
- Jungyo Suh (ORCID: https://orcid.org/0000-0002-3867-4778)
- Tae Joon Jun (ORCID: https://orcid.org/0000-0002-6808-5149)
Institutions
- Ulsan College (KR)
- University of Ulsan (KR)
- Artificial Intelligence in Medicine (Canada) (CA)
Publication Details
- Journal
- Scientific Reports
- Published
- 2026-08-24
- DOI
- https://doi.org/10.1038/s41598-026-68075-8
- Primary Topic
- Scientific Computing and Data Management
- Type
- article
- Field-Weighted Citation Impact
- 0.00