1. Resources
  2. Detection rules
  3. Private Repository Made Public in GitHub

Private Repository Made Public in GitHub detection rules

A private or internal repository is switched to public, exposing its source code, commit history, Actions logs and any secrets committed to it to everyone on the internet.

Platform
GitHub
Severity
High
Log source
GitHub audit log
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Admin access to the repository, or an owner account where visibility changes are restricted to owners.
Impact
Disclosure of proprietary source code, internal documentation and credentials committed anywhere in the history, with forks and clones that persist.
Response
Set the repository back to private or internal, and rotate every credential that was ever committed to it because the full Git history was public.
Mitigation
Restrict repository visibility changes to organization owners, and do not use admin as the base repository permission.
Audit actions
repo.accessprivate_repository_forking.enablerepository_visibility_change.enable

How the attack works

Anyone with admin access to a repository can change its visibility, unless the organization limits visibility changes to owners. Making a repository public publishes the code and its full Git history, makes Actions history and logs readable by everyone and lets anyone fork it. Copies made in that window cannot be recalled by making the repository private again.

Attackers use this as a quiet exfiltration channel: instead of cloning repositories from a suspicious location, they flip visibility and collect the content from the public side, or they publish internal code to pressure or embarrass the victim. Worm-style supply chain malware has also exposed stolen private repositories publicly in bulk. The change leaves a single audit log event that records the new and previous visibility. A threshold rule on this page counts the changes to public per actor, because bulk publication by one account within minutes does not look like a planned release. Another rule reads the policy that allows forks of private and internal repositories, which is a second way for copies of private code to end up under other owners.

What an attacker needs

  • Admin access to the repository (directly, through a team or through an admin base permission), or an owner account where visibility changes are restricted to owners.

Impact

Disclosure of proprietary source code and internal documentation, and of credentials committed anywhere in the history, which can lead to compromise of cloud accounts, databases and third-party services. Forks and clones made while the repository was public persist.

Detection rules

One Actor Made Many GitHub Repositories Public

Counts, per actor, the repositories whose visibility was changed to public (repo.access with visibility public). Five or more changes by one account within 30 minutes are not a planned open source release, which concerns one repository and is prepared. They fit a stolen token or a compromised account that publishes private code in bulk, which is how supply chain malware has exposed the repositories of its victims. Every repository in the count has to be treated as copied. The count and the window are starting points to tune.

Fires when one actor has at least 5 matching events within 30 minutes.

Threshold ruleLevelHighStatusExperimentalLog sourceGitHub audit log
title: GitHub Repository Made Public (Bulk Publication Base Event)
id: d388dcad-a2b1-47ca-b6e8-22eb9f421f95
name: github_repository_made_public
status: experimental
description: >-
  Base event of the threshold rule in this file. A repo.access event whose
  visibility field holds the value public, which GitHub writes when the
  visibility of a repository is changed to public.
logsource:
  product: github
  service: audit
detection:
  selection:
    action: repo.access
    visibility: public
  condition: selection
level: low
---
title: One Actor Made Many GitHub Repositories Public
id: 6307887b-94d4-47aa-96c7-13fd24b18566
status: experimental
description: >-
  Counts, per actor, the repositories whose visibility was changed to public
  (repo.access with visibility public). Five or more changes by one account
  within 30 minutes are not a planned open source release, which concerns one
  repository and is prepared. They fit a stolen token or a compromised
  account that publishes private code in bulk, which is how supply chain
  malware has exposed the repositories of its victims. Every repository in
  the count has to be treated as copied. The count and the window are
  starting points to tune.
references:
  - https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
  - https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/setting-repository-visibility
  - https://attack.mitre.org/techniques/T1537/
author: Forestall
date: 2026-11-18
tags:
  - attack.exfiltration
  - attack.t1537
correlation:
  type: event_count
  rules:
    - github_repository_made_public
  group-by:
    - actor
  timespan: 30m
  condition:
    gte: 5
falsepositives:
  - An organization that opens a group of repositories on a planned date, for example when a project is released as open source. Confirm it with the team and exclude the account that carries out the release for that day.
  - The values of 5 repositories and 30 minutes are starting points, not tested limits. An organization that never publishes code can alert on a lower count.
level: high

False positives

  • An organization that opens a group of repositories on a planned date, for example when a project is released as open source. Confirm it with the team and exclude the account that carries out the release for that day.
  • The values of 5 repositories and 30 minutes are starting points, not tested limits. An organization that never publishes code can alert on a lower count.

GitHub Forking of Private and Internal Repositories Allowed

Detects the policy that allows forks of private and internal repositories being enabled for a repository, an organization or an enterprise (private_repository_forking.enable). New organizations do not allow these forks by default. Once the policy is on, private and internal repositories can be forked, which puts a copy of the code under another owner. The change exposes nothing by itself, which is why the level is low, but it opens a second way for private code to leave next to a visibility change.

LevelLowStatusExperimentalLog sourceGitHub audit log
title: GitHub Forking of Private and Internal Repositories Allowed
id: f4ed248f-a7f5-41c3-87c4-1b9ca00a4771
status: experimental
description: >-
  Detects the policy that allows forks of private and internal repositories
  being enabled for a repository, an organization or an enterprise
  (private_repository_forking.enable). New organizations do not allow these
  forks by default. Once the policy is on, private and internal repositories
  can be forked, which puts a copy of the code under another owner. The
  change exposes nothing by itself, which is why the level is low, but it
  opens a second way for private code to leave next to a visibility change.
references:
  - https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
  - https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-organization-settings/managing-the-forking-policy-for-your-organization
  - https://attack.mitre.org/techniques/T1537/
author: Forestall
date: 2026-11-18
tags:
  - attack.exfiltration
  - attack.t1537
logsource:
  product: github
  service: audit
detection:
  selection:
    action: private_repository_forking.enable
  condition: selection
falsepositives:
  - Organizations whose contribution model uses forks of internal repositories. Confirm the policy change with the acting owner and note the repositories it covers.
level: low

False positives

  • Organizations whose contribution model uses forks of internal repositories. Confirm the policy change with the acting owner and note the repositories it covers.

GitHub Members Allowed to Change Repository Visibility

Detects an owner allowing members with admin access to change repository visibility in an organization or enterprise. After this change, any repository administrator can make a private repository public.

LevelLowStatusExperimentalLog sourceGitHub audit log
title: GitHub Members Allowed to Change Repository Visibility
id: 003d20ad-7611-433a-b426-c77fc3f76e9b
status: experimental
description: >-
  Detects an owner allowing members with admin access to change repository
  visibility in an organization or enterprise. After this change, any
  repository administrator can make a private repository public.
references:
  - https://attack.mitre.org/techniques/T1537/
  - https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization
  - https://docs.github.com/en/organizations/managing-organization-settings/restricting-repository-visibility-changes-in-your-organization
author: Forestall
date: 2026-11-10
tags:
  - attack.exfiltration
  - attack.t1537
logsource:
  product: github
  service: audit
detection:
  selection:
    action: repository_visibility_change.enable
  condition: selection
falsepositives:
  - Organizations that intentionally let repository administrators publish code; confirm the policy change with the acting owner.
level: low

False positives

  • Organizations that intentionally let repository administrators publish code; confirm the policy change with the acting owner.

GitHub Repository Visibility Changed to Public

Detects a repository's visibility being changed to public. Its code, history and Actions logs become readable by anyone, and any secrets committed to it must be treated as exposed.

LevelHighStatusExperimentalLog sourceGitHub audit log
title: GitHub Repository Visibility Changed to Public
id: 3fc031de-ddd9-4ad0-87e2-fe6e835cf2a9
status: experimental
description: >-
  Detects a repository's visibility being changed to public. Its code,
  history and Actions logs become readable by anyone, and any secrets
  committed to it must be treated as exposed.
references:
  - https://attack.mitre.org/techniques/T1537/
  - https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization
  - https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/setting-repository-visibility
author: Forestall
date: 2026-11-10
tags:
  - attack.exfiltration
  - attack.t1537
logsource:
  product: github
  service: audit
detection:
  selection:
    action: repo.access
    visibility: public
  condition: selection
falsepositives:
  - Planned open-source releases. Agree a release process with the teams that publish code and exclude reviewed repositories by repo name.
level: high

False positives

  • Planned open-source releases. Agree a release process with the teams that publish code and exclude reviewed repositories by repo name.

Triage

  • Identify who changed the visibility (actor), the repository (repo) and the previous visibility (previous_visibility).
  • If unexpected, make the repository private again at once, then check for forks, stars and clones while it was public.
  • Treat every secret in the repository's history as exposed; rotate it and review its use since the change.

Response

Once the attack is confirmed:

  1. Set the repository back to private or internal. This stops new access but does not recall copies, because forks and clones made while it was public persist.
  2. Rotate every credential that was ever committed to the repository, including ones removed in later commits, since the full Git history was public. Then review the systems those credentials open for use since the visibility change.
  3. Read the Actions history and logs of the repository for sensitive values that were readable while it was public, and rotate what they show.
  4. Secure the account that changed the visibility, and remove its admin access to repositories until the change is explained.
  5. Check the other repositories the same actor administers for visibility changes, and look for new public repositories that hold copies of private code. Worm-style supply chain malware has published stolen private repositories in bulk.

Mitigation

  • Restrict repository visibility changes to organization owners, and do not use admin as the base repository permission.
  • Keep secrets out of repositories with secret scanning and push protection, and rotate anything that was ever committed.
  • Alert on visibility changes to public and review them within minutes, not days.

Frequently asked questions

Does making the repository private again undo the exposure?

No. While the repository was public, anyone could read the code and its full history and fork or clone it, and those copies cannot be recalled by changing the visibility back. Every secret in the history has to be treated as exposed and rotated, however short the public period was.

What becomes public besides the current code?

The full Git history, which includes credentials committed at any point in the past, and the repository's Actions history and logs. Anyone can also fork the repository. This is why secrets that were removed from the code long ago still have to be rotated.

Does the rule also catch an internal repository that was made public?

Yes. The rule matches the `repo.access` event when the new visibility is public, whatever the visibility was before. The event records the earlier value in `previous_visibility`, which tells a private repository from an internal one during triage.

Why alert on the setting that lets members change repository visibility?

Anyone with admin access to a repository can change its visibility unless the organization limits visibility changes to owners. When an owner lifts that limit (`repository_visibility_change.enable`), every repository administrator can make a private repository public. The change exposes nothing by itself, which is why the rule is low severity, but it widens who can carry out this attack.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.