Security and Safety-Critical Learning-Based Collaborative Control for Multiagent Systems