Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Recommended Policies for GitHub

Recommended Nightfall for GitHub policies for secrets, sensitive data, and public repositories, and how to pair them with endpoint git push monitoring.

Audience: Security teams protecting source code and secrets in GitHub.

Nightfall protects code in two places, and you get the best coverage by using both:

  • Nightfall for GitHub (this page) scans what lands in your GitHub organizations. It finds secrets and sensitive data in every commit, on every branch, and notifies the developer and your security team.

  • Nightfall Endpoint Exfiltration watches where code goes from a managed laptop. It alerts when a developer pushes code to a repository outside your approved list, and blocks source code and secrets from being uploaded to personal or risky destinations. See Pair with endpoint protection.

Nightfall for GitHub does not block pushes, revert commits, or change branch protection. It detects sensitive data, notifies people, and tracks the event until it is resolved.

Before you create policies

  • A GitHub organization owner installs Nightfall on each GitHub organization you want to protect. Choose All repositories so new repositories are covered automatically.

  • Nightfall scans code pushed to any branch, in real time. It scans commit diffs and changed files. It does not scan issues, pull request descriptions, comments, or wikis.

  • Nightfall does not monitor developers' personal GitHub accounts or personal repositories.

  • For the permissions Nightfall requests and how organization and repository scoping work, see the SaaS App Permissions Reference.

Risk
Recommended policy
Action

A secret is committed to a repository

Policy 1: Secrets in code

Alert and notify the developer

Customer data is committed to a repository

Policy 2: Sensitive data in code

Alert and open a ticket

A public repository exposes sensitive data

Policy 3: Public repositories

Alert with a higher risk score

Policy 1: Secrets in code

Why: A key committed to Git stays in the repository history, and in every clone, until it is rotated.

  • Scope: All repositories in each organization.

  • Detection rules: Credentials and API keys, passwords, and cryptographic private keys.

  • Notifications: Notify the developer by email or Slack. Send an admin alert to your security channel.

  • End-user remediation: Turn on Report as False Positive with Business Justification so developers can flag test keys.

  • What to do with a finding: Rotate the key first. Removing the commit does not make a leaked key safe. Then remove it from history if needed. See Remediation on Nightfall for GitHub.

Policy 2: Sensitive data in code

Why: Real customer records end up in test fixtures, seed files, logs, and config files.

  • Scope: All repositories.

  • Detection rules: PII, PCI, and PHI.

  • Notifications: Send an admin alert. From the event, use Send to Jira to assign cleanup to the repository owner.

Policy 3: Public repositories

Why: Anything in a public repository is exposed to the internet the moment it is pushed.

  • Scope: Public repositories only.

  • Detection rules: The same rules as Policies 1 and 2.

  • Risk score: Set a higher risk score than your private repository policies so these events rise to the top of the queue.

  • Notifications: Use email or Slack.

Reduce noise on every GitHub policy

  • Exclude test fixtures, vendored dependencies, and generated files with directory exclusions (for example ^test/fixtures/ or ^vendor/). See Use Regular Expressions to Exclude GitHub Directories.

  • Exclude file types that never hold real secrets, such as lock files.

  • Exclude repositories that exist only for testing by name pattern.

Scan history

Live scanning only covers new pushes. Run a historical scan of all branches when you first connect GitHub, and again before you make any repository public. See GitHub audit.

Pair with endpoint protection

Nightfall for GitHub only sees repositories in your organizations. To see code leaving through other paths, add these Nightfall Endpoint Exfiltration and AI Agent Security policies:

Policy
What it does
Action

Git push to unapproved repositories

Alerts when code is pushed from a managed laptop to a repository outside your approved list, such as a personal GitHub account

Alert only. The push completes

Source code uploads

Stops source code from being uploaded through the browser or synced to personal cloud storage

Block

Secrets on the endpoint

Stops API keys, passwords, and private keys from being pasted or uploaded anywhere

Block

Secrets in AI coding agents

Stops secrets from being sent to, or run by, Claude Code, Cursor, and VS Code Copilot

Block

Remote MCP tools

Limits which remote tools coding agents can call, and removes write and delete tools

Disable tools

For configuration details, see Recommended Policy Configurations (Recommendations 1 and 2) and Hook policy recommendations (policies 1 and 5).

Roll out in stages

  1. Week 1: Turn on Policies 1 and 3. Secret detection is precise, so it is safe to alert right away.

  2. Weeks 1 and 2: Turn on Policy 2 and add exclusions based on what you see.

  3. Ongoing: When you create a new GitHub organization, install Nightfall on it and add it to each policy's scope.

Was this helpful?