gh-repo-security-audit
Skill0 starsChanged 5 months agoMITView on GitHub
OpenSSF-aligned security posture audit across all repos in a GitHub account: default workflow token permissions, allowed-actions policy, branch protection, secret scanning + push protection, and Dependabot alerts. Reports WARN (fixable gaps) vs INFO (opinionated hardening). Read-only by default; the only optional mutation is enabling Dependabot alerts. Use when you ask: "repo security audit", "OpenSSF audit", "are Dependabot alerts on?", "GitHub hardening check", "repo セキュリティ監査", "Actions セキュリティ横断". DO NOT USE FOR: writing code, changing branch protection automatically, or the PR-approval toggle (use gh-pr-perm-audit for that).
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- run-testsSkill
- gh-pr-perm-auditSkill
- issue-triageSkill
- pr-respondSkill
- release-notesSkill
- repo-tourSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Run gh auth status — if not authenticated, output ⚠️ gh CLI not authenticated.
- Distinctive: line 43
no branch protection on the default branch
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Repo Security Posture Audit (OpenSSF-aligned)
Audit every repo in an account against OpenSSF Scorecard-style checks and report a clear posture.
Read-only by default. The single optional mutation is enabling Dependabot alerts (a pure
security gain). Everything else is reported as a human-gated recommendation. See
references/openssf-checks.md for per-check rationale + sources.
Setup Check
Run gh auth status — if not authenticated, output ⚠️ gh CLI not authenticated. Run: gh auth login and stop.
Step 1: Resolve scope
--owner <name>or defaultOWNER=$(gh api user --jq .login).- Repos:
gh repo list "$OWNER" --no-archived --limit 200 --json name --jq '.[].name'.
Step 2: Per-repo checks (GET-only)
For each repo, gather in as few calls as possible:
# one snapshot of the repo object: visibility, default branch, secret scanning
gh api "repos/$OWNER/$REPO" \
--jq '[.visibility, .default_branch, (.security_and_analysis.secret_scanning.status // "n/a")] | @tsv'
gh api "repos/$OWNER/$REPO/actions/permissions/workflow" --jq '.default_workflow_permissions' # read|write
gh api "repos/$OWNER/$REPO/actions/permissions" --jq '.allowed_actions // "all"' # all|local_only|selected
gh api "repos/$OWNER/$REPO/branches/$DEFAULT_BRANCH/protection" >/dev/null 2>&1 && echo yes || echo none
gh api "repos/$OWNER/$REPO/vulnerability-alerts" >/dev/null 2>&1 && echo on || echo offStep 3: Severity model
- WARN (fixable gap):
- Dependabot alerts
off default_workflow_permissions=write(least-privilege violation; should beread)- a public repo with secret scanning not
enabled
- Dependabot alerts
- INFO (opinionated hardening — not a defect):
- no branch protection on the default branch
allowed_actions=all
Step 4: Report
# Repo Security Audit — <owner> — <DATE>
> Generated by github-flow-kit/gh-repo-security-audit (OpenSSF-aligned)
| Repo | vis | def perms | allowed | branch prot | secret scan | Dependabot |
|---|---|---|---|---|---|---|
| <repo> | public | read | all | none | enabled | on |
## ⚠️ WARN (fixable): <N>
- <repo>: Dependabot alerts OFF
## ℹ️ INFO (hardening): <N>
- <repo>: no branch protection / allowed_actions=allStep 5: Remediation
Safe, optional mutation — enable Dependabot alerts (only with --enable-dependabot; pure gain, reversible):
gh api -X PUT repos/<owner>/<repo>/vulnerability-alerts # enable (DELETE to undo)Human-gated (never auto-applied) — print commands, let the user decide:
- Token-Permissions: keep default
read; declare per-workflowpermissions:blocks in YAML. - Branch protection (esp. public + bot-PR repos): require reviews from someone other than the actor.
allowed_actions→selected+ verified creators (stage rollout; third-party actions may break).- SHA-pin actions (
uses: owner/action@<40-hex-sha>): adddependabot.ymlgithub-actions ecosystem, or useratchet/pin-github-action. - Review any
pull_request_target/workflow_runworkflows for untrusted PR-head checkout and${{ github.event.* }}injection intorun:.
Summary Output
✅ Repo Security Audit — <N> repos
⚠️ WARN (fixable) : <n> (mostly Dependabot OFF — fix with --enable-dependabot)
ℹ️ INFO (hardening): <n>
✅ secure : <n>
📋 Next: --enable-dependabot for the safe fix; branch protection / allowed_actions / SHA-pin stay manual.
⭐ Found this useful? Star → https://github.com/thinkyou0714/github-flow-kitError Handling
| Code | Condition | Exit |
| RS-001 | gh not authenticated | 2 |
| RS-002 | owner has no repos | 0 |
| RS-003 | per-repo API error (no admin / archived) | skip that repo |
| RS-004 | API rate limited | stop, show reset time |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

