Enhancing Security Control Production With Generative AI

Chen Ling, Mina Ghashami, Vianne R. Gao, Ali Torkamani, Ruslan Vaulin, Nivedita Mangam, Bhavya Jain, Farhan Diwan, Malini Ss, Mingrui Cheng, Shreya Tarur Kumar, Felix CandelarioarXiv 2024 · DOI

Abstract

Cloud security requires the rapid development of structured security controls to protect diverse services and data. Traditionally, this process is manual and time-consuming, often taking days per control. This paper presents a Generative AI framework using Retrieval-Augmented Generation (RAG) and Chain-of-Thought (CoT) reasoning to automate the production of Gherkin-based security specifications. The system reduces development time from several days to under one minute while maintaining high technical accuracy and human readability.

Introduction

In modern cloud environments, security controls serve as the fundamental safeguards for data protection and regulatory compliance. However, the manual creation of these controls is a significant bottleneck. Security engineers must navigate the vast complexity of cloud service APIs, perform detailed threat modeling, and translate findings into formal specifications.

The primary challenges are twofold: the sheer diversity of cloud services (e.g., Amazon S3 vs. SageMaker) and the absolute requirement for precision. Security code cannot afford "hallucinations" or inaccuracies. Currently, the lifecycle of identifying, writing, and reviewing these specifications—typically written in the Gherkin "Given/When/Then" format—averages 2 to 3 days per control.

The traditional manual workflow for generating Gherkin security controls from AWS service definitions.

Methodology

The proposed framework utilizes a multi-stage pipeline powered by Claude-3-Sonnet via Amazon Bedrock. The architecture mimics human expert workflows through several key components:

1. Agent-based Identification

A specialized Large Language Model (LLM) agent first analyzes the target service and resource. It determines which control categories (such as "Encryption at Rest" or "Logging Enabled") are applicable, preventing the generation of irrelevant rules.

2. Retrieval-Augmented Generation (RAG)

To ground the model in technical reality, the system retrieves real-time data from public API documentation (e.g., Boto3). This ensures the generated code uses correct syntax and reflects the latest service features.

3. In-Context Learning and Chain-of-Thought

The system provides the model with "few-shot" examples of high-quality security controls. By employing Chain-of-Thought (CoT) reasoning, the model is instructed to identify relevant API calls and analyze potential insecure configurations before drafting the final script.

The RAG-based generation process combining in-context learning demonstrations with service API documentation to produce Gherkin code.

4. Structured Output

The framework targets Gherkin as its primary output. Gherkin acts as a "bridge" language: it is structured enough for automated testing and LLM generation, yet remains human-readable for expert review.

Results and Discussion

The implementation of this AI-driven pipeline resulted in a dramatic efficiency gain, reducing the development cycle from 48–72 hours to less than 60 seconds.

Expert evaluations using a 0–5 scoring rubric highlighted the system's strengths:

  • Technical Feasibility: The models achieved a high Scenario Feasibility (S-Score) of approximately 4.1/5, indicating that the generated security scenarios are technically sound.
  • Acceptance Threshold: Final acceptance scores for Encryption (3.42) and Logging (3.32) controls exceeded the production-ready threshold of 2.5.

While the logic and technical scenarios were robust, the models showed slight difficulty with high-level naming conventions and succinct rule descriptions (Rule Score ~0.7/1.0). This suggests that while the AI handles the complex logic, human-in-the-loop review remains essential for final polishing.

Conclusion

This research demonstrates that Generative AI, when combined with RAG and structured reasoning, can effectively automate the production of complex cloud security controls. By decomposing the task into identification, analysis, and generation phases, the framework achieves production-grade accuracy at a fraction of the traditional time cost. Future work will focus on further automating the translation of these Gherkin specifications into executable infrastructure-as-code (IaC) like Terraform or Python.

Summary updated

BibTeX
@misc{ling2024enhancing,
  author = {Chen Ling and Mina Ghashami and Vianne R. Gao and Ali Torkamani and Ruslan Vaulin and Nivedita Mangam and Bhavya Jain and Farhan Diwan and Malini SS and Mingrui Cheng and Shreya Tarur Kumar and Felix Candelario},
  title = {{Enhancing Security Control Production With Generative AI}},
  year = {2024},
  eprint = {2411.04284},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.04284},
}
Figure