Slide 1

Slide 1 text

Domain-­Driven Model Inference Applied To Web Applications Sébastien Salva, William Durand — July 22, 2014 / SERP'14 0

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Context 100+ applications running in production Not (fully) covered by tests Documentation may be outdated MUST be maintained!

Slide 4

Slide 4 text

The only way to ensure stability while fixing a bug is to learn how the application behaves.

Slide 5

Slide 5 text

But writing such models is an heavy task and error prone. A first classic solution is to express these behaviours with formal models, e.g. Input Output Symbolic Transition Systems.

Slide 6

Slide 6 text

Hence the need for a model inference approach.

Slide 7

Slide 7 text

Model Inference

Slide 8

Slide 8 text

Inference is the act or process of reaching a conclusion about something from known facts or evidence.

Slide 9

Slide 9 text

What about doing the same, programmatically? A (human) domain expert can deduce the meaning of an application execution by reading its traces.

Slide 10

Slide 10 text

An expert system is a computer system that emulates the decision-making ability of a human expert.

Slide 11

Slide 11 text

Model Inference Framework

Slide 12

Slide 12 text

Model Generator Layers

Slide 13

Slide 13 text

Rules a rule can only be applied a limited number of times on the same knowledge base the inference rules are Modus Ponens no implicit knowledge elimination

Slide 14

Slide 14 text

Layer 1: Trace Filtering 1. Cleaning-up the trace set given as input, removing noise, a.k.a. irrelevant traces 2. Transforming "raw" traces into structured traces p HTTP requests and responses related to assets (CSS files, JavaScript files, images) are meaningless.

Slide 15

Slide 15 text

Structured HTTP Traces Let t = req1, resp1, ..., reqn, respn be a raw HTTP trace composed of an alternate sequence of HTTP request reqi and HTTP response respi. The structured HTTP trace σ of t is the sequence (a1(p), θ1)... (an(p), θn) where: ai is the HTTP verb used to perform the request in reqi, p is the parameter set {URI, request, response}, θi is a valuation p → Dp which assigns a value to each variables of p. θ is deduced from the values extracted from reqi and respi. The resulting trace set derived from raw traces is denoted ST.

Slide 16

Slide 16 text

Example GET("https://github.com/", req0, resp0) GET("https://github.com/login", ...) POST("https://github.com/session", ...) GET("https://github.com/", ...) GET("https://github.com/willdurand", ...) GET("https://github.com/willdurand/Geocoder", ...) POST("https://github.com/logout", ...) GET("https://github.com/", ...)

Slide 17

Slide 17 text

Layer 2: Transformation Of The Traces Into IOSTSs 1. Translating a structured trace set ST into a run set SR 2. Deriving a first IOSTS δ1 from SR Based on δ1, it should be possible to generate a different model M, but we must preserve the following relation: traces(M) = ST

Slide 18

Slide 18 text

Example

Slide 19

Slide 19 text

Layers 3-­N: IOSTS Abstraction Composed of rules that emulate the ability of a human expert to simplify transitions, to analyze transition syntax in order to deduce more meaningful information related to the targeted application, and to construct more abstract models. Each layer takes an IOSTS given by the direct lower one. It represents the current base of facts.

Slide 20

Slide 20 text

Layer 3 Layer 3 contains low level, generic rules that can be reused against different applications. Example rule "Identify Login Page" when $t: Transition( Action == GET, Guard.response.content contains('login-form') ) then modify ($t) { Assign.add("isLoginPage := true") } end

Slide 21

Slide 21 text

Layer 3 -­ Example

Slide 22

Slide 22 text

Layer 4 Layer 4 allows to infer a more abstract model composed of more expressive actions. Example rule "Identify Authentication" when $t1: Transition(Action == GET, Assign contains "isLoginPage:= true", $t1final := Lfinal) $t2: Transition(Action == PostRedirection, Linit == $t1lfinal, $t2linit := Linit) not Transition(Linit == $t2linit) then insert(new Transition("Authentication", Guard($t1.Guard,$t2.Guard), Assign($t1.Assign, $t2.Assign), $t1.Linit, $t2.Lfinal )) retract($t1) retract($t2) end

Slide 23

Slide 23 text

Layer 4 -­ Example

Slide 24

Slide 24 text

Need More?

Slide 25

Slide 25 text

Conclusion

Slide 26

Slide 26 text

Cons Writing (and maintaining) rules is harder than expected Preserving traces(M) = ST is not easy

Slide 27

Slide 27 text

Pros Original approach to derive IOSTS models It Works™

Slide 28

Slide 28 text

Future Work Applying such a framework on industrial systems (WIP) Generating test cases for regression testing Finding a better way to write rules

Slide 29

Slide 29 text

Thank You. Questions?