This issue was addressed with improved checks to prevent unauthorized actions. This issue is fixed in iOS 15.4 and iPadOS 15.4, Security Update 2022-004 Catalina, macOS Monterey 12.3, macOS Big Sur 11.6.6. A malicious application may bypass Gatekeeper checks.
https://support.apple.com/en-us/HT213256
https://support.apple.com/en-us/102770
https://support.apple.com/en-us/HT213255