Skip to content

Say hello to the new PR page.

Read more

Best settings for security reviews in GitHub

Sara Verdi
Sara Verdi
Graphite software engineer
Try Graphite

Security should be a top concern in software development, particularly during the code review phase where vulnerabilities can be spotted and rectified before production deployment. GitHub provides various settings to secure code reviews, ensuring that only authorized changes make it to your main branches. This guide details GitHub’s security review settings.

GitHub offers several settings to enhance the security of code reviews:

Ensuring that all changes pass through a pull request is fundamental. This setting prevents direct pushes to protected branches, requiring changes to be reviewed and approved in a pull request.

Branch protection rules are crucial for securing your codebase:

  • Require code review approvals: Set the minimum number of required review approvals before merging. For high-security repositories, consider requiring two or more approvals.
  • Dismiss stale pull request approvals when new commits are pushed: This ensures that approvals are specific to the latest code version, preventing outdated reviews from affecting security.

The CODEOWNERS file is a GitHub feature that automatically assigns specific individuals or teams to review changes to certain parts of the code. This is particularly useful for sensitive areas of your codebase, such as security configurations or critical infrastructure code.

Require status checks to pass before merging, including:

  • Continuous Integration (CI) tests
  • Security analysis tools
  • Any other checks that validate the security and functionality of the code
0 min read
Share
Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Built for the world's fastest engineering teams, now available for everyone