The Whomping Willow was the method of guarding the passage.
When the tunnel was originally built, to sneak Lupin in and out of Hogwarts, the Whomping Willow was put there specifically to guard that passageway.
“I told you, months ago, that the Whomping Willow was planted the year I came to Hogwarts. The truth is that it was planted because I had come to Hogwarts. This house –’ Lupin looked miserably around the room, ‘– the tunnel that leads to it – they were built for my use. Once a month, I was smuggled out of the castle, into this place, to transform. The tree was placed at the tunnel mouth to stop anyone coming across me while I was dangerous.”
- Harry Potter and the Prisoner of Azkaban, Chapter 18 (Moony, Wormtail, Padfoot and Prongs)
Anyone coming from the Shrieking Shack would still encounter the Whomping Willow, so it would be an effective guard from anyone trying to break into Hogwarts as well. The tree can hit quite hard, and there’s only one way to get past it - by pressing a specific knot on the trunk. Even if someone knows how to stop the tree, they still would have to physically do it without being hit first. When Harry and Hermione were near it, it did quite a bit of damage to them.
“Harry – we’ve got to go for help –’ Hermione cried; she was bleeding, too; the Willow had cut her across the shoulder.
‘No! That thing’s big enough to eat him, we haven’t got time –’
‘We’re never going to get through without help –’
Another branch whipped down at them, twigs clenched like knuckles.”
- Harry Potter and the Prisoner of Azkaban, Chapter 17 (Cat, Rat, and Dog)
For a person to stop it, they’d most likely need a long stick, since the tree probably wouldn’t let them get close to the knot.
“Sirius thought it would be – er – amusing, to tell Snape all he had to do was prod the knot on the tree-trunk with a long stick, and he’d be able to get in after me.”
- Harry Potter and the Prisoner of Azkaban, Chapter 18 (Moony, Wormtail, Padfoot and Prongs)
It’s possible that if they did think of the passageway to the Shrieking Shack, the staff considered the Whomping Willow to be enough protection for it on its own. Lupin was the only one who knew Sirius was an Animagus, and he was keeping it a secret from everyone including Dumbledore, so they’d presume it would be a human they’d be dealing with, and wouldn’t know he could turn into a dog that was smaller and lower to the ground.
Lupin wouldn’t have told Dumbledore that Sirius could get past it.
Lupin did know that Sirius could get past the Whomping Willow, but he was very much keeping it a secret from everyone else that Sirius was an Animagus and was with him every month. He thought about telling Dumbledore after finding out Sirius escaped from Azkaban, but he never actually did.
“Lupin’s face had hardened, and there was self-disgust in his voice. ‘All this year, I have been battling with myself, wondering whether I should tell Dumbledore that Sirius was an Animagus. But I didn’t do it. Why? Because I was too cowardly. It would have meant admitting that I’d betrayed his trust while I was at school, admitting that I’d led others along with me … and Dumbledore’s trust has meant everything to me. He let me into Hogwarts as a boy, and he gave me a job, when I have been shunned all my adult life, unable to find paid work because of what I am. And so I convinced myself that Sirius was getting into the school using Dark Arts he learnt from Voldemort, that being an Animagus had nothing to do with it … so, in a way, Snape’s been right about me all along.”
- Harry Potter and the Prisoner of Azkaban, Chapter 18 (Moony, Wormtail, Padfoot and Prongs)
He also therefore wouldn't have told Dumbledore that Sirius knew how to get past the Whomping Willow, since that would reveal that he was breaking the rules.
“I sometimes felt guilty about betraying Dumbledore’s trust, of course … he had admitted me to Hogwarts when no other Headmaster would have done so, and he had no idea I was breaking the rules he had set down for my own and others’ safety. He never knew I had led three fellow students into becoming Animagi illegally.”
- Harry Potter and the Prisoner of Azkaban, Chapter 18 (Moony, Wormtail, Padfoot and Prongs)
Lupin wouldn’t have told Dumbledore that Sirius could get past the Whomping Willow, because explaining that would also mean having to admit he’d betrayed Dumbledore’s trust and broken the rules.