It’s an open secret at the Department of Education — but not so much for the public — that principals can pass failing kids with impunity.

Former PS 123 head Tyra Williams passed a slew of flunking kids in 2013 and 2014 — but DOE officer Kate Hansen told investigators that she had every right to do so.

“Ms. Hansen explained that the school’s principal is permitted to change a student’s grade but must notify the teacher, in writing, of such grade change,” a prober wrote in a 2015 Office of Special Investigations report.

Williams was among a parade of city educators who either gave students exam answers or fixed scores, according to records obtained by The Post after a two-year court fight with the city’s Department of Education.

But she wasn’t busted for changing grades — only for not putting the alterations in writing.

“Principal Williams has the authority to change students’ failing grades to passing grades; however, she must do so in writing,” the report states. “It is thereby determined that she committed employee misconduct, because, as per her admission, she failed to do so.”

A UFT insider told The Post that principals have the authority to change grades en masse, while teachers have to get every request approved by their supervisors.

“This is happening more than you can imagine,” the source said, adding that the practice raises “integrity issues.”

A teacher first told investigators that Williams pressured staffers to hike grades for kids who had passed their state Regents exams but had blown their corresponding classes, according to an OSI report.

The whistleblower claimed Williams openly called for failing kids to be pushed through.

“During a faculty meeting on Jan. 30, 2014, Principal Williams announced that for students who passed their Regents exams but failed the corresponding classes, she would change their failing grades to passing,” the teacher said, according to the report.

When staffers rebelled, Williams forced the alterations through because she had “final say” as principal.

She also defended the upgrades by telling teachers at the Bronx school that they were failing to properly prepare their students.

Williams said she ordered the changes “because the eighth-grade teachers were unable to provide valid reasons why they failed certain students,” according to the report.

One staffer told probers that Williams ordered her to “change the failing grades of over 30 eighth-grade students to passing grades,” according to the OSI account.

At least one teacher worried that the grade changes were “unethical,” the report states.

When Williams was confronted by investigators, she argued that some kids were being wrongly failed because of poor behavior rather than inadequate academics, the report states.

She also said she had changed the school’s grading system to involve multiple measures of performance.

After the OSI ruled that she could change the failing grades but didn’t complete the proper paperwork, the DOE told her she could revert to being a teacher if she resigned, according to an account of her case in her union newsletter.

She later tried to rescind her resignation after learning that she wasn’t eligible to become a teacher — but the DOE refused to accept it and she was out of a job, the Council of School Administrators reported.

But an arbitrator eventually sided with Williams after her union filed a grievance, and she was awarded $200,000 in back pay.

“The case with OSI was bogus,” she told the CSA newsletter. “The outcome of this case made me feel totally vindicated.”

Williams eventually landed on her feet and now serves as the principal at the Metropolitan Lighthouse charter school in The Bronx.

She did not return a call for comment on Tuesday.

“We treat this behavior with the utmost seriousness and follow strict policies to ensure any misconduct is swiftly addressed,” said DOE spokesman Doug Cohen.

He reiterated that principals can change grades after they notify teachers in writing.