Detection of security smells in IaC scripts through semantics-aware code and language processing

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: War, Aicha, Rawass, Adnan A., Kabore, Abdoul K., Samhi, Jordan, Klein, Jacques, Bissyande, Tegawende F.
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866908555179720704
author War, Aicha
Rawass, Adnan A.
Kabore, Abdoul K.
Samhi, Jordan
Klein, Jacques
Bissyande, Tegawende F.
author_facet War, Aicha
Rawass, Adnan A.
Kabore, Abdoul K.
Samhi, Jordan
Klein, Jacques
Bissyande, Tegawende F.
contents Infrastructure as Code (IaC) automates the provisioning and management of IT infrastructure through scripts and tools, streamlining software deployment. Prior studies have shown that IaC scripts often contain recurring security misconfigurations, and several detection and mitigation approaches have been proposed. Most of these rely on static analysis, using statistical code representations or Machine Learning (ML) classifiers to distinguish insecure configurations from safe code. In this work, we introduce a novel approach that enhances static analysis with semantic understanding by jointly leveraging natural language and code representations. Our method builds on two complementary ML models: CodeBERT, to capture semantics across code and text, and LongFormer, to represent long IaC scripts without losing contextual information. We evaluate our approach on misconfiguration datasets from two widely used IaC tools, Ansible and Puppet. To validate its effectiveness, we conduct two ablation studies (removing code text from the natural language input and truncating scripts to reduce context) and compare against four large language models (LLMs) and prior work. Results show that semantic enrichment substantially improves detection, raising precision and recall from 0.46 and 0.79 to 0.92 and 0.88 on Ansible, and from 0.55 and 0.97 to 0.87 and 0.75 on Puppet, respectively.
format Preprint
id arxiv_https___arxiv_org_abs_2509_18790
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Detection of security smells in IaC scripts through semantics-aware code and language processing
War, Aicha
Rawass, Adnan A.
Kabore, Abdoul K.
Samhi, Jordan
Klein, Jacques
Bissyande, Tegawende F.
Cryptography and Security
Artificial Intelligence
Machine Learning
Software Engineering
Infrastructure as Code (IaC) automates the provisioning and management of IT infrastructure through scripts and tools, streamlining software deployment. Prior studies have shown that IaC scripts often contain recurring security misconfigurations, and several detection and mitigation approaches have been proposed. Most of these rely on static analysis, using statistical code representations or Machine Learning (ML) classifiers to distinguish insecure configurations from safe code. In this work, we introduce a novel approach that enhances static analysis with semantic understanding by jointly leveraging natural language and code representations. Our method builds on two complementary ML models: CodeBERT, to capture semantics across code and text, and LongFormer, to represent long IaC scripts without losing contextual information. We evaluate our approach on misconfiguration datasets from two widely used IaC tools, Ansible and Puppet. To validate its effectiveness, we conduct two ablation studies (removing code text from the natural language input and truncating scripts to reduce context) and compare against four large language models (LLMs) and prior work. Results show that semantic enrichment substantially improves detection, raising precision and recall from 0.46 and 0.79 to 0.92 and 0.88 on Ansible, and from 0.55 and 0.97 to 0.87 and 0.75 on Puppet, respectively.
title Detection of security smells in IaC scripts through semantics-aware code and language processing
topic Cryptography and Security
Artificial Intelligence
Machine Learning
Software Engineering
url https://arxiv.org/abs/2509.18790