APIs are the primary mechanism for developers to gain access to externally defined services and tools. However, previous research has revealed API misuses that violate the contract of APIs to be prevalent. Such misuses can have harmful consequences, especially in the context of cryptographic libraries. Various API misuse detectors have been proposed to address this issue including CogniCrypt, one of the most versatile of such detectors and that uses a language CrySL to specify cryptographic API usage contracts. Nonetheless, existing approaches to detect API misuse had not been designed for systematic reuse, ignoring the fact that different versions of a library, different versions of a platform, and different recommendations or guidelines might introduce variability in the correct usage of an API. Yet, little is known about how such variability impacts the specification of the correct API usage. This paper investigates this question by analyzing the impact of various sources of variability on widely used Java cryptographic libraries including JCA, Bouncy Castle, and Google Tink. The results of our investigation show that sources of variability like new versions of the API and security standards significantly impact the specifications. We then use the insights gained from our investigation to motivate an extension to the CrySL language named MetaCrySL, which builds on meta programming concepts. We evaluate MetaCrySL by specifying usage rules for a family of Android versions and illustrate that MetaCrySL can model all forms of variability we identified and drastically reduce the size of a family of specifications for the correct usage of cryptographic APIs
翻译:API是开发者获得外部界定的服务和工具的主要机制,然而,先前的研究显示,API滥用情况普遍,违反API合同的API滥用情况违反API合同,这种滥用可能会造成有害后果,特别是在加密图书馆中,建议各种API滥用检测器解决这一问题,包括CogniCrypt,这是这种探测器中最有多种功能的探测器之一,它使用一种语言CrySL来指定加密API使用合同。然而,现有检测API滥用情况的方法并没有设计为系统再利用,忽视图书馆的不同版本、平台的不同版本、不同建议或准则可能会在正确使用API方面造成差异。然而,对于这种变化如何影响正确使用API的规格却知之甚少。本文通过分析各种变异来源对广泛使用的所有爪哇加密图书馆(包括JCA、Bouncy Castle 和Google Tink)的影响来调查这一问题。我们的调查结果显示,变异源的来源,如API和安全标准的新版本,会大大地影响规格的使用。我们随后利用SLSL的变异性概念来确定SL的变异性定义,以便确定SLLLA和SLMMM的代号的代号的代号。