arXiv:2610.06132cs.CROct 2026

Manuscript Offprint

arXiv:2610.06132

Security Is More Than a Library Call: How Security Features Live in Code

Kevin Hermann, Sven Peldszus, Thorsten Berger

KEVIN HERMANN, Ruhr University Bochum, Germany

SVEN PELDSZUS, Chalmers | University of Gothenburg, Sweden

THORSTEN BERGER, Ruhr University Bochum and Chalmers | University of Gothenburg, Germany and Sweden

Implementing security features—functionalities that protect sensitive data or prevent malicious actions by attackers—is important for ensuring the security and integrity of software systems. Correctly implementing access control, cryptography, or other security features is challenging as they require substantial domain expertise, careful design, and custom implementation to integrate them within the software system.

Previous work has thoroughly studied security awareness, perception, practices, and expertise via surveys, interviews, and experiments. While they have shown that the implementation of security features are often supported by security libraries and frameworks, they have also shown that developers rarely are security experts, and make mistakes that introduce vulnerabilities into software when using them. Despite this extensive knowledge of security practices and developer behavior, we still lack a comprehensive understanding of how security features actually manifest at the code level across full software systems.

We close this gap by conducting a mining study of security features in 9 popular and large open-source Java systems such as Hadoop, Signal Server, and Tomcat. We manually inspected 2,127,761 lines of code across 19,121 files, identifying and annotating 183,395 lines implementing 561 security features corresponding to 54 security features in our taxonomy. We analyzed the characteristics of the identified security features, such as their size, scattering, tangling, common implementation patterns, and the use of internal and external functionalities. Our findings show that security features are far more than mere calls to external libraries. Security features, such as access control, can grow large in size, scatter across the whole codebase, and frequently tangle with each other. External security libraries are commonly used, but they require substantial amounts of code for integration. Once integrated, developers reuse their own functionality extensively throughout the codebase. We publish our annotated dataset for future research on security features in software systems.

1 Introduction

Modern software systems implement a wide range of security-specific functionality, commonly referred to as security features [1]. Applications authenticate users and services, enforce authorization decisions, protect data at rest and in transit, manage credentials and cryptographic keys, validate system state, and record security-relevant events. Yet, implementing such functionality correctly remains difficult. Empirical studies have repeatedly shown that developers struggle to implement security-sensitive functionality correctly, including cryptographic API usage and password storage [2–4]. Even when developers actively seek implementation guidance, the resources they consult can substantially affect the security of the resulting code [5]. At scale, incorrect integration of otherwise well-established security mechanisms can lead to exploitable vulnerabilities, as demonstrated, for example, for TLS in Android applications [6].

One response to these difficulties is to encapsulate security functionality in libraries and frameworks. Such abstractions provide reusable implementations of cryptographic primitives, authentication mechanisms, access-control infrastructure, secure communication, and other security functionality, reducing the need for application developers to implement sensitive mechanisms from scratch. However, using a security library does not eliminate the application-specific code required to integrate a security mechanism. Studies of security APIs show that developers often

Authors' Contact Information: Kevin Hermann, Ruhr University Bochum, Germany, Bochum; Sven Peldszus, Chalmers | University of Gothenburg, Sweden, Gothenburg; Thorsten Berger, Ruhr University Bochum and Chalmers | University of Gothenburg, Bochum, Germany and Sweden.

Hermann et al.

require substantial knowledge to compose and configure them correctly [2, 3, 7]. Security libraries and frameworks therefore provide useful entry points for locating security functionality, but they do not necessarily capture all code involved in realizing a security feature [1].

Prior empirical work has also examined the usability and misuse of security APIs [2, 3, 7], showing that developers frequently struggle with security-sensitive APIs and their correct integration. At the same time, feature-location [8, 9] research has shown that scattering and tangling complicate program comprehension and maintenance. For security features, however, it remains unclear how much code they comprise, how widely they are scattered, how strongly they are tangled with other security features, and what part of them comprises custom code instead of library uses.

Despite extensive research on vulnerabilities, security APIs, secure development practices, and security-relevant code [10–16][10–16], we lack a systematic understanding of how functional security features are realized across complete software systems. In particular, it remains unclear how much code they comprise, how widely they are distributed throughout a codebase, which parts are implemented within a project rather than provided by external functionality, and how different security features interact. Understanding these characteristics is important for techniques that aim to locate, analyze, maintain, or reason about security functionality.

To address these open questions, we investigate four research questions:

RQ1: What is the code-level footprint of security features?

RQ2: What are implementation and usage patterns of security features?

RQ3: What parts of security features are implemented within a software project?

RQ4: How do security features interact?

We conduct an empirical study of functional security features in nine mature Java systems from seven categories drawn from GitHub, comprising 2,127,761 lines of code across 19,121 files. We manually identify and annotate security-feature code at both line and block granularity and map the identified functionality to a taxonomy of functional security features derived by Hermann et al. [1]. The resulting dataset contains 561 security features across the 183,395 annotated lines of code in 19,712 locations and records their source-code footprint, including size, distribution, interactions with other security features, and use of internal and external functionality. We contribute:

• a curated dataset of 561 functional security features from 9 mature Java software systems;

• a characterization of the size, scattering, and tangling of security features; and

• an analysis of custom implemented and externally provided security functionality.

Our analysis shows that security features are more than just small wrappers around external security libraries. Across the studied systems, most security-relevant functionality is implemented internally, although custom implementations frequently use external functionality. The balance differs considerably among security feature categories. Standardized functionality, such as cryptographic primitives, is more likely to be externalized. In contrast, application-specific functionality, such as session management and access-control logic, requires substantially more project-specific integration and implementation. Security features also differ considerably in their footprint and distribution throughout the codebase. Access-control functionality, in particular, spans large portions of some systems. Analyses that identify security functionality solely through recognizable security-library calls therefore miss parts of its implementation.

References (57)