Skip to content

Secure-Miner: Improving Secure Code Generation for LLMs by Mining Secure Coding Practices

Junjie Li, Jinqiu Yang

cs.CR

Abstract

Most existing research on secure code generation for Large Language Models (LLMs) heavily relies on disclosed vulnerability reports or synthetic datasets for fine-tuning. This approach frequently overlooks the diverse, secure coding practices that emerge naturally during real-world software development. This paper bridges this gap by proposing a novel framework to automatically extract and leverage secure practices observed in the wild to enhance secure code generation, with a particular focus on low-resource Common Weakness Enumerations (CWEs). Our methodology utilizes a multi-agent system consisting of: (1) a RegEx Agent that dynamically formulates security-related patterns based on CWE descriptions, optimized through an iterative feedback loop; (2) a Verification Agent that precisely identifies genuine secure functions from open-source repositories; and (3) a Refinement Agent that isolates core secure patterns by simplifying external dependencies to compile a high-quality dataset.

Create a lesson

Metadata

Categories
cs.CR, cs.SE