A small learned classifier flags hardcoded secrets in Ansible files from key names alone. It beats the regex tool Glitch and matches two frontier LLMs on recall, at near-zero cost, but trails them on precision.
| Method | F1 | Precision | Recall | |||
|---|---|---|---|---|---|---|
| Median | Rank | Median | Rank | Median | Rank | |
| Sonnet 4.6 | 0.787 | 1.50 | 0.816 | 1.47 | 0.765† | 2.10 |
| Fable 5 | 0.791 | 1.67 | 0.821 | 1.53 | 0.758† | 2.32 |
| Guard | 0.764 | 2.83 | 0.759 | 3.00 | 0.759 | 2.13 |
| Glitch | 0.673 | 4.00 | 0.658 | 4.00 | 0.695 | 4.78 |
| Mistral 7B | 0.560 | 5.00 | 0.455 | 5.00 | 0.731 | 3.67 |
| Glitch | Guard | ||||||
|---|---|---|---|---|---|---|---|
| pos. | P | R | F1 | P | R | F1 | |
| 0 | 519 | 0.630 | 0.698 | 0.662 | 0.816 | 0.799 | 0.807 |
| 4 | 420 | 0.627 | 0.652 | 0.638 | 0.797 | 0.760 | 0.778 |
| 8 | 356 | 0.623 | 0.609 | 0.613 | 0.790 | 0.723 | 0.752 |
| 12 | 308 | 0.625 | 0.556 | 0.581 | 0.787 | 0.681 | 0.724 |
| 16 | 248 | 0.622 | 0.481 | 0.532 | 0.783 | 0.641 | 0.697 |
| 19 | 217 | 0.621 | 0.434 | 0.495 | 0.792 | 0.618 | 0.684 |
| 22 | 181 | 0.625 | 0.377 | 0.452 | 0.796 | 0.569 | 0.651 |
| 26 | 153 | 0.626 | 0.295 | 0.379 | 0.817 | 0.507 | 0.611 |
| 30 | 104 | 0.596 | 0.221 | 0.297 | 0.840 | 0.411 | 0.527 |
| 34 | 72 | 0.512 | 0.106 | 0.154 | 0.866 | 0.307 | 0.434 |
| 38 | 46 | — | 0.000 | 0.000 | 0.857 | 0.173 | 0.287 |
Going deeper

Picture a building manager checking that nobody left a spare key taped under a doormat. The old method is a list of hiding places: under the mat, in the flowerpot. Anything hidden somewhere not on the list goes unseen, and someone must keep adding places by hand.
This paper's tool instead learns what a hiding place looks like. Having seen mats and flowerpots, it also suspects the loose brick and the fake rock. On real Ansible files it finds about as many hidden keys as two big commercial AI models, more than the list method, though it raises more false alarms than the AI models.
The authors then tore pages out of the list one at a time. The list method went blind once the pages ran out. The learned tool, retrained on what was left, kept finding some keys, and what it flagged stayed mostly right. It just checked fewer spots.
The abstract, word for word, with the six densest phrases unpacked.
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 files1. 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 set2. 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 GUARD3, while GUARD in turn significantly outperforms GLITCH and Mistral 7B; on recall, however, GUARD is statistically indistinguishable from Sonnet 4.6 and Fable 54. 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 service5. 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.0006), 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.
Two lines of work lead here: rule-based smell detectors and learned secret detection.
Read four parts of it, in this order.
Skip Section 2.2 if you know IaC security smells.
If the results are weaker than they look, start with the labels and the ablation design.
We resolve such conflicts in favour of sensitivity: a leaf is labeled positive if any of its occurrences is marked no_log = True, and negative only if all of its designated occurrences are marked no_log = False. This follows from the threat model rather than from the data. A key name that accepts secret values in even one module is a name developers demonstrably use for secrets, and a detector that stays silent on it wherever else it appears trades a missed credential for a marginal gain in precision. The rule is also less permissive in practice than it sounds: 632 of the 658 positive leaves have all of their designated occurrences marked secret, leaving 26 leaves with mixed designations across their occurrences; among those 26, a majority-vote rule would have assigned a different (negative) label to at most 10. Restricting training to designated leaves alone would leave the negative class both small and unrepresentative: explicit no_log = False designations are typically added to silence a static check that Ansible runs over module source code, which flags any parameter whose name superficially resembles a secret (e.g., containing password) so that its author can confirm the value need not be suppressed; the designated-negative class therefore over-represents keys that merely resemble secrets. We additionally promote to the negative class every non-designated leaf occurring at least three times in the corpus, on the assumption that a recurring key that no module author ever marked as sensitive is benign; these leaves are flagged so that any result can be recomputed without them. Because this rule manufactures labels, we measured its error rate rather than assuming it: a uniform random sample of 200 promoted leaves (seed 42, covering 6,223 occurrences) was reviewed manually against the annotation codebook used by Opdebeeck et al. [19] to construct their oracle, and one leaf, ssl_key, was found to be secret-bearing, giving an error rate of 0.50%. The final dataset comprises 31,486 unique leaves: 5,643 labeled (658 positive and 4,985 negative, of which 201 are designated and 4,784 promoted) and 25,843 left unlabeled for the semi-supervised methods.
Three properties of the design bound these conclusions. First, a Glitch detection is suppressed only when every keyword it matched has been removed, which is the most favourable assumption we could make on its behalf; its curve is therefore an upper bound on what a genuinely shorter list would have caught. Second, the degradation we attribute to lexical erosion is confounded with training-set size: Guard is retrained on progressively fewer positives, and part of the recall it loses would have been lost to any comparable reduction. Separating the two requires a control in which select is subsampled at random to the same number of positives, which we leave to future work; we note only that the confound cannot explain the preserved precision, which is the property the argument rests on. Third, in the last few removal budgets an increasing share of subsets leaves Glitch with no detections at all, for which precision is undefined and conventionally scored as zero; the apparent collapse of its precision in the rightmost part of Figure 9 is an artefact of that convention rather than a measured degradation.
The API costs reported in Section 4.3 correspond to a single classification pass of each LLM baseline over the full evaluation set, rather than to an average over repeated runs as for the accuracy metrics. Token consumption, and consequently cost, for a given LLM can vary across repeated calls to the same input, so these figures should be read as representative point estimates instead of precise per-run costs; the orders-of-magnitude gap with Guard’s inference cost is nonetheless unlikely to be affected by this variability.
Nothing on this page was recomputed. Every claim points to the paper so you can check it.
More latest news
Read all