Join our Newsletter — 33% off our NHI Course
Home› Guides› How to monitor public GitHub for your company’s…
Guide Secrets Management

How to monitor public GitHub for your company’s leaked secrets: searches, alerts and a triage routine

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 28 November 2026 13 min read
On this page

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.

SignalSample value (illustrative)What it findsNoise level
Corporate email domainsexample.com, example.co.ukConfig files, commit metadata and scripts that name staff or service mailboxesHigh: also matches harmless references
Internal hostnames and URLsgit.corp.example.com, *.internal.example.comCode copied from internal projects, CI configs, connection stringsLow to medium: strong indicator of internal origin
Cloud and tenant identifiersAWS account IDs, Entra tenant ID, GCP project IDsInfrastructure code and deployment scriptsLow
Provider token prefixes in contextghp_ or github_pat_ near your hostnameLive tokens next to an identifying stringLow when combined with a company term
Unique internal stringsProject code names, package namespaces, licence keysLeaked source code and internal librariesLow, but list maintenance is manual
Known people and accountsStaff and contractor GitHub usernames you have recordedPersonal repositories and gists holding work materialMedium; 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

OptionWhat it coversWho is alertedLimits to plan for
GitHub secret scanning partner programmeMatches of registered provider token formats in public sourcesThe token's issuer (the provider), which may revoke it and notify the ownerYou do not see these alerts in your own repositories; coverage depends on the provider being a partner
GitHub public monitoring for enterprisesSecrets 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 domainEnterprise owners and enterprise security managers, in the enterprise security overviewNeeds 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 expressionsYour team, through your own scripts and ticketingSign-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 accountsFull history, and with some tools issue and pull request comments, of repositories you point them atYour teamYou must know which accounts to scan; licences and maintenance status vary
Commercial public code monitoringVaries by service; usually wider sources than GitHub aloneYour teamEvaluate 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

  1. 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.
  2. 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.
  3. 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 with path:*.env or path:*.tfvars; add NOT org:example-org to exclude repositories you already scan. Code search excludes forks by default; add is:fork to include them.
  4. 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.
  5. 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-comments and --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 --redact option; its README states it is feature complete and receiving security patches only, so check maintenance status before you build on it.
  6. 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.
  7. 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

QuestionHow to answer itDecision
Is it ours?Match the hostname, account ID, tenant or key ID against your inventoryNot 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 productionActive 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 accessSets the investigation depth
Was it used?Search provider and source control audit logs from the commit date onwards; see Leaked Secret Validation DetectionUse by unknown parties: open an incident
Who published it?Commit author and email, repository owner, relationship to youEmployee, 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

FrameworkReferenceHow this routine applies
MITRE ATT&CKT1593.003 Code Repositories; T1552.001 Credentials In FilesAdversaries search public code and harvest credentials from files; monitoring finds the same material first
NIST CSF 2.0ID.RA-02, DE.CM-01, DE.AE-02, RS.MI-01, GV.SC-05External intelligence intake, monitoring, analysis of hits, containment by revocation, supplier requirements
NIST SP 800-53 Rev 5IA-5 Authenticator Management; SI-4 System Monitoring; PM-16 Threat Awareness ProgramCredential revocation and rotation, monitoring of external sources, sharing threat awareness
ISO/IEC 27001:2022 Annex AA.5.7 Threat intelligence; A.8.12 Data leakage prevention; A.5.20 Addressing information security within supplier agreementsIntelligence 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

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

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.