Yes, it is generally safe to cook food directly on an oven rack covered with aluminum foil. Aluminum foil is heat resistant and can withstand high temperatures, making it suitable for use in the oven. It's important to ensure the foil is in good condition and not damaged, as tears or punctures can lead to hot spots or uneven cooking. Additionally, using foil can help prevent food from sticking and make cleanup easier. However, for best results, it's recommended to follow specific cooking guidelines for your recipe and oven type.