Analysing risks and applying security measures