Introduction Safe sessions Types with topics Results Conclusion
Secure multiparty sessions with topics
Ilaria Castellani, Mariangiola Dezani-Ciancaglini, Ugo deâLiguoro
INRIA Sophia Antipolis, University of Turin
PLACES - Eindhoven, April 2016
1/20
Introduction Safe sessions Types with topics Results Conclusion
Motivation and goal
control flow based security analysis relies onsecurity levelsand level drop detection to discover information leaks
in case of multiparty communication this leads to unreasonable restrictions
previous work where multiparty sessions have been endowed with security levels and type systems enforcing leak-free communication, suffers from similar restrictions
here we add a further dimension, calledtopics, to relax these restrictions, and show that this can be ensured via a type system
2/20
Introduction Safe sessions Types with topics Results Conclusion
Motivation and goal
control flow based security analysis relies onsecurity levelsand level drop detection to discover information leaks
in case of multiparty communication this leads to unreasonable restrictions
previous work where multiparty sessions have been endowed with security levels and type systems enforcing leak-free communication, suffers from similar restrictions
here we add a further dimension, calledtopics, to relax these restrictions, and show that this can be ensured via a type system
2/20
Introduction Safe sessions Types with topics Results Conclusion
Motivation and goal
control flow based security analysis relies onsecurity levelsand level drop detection to discover information leaks
in case of multiparty communication this leads to unreasonable restrictions
previous work where multiparty sessions have been endowed with security levels and type systems enforcing leak-free communication, suffers from similar restrictions
here we add a further dimension, calledtopics, to relax these restrictions, and show that this can be ensured via a type system
2/20
Introduction Safe sessions Types with topics Results Conclusion
Motivation and goal
control flow based security analysis relies onsecurity levelsand level drop detection to discover information leaks
in case of multiparty communication this leads to unreasonable restrictions
previous work where multiparty sessions have been endowed with security levels and type systems enforcing leak-free communication, suffers from similar restrictions
here we add a further dimension, calledtopics, to relax these restrictions, and show that this can be ensured via a type system
2/20
Introduction Safe sessions Types with topics Results Conclusion
Motivation and goal
control flow based security analysis relies onsecurity levelsand level drop detection to discover information leaks
in case of multiparty communication this leads to unreasonable restrictions
previous work where multiparty sessions have been endowed with security levels and type systems enforcing leak-free communication, suffers from similar restrictions
here we add a further dimension, calledtopics, to relax these restrictions, and show that this can be ensured via a type system
2/20
Introduction Safe sessions Types with topics Results Conclusion
Secure information flow
Let (L, v) be the lattice of security levels:
` v `0â ` is less confidential than `0
⼠= public, > = secret. Aleakis an information flow
¡ ¡ ¡ v`¡ ¡ ¡ u`0¡ ¡ ¡ where ` 6v `0 and
v`is sent from a participantpto a participantqandqis either the sender or the receiver of u`0
3/20
Introduction Safe sessions Types with topics Results Conclusion
Secure information flow
Let (L, v) be the lattice of security levels:
` v `0â ` is less confidential than `0
⼠= public, > = secret.
Aleakis an information flow
¡ ¡ ¡ v`¡ ¡ ¡ u`0¡ ¡ ¡ where ` 6v `0 and
v`is sent from a participantpto a participantqandqis either the sender or the receiver of u`0
3/20
Introduction Safe sessions Types with topics Results Conclusion
Secure information flow
Let (L, v) be the lattice of security levels:
` v `0â ` is less confidential than `0
⼠= public, > = secret.
Aleakis an information flow
¡ ¡ ¡ v`¡ ¡ ¡ u`0¡ ¡ ¡ where ` 6v `0 and
v`is sent from a participantpto a participantqandqis either the sender or the receiver of u`0
3/20
Introduction Safe sessions Types with topics Results Conclusion
Motivating example
Alice as PC member:
receives the opinion of Bob on paper 1 sends her judgment on paper 2 to Charlie
the level of Bob opinion is not smaller than the level of Alice judgment standard information flow security
7
information flow security with topics
3
4/20
Introduction Safe sessions Types with topics Results Conclusion
Motivating example
Alice as PC member:
receives the opinion of Bob on paper 1
sends her judgment on paper 2 to Charlie
the level of Bob opinion is not smaller than the level of Alice judgment standard information flow security
7
information flow security with topics
3
4/20
Introduction Safe sessions Types with topics Results Conclusion
Motivating example
Alice as PC member:
receives the opinion of Bob on paper 1 sends her judgment on paper 2 to Charlie
the level of Bob opinion is not smaller than the level of Alice judgment standard information flow security
7
information flow security with topics
3
4/20
Introduction Safe sessions Types with topics Results Conclusion
Motivating example
Alice as PC member:
receives the opinion of Bob on paper 1 sends her judgment on paper 2 to Charlie
the level of Bob opinion is not smaller than the level of Alice judgment
standard information flow security
7
information flow security with topics
3
4/20
Introduction Safe sessions Types with topics Results Conclusion
Motivating example
Alice as PC member:
receives the opinion of Bob on paper 1 sends her judgment on paper 2 to Charlie
the level of Bob opinion is not smaller than the level of Alice judgment standard information flow security
7
information flow security with topics
3
4/20
Introduction Safe sessions Types with topics Results Conclusion
Motivating example
Alice as PC member:
receives the opinion of Bob on paper 1 sends her judgment on paper 2 to Charlie
the level of Bob opinion is not smaller than the level of Alice judgment standard information flow security
7
information flow security with topics
3
4/20
Introduction Safe sessions Types with topics Results Conclusion
Motivating example
Alice as PC member:
receives the opinion of Bob on paper 1 sends her judgment on paper 2 to Charlie
the level of Bob opinion is not smaller than the level of Alice judgment standard information flow security
7
information flow security with topics
3
4/20
Introduction Safe sessions Types with topics Results Conclusion
Motivating example
Alice as PC member:
receives the opinion of Bob on paper 1 sends her judgment on paper 2 to Charlie
the level of Bob opinion is not smaller than the level of Alice judgment standard information flow security
7
information flow security with topics
3
4/20
Introduction Safe sessions Types with topics Results Conclusion
Safety with topics
A leak is an information flow
¡ ¡ ¡ v`¡ ¡ ¡ u`0¡ ¡ ¡ where ` 6v `0
Addingtopicsa leak is
¡ ¡ ¡ v`,Ď¡ ¡ ¡ u`0,Ď¡ ¡ ¡ where ` 6v `0 and Ď, Ď are correlated
5/20
Introduction Safe sessions Types with topics Results Conclusion
Access control and leak freedom w.r.t. topics
Access control (AC):for each participant p and topic Ď:
participant p is able to receive v`,Ď if ` v Ď(p, Ď) (reading level)
Leak freedom (LF):a session is leak free if for each participant p whenever p receives v`,Ď, she just sends values u`0,Ď s.t.
` v `0 or Ďj Ď where Ďb Ď if Ď and Ď are independent topics.
6/20
Introduction Safe sessions Types with topics Results Conclusion
Access control and leak freedom w.r.t. topics
Access control (AC):for each participant p and topic Ď:
participant p is able to receive v`,Ď if ` v Ď(p, Ď) (reading level)
Leak freedom (LF):a session is leak free if for each participant p whenever p receives v`,Ď, she just sends values u`0,Ď s.t.
` v `0 or Ďj Ď where Ďb Ď if Ď and Ď are independent topics.
6/20
Introduction Safe sessions Types with topics Results Conclusion
Access control and leak freedom w.r.t. topics
Access control (AC):for each participant p and topic Ď:
participant p is able to receive v`,Ď if ` v Ď(p, Ď) (reading level)
Leak freedom (LF):a session is leak free if for each participant p whenever p receives v`,Ď, she just sends values u`0,Ď s.t.
` v `0 or Ďj Ď where Ďb Ď if Ď and Ď are independent topics.
6/20
Introduction Safe sessions Types with topics Results Conclusion
A multiparty session calculus
Expressions:
e ::= x || v`,Ď || op(e1, . . . , en) Processes:
P ::= q!Îť(e).P || p?Îť(x ).Q || P â P || P + P || ÂľX .P || X || 0
Multiparty sessions:
M ::= p1/ P1 | . . . | pn/ Pn
Operational semantics:
P q!Îť(v
`,Ď)
ââââââ P0 Q p?Îť(v
`,Ď)
âââââââ Q0 p / P | q / Q p(Îť,v
`,Ď)q
âââââââ p / P0 | q / Q0
7/20
Introduction Safe sessions Types with topics Results Conclusion
Safe sessions
Definition
A multiparty session M is safe if it satisfies:
Access control (AC):
whenever Ď Âˇ p(Îť, v`,Ď)q is a trace of M, then ` v Ď(q, Ď);
Leak freedom (LF):
whenever Ď Âˇ p(Îť, v`,Ď)q ¡ Ď0¡ q(Îť0, u`0,Ď)r is a relay trace of M, then either ` v `0 or Ďb Ď.
where Ď Âˇ p(Îť, v`,Ď)q ¡ Ď0¡ q(Îť0, u`0,Ď)r is a relay trace from p to r mediated by q.
8/20
Introduction Safe sessions Types with topics Results Conclusion
Examples
A trace of a safe session (that was not such in past systems)
Bob (evaluation,ârejectâ`1, paper 1) Alice Alice (evaluation,âacceptâ`2, paper 2) Charlie
`1is not smaller than `2
paper 1 and paper 2 are independent
9/20
Introduction Safe sessions Types with topics Results Conclusion
Examples
A trace of a safe session (that was not such in past systems)
Bob (evaluation,ârejectâ`1, paper 1) Alice
Alice (evaluation,âacceptâ`2, paper 2) Charlie
`1is not smaller than `2
paper 1 and paper 2 are independent
9/20
Introduction Safe sessions Types with topics Results Conclusion
Examples
A trace of a safe session (that was not such in past systems)
Bob (evaluation,ârejectâ`1, paper 1) Alice Alice (evaluation,âacceptâ`2, paper 2) Charlie
`1is not smaller than `2
paper 1 and paper 2 are independent
9/20
Introduction Safe sessions Types with topics Results Conclusion
Examples
A trace of a safe session (that was not such in past systems)
Bob (evaluation,ârejectâ`1, paper 1) Alice Alice (evaluation,âacceptâ`2, paper 2) Charlie
`1is not smaller than `2
paper 1 and paper 2 are independent
9/20
Introduction Safe sessions Types with topics Results Conclusion
Examples
A trace of a safe session (that was not such in past systems)
Bob (evaluation,ârejectâ`1, paper 1) Alice Alice (evaluation,âacceptâ`2, paper 2) Charlie
`1is not smaller than `2
paper 1 and paper 2 are independent
9/20
Introduction Safe sessions Types with topics Results Conclusion
Types
Sorts:
S ::= nat || int || bool || string Global types:
G ::= p â q : {Îťi(Si`i,Ďi).Gi}i âI || Âľt.G || t || end Session types:
T ::=_
i âI
q!Îťi(Si`i,Ďi).Ti || ^
i âI
p?Îťi(Si`i,Ďi).Ti || Âľt.T || t || end
10/20
Introduction Safe sessions Types with topics Results Conclusion
Level, topic agreement with a type
h`, Ďiagreeswith T , h`, Ďi âş T , if according to T only values of level
`0w ` are sent on topics related with Ď
h`, Ďi âş T is co-inductively defined by h`, Ďi âş end
if h`, Ďi âş Ti for all i â I then h`, Ďi âş^
i âI
p?Îťi(Si`i,Ďi).Ti
if h`, Ďi âş Ti and either ` v `0i or Ďb Ďi for all i â I then h`, Ďi âş_
i âI
q!Îťi(S`0i,Ďi).Ti
11/20
Introduction Safe sessions Types with topics Results Conclusion
Level, topic agreement with a type
h`, Ďiagreeswith T , h`, Ďi âş T , if according to T only values of level
`0w ` are sent on topics related with Ď h`, Ďi âş T is co-inductively defined by
h`, Ďi âş end
if h`, Ďi âş Ti for all i â I then h`, Ďi âş^
i âI
p?Îťi(Si`i,Ďi).Ti
if h`, Ďi âş Ti and either ` v `0i or Ďb Ďi for all i â I then h`, Ďi âş_
i âI
q!Îťi(S`0i,Ďi).Ti
11/20
Introduction Safe sessions Types with topics Results Conclusion
Safe session types
Type T issafeif
1 all input continuations are safe and agreed by the respective participant, topic pairs,
2 all output continuations are safe and outputs are sent to participants with the proper reading level
Coinductively end is safe
if h`i, Ďii âş Ti and Ti is safe for all i â I then
^
i âI
p?Îťi(Si`i,Ďi).Ti is safe if `iv Ď(q, Ďi) and Ti is safe for all i â I then
_
i âI
q!Îťi(Si`i,Ďi).Ti
12/20
Introduction Safe sessions Types with topics Results Conclusion
Safe session types
Type T issafeif
1 all input continuations are safe and agreed by the respective participant, topic pairs,
2 all output continuations are safe and outputs are sent to participants with the proper reading level
Coinductively end is safe
if h`i, Ďii âş Ti and Ti is safe for all i â I then
^
i âI
p?Îťi(Si`i,Ďi).Ti is safe if `iv Ď(q, Ďi) and Ti is safe for all i â I then
_
i âI
q!Îťi(Si`i,Ďi).Ti
12/20
Introduction Safe sessions Types with topics Results Conclusion
Session type system
Type rules:
Î ` e : S`,Ď Î ` P I T Î ` q!Îť(e).P I q!Îť(S`,Ď).T
Î, x : S`,Ď` Q I T Î ` p?Îť(x ).Q I p?Îť(S`,Ď).T Î ` P1I T1 Î ` P2I T2
Î ` P1â P2I T1⨠T2
Î ` P1I T1 Î ` P2I T2 Î ` P1+ P2I T1â§ T2
Î ` P I T is asafe typing if all types in the derivation are safe.
Example: if Ď(p, Ď) = > and Ďb Ď we can derive
` p?Îť(x).r!Îť0(falseâĽ,Ď).0 I p?Îť(bool>,Ď).r!Îť0(boolâĽ,Ď).end
13/20
Introduction Safe sessions Types with topics Results Conclusion
Session type system
Type rules:
Î ` e : S`,Ď Î ` P I T Î ` q!Îť(e).P I q!Îť(S`,Ď).T
Î, x : S`,Ď` Q I T Î ` p?Îť(x ).Q I p?Îť(S`,Ď).T Î ` P1I T1 Î ` P2I T2
Î ` P1â P2I T1⨠T2
Î ` P1I T1 Î ` P2I T2 Î ` P1+ P2I T1â§ T2
Î ` P I T is asafe typing if all types in the derivation are safe.
Example: if Ď(p, Ď) = > and Ďb Ď we can derive
` p?Îť(x).r!Îť0(falseâĽ,Ď).0 I p?Îť(bool>,Ď).r!Îť0(boolâĽ,Ď).end
13/20
Introduction Safe sessions Types with topics Results Conclusion
Subtyping
Subtyping of safe types, T ⤠T0, is co-inductively defined by end ⤠end
if Ti⤠Ti0 for all i â I â J then
^
i âI
p?Îťi(Si`i,Ďi).Ti 6^
j âJ
p?Îťj(Sj`j,Ďj).Tj0
if Ti⤠Ti0 for all i â I â J then _
i âI
p!Îťi(Si`i,Ďi).Ti 6_
j âJ
p!Îťj(Sj`j,Ďj).Tj0
14/20
Introduction Safe sessions Types with topics Results Conclusion
Global type system
Letâs take from [Honda-Yoshida-Carbone 2008]:
pt{G } is the set of participants of G
G p is the projection into the session type for p
` Pi I Ti Ti⤠G pi pt{G } â {p1, . . . , pn} âi â {1, . . . , n}
p1/ P1| . . . | pn/ PnI G
15/20
Introduction Safe sessions Types with topics Results Conclusion
Typing example
Alice / Bob?evaluation(x ). Charlie!evaluation(âacceptâ`1,paper 2).0 Bob?evaluation(String`1,paper 1).Charlie!evaluation(String`2,paper 2).end
16/20
Introduction Safe sessions Types with topics Results Conclusion
Session and global type reduction
Reduction of session types:
T ⨠T0=â T p!Îť(S`,Ď).T =â T ^
i âI
p?Îťi(Si`i,Ďi).Ti =â Ti
Reduction of global types:
G =â G \ pââ qÎť
where G \ pââ q is the global type obtained from G by executing theÎť communication pââ qÎť
17/20
Introduction Safe sessions Types with topics Results Conclusion
Subject reduction
Theorem
If p / P | Mââ p / PÎş 0 | M0, and p / P | M I G and ` P I T , then:
1 p / P0 | M0 I G0 for some G0 such that G =ââG0;
2 ` P0 I T0 for some T0 such that T =ââT0.
Proved by establishing that:
if q!Îť(S`,Ď).T ⤠G p, then T ⤠(G \ pââ q) p;Îť if p?Îť(S`,Ď).T â§ T0⤠G q, then T ⤠(G \ pââ q) q;Îť G r = (G \ pââ q) r for r 6= p, r 6= q.Îť
18/20
Introduction Safe sessions Types with topics Results Conclusion
Soundness theorem
Theorem
If M is typeable by a derivation containing only safe types then M is safe.
Proof essentially based on subject reduction theorem.
19/20
Introduction Safe sessions Types with topics Results Conclusion
Conclusion and further work
Advantages of the proposed approach:
A sequence of messages directed to the same participant is always allowed
Thanks to the introduction of topics, the standard leak-freedom requirement can be relaxed also on relay sequences, by forbidding only downward flows between messages on related topics. Further directions:
consider multiple sessions
enrich the present calculus by allowing levels and topics to depend on exchanged values, following [Louren¸co-Caires 2015]
20/20
Introduction Safe sessions Types with topics Results Conclusion
Conclusion and further work
Advantages of the proposed approach:
A sequence of messages directed to the same participant is always allowed
Thanks to the introduction of topics, the standard leak-freedom requirement can be relaxed also on relay sequences, by forbidding only downward flows between messages on related topics.
Further directions:
consider multiple sessions
enrich the present calculus by allowing levels and topics to depend on exchanged values, following [Louren¸co-Caires 2015]
20/20
Introduction Safe sessions Types with topics Results Conclusion
Conclusion and further work
Advantages of the proposed approach:
A sequence of messages directed to the same participant is always allowed
Thanks to the introduction of topics, the standard leak-freedom requirement can be relaxed also on relay sequences, by forbidding only downward flows between messages on related topics.
Further directions:
consider multiple sessions
enrich the present calculus by allowing levels and topics to depend on exchanged values, following [Louren¸co-Caires 2015]
20/20