enforcing user privacy in web applications using erlang

30
Enforcing User Privacy in Web Applications using Erlang Ioannis Papagiannis, Matteo Migliavacca, Peter Pietzuch Department of Computing Imperial College London David Eyers, Jean Bacon Computer Laboratory University of Cambridge Brian Shand CBCU National Health Service Web 2.0 Security & Privacy (W2SP) 2010 May 20, Berkeley, California, USA

Upload: others

Post on 14-Nov-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Enforcing User Privacy in Web Applications using Erlang

Enforcing User Privacy in Web

Applications using Erlang

Ioannis Papagiannis, Matteo

Migliavacca, Peter Pietzuch

Department of Computing

Imperial College London

David Eyers, Jean BaconComputer Laboratory

University of Cambridge

Brian ShandCBCU

National Health Service

Web 2.0 Security & Privacy (W2SP) 2010May 20, Berkeley, California, USA

Page 2: Enforcing User Privacy in Web Applications using Erlang

2

User Privacy in Web Applications

Which is longer, the United States Constitution or

Facebook’s Privacy Policy?

Facebook’s Privacy Policy: 5,830 words

United States Constitution: 4,543 words

[NYT, May 12, 2010]

Twitter 0 followers bug

Tweet "accept," followed by "@" and user name

The other user starts following you automatically (!)

[Official Twitter Blog, May 10, 2010]

W2SP 2010

Page 3: Enforcing User Privacy in Web Applications using Erlang

3

User Privacy in Web Applications

User data privacy must be guaranteed independently

of the application’s functional correctness

W2SP 2010

Page 4: Enforcing User Privacy in Web Applications using Erlang

4

User Privacy in Web Applications

Code should access only relevant user data and keep

them isolated from other users’ data

W2SP 2010

Page 5: Enforcing User Privacy in Web Applications using Erlang

5

Use Case: Privacy in Microblogging

A microblogging system should guarantee:

1. Messages from a publisher component shall be delivered only to authorised subscribers’ components. [User A’s messages will only go to Users B and C]

2. Authorised subscribers shall not be disclosed to any other publisher or subscriber component. [User B will not know about User C]

3. Subscription authorisation requests from a subscribing component shall be delivered only to the relevant publisher’s component.[Only User A can authorise a new User D]

W2SP 2010

Page 6: Enforcing User Privacy in Web Applications using Erlang

6

IFC for Microblogging

W2SP 2010

Page 7: Enforcing User Privacy in Web Applications using Erlang

7

IFC for Microblogging

W2SP 2010

Page 8: Enforcing User Privacy in Web Applications using Erlang

8

IFC for Microblogging

W2SP 2010

Page 9: Enforcing User Privacy in Web Applications using Erlang

9

IFC for Microblogging

W2SP 2010

Page 10: Enforcing User Privacy in Web Applications using Erlang

10

IFC for Microblogging

W2SP 2010

Page 11: Enforcing User Privacy in Web Applications using Erlang

11

IFC for Microblogging

What happens when data belonging to different users

has to be processed by a single component?

W2SP 2010

Page 12: Enforcing User Privacy in Web Applications using Erlang

12

Microblogging: The Dispatcher

Multiple publishing components have to use a single

dispatcher to reach the relevant subscriber components

W2SP 2010

Page 13: Enforcing User Privacy in Web Applications using Erlang

13

Microblogging: The Dispatcher

W2SP 2010

Multiple publishing components have to use a single

dispatcher to reach the relevant subscriber components.

Page 14: Enforcing User Privacy in Web Applications using Erlang

14

Solution

Each User’s data must be kept separate, but

applications are usually monolithic

Compartmentalize the application in multiple isolated

components, one per user

Granularity?

W2SP 2010

Page 15: Enforcing User Privacy in Web Applications using Erlang

15

Solution

Language Isolation Issue

C OS Processes ~100kB per process

W2SP 2010

Each User’s data must be kept separate, but

applications are usually monolithic

Compartmentalize the application in multiple isolated

components, one per user

Granularity?

Page 16: Enforcing User Privacy in Web Applications using Erlang

16

Solution

Language Isolation Issue

C OS Processes ~100kB per process

Java OS Threads Limited isolation: static fields,

object locks, runtime channels

W2SP 2010

Each User’s data must be kept separate, but

applications are usually monolithic

Compartmentalize the application in multiple isolated

components, one per user

Granularity?

Page 17: Enforcing User Privacy in Web Applications using Erlang

17

Solution

Language Isolation Issue

C OS Processes ~100kB per process

Java OS Threads Limited isolation: static fields,

object locks, runtime channels

PHP

JavaScript

OS Processes Spawning a new runtime on top of

spawning a new OS process

W2SP 2010

Each User’s data must be kept separate, but

applications are usually monolithic

Compartmentalize the application in multiple isolated

components, one per user

Granularity?

Page 18: Enforcing User Privacy in Web Applications using Erlang

18

Erlang

Sequential Part:

functional language, single assignment, dynamic typing

Concurrency:

share nothing concurrency, message passing

Erlang is great for IFC

Isolation is free

Asynchronous message passing can be naturally

combined with label checks

Processes are lightweight (~100B, runtime implementation)

W2SP 2010

Page 19: Enforcing User Privacy in Web Applications using Erlang

19

Erlang: Example

Receiver Process:primeTester() ->

receive

{calculate, Pid, Number} ->

Result = isPrime(Number),

Pid ! {result, Result}

end.

Sender Process:test(0) -> done;

test(N) ->

pid=spawn(primeTester),

pid ! {calculate, self(), N},

receive

{result, Result}->

io:format(“~w”,[Result])

end,

test(N-1)

end.

Spawning processes is fast!

Async message passing is the only way* of communication!

You can want to have lots of them!

W2SP 2010

Page 20: Enforcing User Privacy in Web Applications using Erlang

20

Supporting IFC in Erlang

Attach labels to pids

new_tag()

creates a new tag for the calling process

spawn(TagsAdd, TagsRemove, ...)

changes the tags of the spawned process (≠ caller’s tags)

send(TagsAdd, TagsRemove, ...)

changes the tags of the message (≠caller’s tags)

checks labels

delegate(PidReceiver, Tag, Type)

gives privileges over a tag to another process

W2SP 2010

Page 21: Enforcing User Privacy in Web Applications using Erlang

21

Erlang for Microblogging I

1. Messages from a publisher shall be received only by authorised subscribers.

W2SP 2010

(untrusted code)

Page 22: Enforcing User Privacy in Web Applications using Erlang

22

Erlang for Microblogging I

W2SP 2010

2. Authorised subscribers shall not be disclosed to any other publisher or subscriber.

(untrusted code)

Page 23: Enforcing User Privacy in Web Applications using Erlang

23

Erlang for Microblogging II

2. Authorised subscribers shall not be disclosed to any other publisher or subscriber.

W2SP 2010

(bug prevention)

Page 24: Enforcing User Privacy in Web Applications using Erlang

24

Erlang for Microblogging III

3. Subscription authorisation requests from subscribers shall be delivered only to the relevant publisher.

W2SP 2010

(bug prevention)

Page 25: Enforcing User Privacy in Web Applications using Erlang

25

Experimental Setup

Erlang Library that provides the IFC API Measure throughput in terms of messages per second #publishers=#subscribers, 10 subscriptions/subscriber Ignored orthogonal issues like message persistence

Comparison between: Python

[represents scripting languages]

Erlang (no IFC)[Dispatcher per publisher, better multicore performance]

Erlang (IFC)[Anonymisers plus label checks]

Erlang (IFC + caching)[cache and reuse of label checks]

W2SP 2010

Page 26: Enforcing User Privacy in Web Applications using Erlang

26

Evaluation

W2SP 2010

Page 27: Enforcing User Privacy in Web Applications using Erlang

27

Limitations & Discussion

Complexity Applications have to handle tags/privileges manually Deciding upon a tag allocation scheme is challenging Handling tags routines must be correct for secure operation

Policy languages may come to the rescue

Persistence Messages must be stored permanently Fetching and storing data but be compatible with labels

Extend Mnesia to be label aware

Scalability Inactive users must be offloaded from RAM Scalability depends upon the ability to keep in memory only

the required state

Introduce a primitive to hibernate/restore a process

W2SP 2010

Page 28: Enforcing User Privacy in Web Applications using Erlang

28

Conclusion

Erlang is an attractive approach for web applications thatuse IFC to provide privacy guarantees:

Isolation of components is free Asynchronous message passing is the norm in IFC

systems Scales well in multicore architectures

Web applications can provide IFC-enabled Erlang APIs and hosting facilities for untrusted extensions

The web application has to disseminate tags to components according to the relationships between users

Tags can enforce that the third-party extensions do not violate high level policy

W2SP 2010

Page 29: Enforcing User Privacy in Web Applications using Erlang

29

The End

Ioannis Papagiannis

DoC, Imperial College London

[email protected]

Page 30: Enforcing User Privacy in Web Applications using Erlang

30

Related Work

[How are Erlang Processes Lightweight? 2006]

Stack frames can be resized/moved (mem)

User-level, efficient caching when switching (time)

Lack of shared state means no locking (time)

[xBook09]

Uses a subset of JavaScript on the server side

Recreates Erlang’s communication model

[Abestos05]

Lightweight OS Processes, one per user

Cooperative Scheduling