Vibe coder? Secure your GitHub repository before your next AI-generated commit
Updated
Before publishing AI-generated code, verify that your GitHub repository is Private if it contains nonpublic work, enable security features available to your plan, protect the main branch, and keep credentials out of code. GitHub asks you to choose visibility; never assume a universal default.
AI tools can produce a working interface without ensuring your repository, secrets, database, authentication or release process are protected. This beginner-friendly checklist explains exactly where to look, which controls may require a paid GitHub plan, and what to do if something was already exposed.
Start here: is your repository public or private?
Go to GitHub, open your repository, and look for the Public, Private or (on eligible enterprise organizations) Internal visibility label near the repository name. For a commercial app with nonpublic source or configuration, intentionally choose Private. If you want to open-source your project, choose Public deliberately and audit it for secret values and sensitive material first.
When you create a repository, GitHub's creation flow offers visibility choices. The current choice can vary with your account, organization policy or creation method. It is inaccurate to promise every new repository defaults to Public or Private. The safe habit is to make the choice explicitly and check the result.
To change an existing repository, use Settings → General → Danger Zone → Change repository visibility (if your role has permission). Do not confuse GitHub's repository visibility with whether your deployed web app is publicly accessible. A private repository can still deploy an insecure public application.
Important: if your code was previously public, switching to Private does not recall existing clones, screenshots or public forks. Treat exposed credentials as compromised and revoke or rotate them at their provider.
- New app you are not intentionally open-sourcing: choose Private and verify the label after creation.
- Open-source project: choose Public knowingly; never store secrets in source, even for a moment.
- Shared organization: review members, collaborators and third-party GitHub App access before granting more permissions.
Your first five GitHub security checks
Open the repository Settings tab. Depending on the repository and plan, security controls may appear under Settings → Advanced Security or Security & analysis, while alerts appear under the Security tab. If an option is missing, check plan eligibility and your administrator role instead of assuming GitHub is protecting you automatically.
Use the following as a checklist, not a promise that GitHub has every feature switched on or that all features are included in every plan.
| Control | What to review | Why it matters |
|---|---|---|
| Repository visibility | Private unless you intentionally release source | Reduces accidental public source exposure; not a substitute for application security |
| Dependency graph + Dependabot alerts | Enable available dependency inventory and vulnerability alerts | Find known vulnerable libraries; read alerts and apply fixes |
| Secret scanning + push protection | Check availability and whether alerts and pre-push blocking are active | Helps find or prevent exposed supported credential patterns; coverage varies by plan and repository |
| Code scanning / CodeQL | Enable when your plan and language support it; review findings | Detects some coding flaws, not every vulnerability |
| Branch protections / rulesets | Require pull requests, review, and relevant passing checks where supported | Prevents an AI agent or rushed commit from bypassing review |
Turn on alerts — and understand what each one does
Dependency graph lists known dependencies; Dependabot alerts identify known vulnerable versions from supported ecosystems. Dependabot security updates can propose version bumps. You still need to review, test and merge changes. Alerts and update settings are separate controls.
Secret scanning looks for certain secret patterns and creates alerts; push protection can block pushes of supported exposed credentials before they land. Public and private repositories have different entitlements and feature availability. Some user-level protections operate separately from repository-level paid features. Check the current GitHub feature page for your exact account.
Code scanning can analyze supported source with CodeQL. It may require GitHub Code Security or other plan entitlement for private repositories. A green code scan only means that particular scan found no reportable issue in what it checked.
Go to the Security tab after enabling features and confirm actual alert status and recent scan results. An empty alert list does not demonstrate that scanning ran successfully.
- Resolve a critical credential alert by revoking or rotating the key first, not merely deleting a line.
- Review dependency alerts and prioritize exploited or internet-facing risks.
- Do not dismiss a finding simply because an AI assistant calls it a false positive.
Protect your main branch from unreviewed AI changes
Under Settings → Rules → Rulesets, or Settings → Branches where available, protect your production branch. Require a pull request and appropriate human review before merging. Add tests, build and security scans as required status checks only after those checks reliably run in your repository.
Disable force pushes and deletion for the protected branch where supported. Consider requiring updated approvals after changes and restricting who can bypass rules. Access to rulesets and branch protection on private repositories varies by GitHub plan; if the controls are not available, use the strictest supported alternative and a manual reviewed PR workflow.
An AI-generated pull request is still a code change with real authority: it can modify deployment scripts, IAM permissions, GitHub Actions and package install hooks. Read those changes, not just the summary an agent wrote.
Never give an AI agent production secrets just to make the build pass
Keep API keys, database passwords, private keys and service-role credentials out of committed code, screenshots, issue comments, chat transcripts and client-side JavaScript. Add local secret files such as .env.local to .gitignore before the first commit, and commit a redacted .env.example listing variable names only.
Store CI credentials with appropriate GitHub Actions secrets or your deployment provider's secrets manager, grant least privilege, and keep production credentials out of local coding-agent sessions unless absolutely necessary. A GitHub Actions secret is not a general-purpose replacement for your production secret store.
Watch for client-exposed variable prefixes in frontend frameworks. A value deliberately bundled into browser JavaScript is public to anyone who can load the app, regardless of whether its GitHub repository is Private.
If a secret has ever been pushed, revoke/rotate it at the service provider, investigate Git history and access logs, and replace it securely. Deleting the latest file or changing repository visibility does not remove all copies.
Your database and API still need their own security
A Private GitHub repository does not stop someone from calling a public API URL or reading a database table exposed by an unsafe policy. For a Supabase application, review Row Level Security on every table exposed to client roles, inspect policies using the effective user identity, and test that one user cannot read or update another user's rows.
For Next.js and other backend frameworks, enforce authentication and authorization on the server at every sensitive route and action. A disabled button, hidden component or client-side login check is not a server-side permission check.
Use synthetic accounts with two different tenants to test access boundaries in an isolated environment. Never point unauthorized test probes at someone else's website or production data.
Give Claude Code, Cursor and other agents a restricted job
Review which repositories, files, commands and services each coding agent can access. Treat commands pulled from external repositories, third-party agent skills, AGENTS.md/CLAUDE.md instructions and MCP server configurations as untrusted input until you verify the source and requested permissions.
Prefer read-only access for security review and tightly scoped permissions for actual edits. Require an explicit human step before changing cloud IAM, production variables, branch rules, package scripts, billing, or database policies. Inspect generated diffs and execute tests independently instead of trusting an agent's claim that everything is secure.
- Never paste a production secret into a chat or ask an agent to log it for debugging.
- Review any new GitHub Actions workflow, package postinstall script or external MCP server before approving it.
- Do not authorize a coding agent to disable a security control to make a failing CI run green.
If you accidentally published something sensitive, do this first
Act in incident order, not just code-cleanup order: revoke/rotate affected credentials; review provider logs for unexpected activity; restrict access and correct repository visibility; then plan removal of sensitive history if appropriate. GitHub documents why rewriting history is not a simple undo and cannot erase other people's clones.
If customer information or regulated data was exposed, follow your incident response and reporting procedures. Do not make a public assertion that no one accessed the data without evidence.
A ten-minute safety checklist before your next deployment
Do the checks below now and repeat after the AI agent adds new dependencies, GitHub Actions, routes, or credential handling. No one checklist replaces expert assessment, but these steps prevent several avoidable mistakes.
- Confirm repository visibility was chosen intentionally (Private unless open source is deliberate).
- Inspect collaborators and installed apps; remove unexpected access.
- Turn on available dependency, secret and code scanning; confirm scans actually run.
- Enable applicable branch rules and require review before merge.
- Use environment secrets, not committed or browser-exposed service credentials.
- Check Supabase RLS or your database authorization for exposed tables.
- Check server-side authentication/authorization on sensitive API routes.
- Read generated workflow, dependency and configuration diffs before merging.
- Test that a second user's account cannot view or change the first user's data.
- Record what passed, failed, or was not checked; retest after each fix.
Where ShipReadyMetrics fits — without pretending a scan happened
ShipReadyMetrics is building evidence-based engineering readiness and Vibe Security capabilities. Its existing Ship-Ready Score can report measured versus unknown pillars, and the repository contains safety detector implementations and fix-prompt tools. Not every Safety check is connected to every live quick-scan workflow yet, so do not interpret a current score as comprehensive security certification.
Use the SRM Ship-Ready experience to understand what your account has actually measured, keep the above GitHub settings under your own control, and treat unmeasured risks as not assessed. For a practical walkthrough of your repository-security setup, use the Calendly booking link in Resources below. The walkthrough is educational; it does not promise a penetration test or certification.
Frequently asked questions
Does GitHub make every new repository public by default?
No universal default is safe to assume. GitHub creation paths let you choose visibility and organization policies can alter options. Explicitly choose Private for nonpublic work and verify the result.
If my GitHub repository is Private, is my deployed app secure?
No. A private repository controls source access. Your deployed API, database, authentication, cloud settings and client-side assets still need independent security review.
Are secret scanning and code scanning free for private repositories?
Availability differs by repository type, owner, plan and GitHub security product. Review the repository's Security and Settings pages and the current official GitHub documentation; do not assume a missing setting was automatically enabled.
Is turning on Dependabot enough?
No. Dependabot focuses on dependency advisories and updates. You still need review of API authorization, credentials, branch controls, cloud access and app-specific issues.
What if I already committed an API key?
Revoke or rotate it immediately at the issuing provider, inspect suspicious activity, and then handle repository history and deployment configuration. Deleting the file from the latest commit is not sufficient.
Can Claude Code or Cursor configure my GitHub security for me?
They can explain settings and propose code/configuration changes, but you should verify GitHub permissions, examine diffs and keep human approval for irreversible or high-risk administrative actions.
Published by ShipReady Metrics, an evidence-based technology and compliance intelligence platform. This guide is educational and vendor-neutral.