Guard: Robust Detection of Hardcoded Secrets in Ansible Playbooks

The adoption of DevOps practices and Infrastructure as Code (IaC) has transformed IT and cloud infrastructure management, but it also introduces new security challenges, as entire infrastructures are now defined in code. Existing detection tools for security smells are rule-based, matching configuration keys against keyword lists that must be curated and maintained by hand, or are learned models that operate on module-level metadata rather than on the configuration as written. In this paper we present GUARD, a learned classifier for hardcoded secrets that relies only on the key names found in IaC playbook files. Unlike regex-based approaches, GUARD does not depend on a fixed vocabulary, as it identifies variants of known secret key names and continues to flag keys whose tokens never appear in its training set. We compare GUARD against GLITCH, the state-of-the-art regex-based detector for Ansible, and three zero-shot large language models, namely Sonnet 4.6, Fable 5, and Mistral 7B. On F1 and precision, Sonnet 4.6 and Fable 5 significantly outperform GUARD, while GUARD in turn significantly outperforms GLITCH and Mistral 7B; on recall, however, GUARD is statistically indistinguishable from Sonnet 4.6 and Fable 5. Unlike commercial LLMs, GUARD attains this recall parity at a negligible inference cost with fully deterministic predictions, and without transmitting potentially sensitive IaC data to a third-party service. We further conduct an ablation study that incrementally strips the vocabulary GLITCH relies on: GLITCH's detection collapses once the list is exhausted (F1 from 0.662 to 0.000), whereas GUARD, retrained on the remaining key names, retains an F1 of 0.287 at a precision that never leaves [0.783, 0.868]. Losing keyword coverage therefore induces a trade-off for GUARD on recall, but not on reliability.

Authors

Institutions

Publication Details

Journal
arXiv
Published
2026-12-02
DOI
https://doi.org/10.48550/arxiv.2612.03789
Primary Topic
Software Engineering Research
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Guard: Robust Detection of Hardcoded Secrets in Ansible Playbooks

Matteo Grella, Luca Mariot, Andrea Continella, Willem Jonker
arXiv
Software Engineering Research
preprint

Guard: Robust Detection of Hardcoded Secrets in Ansible Playbooks

Matteo Grella, Luca Mariot, Andrea Continella, Willem Jonker
preprint en

Abstract

The adoption of DevOps practices and Infrastructure as Code (IaC) has transformed IT and cloud infrastructure management, but it also introduces new security challenges, as entire infrastructures are now defined in code. Existing detection tools for security smells are rule-based, matching configuration keys against keyword lists that must be curated and maintained by hand, or are learned models that operate on module-level metadata rather than on the configuration as written. In this paper we present GUARD, a learned classifier for hardcoded secrets that relies only on the key names found in IaC playbook files. Unlike regex-based approaches, GUARD does not depend on a fixed vocabulary, as it identifies variants of known secret key names and continues to flag keys whose tokens never appear in its training set. We compare GUARD against GLITCH, the state-of-the-art regex-based detector for Ansible, and three zero-shot large language models, namely Sonnet 4.6, Fable 5, and Mistral 7B. On F1 and precision, Sonnet 4.6 and Fable 5 significantly outperform GUARD, while GUARD in turn significantly outperforms GLITCH and Mistral 7B; on recall, however, GUARD is statistically indistinguishable from Sonnet 4.6 and Fable 5. Unlike commercial LLMs, GUARD attains this recall parity at a negligible inference cost with fully deterministic predictions, and without transmitting potentially sensitive IaC data to a third-party service. We further conduct an ablation study that incrementally strips the vocabulary GLITCH relies on: GLITCH's detection collapses once the list is exhausted (F1 from 0.662 to 0.000), whereas GUARD, retrained on the remaining key names, retains an F1 of 0.287 at a precision that never leaves [0.783, 0.868]. Losing keyword coverage therefore induces a trade-off for GUARD on recall, but not on reliability.

arXiv
University of Twente (NL)
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon