Pin down your GitHub organization.
Twelve field guides for engineers who own a GitHub organization or enterprise: identity, rulesets, Actions, secrets, supply chain and audit logs, with the exact settings, YAML and API calls to apply.
GitHub Hardening is an independent, non-commercial resource. It is not affiliated with, endorsed by or sponsored by GitHub, Inc. or Microsoft Corporation. GitHub and GitHub Actions are trademarks of GitHub, Inc. Other names are trademarks of their respective owners.
- 01members.base_permission= none or read
- 02identity.sso= enforced
- 03tokens.fine_grained= approval, max lifetime
- 04rulesets.default_branch= active
- 05secret_scanning.push_protection= on
- 06dependency_review.fail_on= moderate
- 07actions.uses= @<full commit sha>
- 08pull_request_target= no untrusted checkout
- 09runners.self_hosted= ephemeral
- 10cloud.credentials= oidc, no static keys
- 11audit_log.stream= siem
- 12audit.review= monthly
The guides
Grouped by where the control lives. Read them in order for a full hardening pass, or jump to the area you are reviewing.
Organization and access
Who can get in, with which identity, and what they can do once inside.
- 01GitHub Organization Security Best PracticesA practical security baseline for a GitHub organization: 2FA enforcement, base permissions, member privileges, outside collaborators and security defaults.@b4183378 min@b4183378 min
- 02GitHub SAML SSO vs Enterprise Managed UsersChoose and harden GitHub identity: organization vs enterprise SAML SSO, Enterprise Managed Users with OIDC or SAML, SCIM provisioning and credential authorization.@5f196bf7 min@5f196bf7 min
- 03Fine-Grained PATs vs GitHub Apps vs OAuth AppsControl programmatic access to a GitHub organization: fine-grained PAT policies, approval and lifetime limits, classic token restrictions, GitHub Apps and OAuth apps.@8a532ef6 min@8a532ef6 min
Repositories and code
What has to happen before code merges, and what must never be committed.
- 04GitHub Rulesets, Branch Protection and CODEOWNERSProtect GitHub default branches with rulesets: required reviews, CODEOWNERS approval, status checks, signed commits, bypass lists and organization-wide targeting.@7811a597 min@7811a597 min
- 05GitHub Secret Scanning and Push Protection SetupEnable GitHub secret scanning and push protection across an organization, control bypasses, add custom patterns, triage alerts and respond to a leaked secret.@c865c8c6 min@c865c8c6 min
- 06Dependabot and Dependency Review: Secure SetupConfigure Dependabot updates, cooldowns and grouping, block vulnerable dependencies with the dependency review action, and add CodeQL code scanning on GitHub.@431737a6 min@431737a6 min
GitHub Actions
Workflow permissions, untrusted input, runners and cloud credentials.
- 07GitHub Actions Security Best PracticesHarden GitHub Actions: least-privilege GITHUB_TOKEN permissions, SHA-pinned actions, allowed-actions policies, environments for secrets and runtime egress monitoring.@17875dc6 min@17875dc6 min
- 08pull_request_target and Script Injection in ActionsHow pwn requests and script injection compromise GitHub Actions workflows, how to spot them in YAML, and the safe patterns for pull_request_target and workflow_run.@6d8a7ed5 min@6d8a7ed5 min
- 09GitHub Self-Hosted Runner Security GuideSecure GitHub Actions self-hosted runners: ephemeral and JIT runners, runner groups, Actions Runner Controller, network isolation and why public repositories need care.@7d47fa66 min@7d47fa66 min
- 10GitHub Actions OIDC for AWS, Azure and Google CloudReplace long-lived cloud keys in GitHub Actions with OIDC federation: AWS role trust policies, Azure federated credentials, GCP Workload Identity and safe sub claims.@6e5e42e6 min@6e5e42e6 min
Audit and monitoring
Logs to keep, signals to alert on and tools to measure the result.
- 11GitHub Audit Log and Audit Log Streaming GuideUse the GitHub audit log for security monitoring: search and API queries, enterprise audit log streaming to a SIEM, Git events, source IPs and high-value alerts.@dac0f026 min@dac0f026 min
- 12Audit a GitHub Org with Scorecard, Allstar, LegitifyMeasure GitHub organization security with open source tools: OpenSSF Scorecard for repositories, Allstar for continuous policy enforcement and Legitify for org settings.@e531c166 min@e531c166 min
Start where most incidents start: the organization settings.
The baseline guide covers two-factor enforcement, base permissions, member privileges and outside collaborators. Most of it works on every plan and takes an afternoon.