arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.18542cs.CRcs.AIcs.CLcs.LG
收藏

SecureCode:用于训练安全意识代码生成模型的生产级多轮数据集

SecureCode: A Production-Grade Multi-Turn Dataset for Training Security-Aware Code Generation Models

Scott Thornton

AI总结:

研究针对AI编码助手生成漏洞代码问题,提出SecureCode数据集,涵盖网络应用安全和AI/ML安全领域,有特定对话结构,经质量保证,发布统一数据集、开源模型及评估框架,是首个提供相关覆盖的公共数据集。

摘要:

人工智能编码助手在45%的安全相关场景中会生成易受攻击的代码,但尚无适合指令调整的公开训练数据集能同时教授传统网络安全和人工智能/机器学习特定防御。我们提出了SecureCode,这是一个包含2185个多轮安全训练示例的生产级数据集,涵盖两个领域:网络应用安全(1435个示例,涵盖2021年OWASP十大漏洞,涉及11种语言和9个框架,100%基于记录在案的漏洞和安全事件)和人工智能/机器学习安全(750个示例,涵盖2025年OWASP LLM十大漏洞的所有10个类别,涉及40多个框架)。每个示例都遵循4轮对话结构,旨在直接用于指令调整管道。质量保证结合了自动结构验证、来自七个专家人工智能视角的多智能体审查以及8阶段修复管道,为人工智能/机器学习组件产生了93.8/100(标准差=0.93)的评分标准校准平均质量得分。我们在Hugging Face上发布了统一数据集、八个微调的开源模型和一个评估框架。据我们所知,SecureCode是第一个以适合指令调整的统一对话模式联合提供2021年OWASP十大网络覆盖和2025年OWASP LLM十大人工智能/机器学习覆盖的公共数据集。

英文摘要:

AI coding assistants produce vulnerable code in 45\% of security-relevant scenarios~\cite{veracode2025}, yet no public training dataset teaches both traditional web security and AI/ML-specific defenses in a format suitable for instruction tuning. We present SecureCode, a production-grade dataset of 2,185 multi-turn security training examples spanning two domains: web application security (1,435 examples covering the OWASP Top 10 2021 across 11 languages and 9 frameworks, 100\% grounded in documented CVEs and security incidents) and AI/ML security (750 examples covering all 10 OWASP LLM Top 10 2025 categories across more than 40 frameworks, including LangChain, OpenAI, and Hugging Face). Every example follows a 4-turn conversational structure -- feature request; vulnerable and secure implementations with attack demonstrations; advanced probing; and defense-in-depth operational guidance -- designed for direct use in instruction tuning pipelines. Quality assurance combines automated structural validation with multi-agent review from seven specialist AI perspectives (more than 10{,}500 assessments) and an 8-phase remediation pipeline, producing a rubric-calibrated mean quality score of 93.8/100 ($σ= 0.93$) for the AI/ML component. Each example provides SIEM integration strategies, infrastructure hardening recommendations, and testing approaches using production frameworks. We release the unified dataset on Hugging Face with domain-specific loading configurations (web, aiml, default), alongside eight fine-tuned open-source models (3B--20B parameters, QLoRA), and an evaluation framework with four security-specific metrics. To our knowledge, SecureCode is the first public dataset that jointly provides OWASP Top 10 2021 web coverage and OWASP LLM Top 10 2025 AI/ML coverage in a unified conversational schema suitable for instruction tuning.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑