PS CyberSecurity × WeSTEM · Learn With Anya Series

The Ghost in the Repository

5–8 minute read
Offboarding · Stale Access · Developer Credentials

Nobody had thought about Anas in months.

He had left Neuromesh quietly, the way most people leave companies — a farewell message on the team channel, a small gathering in the kitchen on his last Friday, a handover document that everyone agreed was comprehensive and nobody read in full. His last day was a Thursday in February. By the following Monday the team had redistributed his tickets and moved on.

The audit preparation started on a Tuesday in June.

Neuromesh was facing its first external security audit and the preparation had fallen to a small working group that included Anya. Their job was to gather evidence — access logs, system configurations, user account lists, repository activity records — anything the auditors might ask to see. It was methodical, unglamorous work and most of it involved pulling reports from systems that nobody had looked at carefully in a long time.

It was while pulling the activity logs from the code repositories that Anya noticed something that made her stop.

repository activity log — extract 2024-02-06 17:43 · anas.k · commit · main · "final handover cleanup" 2024-02-06 17:51 · anas.k · commit · main · "remove personal config" 2024-02-06 18:02 · anas.k · commit · main · "last day" ... 2024-04-13 02:17 · anas.k · remote_exec · pipeline-prod · [automated] 2024-05-04 02:31 · anas.k · remote_exec · pipeline-prod · [automated] 2024-06-08 02:19 · anas.k · remote_exec · pipeline-prod · [automated]

His account was still active. His access had never been revoked.

How does this happen?

Offboarding a person from an organisation feels straightforward. HR processes the paperwork. The laptop gets returned. The email account gets closed or forwarded. A box gets ticked somewhere that says the employee has left.

What that process almost never captures completely is the full surface area of access that a technical employee accumulates over the course of their time at a company. A developer like Anas does not just have an email account and a laptop login.

None of these disappear when someone's email account is closed. They persist in exactly the state they were in on the last day of employment, quietly functioning, until someone explicitly revokes them.

Who was using his credentials?

This was the question that kept the security team occupied for the following two weeks — and one they could not answer with complete certainty even after an extensive investigation.

Two explanations. Both plausible. Neither provable.

The benign explanation: an automated process — a scheduled script, a CI/CD job — had been configured to run under Anas's personal credentials rather than a dedicated service account, and had simply continued running on schedule without anyone realising it was still tied to a departed employee's identity. This happens more often than most organisations would like to admit. Developers working quickly use their own credentials to get something running and mean to migrate it to a proper service account later. Later never arrives.

The less benign explanation: someone who had obtained Anas's credentials — through phishing, through a breach of a platform where he had reused a password — had been using them to move through Neuromesh's systems under cover of an identity that looked legitimate in logs because it had been legitimate until recently. Remote executions running at unusual hours on weekends were consistent with either explanation.

The uncertainty itself was the problem. The organisation did not know who had been in their systems, under what authority and for what purpose, for several months.

What should offboarding actually look like for technical staff?

Closing the gap between standard offboarding and adequate offboarding for technical staff requires knowing, at any given time, what access each person has — which is harder than it sounds in organisations where access has been granted informally and never systematically reviewed.

This is not a five-minute checklist. For a senior developer who has been at an organisation for several years it can take hours to do properly. But the alternative — leaving a ghost in the system with active credentials and no one monitoring what they are doing — is a risk that compounds quietly over time.

What about secrets already in the commit history?

This deserves its own moment of attention because it is the part of the problem that does not go away even when access is properly revoked.

Revoking Anas's repository access meant he could no longer clone, read or contribute going forward. It did not affect anything that had already happened. Any secrets committed to the repository's history remained there, readable by anyone with current access and potentially by anyone who had ever cloned the repository.

Deleting the file is not enough

The appropriate response to discovered secrets in commit history is not to delete the file and assume the problem is resolved. It is to treat the secret as compromised — rotate it immediately, generate a new API key, change the database password, reissue the certificate — and then address the history itself through repository cleaning tools that rewrite commit history to remove the sensitive content.

This requires coordination across everyone who has cloned the repository, since their local copies still contain the old history until they re-clone or have the history force-pushed.

The better answer is not to put secrets in repositories in the first place. Secret management tools and environment variable configurations exist precisely to keep credentials out of codebases. The habit of hardcoding credentials for convenience is one of the most persistent sources of unnecessary exposure in technical environments.

Anya documented everything she had found and handed it to the security lead before the auditors arrived. The automated process running under Anas's credentials turned out to be a scheduled report job that a former team member had set up eighteen months earlier and forgotten to migrate. Probably. The team could not be entirely certain, which was noted in the audit findings.

Neuromesh spent the two weeks following the audit building a proper offboarding checklist for technical staff and conducting an access review across all current and recently departed employees.

What the access review found
  • Three accounts that should have been deactivated and were not
  • Two API tokens associated with a contractor who had finished their engagement eight months earlier
  • One SSH key on a production server that nobody could attribute to any current or former employee at all

That last one kept the security team busy for a while longer.

Back to Learn With Anya
Parul Sharma — PS CyberSecurity
Parul Sharma · PS CyberSecurity × WeSTEM

Cybersecurity professional and software developer based in Luxembourg. CISSP, CISM, and CC certified. Founder of PS CyberSecurity — creating cybersecurity education for professionals across Europe and beyond.