Towards Security by Design of Connected and Automated Vehicles: Cyber and Physical Threats, Mitigations, and Architectures