The document discusses software analysis for web applications. It outlines the evolution of web technologies from static to dynamic and rich internet applications. It describes achievements in web code analysis including static, dynamic, and hybrid analysis techniques. Challenges in web code analysis are also discussed such as the asynchronous and event-driven nature of JavaScript. Future prospects include cross-language analysis, program support in IDEs, empirical studies on web applications, and semi-automatic learning. The document concludes that JavaScript is ubiquitous in web, mobile, and hardware applications and more software will be developed as web applications.
13. JavaScript: the Difficult Parts
1. Dynamic and weakly-typed
• types can change dynamically
• objects/functions can change
• First-class functions
2. Event-driven
3. Asynchronous callbacks
4. Prototype-based
• objects inherent from objects
• can be redefined at runtime
5. Constructs such as eval
6. Interactions with DOM
7. Interpreted (not compiled)
8. …
Make Software
Analysis Challenging
13
25. Cross-Language Analysis
We don’t know how to infer proper
control flow graphs for web code.
Stateless ServerBrowser
Async HTTP
Request
Response
Internet
JSON
JS, Java,
PHP, Ruby,
etc
DOMCSS
JS
34. Empirical Studies
Web analysis tools mainly built by reading best
practices or through developer intuition and
anecdotal observation
Example: what are the most common cross-project bug
patterns in web code?
40. 40
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
@Test
public void testAddNote(){
get("http://localhost:8080/theorganizer/");
findElement(By.id("logon_username")). sendKeys("user");
findElement(By.id("logon_password")). sendKeys("pswd");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Welcome to The Organizer!", closeAlertAndGetItsText());
findElement(By.id("newNote")). click();
findElement(By.id("noteCreateShow_subject")).sendKeys("Running Example");
findElement(By.id("noteCreateShow_text")).sendKeys("Create a simple running example");
findElement(By. cssSelector("input type ="image"")).click();
assertEquals("Note has been created.", findElement(By.id("mainContent")). getText());
findElement(By.id("logoff")).click();
}
41. Learning Assertions
A classification problem:
• Is a web element important to be checked by an assertion?
Apply machine learning to train a classier
• Features: position, size, page-rank, LinkNum, ChildNum, …
43. TO MICRO SERVICES
Micro ServicesBrowser
Restful HTTP
Request
Response
Internet
JSON
DOMCSS
JS
Micro
Service
Micro
Service
Micro
Service
Micro
Service
Micro
Service
Micro
Service
Micro
Service
Micro
Service
Micro
Service
Micro
Service
Micro
Service
Micro
Service
44. 44
On the client Even in hardware!On the server
JavaScript is everywhere