# How to enable PR security reviews with Codex Security

## Executive summary

This guide demonstrates how to integrate Codex Security into the GitHub pull request (PR) workflow to automatically identify and remediate security vulnerabilities before code reaches production. The process involves initial manual review requests, followed by configuring automated, repository-wide security checks that trigger on PR creation or every push.

## Key takeaways

- Initiating a Manual Security Review: A developer can request a security review by tagging Codacy in a PR comment (e.g., 'Codacy, do your security review'). The results appear directly in the PR, allowing developers to interact with the findings.
- Using Codex to Fix Vulnerabilities: Codex can analyze a PR link and generate a fix (e.g., resolving a cross-site scripting issue) and publish the commit directly to the PR, which must then be verified by a second review.
- Configuring Automated Reviews: To automate security checks, navigate to the Codex app settings and configure the 'Code Review' section. Reviews can be triggered on PRs or on every push, and severity thresholds can be set for both manual and automatic alerts.

## Technical details

- Initial Setup: Ensure the ChatGPT Codacy connector app is installed and configured within the GitHub repository settings under 'GitHub apps'. If access is restricted, the workspace administrator must install the app.
- Automating Code Review: To enable repository-wide automation, disable the personal security review preference and configure the 'review security vulnerabilities' toggle to 'All PRs' within the Codex app settings. The trigger can be set to 'on PRs open' or 'on every push'.
- Advanced Guidance: Repositories can be guided by providing Codex with 'agents markdown files' and 'security MD files' to help understand repository nuances.

## Practical implications

- Integrating Codex Security into the PR workflow shifts vulnerability detection left, ensuring that security issues are caught by developers before they become production-facing vulnerabilities.
- Automating the review process minimizes manual overhead and ensures consistent security coverage across all branches and PRs.
- The ability for Codex to analyze and propose fixes (e.g., resolving XSS) accelerates the remediation cycle.

## Topics

Security Reviews, Pull Requests (PR), GitHub Workflow, Code Analysis, CI/CD Security, Codex AI, Codex Security, GitHub, Codacy connector

Source: https://www.youtube.com/watch?v=vdBDMj2UhDg
