Statically Checking Web API Requests in Java']JavaScript

被引:23
|
作者
Wittern, Erik [1 ]
Ying, Annie T. T. [1 ]
Zheng, Yunhui [1 ]
Dolby, Julian [1 ]
Laredo, Jim A. [1 ]
机构
[1] IBM TJ Watson Res Ctr, Yorktown Hts, NY 10598 USA
关键词
Static analysis; !text type='Java']Java[!/text]Script; Web APIs;
D O I
10.1109/ICSE.2017.30
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Many JavaScript applications perform HTTP requests to web APIs, relying on the request URL, HTTP method, and request data to be constructed correctly by string operations. Traditional compile-time error checking, such as calling a nonexistent method in Java, are not available for checking whether such requests comply with the requirements of a web API. In this paper, we propose an approach to statically check web API requests in JavaScript. Our approach first extracts a request's URL string, HTTP method, and the corresponding request data using an inter-procedural string analysis, and then checks whether the request conforms to given web API specifications. We evaluated our approach by checking whether web API requests in JavaScript files mined from GitHub are consistent or inconsistent with publicly available API specifications. From the 6575 requests in scope, our approach determined whether the request's URL and HTTP method was consistent or inconsistent with web API specifications with a precision of 96.0%. Our approach also correctly determined whether extracted request data was consistent or inconsistent with the data requirements with a precision of 87.9% for payload data and 99.9% for query data. In a systematic analysis of the inconsistent cases, we found that many of them were due to errors in the client code. The here proposed checker can be integrated with code editors or with continuous integration tools to warn programmers about code containing potentially erroneous requests.
引用
收藏
页码:244 / 254
页数:11
相关论文
共 50 条
  • [1] Statically Checking Conventionality of Array Objects in Java']JavaScript
    Younang, Astrid
    Lu, Lunjin
    Almashfi, Nabil
    [J]. TOOLS AND METHODS OF PROGRAM ANALYSIS, 2018, 779 : 183 - 195
  • [2] A Formal Model for Checking Cryptographic API Usage in Java']JavaScript
    Mitchell, Duncan
    Kinder, Johannes
    [J]. COMPUTER SECURITY - ESORICS 2019, PT I, 2019, 11735 : 341 - 360
  • [3] Analyzing Java']JavaScript Web Applications in the Wild (Mostly) Statically
    Ryu, Sukyoung
    [J]. PROGRAMMING LANGUAGES AND SYSTEMS, APLAS 2015, 2015, 9458 : XII - XIV
  • [4] Statically Checking REST API Consumers
    Burnay, Nuno
    Lopes, Antonia
    Vasconcelos, Vasco T.
    [J]. SOFTWARE ENGINEERING AND FORMAL METHODS, SEFM 2020, 2020, 12310 : 265 - 283
  • [5] Type Checking for Java']JavaScript
    Anderson, Christopher
    Giannini, Paola
    [J]. ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2005, 138 (02) : 37 - 58
  • [6] xWIDL: Modular and Deep Java']JavaScript API Misuses Checking Based on eXtended WebIDL
    Zhang, Zhen
    [J]. COMPANION PROCEEDINGS OF THE 2016 ACM SIGPLAN INTERNATIONAL CONFERENCE ON SYSTEMS, PROGRAMMING, LANGUAGES AND APPLICATIONS: SOFTWARE FOR HUMANITY (SPLASH COMPANION'16), 2016, : 63 - 64
  • [7] Roy A Statically Typed, Functional Language for Java']JavaScript
    McKenna, Brian
    [J]. IEEE INTERNET COMPUTING, 2012, 16 (03) : 86 - 91
  • [8] Mining API Type Specifications for Java']JavaScript
    Wang, Shuai
    Dou, Wensheng
    Gao, Chushu
    Wei, Jun
    Huang, Tao
    [J]. 2017 24TH ASIA-PACIFIC SOFTWARE ENGINEERING CONFERENCE (APSEC 2017), 2017, : 368 - 377
  • [9] CoffeeStrainer - Statically checking structural constraints on Java']Java programs
    Bokowski, B
    [J]. OBJECT-ORIENTED TECHNOLOGY: ECOOP'98 WORKSHOP READER, 1998, 1543 : 380 - 381
  • [10] Exploring API Deprecation Evolution in Java']JavaScript
    Nascimento, Romulo
    Hora, Andre
    Figueiredo, Eduardo
    [J]. 2022 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION AND REENGINEERING (SANER 2022), 2022, : 169 - 173