OWASP code review guidelines

Kenny DuMez
Kenny DuMez
Graphite software engineer

Secure code review is an important step in the software development lifecycle aimed at identifying security vulnerabilities that might be missed during automated tests or penetration testing. The Open Web Application Security Project (OWASP) provides comprehensive guidelines for conducting these reviews. This guide explores OWASP’s recommendations for secure code reviews, differentiating them from other security assessments like penetration tests, and highlighting best practices for finding and mitigating security risks.

OWASP's code review guidelines are designed to provide developers and security professionals with a systematic approach to reviewing source code for security vulnerabilities. These guidelines emphasize the importance of manual inspection of code, which is important for discovering complex security issues that automated tools might overlook.

  1. Scope of review:
  • Secure code review: This is a proactive measure conducted at the source code level. The goal is to identify and fix security vulnerabilities within the code before the application is deployed. It involves manually reviewing the code or using automated tools to detect issues like security flaws, bugs, and other vulnerabilities which might compromise security. Since it happens early in the development cycle, it can prevent vulnerabilities from being introduced into the live environment.

  • Penetration testing: Often referred to as a pen test, this is a reactive technique that simulates a cyberattack on a running application to identify exploitable vulnerabilities. It tests the application's external defenses and is performed in an environment that mimics a real-world attack. Unlike secure code reviews, penetration testing does not involve examining the source code; instead, it focuses on exploiting weaknesses in the deployed application.

  1. Identifying common vulnerabilities:
  1. Define source code review requirements:

    • Establish clear objectives for the review process, including which parts of the codebase will be reviewed, based on risk assessment and previous security incidents.
  2. Prepare for the review:

    • Ensure that all source code is accessible and that reviewers have the necessary tools and resources, such as access to the complete codebase and any dependent libraries or components.
  3. Conducting the review:

    • Use a code review platform like Graphite to facilitate thorough code review. Manual review is essential for understanding the context and logic that automated tools might miss.
  4. Documenting findings in a secure code review report:

    • A comprehensive report should include details of the vulnerabilities found, their potential impact, and recommendations for mitigation. This report serves as a record for future reference and validation of fixes.
  1. Use a checklist: Develop a checklist based on OWASP guidelines to ensure all relevant security aspects are covered during the review.
  2. Regular updates: Keep the review guidelines up-to-date with the latest security research and vulnerabilities.
  3. Training and awareness: Regularly train code reviewers on the latest security practices and common vulnerabilities to look for.
  4. Integrate with the rest of the development lifecycle: Embed the secure code review process early and continuously throughout the development cycle, rather than as a one-off task before deployment.

Adhering to OWASP's code review guidelines helps organizations enhance their security posture by proactively identifying and addressing vulnerabilities in the software development phase. By incorporating these practices into your development process, you can significantly reduce the risk of security breaches and protect your applications from emerging threats.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2