Author Login Editor-in-Chief Peer Review Editor Work Office Work

Computer Engineering

   

A Static Detection Method for Dockerfile Temporary Files Based on Rule Validation

  

  • Published:2024-04-09

基于规则验证的Dockerfile临时文件静态检测方法

Abstract: The temporary file issue in Dockerfile causes the Docker image to pack unnecessary file resources beyond its functional requirements, resulting in an increase in image size and affecting the efficiency of image transmission and deployment. The existing dynamic analysis methods generate a large number of logs during runtime, resulting in significant system overhead. However, static analysis methods cannot detect various changes in temporary files, which limits their effective application in daily detection. This article proposes a static detection method for Dockerfile temporary files, which collects 21 temporary file forms through rule validation; Using node association algorithm to improve the AST structure and enhance detection efficiency; And based on NA-AST, a coloring mechanism is used to process nodes, ensuring detection integrity. The experimental results show that compared to existing schemes, the proposed method can detect various temporary file forms in files with less time overhead. In addition, this method provides a basis for classifying the forms of temporary files, which can be used for analyzing and detecting the new forms of subsequent temporary files, and has high universality.

摘要: Dockerfile中存在的临时文件问题使Docker镜像打包了超过其功能所需的不必要文件资源,导致镜像尺寸增大,影响了镜像传输和部署的效率。现有的动态分析法在运行时会产生大量日志,造成较大的系统开销,而静态分析法无法检测出临时文件的多种变化形式,限制了其在日常检测中的有效应用。本文提出了一种Dockerfile临时文件静态检测方法,通过规则验证收集了21种临时文件形式;使用节点关联算法改进AST结构,提高了检测效率;并在NA-AST基础上使用着色机制对节点进行处理,保证了检测完整性。实验结果表明,相较于现有方案,所提方法能够以较小的时间开销检测出文件中存在的各种临时文件形式。此外本文方法提供了一种对临时文件形式分类的依据,可用于对后续临时文件新增形式的分析和检测,具有较高的普适性。