Habr•September 3, 2026•🇷🇺Translated from Russian

Detecting and Removing Secrets from Git History with Betterleaks and git-filter-repo

Have you ever wondered exactly what has entered your Git repository over time? Accidental commits of debug functions, incorrect comments, or copied files can usually be fixed with a follow-up commit. However, when sensitive data such as third-party service keys, integration credentials, database dumps, or entire /private/uploads directories are involved, simply committing a deletion does not remove the information from history.

Secrets committed to any repository, even a private one, remain accessible through git log or by checking out older commits. Anyone who can read the repository, clone it, fork it, or access connected CI/CD pipelines gains exposure. Contracts with clients frequently prohibit storing credentials or sensitive data in repositories for this reason, emphasizing the need for traceable password issuance and revocation processes.

The first step is to scan the repository thoroughly. The recommended tool is Betterleaks, which replaced earlier utilities such as gitleaks. It applies rule-based detection for patterns resembling AWS keys or GitHub tokens, uses BPE tokenization to reduce false positives, and automatically decodes Base64, hex, and URL-encoded content. Installation is available via Homebrew, Docker, or source build.

Running betterleaks git . --log-opts="--all" -v examines every commit, patch, and change across all branches. Results include details such as the rule ID, matched secret, author, commit message, and file path. Reports can be exported in JSON format for further processing. Manual review of findings is essential to distinguish real secrets from false positives.

After confirmation, git-filter-repo is used to rewrite history. Secrets extracted from the report are converted into replacement rules, and files matching dangerous extensions such as .sql, .env, or .bak are listed for removal. Before execution, secrets must be moved to external configuration files such as .env.local or settings.local.php so the application continues to function after cleanup.

The procedure is destructive and irreversible. A mirror backup must be created, all pull requests closed, and a clean clone prepared. The command git filter-repo --invert-paths --paths-from-file paths-to-remove.txt --replace-text secrets-to-replace.txt performs both file deletion and secret replacement in one pass. After verification with a new scan, aggressive garbage collection and a forced mirror push complete the process.

Every contributor and CI/CD pipeline must then perform a fresh clone rather than a pull or rebase, because commit hashes have changed. Even after these steps, old objects may survive in forks, backups, or caches, making secret rotation mandatory.

Related articles

Habr•Data Breaches & Leaks

FBI Investigates Alleged Breach of National Crime Information Center Database

The FBI is examining a possible intrusion into the National Crime Information Center (NCIC), the nationwide law enforcement database it operates. The incident marks the second reported compromise of FBI systems in two months. NCIC contains records on wanted persons, missing individuals, arrest warrants, stolen vehicles, firearms, and protection orders used daily by local, state, and federal agencies. CNN reported the development citing two sources familiar with the investigation, though the exact timing, method of access, and any data exfiltration remain unknown. The agency has not confirmed the breach or responded to media inquiries. The current event shows no apparent connection to the earlier claimed compromise of the FBIJobs.gov HR platform by the ShinyHunters group, which allegedly stole personnel records of agents and applicants.

Habr•Data Breaches & Leaks

Duhndal Studio Reports Unauthorized Steamworks API Key Access Leading to Player Bans and Refunds

Duhndal, the developer behind the free-to-play Steam shooter One-armed Robber, disclosed that an unknown actor obtained access to one of its Steamworks API keys. The compromised key was used to issue player bans and process refunds for in-game purchases, directly affecting the studio's revenue model that relies solely on microtransactions. The game, released in December 2023, features cooperative bank and store heists where each character has only one arm. Following the incident, Duhndal revoked the affected key, lifted all unauthorized bans, and urged affected players to spend the refunded amounts back in the game. The studio also launched a sale on paid heist maps. Most users require no further action, though the event highlights risks associated with long-lived API credentials in game distribution platforms.

Habr•Data Breaches & Leaks

NordPass Report: '123456' Tops Global Password Rankings for Seventh Straight Year

NordPass has published its eighth annual ranking of the world's most common passwords, compiled from analysis of leaked credential databases. The password '123456' has held the top position for seven out of the eight years the report has been issued. Even in the single year it did not rank first, the combination remained among the most frequently used. The passwords 'admin' and '12345678' have stayed in the top three consistently across all eight editions. The only notable shift in the top 10 this year was the entry of the short sequence '1234', while 'password' moved from sixth to seventh place. NordPass recommends replacing passwords entirely with passkeys or biometric authentication and always enabling multi-factor authentication where passwords remain necessary.

AntiMalware•Data Breaches & Leaks

Lapsus$ Member Arion Kurtadj Pleads Guilty to Breaches at Uber, Revolut and Rockstar Games Ahead of GTA VI Release

British national Arion Kurtadj, a member of the Lapsus$ cybercrime group, pleaded guilty to six charges at Woolwich Crown Court just days before the scheduled release of Grand Theft Auto VI. In September 2022 he breached Uber, Revolut and Rockstar Games while on bail with internet restrictions, resulting in the leak of unreleased GTA VI footage. Prosecutors stated that Kurtadj used a mobile phone and an Amazon Fire Stick connected to a hotel television to conduct the intrusions. The 21-year-old admitted four counts under the Computer Misuse Act, one count of fraud and one count of possessing a mobile phone in prison. Although psychiatrists initially deemed him unfit to stand trial due to severe autism in 2023, treatment in a secure hospital restored his fitness, allowing the case to proceed. Sentencing is expected next week, while the game itself launches on 19 November.