They sometimes directly use military (or ex-military) technology. Hubble is a prime example, being derived partly from cold-war spy satellites, just pointed around away from Earth.
Rockets, too, have technology heavily funded by the military for ballistic missiles.
There’s enough overlap that some discoveries, especially those close to Earth where weapons might be used, have to be checked out for national security reasons.
Further away from Earth, like planetary probes, there should be less of a problem.
Latest Answers