If you can't open apps and get a message like “Sample.app” is damaged and can’t be opened. You should move it to the Bin.
, do the following:
xattr -p com.apple.rootless "/Applications/Safari.app" > quarantine.attr
xattr -w com.apple.quarantine "`cat quarantine.attr`" "/Applications/Sample.app"
Does not seem to work anymore from macOS Ventura.