A Type Inference Algorithm for Secure Ambients