The DoJ's Office of Legal Counsel (most of whose opinions have been classified for years) provides guidance to POTUS in regard to questions relating to what he can or cannot get away with. They have, over the years, provided legal justification for the national security apparatus now in place.
During the inherently subjective conditions of wartime, the OLC has tended to answer the president’s legal questions in a similar way: by finding justifications to expand executive power, often despite legal restrictions to the contrary.