arXiv:2608.22638cs.SEcs.AI2026-08中稿 · ASE 2026被引 1

提出软屏障机制,阻止代码盲目复制粘贴,提升编程安全与质量。

Do Not Copy/Paste: Soft Barriers for Copying in AI-Assisted Programming

论文配图:Do Not Copy/Paste: Soft Barriers for Copying in AI-Assisted Programming
图 1 · 摘自论文原文
  • 用字符编码扰动实现视觉可读但无法直接执行的代码输出
  • 在HumanEval和MBPP上测试,不同模型下抗复制率差异显著
  • 适合关注代码安全、教育训练与审查场景的研究者和开发者

从聊天窗口将函数复制到编辑器不到一秒。对于许多AI编程工具的使用场景,速度是关键;但在编程教育、代码审查和高安全要求开发中,这反而成为问题。本文将复制粘贴视为‘AI代码交接’问题:模型生成内容进入可执行或提交软件的瞬间,正是当前工具缺乏管理的设计边界。我们主张,评估AI编程助手不应仅看生成代码质量,更要看其如何引导代码转移。提出‘软屏障’作为一类感知交接的机制,在保留辅助能力的同时,使未经检查的转移不再轻易实现。作为初步技术探索,我们采用保持视觉可读性但破坏直接复制执行的Unicode输出扰动。引入复制粘贴抵抗度(CPR),衡量功能正确但干净的解决方案在扰动后变为语法错误的比例。在HumanEval和MBPP数据集上,四类大型语言模型与四种扰动方法组合测试表明,输出级屏障可实现高抗复制性,但效果高度依赖模型与任务。18名参与者的探索性实验显示,软屏障能促使用户从直接转移转向编辑重构。我们不将Unicode扰动视为可部署方案,而是作为推动更广泛研究的最小探针,涵盖实用、透明且政策敏感的AI代码交接机制。

原文摘要 · Abstract (English)

Copying a function from a chat window into an editor takes less than a second. For many uses of AI coding tools, that speed is the point; in settings such as programming education, code review, and security-sensitive development, it can also be the problem. This paper frames copy-paste as an \emph{AI code handoff problem}: the moment model-generated text crosses from a conversational context into executable or committed software is a design boundary that current tools leave largely unmanaged. We argue that AI coding assistants should not only be evaluated by the code they generate, but also by how they mediate the transfer of that code into software artifacts. We propose \emph{soft barriers} as one class of handoff-aware mechanisms. Soft barriers preserve access to AI assistance while making unexamined transfer less frictionless. As an initial technical probe, we instantiate this idea using Unicode output perturbations that preserve visual readability but disrupt naive copy-paste execution. We introduce Copy-Paste Resistance (CPR), the fraction of functionally correct clean solutions that become syntactically invalid after perturbation. Across HumanEval and MBPP with four LLMs and four perturbation families, we find that output-level barriers can achieve high copy-paste resistance, but their effectiveness is highly model- and task-dependent. An exploratory pilot with 18 participants provides early evidence that soft barriers can shift users from direct transfer toward editing and reconstruction. We do not present Unicode perturbations as a deployment-ready solution; rather, we use them as a minimal probe for a broader research agenda on practical, transparent, and policy-aware AI code handoff.

代码生成AI安全人机交互软屏障

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。