That’s a harder question to answer and depends more on your own moral compass. Do you believe that having better defensive capabilities empowers the users of your creation to feel safe enough to do evil things? I certainly don’t think you could absolve the makers of anti-missile systems who supply militaries that are committing genocide.
I try to stay practical about it. A screwdriver manufacturer is not an arms dealer. But if your work only has value in the violent world of war, then I think it’s worth asking yourself if you’re comfortable with that. I don’t always disparage people that are, even though I certainly couldn’t stomach it.
My rule of thumb is to ask whether the defense industry is the only customer for the product. The company I work for does sell some to defense, but the products were not designed with defense as the primary purpose. It still doesn’t feel great to me, but I’m finding it increasingly difficult to avoid defense funding nowadays.