Yes, it is safe to cook pasta directly in boiling salted water. In fact, that is the most common and traditional method of cooking pasta.
Cooking pasta in boiling salted water helps to season the pasta, enhancing its flavor. The salt also helps to raise the boiling point of the water slightly, which can contribute to a more even cooking of the pasta. Additionally, salted water can help prevent the pasta from sticking together.
To cook pasta, you typically bring a pot of water to a rolling boil, add salt to the water (usually about 1-2 tablespoons per 4-6 quarts/liters of water), and then add the pasta. Make sure you have enough water to fully submerge the pasta and allow it to move freely as it cooks. Follow the package instructions for the recommended cooking time, as it can vary depending on the type and thickness of the pasta.
It's worth noting that some people prefer to add oil to the boiling water to prevent sticking, but this is not necessary and can actually make the pasta more slippery, causing the sauce to slide off. Stirring the pasta occasionally during cooking is usually enough to prevent sticking.
After the pasta is cooked to the desired tenderness, it is typically drained and then mixed with sauce or used in a recipe.