A senior NSW police officer, celebrated for heroism during the Bondi Junction attack, has been diagnosed with a rare and aggressive form of cancer.