I've never had difficulty in my career expressing my advice to anybody, including the minister for whom I worked, when I thought what he was about to do was not a good idea, either for legal reasons or for ethical reasons or for policy reasons of any sort. That is part of the function of a public servant, to give the best advice to a minister.
I was never a yes man to a minister, but in the final analysis one always, if it was legal and if there was no ethical problem, complied with whatever it was the government wanted to do.