President Trump's friendship with Rupert Murdoch could soon become a liability for the Justice Department.

The president and the 21st Century Fox executive chairman talk almost every day, White House sources say. Murdoch frequently offers Trump advice on policy, strategy and messaging. Murdoch's Fox News is favorable to Trump, and Trump is generous in giving praise -- and interviews -- to Fox News.

At the same time, Trump's Justice Department is conducting an investigation into 21st Century Fox's handling of financial settlements with women who accused Roger Ailes, the former Fox News chairman and CEO, of sexual harassment. (Ailes has denied all the allegations.)

The relationship between Trump and Murdoch will test the independence of the Justice Department and particularly Attorney General Jeff Sessions, who is also a close friend and influential adviser to the president, two former U.S. attorneys in another Republican administration told CNNMoney.

"This is a major test for Sessions," said Paul K. Charlton, the former U.S. attorney for the District of Arizona. "He needs to show his independence from the president."

Attorney General Loretta Lynch, Sessions' predecessor, came under fire last year after she met privately with former President Bill Clinton while his wife, Democratic presidential candidate Hillary Clinton, was under an FBI investigation regarding her emails. While Lynch said the conversation did not pertain to the investigation, she also said that because of the concern it raised she "certainly wouldn't do it again."

At the time, Trump called the meeting "terrible" and "horrible."

But given Trump's friendships with both Sessions and Murdoch, there are similar concerns regarding the investigation into Fox News.

Earlier this week, Murdoch called Trump a "friend" while introducing him at a World War II memorial event in New York. Trump has praised Murdoch in the past, and in January tweeted, "Rupert Murdoch is a great guy who likes me much better as a very successful candidate than he ever did as a very successful developer!" (Neither the White House nor 21st Century Fox have commented on the friendship in context of the investigation.)

Related: Trump: Rupert Murdoch treats me better than Roger Ailes did

The two former U.S. attorneys said Trump and Murdoch had no obligation to stop communicating, despite what they described as the appearance of a conflict of interest. Still, they stressed that the two men should not be discussing the investigation.

"They don't have to break off the conversations. Just because you're under an investigation doesn't mean you've done anything wrong," Johnny Sutton, the former U.S. Attorney for the Western District of Texas, said. "Obviously, they shouldn't be discussing the investigation and the White House shouldn't be weighing in."

Policing private conversations between friends is usually impossible, of course -- especially when one of those friends is the most powerful man in the country.

Instead, the former U.S. attorneys said, they will be looking to the Justice Department to remain independent of both the Murdochs and the White House.

"There is a longstanding tradition of independence" inside the Department of Justice, Sutton said. "That's especially true for the Southern District of Manhattan," he added, citing the office that is overseeing the investigation.

"There's an independence there and you can't just shut down relationships because of investigations," Sutton said, noting that President Obama spoke with and campaigned for Hillary Clinton even as she was under investigation by the FBI.

Related: Fox News fight moves to U.K. as lawyers lobby regulator over Sky deal

In March, Trump fired Preet Bharara, the former U.S. attorney for the Southern District, who was famous for going after Wall Street titans and New York politicians of both parties. Bharara was replaced by his deputy Joon H. Kim.

Kim's boss, of course, is Sessions, one of Trump's most-trusted advisers.

Both Charlton and Sutton said Sessions did not need to recuse himself from the case so long as he avoided any conflict of interest.

As precedent, Charlton cited Attorney General John Ashcroft's handling of the Scooter Libby trial. Ashcroft had overseen that case up until Karl Rove's role in the Valerie Plame affair raised the appearance of a conflict of interest, at which point he recused himself and brought in Patrick Fitzgerald, the U.S. Attorney for Northern Illinois, as special prosecutor.

"AG Ashcroft handled the case initially until connections with Rove showed a conflict. Then they brought in Fitzgerald to act as independent counsel," Charlton explained. "It seems Session should get the same benefit given to Ashcroft. Until a conflict is shown with Sessions or [there is evidence] that the President or his office are involved in wrongdoing then there is no need to recuse."