If you are interested in how app notarisation is enforced in detail, I recommend watching the WWDC 2019 session "Advances in macOS Security" [1]
Here's a quick summary:
App Notarisation is enforced by Gatekeeper. Gatekeeper only checks software with the "quarantined" attribute [2]. The "quarantined" attribute is set by web browsers, email clients, messaging apps, etc.
So this means that Gatekeeper does not check software installed with curl / brew / port.
You can circumvent Gatekeeper by right-clicking the file in Finder, or by removing the quarantine attribute.
A change from previous versions of macOS is that Gatekeeper now also checks programs you start from the command line (if they have the quarantine attribute set).
[2]: Actually Gatekeeper now also checks programs that don't have the quarantine attribute set, but it only checks the signature against a known malware database, and doesn't require notarisation. Details are in the video linked above.
Here's a quick summary:
App Notarisation is enforced by Gatekeeper. Gatekeeper only checks software with the "quarantined" attribute [2]. The "quarantined" attribute is set by web browsers, email clients, messaging apps, etc.
So this means that Gatekeeper does not check software installed with curl / brew / port.
You can circumvent Gatekeeper by right-clicking the file in Finder, or by removing the quarantine attribute.
A change from previous versions of macOS is that Gatekeeper now also checks programs you start from the command line (if they have the quarantine attribute set).
[1]: https://developer.apple.com/videos/play/wwdc2019/701/ (Transcript: https://asciiwwdc.com/2019/sessions/701)
[2]: Actually Gatekeeper now also checks programs that don't have the quarantine attribute set, but it only checks the signature against a known malware database, and doesn't require notarisation. Details are in the video linked above.