The same way as everywhere else where collateral damage is a concern. Electronic warfare and jammers.
ESG demonstrated their modular GUARDION system specifically for harbour protection to NATO navies during Open Spirits 2019. The system is operational with the German military for field camp defense since last year.
I think the security teams will be in for a rude awakening by having a false sense of security with such a system such as GUARDION and other similar systems guarding harbors and important infrastructures.
First thing I wouldn't underestimate the intelligence and determination and what our enemies are capable of doing and this system seems to be designed and built thinking the adversary will be coming high in broad daylight, using gps and being controlled from the ground. The adversary, especially state sponsored would add an anti-jammer to their drone if they would even use gps. Onboard electronics and electric motors would be shielded from HPEM devices.
Several drones out the back of a van, pickup truck or local delivery cube van coordinated from multiple locations could be launched very quickly and at close range from a public road close to its target. A drone flying low between trees and buildings gives operators very little time to react even against cots drones.
How well does the Guardion system detect against background clutter of trees and buildings?(I know this would be classified, but food for thought) Does it detect a drone flying low and fast across choppy water in the harbor at night towards your naval ship. Add in some inclement weather, rain, snow, sandstorm. What about heavy fog, dense smoke?
A harbor is a great collection of ships and infrastructure and to any adversary is like shooting fish in a barrel.
What worries me is the next Pearl Harbor won't be from aircraft carriers and dive bombers but from the enemy within. Small independent groups sponsored with the support of an outside state could be extremely devastating.
The Guardian system is a start, but I hope their not all patting themselves on the back thinking how great their system is in defending a harbor from an intelligent, capable and determined foe.
Even here in Canada our naval bases will be targets and should be well defended. When you look at the amount of capital spent on our warships and infrastructure, all in such a small radius, it begs the question, are our bases protected from a modern day Pearl Harbor from happening?