paperbot · PL 论文追踪

全部论文 待读 收藏

P2 SCPatcher: Mining Crowd Security Discussions to Enrich Secure Coding Practices

SCPatcher:挖掘众包安全讨论以丰富安全编码实践
ASE 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)2023匹配度 3/10 · 该论文利用LLM从Stack Overflow挖掘安全编码讨论并自动丰富安全编码实践,属于LLM+软件工程/安全方向,但与用户核心关注的静态分析、Agentic程序分析、浮点程序分析及贝叶斯程序分析关联较弱。它更偏安全知识抽取与规范构建,而非程序分析或验证技术。引用 1 inbox
Ziyou Jiang, Lin Shi, Guowei Yang, Qing Wang
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:挖掘 Stack Overflow 安全讨论,用 LLM 抽取代码示例与解释以自动丰富安全编码实践。

安全编码实践(SCP)通常只有一句话原则,缺乏具体说明,开发者难以落地。SCPatcher 通过挖掘 Stack Overflow 等在线知识共享平台中的众包安全讨论来自动丰富 SCP。对每个安全帖子,先用 Prompt Learning 调优的 LLM 抽取代码示例区与代码解释区;再将长代码分层切分为代码示例,并借助区域信息总结解释;最后匹配 CWE 与公共 SCP,融合示例和解释生成带细节的“野生 SCP 规范”。在 3907 个安全帖上,其代码示例抽取平均比基线高 2.73% MLine,解释抽取高 3.97% F1;在 447 个新帖上,生成规范为公共 SCP 增加 3074 行代码和 1967 句说明。

问题
安全编码实践通常仅为一句话原则、缺少详细规范,开发者尤其是缺乏安全编程经验者难以在实践中遵循。
方法
SCPatcher 使用经 Prompt Learning 调优的 LLM 从安全帖子中抽取代码示例与解释区域,分层切分长代码并总结解释,再匹配 CWE 与公共 SCP,融合生成更具体的“野生 SCP 规范”。
评估
在 3907 个 Stack Overflow 安全帖上,SCPatcher 在代码示例抽取上平均优于所有基线 2.73% MLine,在解释抽取上平均优于基线 3.97% F1;并在 447 个新帖上验证实用性,为公共 SCP 增加 3074 行代码和 1967 句说明。
原文摘要(Abstract)

Secure coding practices (SCPs) have been proposed to guide software developers to write code securely to prevent potential security vulnerabilities. Yet, they are typically one-sentence principles without detailed specifications, e.g., “Properly free allocated memory upon the completion of functions and at all exit points.”, which makes them difficult to follow in practice, especially for software developers who are not yet experienced in secure programming. To address this problem, this paper proposes SCPatcher, an automated approach to enrich secure coding practices by mining crowd security discussions on online knowledge-sharing platforms, such as Stack Overflow. In particular, for each security post, SCPatcher first extracts the area of coding examples and coding explanations with a fix-prompt tuned Large Language Model (LLM) via Prompt Learning. Then, it hierarchically slices the lengthy code into coding examples and summarizes the coding explanations with the areas. Finally, SCPatcher matches the CWE and Public SCP, integrating them with extracted coding examples and explanations to form the SCP specifications, which are the wild SCPs with details, proposed by the developers. To evaluate the performance of SCPatcher, we conduct experiments on 3,907 security posts from Stack Overflow. The experimental results show that SCPatcher outperforms all baselines in extracting the coding examples with 2.73 % MLine on average, as well as coding explanations with 3.97 % F1 on average. Moreover, we apply SCPatcher on 447 new security posts to further evaluate its practicality, and the extracted SCP specifications enrich the public SCPs with 3,074 lines of code and 1,967 sentences.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{JiangSYW23,
  title = {SCPatcher: Mining Crowd Security Discussions to Enrich Secure Coding Practices},
  author = {Ziyou Jiang and Lin Shi and Guowei Yang and Qing Wang},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00040}
}