# A Hybrid Approach for Automated Security Pattern Recovery

DevFeed: [A Hybrid Approach for Automated Security Pattern Recovery](<https://devfeed.tech/articles/a-hybrid-approach-for-automated-security-pattern-recovery-118060.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.05823>)

Author: Anh Minh Nguyen, Tuan Dat Tran, Alzubair Hassan, Liliana Pasquale

Published: 2026-11-05T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>), [arXiv: Cryptography and Security](<https://devfeed.tech/sources/arxiv-cryptography-and-security.md>), [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [Static code analysis](<https://devfeed.tech/topics/static-code-analysis.md>), [llm-reasoning](<https://devfeed.tech/topics/llm-reasoning.md>), [code security](<https://devfeed.tech/topics/code-security.md>), [ReAct agent Python](<https://devfeed.tech/topics/react-agent-python.md>)

Tags: [abstract](<https://devfeed.tech/tags/abstract.md>), [agent](<https://devfeed.tech/tags/agent.md>), [aggregate](<https://devfeed.tech/tags/aggregate.md>), [all](<https://devfeed.tech/tags/all.md>), [analysis](<https://devfeed.tech/tags/analysis.md>), [api](<https://devfeed.tech/tags/api.md>), [approach](<https://devfeed.tech/tags/approach.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [arxiv](<https://devfeed.tech/tags/arxiv.md>), [automated](<https://devfeed.tech/tags/automated.md>), [can](<https://devfeed.tech/tags/can.md>), [code](<https://devfeed.tech/tags/code.md>), [code-property-graph](<https://devfeed.tech/tags/code-property-graph.md>), [code-search](<https://devfeed.tech/tags/code-search.md>), [components](<https://devfeed.tech/tags/components.md>), [costs](<https://devfeed.tech/tags/costs.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-cr](<https://devfeed.tech/tags/cs-cr.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [hybrid](<https://devfeed.tech/tags/hybrid.md>), [pattern](<https://devfeed.tech/tags/pattern.md>), [recovery](<https://devfeed.tech/tags/recovery.md>), [security](<https://devfeed.tech/tags/security.md>)

## AI overview

SecPatRec recovers security-pattern implementations by treating each pattern as a reference architecture: a ReAct-style LLM agent uses semantic and lexical code search to detect and ground roles in code, while static code property graph analysis recovers interactions. On a human-validated dataset of 100 instances of five patterns across 93 Java and Python repositories, averages across four LLMs were 0.84 for role detection, 0.84 for role-grounding similarity, and 0.66 for interaction recovery. Compared with a one-shot LLM baseline, SecPatRec had higher aggregate recovery scores, lower estimated API cost per run, and handled repositories beyond the baseline's configured input limit. The abstract describes results for this dataset and evaluation; recovered mappings and interactions can support inspection, but do not by themselves establish implementation security.

## Source excerpt

arXiv:2611.05823v1 Announce Type: cross Abstract: Security-by-design emphasises integrating security into software design and development. Security pattern catalogues operationalise this principle by prescribing reusable architectural solutions to recurring security problems. However, recovering their implementations from source code remains challenging because security patterns are abstract, span multiple components, and admit many valid implementations. We present SecPatRec, a hybrid approach for automated security pattern recovery from source code repositories. We treat a security pattern as a reference architecture and frame its recovery as a deductive task: determining which prescribed roles are present, grounding them in code entities, and recovering their interaction sequences. SecPatRec pairs a ReAct-style LLM agent equipped with semantic and lexical code search for role detection and grounding with static code property graph analysis for interaction recovery. We curate a human-validated ground-truth dataset of 100 pattern instances covering five security patterns across 93 open-source Java and Python repositories, and introduce a three-level evaluation framework measuring recovery correctness against this ground truth. We evaluate SecPatRec using four LLMs, including proprietary and open-source models. Averaged over all models and pattern instances, SecPatRec achieves role-detection accuracy of 0.84, role-grounding similarity of 0.84, and an interaction-recovery score of 0.66. Compared to a one-shot end-to-end LLM baseline, SecPatRec achieves higher aggregate recovery scores and lower estimated LLM API costs per run, while processing repositories that exceed the baseline's configured input limit. The recovered role mappings and statically derived interaction sequences provide structural and behavioural evidence that can support inspection of security-pattern implementations.