Striking a note for transparency, a federal judge ruled on Friday that President Trump and his longtime personal lawyer, Michael D. Cohen, cannot proceed in total secrecy as they weigh in on the final stages of a laborious review of a huge trove of materials seized from Mr. Cohen during a series of raids by the authorities in April.

For two months now, Mr. Trump and Mr. Cohen’s lawyers have been fighting with prosecutors in Manhattan over how to handle the millions of documents and data files that federal agents hauled away from Mr. Cohen’s office, apartment and hotel room. The chief dispute concerned the question of who should get to determine what materials were protected by the attorney-client privilege that Mr. Trump enjoys in his dealings with Mr. Cohen. Those determinations are important because any file covered by that privilege could be withheld from the prosecutors who are investigating Mr. Cohen’s various business projects, including some involving Mr. Trump.

The battle over the materials — a vast cache of Mr. Cohen’s papers, data files from several of his iPads, cellphones and computer drives, and even the contents of one of his shredders — could determine how much and what kinds of evidence the government has at its disposal as it pursues its investigation.

But even though the judge in the case, Kimba M. Wood, solved the quarrel with a compromise in April, appointing an independent arbiter known as a special master to oversee the review of the materials, she still allowed Mr. Trump and Mr. Cohen to make objections to the special master’s findings — and that led to a new dispute this week.