What tends to happen is when something blocks access to the search engine, it gets redirected to a page that doesn't have a valid certificate and you get that message, so it isn't necessarily anything to do with your wifi It's not a very specific or accurate message
It is some sort of misconfiguration.
One common cause is if time on the computer is wrong. Google particularly checks the security certificate with the time and if the time is wrong then you'll get that message.
It could be parental controls
It could be that you actually are on a public network and it isn't secure of course
It could be a VPN or antivirus if you have one
It could be an outdated version of Safari.
The point is, look at the configuration and see if there's something mismatched, don't just focus on the wifi
I"m going to have another take on that:
Supposing you are on an unsecure network, you type a request and it takes you to a dodgy site where the security certificate on the page is wrong. It'll pick it up and tell you you're on an unsecure network.
But anything which blocks access will take you to a page which can do that, or something which makes the certificate look invalid like the date or time being wrong will do exactly the same thing and it's this checking of the certificate and finding a mismatch which is creating the problem