dynamic verification of inter parameter constraints in
play

Dynamic Verification of Inter-Parameter Constraints in Web - PowerPoint PPT Presentation

# Dynamic Verification of Inter-Parameter Constraints in Web Applications Nathalie Oostvogels Joeri De Koster Wolfgang De Meuter Third party web services 2 Web API specifications 3 Web API requests request.post( { url:


  1. ‹#› Dynamic Verification of Inter-Parameter Constraints in Web Applications Nathalie Oostvogels ・ Joeri De Koster ・ Wolfgang De Meuter

  2. Third party web services 2

  3. Web API specifications 3

  4. Web API requests request.post( { url: “api.twitter.com/1.1/direct_messages/new.json”, form: { user_id: 42, screen_name: “Alice”, text: “Hello” }}, (error, r, result) => { console.log(result) }); 4

  5. Web API specifications optional number max length optional string = 15 max length required string = 140 5

  6. Automatically Verifying Requests 6

  7. ⎬ Dynamic verification request.post( { url: “api.twitter.com/1.1/direct_messages/new.json”, form: { user_id: 42, 
 screen_name: “Alice”, test : “Hello” }}, (error, r, result) => { console.log(result) }); Request to “api.twitter.com/1.1/ � direct_messages/new.json" is incorrect: required field “text” not present. 7

  8. ⎬ Dynamic verification request.post( { url: “api.twitter.com/1.1/direct_messages/new.json”, form: { user_id: 42 screen_name: “Alice”, text : “Hello” }}, (error, r, result) => { console.log(result) }); � 8

  9. At runtime… � “Incompatible parameters specified in the request” � “Some co-ordinate parameters were blank” � “You must specify either a list ID or a slug and owner” 9

  10. Inter-parameter constraints ○ constraints defined over multiple parameters Exclusive Dependent Group Constraints Constraints Constraints 10

  11. Automatically Verifying Requests 11

  12. Exclusive constraints ○ exactly one of a set of parameters is required Silent choice: Twitter chooses screen_name over user_id 12

  13. Dependent constraints ○ constraints on a parameter depend on a 
 property of another parameter Silent choice: Facebook ignores details of link when link is not provided 13

  14. Group constraints ○ a set of parameters should either be all 
 excluded from a request or all included Silent choice: Twitter ignores latitude when longitude is not provided 14

  15. Inter-parameter constraints in web APIs # entry XOR Dependent Group points 117 10 3 3 97 32 14 6 50 11 3 5 206 12 0 1 209 11 4 1 9 2 5 2 15

  16. A new specification language for web APIs paths: /direct_messages/new: post: parameters: - name: user_id type: number - name: screen_name type: string - name: text 
 type: string required: true x-constraints: - present(screen_name) XOR present(user_id) 16

  17. Dynamic verification request.post( { url: “api.twitter.com/1.1/direct_messages/new.json”, form: { user_id : 42, screen_name : “Alice”, text: “Hello” }}, (error, r, result) => { console.log(result) }); Request to “api.twitter.com/1.1/direct_messages/new.json" is incorrect: � the exclusive constraint on user_id and screen_name is not satisfied. 17

  18. Inter-parameter constraints in web APIs Error message when � Error message when constraints not satisfied. � constraints not satisfied. � Eliminating vague error messages � Uniform error messages 18

  19. Conclusion ○ When programming against Web APIs, programmers 
 oIen resort to trial and error ○ Introduced tool that transparently intercepts and 
 validates requests according to specificaKon ○ S upports validaKon of inter-parameter constraints ○ Future work: inter-parameter constraints outside 
 of web APIs 19

Recommend


More recommend