I see this idea come up a lot on social media, even from rational people. The idea that the US government or world governments would try to cover up an imminent impact of a large asteroid or comet. As I work in this business I thought it would be fun to share some information about how this process works and why it would be impossible to keep it secret.
Some of you may know that in the 90s a 1.5km wide comet broke apart and smashed into Jupiter. If you are not aware of this you can read about it here: Shoemaker-Levy 9. This obviously garnered some attention from astronomers and the US government as fragment G left an impact scar on Jupiter that was roughly the size of the Earth's diameter. That coupled with other discoveries in the 90s such as the Chixculub impact crater led Congress to mandate in 1998 that NASA find all near-Earth objects (NEOs) greater than 1km in diameter. As this goal was nearing completion in 2005 the mandate was updated to include all NEOs 140m+ in diameter.
A near-Earth object is any comet or asteroid that has a perihelion distance (closest approach to sun) of less than or equal to 1.3 astronomical units (AU). Obviously the .3 AU part of 1.3 AU is a huge distance so while some objects are classified as NEOs they never come very close to Earth. In recent times objects have been discovered with their aphelion (furthest distance away from sun) inside of Venus's orbit. Strangely these are still classified as NEOs. The ones we really want to pay attention to are the objects that are around 100m or larger in diameter that pass within 19.5 lunar distances of Earth's orbit (~4.7 million miles). The 140m+ class of these objects are considered Potentially Hazardous Asteroids (PHAs). Their orbits are not stable over shorter time frames and they pose a larger threat to Earth. You can read up on NEO basics here: JPL NEO Basics
As of January 14th 2022, there are 2,218 known PHAs. This likely represents less than half of the population. NASA setup the Planetary Defense Coordination Office (PDCO) and started funding sky surveys to find all of these objects. There are two main surveys in operation right now that are currently discovering almost all NEOs, Catalina Sky Survey (CSS) and Pan-STARRS (PS). The new Rubin Observatory (LSST) will likely usher in a new age of NEO discovery when it comes online in Chile in a few years. Some estimates have LSST doubling the known NEO population in its first full year of operation. All of these projects are primarily funded by US tax dollars. The good news here is well over 90% of all NEOs 1km+ have been found and cataloged, and we are approaching about 50% of the 140m+ class cataloged. An extinction level event has been ruled out for the foreseeable future apart from the rogue long period comet that could hit Earth. The odds of this are extremely low as these are rare to begin with, and it's even rarer they are also NEOs.
NEOs are discovered by imaging an area of the sky 4 times over about 30 minutes (CSS and PS). When you do a time spaced series like this objects like stars do not move. Anything that is moving is going to be in near-Earth space or orbiting around the sun somewhere in the solar system. These images are sent through complex computer pipelines that reduce the data, remove static objects, and detect moving objects. These moving object detections are mostly false - hot pixels, cosmic rays, flat artifacts, ect, so a human will typically verify the detection is a real object. After an object is determined to be real and new it is sent to the Minor Planet Center (MPC) for publishing. The MPC is like the clearing house for astrometric observations of asteroids and comets. Their data is populated out to institutions across the globe. NASA's JPL uses this data to monitor for potential impacts on its public facing site Sentry. MPC publishes data on new objects within a few minutes of receiving it, and data on known NEOs once a day. The European Space Agency also keeps its own impact risk list here.
You can see on the JPL Sentry page that an newly found asteroid (2022 AE1) currently holds the top spot for a potential impact (1/1700 odds) in July 2023. Nothing secretive happening here. This impact will mostly likely be ruled out as the orbit is refined more via more astrometric measurements in coming weeks.
It is imperative after discovering a new NEO to get it published to public facing websites ASAP. The primary reason is you cannot resolve the orbit of an object that only has 20-30 minutes of observations on it to any degree of confidence. Basically, we don't know where the objects are going after we find them, they must be tracked. The main reason for this is we only have a tiny sample of its orbit and there are astrometric uncertainties with the observations. Observations of asteroids are not perfect. There are tiny errors usually on the order of less than 1 arcsecond per observation that affect the orbit solve. If you only have 30 minutes of observations of a new NEO, and you don't continue to track it, the number of orbits that fit those observations will eventually span the entire night sky after a few hours/days. These rocks can and do get lost because of this. Large long period comets are often found while they are still well out past Jupiter. These objects are moving very slow and they are fuzzy which makes them even harder to measure and increases the number of possible orbits that fit the observations. It can take well over a week to have a really good idea of where one of these new comets is headed once it's discovered. This is one area where professional astronomy relies on amateur astronomers a lot. There are amateur astronomers across the globe that help track these new discoveries often from their back yards with telescopes in the 10-14 inch range. They are able to do this because all of the data is published by MPC in near real time. Without this data being made public quickly, we'd lose more rocks than we find and we'd have no clue where they were going.
Considering all of this information I hope you can see how ludicrous the idea of of the government covering up a known hazardous asteroid or comet would be. The entire process is based on getting objects discovered and published quickly so the public and other institutions can help track them to rule out impacts. They are published before we even know where they are going. There is nothing secretive about this process and there never will be. There is a large rock out there right now with our name on it. The goal is to find it before it finds us.