Applying Security by Design at the Point of Execution: How Governed Security Requirements Affect the Security of AI-Generated Code
- Source
- arxiv.org
- Author
- Pedro Farinha
- Date

Context
Giving a coding model explicit security requirements improved security scores in this small study, but did not establish an overall gain in working, secure software. Requirements were selected from a security knowledge base and delivered through a connection when the model generated code.
On 28 backend scenarios tested with working exploits, the share of functionally correct solutions resisting every exploit rose from 65% to 86%. That denominator matters: solutions that failed functional tests were excluded from this security comparison. The prespecified measure requiring both functionality and security did not improve significantly. Each experiment used one model and one generation per task, making the result evidence for supplying requirements at generation time, with the broader outcome still unresolved. Reported findings and limits.
- Requirements came from the author's governed security-by-design knowledge base (SbD-ToE) served over an ; typical secure-code benchmarks give the task without requirements and score it with unseen security tests.
- On DualGauge (59 Python tasks, scored by a language-), tasks passing all security tests rose from 44.1% to 78.0%, and the share of security tests passed rose from 77.4% to 93.0%.
- BaxBench's 86% exploit-free rate roughly matched the authors' Oracle Security Reminder (85%), which they call an unrealistic upper bound, and was reached without knowledge of the tests.
- The pre-specified joint secure-and-functional metric did not improve significantly on either benchmark: the stricter code failed functional tests that fix values the task never states.
- Each experiment used one model and one generation per task, and the manual's completeness was not assessed. The author proposes measuring conformance with applicable requirements, not just detected weaknesses.
- Tool — An operation that the software around a model makes available for the model to request, with a name, expected inputs and a kind of result.
- MCP server — A program that provides tools, resources and prompt templates to an MCP client; it may run on the same machine as the application or remotely.
- Model judge — A model asked to read an output and say whether it meets a criterion.
- Benchmark — A fixed set of tasks with a stated way of scoring them, used to compare models or setups.
articleEvaluating and Preventing Security Smells in AI-Generated Ansible CodePandu Ranga Reddy Konala, Vimal Kumar, David Bainbridge, Junaid Haseeb
articleWhen Passing Tests Hides Vulnerabilities: An Empirical Study of Silent Failures in Agentic SystemsWenji Bai, Muhammad Waseem, Zeeshan Rasheed, Jaakko Peltonen, Pekka Abrahamsson
articleAgentic Security: A Systematization of Tools, Failure Modes, and Design Laws for LLM-Driven Penetration TestingIsrat Moyeen Noumi, Tarannum Ahmed Nowshin, Md. Mehedi Hasan Nipu, Mohammad Sakib Mahmood, Md. Jakir Hossain, M. F. Mridha
Checking sign-in…
Loading comments…