JavaScript is the most used programming language for the last few years. Many JavaScript libraries are widely used in practice. However, existing research is not yet ready for analyzing JavaScript libraries. Pattern-based static analyzers use pattern matching to identify known buggy patterns. Yet, it can hardly identify bugs that require semantics-based analysis. Applying existing semantics-based static analyzers on JavaScript libraries faces several challenges: functions not reachable during analysis, creating objects of dynamic types, identifying new warnings for untested execution paths, and insufficient debugging aids.
To address these limitations, this thesis proposes TSA, a test-based approach that combines static and dynamic analysis. It leverages existing test cases to call and reach the library functions during static analysis. The approach extends existing test cases to identify new warnings for untested execution paths. It also reveals real errors that serve as debugging aids. This thesis applied TSA to analyze 32 popular client-side JavaScript libraries from GitHub. TSA identified 22–27% of new warnings for untested execution paths. It also verified the warnings of 47% of the subjects. A total of 3723 extended test cases revealed 33 unique TypeError. Among the 33 TypeError, existing tools can detect at most 24% of them. Developers confirmed six of the detected TypeError as real bugs. The proposed approach acts as a milestone that drives the JavaScript community to expand their scope of research by analyzing a large variety of JavaScript libraries in their work.
자바스크립트는 지난 몇 년 동안 가장 많이 사용되는 프로그래밍 언어이다. 실제로 많은 자바스크립트 라이브러리가 널리 사용 되지만, 기존 연구로는 자바스크립트 라이브러리 분석이 어렵다. 패턴 기반 정적 분석기는 패턴 일치를 사용하여 알려진 버그 패턴을 식별하지만, 의미 기반 분석이 필요한 버그를 식별하기는 쉽지 않다. 왜냐하면, 자바스크립트 라이브러리에 기존의 의미 기반 정적 분석기를 적용하면 분석 중에 도달 할 수없는 함수, 동적 유형의 객체 생성, 테스트되지 않은 실행 경로에 대한 새로운 경고 식별, 디버깅 도구 부족 등 여러 가지 문제가 있기 때문이다.
이러한 한계를 극복하기 위해 이 논문에서는 정적 분석과 동적 분석을 결합한 테스트 기반 접근 방식 인 TSA를 제안한다. 기존 분석 사례를 활용하여 정적 분석 중에 라이브러리 함수를 호출하고 도달한다. 이 접근법은 기존 테스트를 확장하여 테스트되지 않은 실행 경로에 대한 새로운 경고를 식별한다. 또한 디버깅 도구로 사용되는 실제 오류를 보여준다. 이 논문은 TSA를 통해 GitHub의 인기있는 자바스크립트 클라이언트 프로그램 32개를 분석했다. TSA는 테스트되지 않은 실행 경로에 대해 22-27%의 새로운 경고를 확인했으며, 또한 실험 프로그램 중 47%의 경고를 검증했다. 총 3723개의 확장 된 테스트가 33개의 고유 TypeError를 찾아냈다. 33개의 TypeError 중에서 기존 도구는 최대 24% 까지만 감지할 수 있다. 개발자들은 발견 된 TypeError 중 6개를 실제 버그로 확인했다. 제안 된 접근 방식은 자바스크립트 커뮤니티가 다양한 자바스크립트 라이브러리를 분석하여 연구 범위를 확장하는 중요한 이정표 역할을 한다.