Background: Previous studies have shown that up to 99.59 % of the Java apps using crypto APIs misuse the API at least once. However, these studies have been conducted on Java and C, while empirical studies for other languages are missing. For example, a controlled user study with crypto tasks in Python has shown that 68.5 % of the professional developers write a secure solution for a crypto task. Aims: To understand if this observation holds for real-world code, we conducted a study of crypto misuses in Python. Method: We developed a static analysis tool that covers common misuses of 5 different Python crypto APIs. With this analysis, we analyzed 895 popular Python projects from GitHub and 51 MicroPython projects for embedded devices. Further, we compared our results with the findings of previous studies. Results: Our analysis reveals that 52.26 % of the Python projects have at least one misuse. Further, some Python crypto libraries API design helps developers from misusing crypto functions, which were much more common in studies conducted with Java and C code. Conclusion: We conclude that we can see a positive impact of the good API design on crypto misuses for Python applications. Further, our analysis of MicroPython projects reveals the importance of hybrid analyses.
翻译:: 先前的研究显示, 高达99.59% 的 Java 应用程序使用加密 API 使用加密 API 至少一次滥用 API 。 然而, 这些研究是在 Java 和 C 上进行的, 而其他语言的经验性研究却缺失。 例如, Python 的加密任务受控制的用户研究显示, 68.5% 的专业开发者为加密任务撰写了安全解决方案。 目标 : 为了了解这个观测是否维持真实世界代码, 我们进行了 Python 中加密滥用的加密应用研究。 方法 : 我们开发了一个静态分析工具, 覆盖了 5 种不同的 Python 加密 API 的常见滥用。 我们分析了 GitHub 的895 流行 Python 项目, 和 嵌入设备的51 微波子项目 。 此外, 我们的分析显示 Python Pypto 项目的52 至少有一次误用 。 一些 Python 图书馆 API 设计有助于开发者误用加密 Pypto 函数, 我们的正确分析了 Calto 。