Your credentials can leak into public GitHub from repositories you do not own: an employee's personal account, a contractor's side project or a fork of something that was once private. Secret scanning inside your own organisation does not see those places, so the leak sits in public until a researcher, a provider or an attacker finds it. This guide shows how to build a monitoring routine for public GitHub content tied to your company: what to watch, which GitHub features and open source tools cover which gap, how to triage a hit, and how to measure the programme. It is for security engineers, secrets owners and threat intelligence teams. GitHub feature details were checked against GitHub's documentation and changelog in November 2026.
Key takeaways
- Your own repositories are only part of the surface. Several leaks on our breach database sat in employee or contractor accounts, outside any scanning the victim organisation ran.
- GitHub public monitoring is the first control to switch on if you have it. As announced on 28 October 2026, it alerts enterprises with GitHub Secret Protection when secrets attributed to their members or verified email domains appear in public content.
- Attribution has gaps, so add your own searches. Contractors using personal email addresses, former staff and unlinked accounts fall outside member and domain matching; scheduled code searches for your domains, hostnames and internal identifiers cover part of that gap.
- Treat every confirmed public secret as compromised. Revoke or rotate first, then investigate use, then clean up the content; deleting the file or making the repository private does not invalidate a credential.
- Measure time to revoke, not number of findings. The useful numbers are how fast a public leak is found, how fast the credential stops working, and whether the same people or teams keep leaking.
Why you need to watch beyond your own organisation
Repository secret scanning and push protection, covered in the Git Secret Scanning Guide, protect repositories your organisation owns. The incidents below show where that boundary fails:
- Employee personal repository: in the Mercedes-Benz GitHub token exposure, a token for the internal GitHub Enterprise Server sat in an employee's public repository for about 117 days before a security firm found it during a routine scan of GitHub.
- Contractor repository: in the CISA Private-CISA GitHub leak, a contractor's public repository held administrative AWS GovCloud keys and other credentials for about six months, and the keys stayed valid for roughly 48 hours after the repository came down.
- Subcontractor upload: in the Toyota T-Connect key exposure, part of the website source code with a data server access key stayed on public GitHub from December 2017 to September 2022.
In each case the credential belonged to the organisation but the repository did not. A monitoring programme has to be organised around what identifies your company (domains, token formats, internal names), not around which repositories you own. For the wider incident pattern see Leaked secret breaches.
What to monitor: your company's signals
Build a short watch list before choosing tools. Each signal finds a different kind of leak.
| Signal | Sample value (illustrative) | What it finds | Noise level |
|---|---|---|---|
| Corporate email domains | example.com, example.co.uk | Config files, commit metadata and scripts that name staff or service mailboxes | High: also matches harmless references |
| Internal hostnames and URLs | git.corp.example.com, *.internal.example.com | Code copied from internal projects, CI configs, connection strings | Low to medium: strong indicator of internal origin |
| Cloud and tenant identifiers | AWS account IDs, Entra tenant ID, GCP project IDs | Infrastructure code and deployment scripts | Low |
| Provider token prefixes in context | ghp_ or github_pat_ near your hostname | Live tokens next to an identifying string | Low when combined with a company term |
| Unique internal strings | Project code names, package namespaces, licence keys | Leaked source code and internal libraries | Low, but list maintenance is manual |
| Known people and accounts | Staff and contractor GitHub usernames you have recorded | Personal repositories and gists holding work material | Medium; needs a lawful basis and a privacy review |
Token prefixes are useful because many providers use fixed formats; see the GitHub Token Types and Prefixes Reference. Keep the watch list in a controlled place: it is itself a map of your internal estate.
Monitoring options compared
| Option | What it covers | Who is alerted | Limits to plan for |
|---|---|---|---|
| GitHub secret scanning partner programme | Matches of registered provider token formats in public sources | The token's issuer (the provider), which may revoke it and notify the owner | You do not see these alerts in your own repositories; coverage depends on the provider being a partner |
| GitHub public monitoring for enterprises | Secrets in public content across github.com, including git content, pull request comments and gists, attributed to enterprise members or users whose email matches a verified domain | Enterprise owners and enterprise security managers, in the enterprise security overview | Needs GitHub Enterprise Cloud with Secret Protection or Advanced Security; attribution only by membership and verified domain |
| Scheduled GitHub code search (web or REST API) | Default branches of public repositories, by your own terms and regular expressions | Your team, through your own scripts and ticketing | Sign-in required; default branch only; files over the size limit excluded; REST endpoint limited to 10 requests per minute and up to 1,000 results per search |
| Open source scanners on known accounts | Full history, and with some tools issue and pull request comments, of repositories you point them at | Your team | You must know which accounts to scan; licences and maintenance status vary |
| Commercial public code monitoring | Varies by service; usually wider sources than GitHub alone | Your team | Evaluate scope, data handling and false positive rates; see the Attack Surface Management Buyer's Guide for evaluation questions |
Decision guidance: if you are on GitHub Enterprise Cloud with Secret Protection, turn on public monitoring first and verify every corporate email domain, because domain matching extends attribution to users who are not enterprise members. Add scheduled code searches for hostnames and identifiers that secret patterns will not match. Small organisations without an enterprise plan can run a weekly set of saved searches and a scanner against a short list of known contributor accounts; larger organisations usually feed all sources into one queue owned by the secrets or detection team.
Step-by-step: set up the routine
- Agree scope and lawful basis. Write down which signals you monitor and why. Searching public code for your own domains and credentials is low risk; recording individuals' personal accounts needs a privacy and HR review in many jurisdictions.
- Turn on GitHub public monitoring (enterprise plans). An enterprise owner or enterprise security manager enables it from the enterprise Security tab. GitHub's changelog of 28 October 2026 states it shows recently leaked secrets on enablement and then watches for new ones. Confirm all corporate email domains are verified for the enterprise.
- Write the search set. Use GitHub code search qualifiers to keep results precise. Samples: a quoted internal hostname such as
"git.corp.example.com"; a hostname plus a token prefix such as"corp.example.com" /ghp_[A-Za-z0-9]{36}/; restrict by file type withpath:*.envorpath:*.tfvars; addNOT org:example-orgto exclude repositories you already scan. Code search excludes forks by default; addis:forkto include them. - Schedule it through the API. Run the set daily with a dedicated, read-only, fine-grained token stored in a secrets manager. Pace requests to the documented 10 per minute for code search, record the commit or blob reference of each hit, and store the result hash so repeat hits do not re-alert.
- Scan known accounts more deeply. For repositories the searches surface, and for contributor accounts you have a basis to watch, run an open source scanner over full history. TruffleHog (AGPL-3.0) can scan a GitHub organisation or repository, include issue and pull request comments with
--issue-commentsand--pr-comments, and report only credentials it confirms as active with--results=verified. Gitleaks scans git history and directories with custom TOML rules and a--redactoption; its README states it is feature complete and receiving security patches only, so check maintenance status before you build on it. - Route findings to one queue. Public monitoring alerts, search hits and scanner output go to one ticket type with an owner, the secret type, location, first seen time and validity state.
- Pilot, tune, then expand. Run for two to four weeks on a small signal set, mark every false positive with a reason, tighten regular expressions, then add signals. Roll back a noisy signal by disabling its search rather than deleting it, so you keep its history.
Triage a finding
| Question | How to answer it | Decision |
|---|---|---|
| Is it ours? | Match the hostname, account ID, tenant or key ID against your inventory | Not ours: if it is a third party's secret, report it through their disclosure route |
| Is it valid? | Public monitoring shows a validity state (active, inactive or unknown); otherwise check through the issuing system's own console or API, not by using the secret against production | Active or unknown: revoke now |
| What could it reach? | Look up its owner, permissions and scope; see How to scope what a leaked API key could access | Sets the investigation depth |
| Was it used? | Search provider and source control audit logs from the commit date onwards; see Leaked Secret Validation Detection | Use by unknown parties: open an incident |
| Who published it? | Commit author and email, repository owner, relationship to you | Employee, contractor or unknown drives the follow-up |
Order of actions: revoke or rotate, then check use, then remove the content. GitHub's guidance on removing sensitive data says that once a secret is revoked or rotated it can no longer be used for access, and that forks, existing clones and cached views can still hold the data; GitHub Support helps with cached views and pull request references mainly where rotation cannot mitigate the risk. For token-specific steps see How to revoke a leaked GitHub personal access token and check what it touched and the API Key Leak Response Playbook.
Contacting the publisher: for an employee or contractor, go through their manager or the supplier contact and ask them to take the content down after you have revoked the credential. For an unknown account, do not rely on the owner responding: in the CISA case the owner was not answering alerts. Dismissing a public monitoring alert changes its state for your enterprise only; it does not revoke the credential or remove the public content.
Where identity fits
Most public leaks are non-human credentials: personal access tokens, cloud access keys, CI tokens and service account keys. Two identity controls cut the damage from a leak you have not yet found. First, prefer short-lived, federated credentials for pipelines so a copied value expires quickly; see the GitHub Actions OIDC Federation Hardening Guide. Second, link people's GitHub identities to the company: with GitHub Enterprise Managed Users, work happens in company-controlled accounts, and GitHub's documentation lists secret scanning for user-owned repositories as available on Enterprise Cloud with Enterprise Managed Users. Offboarding should include revoking tokens the person created; see the Employee Offboarding Security Guide.
Detection and measurement
- Time to detect: commit date to first alert, per source. A rising number means a source has stopped working.
- Time to revoke: first alert to credential invalidated, with a target set per secret class (for example hours for cloud admin keys).
- Active at detection: share of findings still valid when found; high values point to long-lived credentials.
- Attribution coverage: share of findings that came only from your own searches, not from public monitoring; it shows how much the attribution gap matters for you.
- Repeat publishers: people, teams or suppliers with more than one finding per quarter, as input to training and supplier reviews.
- False positive rate per signal: retire or tighten signals that produce noise without findings.
Also log the monitoring itself: failed API runs, expired search tokens and disabled alerts. A silent monitoring job looks the same as a quiet week.
Common failure patterns
- Watching only owned repositories: the Mercedes-Benz and Toyota leaks were in an employee's and a subcontractor's repositories.
- Deleting instead of revoking: in the CISA leak, removing the repository left AWS keys valid for about two more days.
- Unverified domains: public monitoring cannot attribute leaks by users whose email domain the enterprise has not verified.
- Searching once: a one-off search during an audit finds history but not tomorrow's leak; schedule it.
- No supplier clause: contracts that do not require approved secrets tooling and prompt reporting of exposures leave you dependent on goodwill.
- Testing found secrets against production: using a leaked credential to "check" it pollutes audit logs and may break policy; validate through the issuing system.
Framework mapping
| Framework | Reference | How this routine applies |
|---|---|---|
| MITRE ATT&CK | T1593.003 Code Repositories; T1552.001 Credentials In Files | Adversaries search public code and harvest credentials from files; monitoring finds the same material first |
| NIST CSF 2.0 | ID.RA-02, DE.CM-01, DE.AE-02, RS.MI-01, GV.SC-05 | External intelligence intake, monitoring, analysis of hits, containment by revocation, supplier requirements |
| NIST SP 800-53 Rev 5 | IA-5 Authenticator Management; SI-4 System Monitoring; PM-16 Threat Awareness Program | Credential revocation and rotation, monitoring of external sources, sharing threat awareness |
| ISO/IEC 27001:2022 Annex A | A.5.7 Threat intelligence; A.8.12 Data leakage prevention; A.5.20 Addressing information security within supplier agreements | Intelligence collection, leak detection, supplier obligations |
Practitioner checklist
- Written watch list of domains, hostnames, cloud and tenant identifiers and internal strings, stored with restricted access.
- GitHub public monitoring enabled where your plan includes it, with every corporate email domain verified.
- Saved code searches scheduled daily through the API with a read-only token held in a secrets manager.
- Deeper scanner runs on surfaced repositories and on accounts you have a documented basis to watch.
- One finding queue with an owner, validity state and time stamps.
- Revoke first, check use second, remove content third, written into the runbook.
- Supplier contracts require approved secrets tooling and prompt reporting of exposures.
- Metrics for time to detect, time to revoke and repeat publishers reviewed monthly.
- Monitoring job health alerts for failed runs and expired tokens.
Standards and references
- GitHub Docs: Public monitoring
- GitHub Changelog: Public monitoring for enterprises generally available
- GitHub Docs: Viewing public monitoring alerts
- GitHub Docs: Secret scanning partner program
- GitHub Docs: Understanding GitHub code search syntax
- GitHub Docs: REST API endpoints for search
- GitHub Docs: Removing sensitive data from a repository
- TruffleHog: Project README
Related NHI Mgmt Group resources: Git Secret Scanning Guide · How to respond to a GitHub secret scanning alert · OSINT and Reconnaissance Guide · Honeytokens and Canary Credentials Guide