Merge Gates: Hardening a GitHub Org for AI-Written Code
Org-wide rulesets, central security checks, supply-chain controls, hardened Actions and managed AI agents, practiced on a fleet of deliberately weak repos
What you'll learn
- Inventory every repository and org setting that affects security, with scripts you can rerun
- Enforce branch, review and file-ownership rules that individual repos cannot quietly remove, on free and paid plans
- Run one central security gate (SAST, secrets, dependencies, workflow lint) across a fleet, rolled out without stopping delivery
- Block invented, too-new and unpinned dependencies, including GitHub Actions
- Find and fix dangerous workflow triggers, script injection and over-privileged tokens
- Lock down Claude Code and other AI agents on developer machines with managed settings and enforced hooks
- Run AI review in CI without giving the model write access or trusting its verdict as a gate
- Detect drift, audit bypasses, measure the program, and respond to leaked secrets and malicious packages
About this course
AI agents now write a large share of the code that reaches your repositories, and they open more pull requests than reviewers can read carefully. They also suggest packages that do not exist, copy insecure workflow patterns, and run with real credentials on developer machines and in CI. If you are responsible for security across many repositories, you cannot fix this one pull request at a time, and you cannot rely on every developer (or every agent) doing the right thing.
This course shows how to build protections that hold anyway. You create a free test organization, bootstrap a fleet of five deliberately weak repositories, and harden them the way you would harden a real org: inventory first, then enforcement that developers cannot switch off, a central security gate, supply-chain controls, hardened GitHub Actions, managed settings for AI coding agents, safe AI review in CI, and the operating work that keeps it all in place.
Everything runs on GitHub Free with public lab repos, so it costs nothing. Every lesson also says what changes on private repos and which paid plan (Team, Enterprise, Secret Protection, Code Security) a feature needs, because most companies run on paid plans. Every command and config in the course is in the companion repo, one directory per lesson, and was tested against a real org.
Curriculum
10 modules · 34 lessons01What AI changed, and your lab3 lessons
The threat model for AI-assisted development at org scale, a free test org with a fleet of weak repos, and the inventory habit everything else builds on.
02Audit the fleet3 lessons
Org settings, repo settings, workflows and secrets in history, scanned across every repo and turned into a risk-ranked backlog.
03Enforcement developers can't turn off4 lessons
Rulesets on free and paid plans, a baseline applied to every repo, CODEOWNERS for security-critical files, and secret scanning with push protection.
04A central security gate4 lessons
One reusable security workflow for the whole fleet: diff-aware SAST, secrets, dependencies and config, rolled out from audit to block with exceptions that expire.
05Supply chain at fleet scale4 lessons
Dependabot everywhere, lockfiles and install scripts, a gate for invented and too-new packages, and GitHub Actions treated as dependencies.
06Hardening GitHub Actions4 lessons
Least-privilege tokens, dangerous triggers and script injection, zizmor across the fleet, and OIDC, environments and runners.
07AI agents on developer machines4 lessons
What an org can enforce on Claude Code with managed settings, permissions, sandboxing, enforced hooks and MCP control, and where instruction files stop.
08AI agents in the pipeline3 lessons
AI review in CI without the keys, prompt injection through pull request content, and scoping coding agents and autofix bots.
09Running the program4 lessons
Exceptions and bypasses you can audit, scheduled drift detection, metrics that mean something, and playbooks for leaked secrets and malicious packages.
10Capstone1 lesson
Harden the whole fleet and prove it with evidence.
// final project
Final project
Take the five-repo lab fleet from its weak starting state to a hardened state and prove it. Submit: the inventory output before and after; the baseline ruleset and drift-check output showing zero drift; a pull request that the central gate blocked, with the reason; a dependency PR rejected by the package check; zizmor results before and after; your managed-settings.json for Claude Code with a short note on what it enforces and what it cannot; and an exceptions log with at least one expiring exception.
Prerequisites
- Comfortable on the command line (bash) and with git
- A GitHub account, and permission to create a free organization
- GitHub CLI (gh) 2.x installed and logged in
- Docker (for running scanners without installing them)
- Basic reading knowledge of YAML and JavaScript
Who it's for
Security engineers, secops and platform teams responsible for many repositories, who need protections that hold even when developers and their AI agents take shortcuts. Developers who own their team's repos can follow along too.
