- from: github
test: (?:^|\s)gh\s+repo\s+delete(\s|$)
description: "Permanently deletes a repository and all its data."
id: github:repo_delete
severity: Critical
- from: github
test: '(?:^|\s)gh\s+repo\s+archive(\s|$)|(?:^|\s)gh\s+api\s+(?:\S+\s+)*?(?:-[fF]\s*|--(?:raw-)?field(?:\s+|=))archived=true(?:\s|$)'
description: "Archiving a repository makes it read-only and can break workflows."
id: github:repo_archive
severity: High
- from: github
test: (?:^|\s)gh\s+repo\s+rename(\s|$)
description: "Renaming a repository breaks all existing URLs, clones, and CI/CD references."
id: github:repo_rename
severity: High
- from: github
test: (?:^|\s)gh\s+repo\s+edit\s+.*--visibility
description: "Changing repository visibility can expose private code or break public access."
id: github:repo_change_visibility
severity: High
- from: github
test: (?:^|\s)gh\s+release\s+delete(\s|$)
description: "Deleting a release removes it and its assets permanently."
id: github:release_delete
severity: High
- from: github
test: (?:^|\s)gh\s+secret\s+delete(\s|$)
description: "Deleting a secret can break CI/CD pipelines that depend on it."
id: github:secret_delete
severity: High
- from: github
test: (?:^|\s)gh\s+variable\s+delete(\s|$)
description: "Deleting a variable can break CI/CD pipelines that depend on it."
id: github:variable_delete
severity: High
- from: github
test: '(?:^|\s)gh\s+api\s+(?:\S+\s+)*?(?:-X|--method)\s*["'']?DELETE["'']?\s+(?:\S+\s+)*?/?repos/[^/\s]+/[^/\s]+/?(?:\s|$)'
description: "This deletes the GitHub repository through the API, with its issues, pull requests and wiki."
id: github:api_delete_repo
severity: Critical
- from: github
test: '(?:^|\s)gh\s+pr\s+merge\s+(?:\S+\s+)*?--admin(?:\s|$)'
description: "This merges the pull request as an administrator, bypassing the branch protection rules (required reviews and checks)."
id: github:pr_merge_admin
severity: Medium
- from: github
test: '(?:^|\s)gh\s+api\s+(?:(?:\S+\s+)*?(?:-X|--method)[\s=]*["'']?DELETE["'']?\s+(?:\S+\s+)*?/?repos/\S+/git/refs/(?:heads|tags)/\S+|(?:\S+\s+)*?/?repos/\S+/git/refs/(?:heads|tags)/\S+\s+(?:\S+\s+)*?(?:-X|--method)[\s=]*["'']?DELETE["'']?)(?:\s|$)'
description: "This deletes a branch or tag of the repository through the GitHub API (like `git push --delete`)."
id: github:api_delete_ref
severity: High
alternative: "gh api repos/<owner>/<repo>/git/refs/heads/<branch>"
alternative_info: "Read the ref first (a GET) and make sure it is not a protected branch."
- from: github
test: '(?:^|\s)gh\s+api\s+(?:(?:\S+\s+)*?(?:-X|--method)[\s=]*["'']?DELETE["'']?\s+(?:\S+\s+)*?/?(?:repos/[^/\s]+/[^/\s]+|orgs/[^/\s]+)/hooks/\d+|(?:\S+\s+)*?/?(?:repos/[^/\s]+/[^/\s]+|orgs/[^/\s]+)/hooks/\d+\s+(?:\S+\s+)*?(?:-X|--method)[\s=]*["'']?DELETE["'']?)(?:\s|$)'
description: "This deletes a repository or organization webhook through the GitHub API: the integration behind it (CI, deploys, security scanning) stops getting events."
id: github:api_delete_webhook
severity: Medium
alternative: "gh api repos/OWNER/REPO/hooks"
alternative_info: "List the webhooks first and check which integration this one belongs to."
- from: github
test: '(?:^|\s)gh\s+api\s+(?:(?:\S+\s+)*?(?:-X|--method)[\s=]*["'']?(?:DELETE|PUT|PATCH|POST)["'']?\s+(?:\S+\s+)*?/?repos/\S+/branches/\S+/protection\S*|(?:\S+\s+)*?/?repos/\S+/branches/\S+/protection\S*\s+(?:\S+\s+)*?(?:-X|--method)[\s=]*["'']?(?:DELETE|PUT|PATCH|POST)["'']?)(?:\s|$)'
description: "This removes or changes the branch protection rules (required reviews and checks) through the GitHub API."
id: github:api_branch_protection
severity: High
alternative: "gh api repos/<owner>/<repo>/branches/<branch>/protection"
alternative_info: "Read the current protection rules first (a GET)."
- from: github
test: (?:^|\s)gh\s+workflow\s+disable(?:\s|$)
description: "This turns a GitHub Actions workflow off: its CI, deploy or security checks stop running."
id: github:workflow_disable
severity: Medium
alternative: "gh workflow list"
alternative_info: "Check which workflow it is first; `gh workflow enable` turns it back on."
- from: github
test: '(?:^|\s)gh\s+(?:secret|variable)\s+set\s+(?:\S+\s+)*?(?:<\s*/dev/null(?:\s|$)|(?:-b|--body)(?:\s+|=)?(?:""|'''')?(?:\s+-|\s*$))'
description: "This replaces a GitHub secret or variable with an empty value: pipelines that use it break as if it were deleted."
id: github:secret_set_empty
severity: Medium
- from: github
test: '(?:^|\s)gh\s+api\s+(?:\S+\s+)*?-[fF]\s*visibility=public(?:\s|$)|(?:^|\s)gh\s+api\s+(?:\S+\s+)*?-[fF]\s*private=false(?:\s|$)'
description: "This makes the repository public through the GitHub API: its code and history become visible to everyone."
id: github:api_make_public
severity: High
- from: github
test: '(?:^|\s)gh\s+api\s+(?:\S+\s+)*?repos/[^/\s]+/[^/\s]+/actions/permissions\s+(?:\S+\s+)*?-[fF]\s*enabled=false(?:\s|$)|(?:^|\s)gh\s+api\s+(?:\S+\s+)*?-[fF]\s*enabled=false\s+(?:\S+\s+)*?repos/[^/\s]+/[^/\s]+/actions/permissions(?:\s|$)'
description: "This turns GitHub Actions off for the repository: no workflow (CI, deploys, security scans) runs."
id: github:api_disable_actions
severity: High