You could. They would have a similar meaning in this context. However, 'endangering' suggests something a bit more drastic and extreme (as it is from the word 'danger'), whereas 'compromise' is a more measured term meaning 'to affect in a detrimental way'.
I think compromising works well in this sentence. Compromising or compromised can imply a certain type of danger, as in your sentence and in "compromised position," etc. these definitions are from merriam webster online for compromising and compromised: b: to reveal or expose to an unauthorized person and especially to an enemy <confidential information wascompromised> c: to cause the impairment of <a compromised immune system> <a seriously compromised patient>