Skip to content

Domain 6: Privacy, Security, and Administration (10%) โ€‹

โ† Domain 5 ยท Domain 7 โ†’


Authentication โ€‹

Two-Factor Authentication (2FA) โ€‹

2FA adds a second layer of security beyond a password. GitHub supports:

  • TOTP apps (Authenticator apps like Google Authenticator, Authy)
  • SMS (less secure, not recommended)
  • Security keys (hardware keys, WebAuthn โ€” most secure)
  • GitHub Mobile (push notification approval)

Important

Organization admins can require 2FA for all members. Members who don't enable it are removed from the org.

Personal Access Tokens (PATs) โ€‹

PATs replace passwords for API and Git authentication:

Token TypeScope
Classic PATBroad permissions, single token
Fine-grained PATPer-repo, per-permission control

Best Practice

Use fine-grained PATs โ€” they follow the principle of least privilege. Classic PATs are being deprecated for org use.

SSH Keys โ€‹

SSH keys allow passwordless Git authentication:

bash
ssh-keygen -t ed25519 -C "your@email.com"
# Add public key to GitHub Settings โ†’ SSH and GPG keys

SAML SSO โ€‹

Organizations on GitHub Enterprise Cloud can require SAML Single Sign-On โ€” members authenticate through an identity provider (Okta, Azure AD, etc.) before accessing org resources.


Branch Protection Rules โ€‹

Branch protection rules enforce code quality gates on specific branches (typically main).

Available Protections โ€‹

RuleEffect
Require pull request reviewsPR must be approved before merge
Required approvalsMinimum number of approvals (e.g., 2)
Dismiss stale reviewsNew commits re-require approval
Require status checksCI must pass before merge
Require signed commitsAll commits must be GPG/SSH signed
Require linear historyNo merge commits โ€” squash or rebase only
Include administratorsRules apply to repo admins too
Restrict who can pushLimit direct pushes to specific users/teams
Require conversation resolutionAll review comments must be resolved

Exam Tip

Branch protection rules are set per branch (or branch pattern with wildcards like release/*). They're configured under Settings โ†’ Branches.

Rulesets (newer approach) โ€‹

Rulesets are a more flexible alternative to branch protection rules:

  • Can apply to multiple branches at once with patterns
  • Can be enforced at organization level across all repos
  • Support "Evaluate" mode for testing before enforcing

Security Features โ€‹

Secret Scanning โ€‹

Secret scanning automatically detects accidentally committed secrets (API keys, tokens, passwords):

TierBehavior
Default (public repos)Scans pushed commits, alerts the token provider
Secret scanning alerts (private)Org/repo admins see alerts in the Security tab
Push protectionBlocks the push if a secret is detected (before it lands in history)

Push Protection

With push protection enabled, GitHub blocks the git push if it detects a secret โ€” preventing it from ever entering the commit history.

Dependabot โ€‹

Dependabot automates dependency security:

FeatureWhat it does
Dependabot alertsNotifies you when a dependency has a known vulnerability (CVE)
Dependabot security updatesAutomatically opens PRs to update vulnerable dependencies
Dependabot version updatesAutomatically opens PRs to keep dependencies up-to-date

Configured via .github/dependabot.yml:

yaml
version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"

Code Scanning (GHAS) โ€‹

Code scanning uses CodeQL or third-party tools to find security vulnerabilities in code. Available on:

  • Public repos (free)
  • Private repos with GitHub Advanced Security (GHAS)

Organizations, Teams, and Permissions โ€‹

Organization Structure โ€‹

Organization
โ”œโ”€โ”€ Teams
โ”‚   โ”œโ”€โ”€ Team A (members + repos)
โ”‚   โ””โ”€โ”€ Team B (members + repos)
โ”œโ”€โ”€ Repositories
โ””โ”€โ”€ Members (roles)

Organization Roles โ€‹

RoleCapabilities
OwnerFull admin access to org and all repos
MemberAccess to repos based on team membership
Outside CollaboratorAccess to specific repos only, not org member
Billing ManagerManage billing only

Repository Permission Levels โ€‹

LevelCan do
ReadView and clone repo
TriageManage issues and PRs (no code push)
WritePush to branches, manage issues/PRs
MaintainManage repo settings (no destructive actions)
AdminFull control, including destructive actions

Exam Tip

Teams grant repository access at a permission level. Org members inherit the base permission level set by the org admin. Individual permissions can override team permissions (highest wins).

Teams โ€‹

Teams group org members and can be:

  • Visible โ€” all org members can see the team and @mention it
  • Secret โ€” only team members and org owners can see it

Teams can be nested (parent/child hierarchy) and support @org/team-name mentions.


Domain 6: Security and Administration

1 / 7
โ“

What does the branch protection rule Require Status Checks do?

(Click to reveal)
๐Ÿ’ก
Prevents merging a PR until specified CI checks (e.g., GitHub Actions workflows) have passed.

โ† Domain 5 ยท Domain 7 โ†’

Happy Studying! ๐Ÿš€ โ€ข Privacy-friendly analytics โ€” no cookies, no personal data
Privacy Policy โ€ข AI Disclaimer โ€ข Report an issue