The following custom Cypher queries can be imported into BloodHound to enhance visibility.
Each query is defined in a JSON file located in the Queries directory of the GitHound repository.
This file is automatically generated from the JSON query files
that are bundled with the GitHound collector.
Finds organizations that do not require SHA pinning for GitHub Actions. Without pinning, actions referenced by tag can be silently replaced with malicious versions.
Copy
Ask AI
MATCH (org:GH_Organization {actions_sha_pinning_required: false})RETURN orgLIMIT 1000
Finds secret scanning alerts that are both unresolved and confirmed active. These are valid, usable credentials committed to source code and represent an immediate compromise risk.
Copy
Ask AI
MATCH p=(:GH_Repository)-[:GH_Contains]->(alert:GH_SecretScanningAlert {state: 'open', validity: 'active'})RETURN pLIMIT 1000
Finds organizations where GitHub Advanced Security is not automatically enabled for new repositories. New repositories will lack code scanning, secret scanning, and other GHAS features.
Copy
Ask AI
MATCH (org:GH_Organization {advanced_security_enabled_for_new_repositories: false})RETURN orgLIMIT 1000
Finds organizations that allow all GitHub Actions to run, including third-party actions from the marketplace. This creates supply chain risk if a malicious or compromised action is used.
Copy
Ask AI
MATCH (org:GH_Organization {actions_allowed_actions: 'all'})RETURN orgLIMIT 1000
Finds branch protection rules where administrators can bypass all protections. Admins can push directly, skip reviews, and override status checks on these branches.
Copy
Ask AI
MATCH p=(:GH_BranchProtectionRule {enforce_admins: false})-[:GH_ProtectedBy]->(:GH_Branch)RETURN pLIMIT 1000
Finds branches where force pushes are allowed. Force pushes can rewrite commit history, potentially hiding malicious changes or destroying audit trails.
Copy
Ask AI
MATCH p=(:GH_BranchProtectionRule {allows_force_pushes: true})-[:GH_ProtectedBy]->(:GH_Branch)RETURN pLIMIT 1000
Finds branches where code owner reviews are not required. Changes to security-critical paths can be merged without authorization from the designated code owners.
Copy
Ask AI
MATCH p=(:GH_BranchProtectionRule {require_code_owner_reviews: false})-[:GH_ProtectedBy]->(:GH_Branch)RETURN pLIMIT 1000
Branch Protection Rules - No Pull Request Reviews Required
Finds branches where pull request reviews are not required. Code can be merged directly without peer review, increasing the risk of undetected vulnerabilities or malicious changes.
Copy
Ask AI
MATCH p=(:GH_BranchProtectionRule {required_pull_request_reviews: false})-[:GH_ProtectedBy]->(:GH_Branch)RETURN pLIMIT 1000
Branch Protection Rules - No Status Checks Required
Finds branches where CI/CD status checks are not required before merging. Code with failing tests or security scans can be merged into protected branches.
Copy
Ask AI
MATCH p=(:GH_BranchProtectionRule {requires_status_checks: false})-[:GH_ProtectedBy]->(:GH_Branch)RETURN pLIMIT 1000
Finds branches where the author of the last push can approve their own pull request. This allows a single person to both write and approve code changes.
Copy
Ask AI
MATCH p=(:GH_BranchProtectionRule {require_last_push_approval: false})-[:GH_ProtectedBy]->(:GH_Branch)RETURN pLIMIT 1000
Branch Protection Rules - Stale Reviews Not Dismissed
Finds branches where stale reviews are not dismissed when new commits are pushed. An attacker could get a review approved, then push additional malicious commits that inherit the stale approval.
Copy
Ask AI
MATCH p=(:GH_BranchProtectionRule {dismisses_stale_reviews: false})-[:GH_ProtectedBy]->(:GH_Branch)RETURN pLIMIT 1000
Identifies users with dangerous branch permissions in a GitHub organization, including bypass allowances on protection rules.
Copy
Ask AI
MATCH p=(:GH_User)-[:GH_HasRole|GH_HasBaseRole|GH_MemberOf*1..]->(:GH_RepoRole)-[:GH_PushProtectedBranch|GH_BypassBranchProtection]-(r:GH_Repository)MATCH p1=(:GH_User)-[:GH_BypassPullRequestAllowances|GH_RestrictionsCanPush]->(rule:GH_BranchProtectionRule)-[:GH_ProtectedBy]->(b:GH_Branch)RETURN p,p1LIMIT 1000
The cloud-to-cloud pivot through GitHub: a compromised Azure or Okta identity syncs to a GitHub user via SSO. That GitHub user has write access to repositories configured with OIDC federation to Azure workload identities. The attacker pivots from one cloud identity through GitHub into a completely different Azure identity — crossing cloud boundaries twice in a single attack chain.
Copy
Ask AI
MATCH p1=(extUser)-[:SyncedToGHUser]->(ghUser:GH_User)MATCH p2=(ghUser)-[:GH_HasRole|GH_HasBaseRole|GH_MemberOf*1..]->(:GH_RepoRole)-[:GH_WriteRepoContents]->(:GH_Repository)-[:GH_CanAssumeIdentity]->(cred:AZFederatedIdentityCredential)RETURN p1, p2LIMIT 1000
Dependabot Security Updates Disabled for New Repositories
Finds organizations where Dependabot security update PRs are not enabled for new repositories. Known vulnerable dependencies will not receive automated fix PRs.
Copy
Ask AI
MATCH (org:GH_Organization {dependabot_security_updates_enabled_for_new_repositories: false})RETURN orgLIMIT 1000
Finds organizations where the dependency graph is not enabled for new repositories. Without the dependency graph, transitive dependency vulnerabilities cannot be tracked.
Copy
Ask AI
MATCH (org:GH_Organization {dependency_graph_enabled_for_new_repositories: false})RETURN orgLIMIT 1000
Finds deployment environments where administrators can bypass protection rules such as required reviewers and wait timers. Admins can deploy to these environments without any approval.
Copy
Ask AI
MATCH p=(:GH_Repository)-[:GH_HasEnvironment]->(env:GH_Environment {can_admins_bypass: true})RETURN pLIMIT 1000
Finds external identities that lack SCIM synchronization. Without SCIM, user deprovisioning in the identity provider will not automatically revoke GitHub access.
Copy
Ask AI
MATCH (ei:GH_ExternalIdentity)WHERE ei.scim_identity_username = ''RETURN eiLIMIT 1000
Finds GitHub entities (repositories, branches, environments) that can assume Azure identities via OIDC federation. Verify that each trust relationship is intentional and scoped appropriately.
Copy
Ask AI
MATCH p=(src)-[:GH_CanAssumeIdentity]->(cred:AZFederatedIdentityCredential)RETURN pLIMIT 1000
Finds organizations where members can change repository visibility. This allows any member to make a private repository public, potentially exposing source code and secrets.
Copy
Ask AI
MATCH (org:GH_Organization {members_can_change_repo_visibility: true})RETURN orgLIMIT 1000
Finds organizations where members can create GitHub Pages sites. Pages can be used to host phishing content, data exfiltration endpoints, or other malicious resources.
Copy
Ask AI
MATCH (org:GH_Organization {members_can_create_pages: true})RETURN orgLIMIT 1000
Finds organizations where members can create internet-facing public repositories. This increases the risk of accidental exposure of proprietary code or secrets.
Copy
Ask AI
MATCH (org:GH_Organization {members_can_create_public_repositories: true})RETURN orgLIMIT 1000
Finds organizations where any member can invite external users. This can lead to unauthorized third-party access to repositories without centralized oversight.
Copy
Ask AI
MATCH (org:GH_Organization {members_can_invite_outside_collaborators: true})RETURN orgLIMIT 1000
Finds fine-grained personal access tokens scoped to all repositories. A single compromised token grants access to every repository in the organization.
Copy
Ask AI
MATCH p=(:GH_User)-[:GH_HasPersonalAccessToken]->(token:GH_PersonalAccessToken {repository_selection: 'all'})RETURN pLIMIT 1000
Finds pending fine-grained personal access token requests awaiting approval. Review these to ensure requested permissions are appropriate before granting access.
Copy
Ask AI
MATCH p=(:GH_User)-[:GH_HasPersonalAccessTokenRequest]->(req:GH_PersonalAccessTokenRequest)RETURN pLIMIT 1000
Secret Scanning Push Protection Disabled for New Repositories
Finds organizations where push protection is not enabled for new repositories. Without push protection, secrets can be committed without being blocked before they reach the repository.
Copy
Ask AI
MATCH (org:GH_Organization {secret_scanning_push_protection_enabled_for_new_repositories: false})RETURN orgLIMIT 1000
Finds users and teams that are allowed to push directly to protected branches when push restrictions are enabled. These actors bypass the normal pull request workflow.
Copy
Ask AI
MATCH p=(actor)-[:GH_RestrictionsCanPush]->(rule:GH_BranchProtectionRule)-[:GH_ProtectedBy]->(branch:GH_Branch)RETURN pLIMIT 1000
Secrets reachable by users who can create new branches (computed by Compute-GitHoundBranchAccess). The GH_CanCreateBranch edge accounts for branch protection rules, push restrictions, blocks_creations settings, and all bypass mechanisms (admin, push_protected_branch, pushAllowances). Edges emit from RepoRole in the common case; per-actor edges from User/Team are only present when per-rule allowances grant additional access beyond the role.
Copy
Ask AI
MATCH p1=(:GH_User)-[:GH_HasRole|GH_HasBaseRole|GH_MemberOf*1..]->(:GH_RepoRole)-[:GH_CanCreateBranch]->(repo:GH_Repository)-[:GH_HasSecret]->(s)WHERE (s:GH_RepoSecretOR s:GH_OrgSecret)OPTIONAL MATCH p2=(repo)<-[:GH_CanCreateBranch]-(:GH_User)OPTIONAL MATCH p3=(repo)<-[:GH_CanCreateBranch]-(:GH_Team)<-[:GH_HasRole|GH_MemberOf|GH_AddMember*1..]-(:GH_User)RETURN p1, p2, p3LIMIT 1000
Finds organizations where secret scanning is not automatically enabled for new repositories. New repositories will not detect committed credentials until manually enabled.
Copy
Ask AI
MATCH (org:GH_Organization {secret_scanning_enabled_for_new_repositories: false})RETURN orgLIMIT 1000
Returns all repo and org secrets reachable by users through write access. Users with write access can create GitHub Actions workflows to access secrets.
Copy
Ask AI
MATCH p=(:GH_User)-[:GH_HasRole|GH_HasBaseRole|GH_MemberOf*1..]->(:GH_RepoRole)-[:GH_WriteRepoContents]->(:GH_Repository)-[:GH_HasSecret]->(s)WHERE s:GH_RepoSecretOR s:GH_OrgSecretRETURN pLIMIT 1000
Returns all users who hold the maintainer role over a team, this also represents team nesting.
Copy
Ask AI
MATCH p=(:GH_User)-[:GH_HasRole]->(:GH_TeamRole)-[:GH_AddMember]->(team:GH_Team)MATCH p1=(team)<-[:GH_MemberOf]-(:GH_Team)<-[:GH_AddMember]-(:GH_TeamRole)<-[:GH_HasRole]-(:GH_User)RETURN p,p1LIMIT 1000
Repositories with Workflows and Unprotected Default Branch
Returns all repositories that have GitHub Actions workflows and an unprotected default branch. This means that users with GH_WriteRepoContents to the Repository can overwrite or change the workflow.
Copy
Ask AI
MATCH p=(repo:GH_Repository)-[:GH_HasWorkflow]->(:GH_Workflow)MATCH p1=(repo)-[:GH_HasBranch]->(branch:GH_Branch)WHERE repo.default_branch = branch.short_nameRETURN p1LIMIT 1000