Trust & Security

How DigitalOcean Uses Semgrep to Fortify Security: A Highlight From Our Toolset

Product Security Engineer

Posted: October 7, 20242 min read
<- Back to Blog Home

Share

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!Sign up

One tool DigitalOcean uses to help provide code safety and quality is Semgrep, an open-source static analysis tool. Our Product Security team, in part, adds automation and guardrails to our engineering processes to integrate security by default. Semgrep doesn’t just help us address individual vulnerabilities; it empowers us to tackle entire classes of security issues. Semgrep allows us to detect vulnerabilities across codebases using complex matching patterns, and it integrates seamlessly into our CI pipeline to create a robust security framework on every pull request.

How we use Semgrep to identify security issues

Here’s a peek into how Semgrep empowered our security efforts after a researcher alerted us to an issue. The flaw involved legacy account users and their default team configurations. In rare scenarios, our authorization systems incorrectly used the User ID as the Team ID. This inaccuracy allowed users who had left a team to still access resources intended for that team. The researcher also identified a separate issue where certain endpoints related to the Biller user role were not enforcing function-level authorization properly.

The complexity of the underlying business logic made uncovering and addressing these issues more difficult than a simple search-and-replace in our codebase. Through labor-intensive manual analysis, we identified a cohort of affected endpoints that needed to be fixed. However, we thought there was more out there that we couldn’t find. We codified the issue into a Semgrep rule and leveraged Semgrep to conduct a thorough audit, which resulted in a large addition to our affected endpoints. We also integrated this rule into our CI pipelines, thus preventing similar issues from making their way into production in the future. The result of hours of manual analysis was surpassed by several minutes of rule creation.

In addition to its pattern-matching capabilities, we also found a lot of value in Semgrep’s ability to enhance developer workflows. When Semgrep identifies a vulnerability, it can provide enriched metadata, including custom auto-fix logic and links to detailed internal explanations of the vulnerabilities or desired remediation actions. This helps developers quickly understand and address issues within their code, reinforcing our commitment to maintaining a secure environment.

By integrating Semgrep into our security practices, DigitalOcean is better equipped to handle code security issues proactively and ensure robust protection for your data. Learn more about DigitalOcean’s security processes on our Blog or Security webpage. If you believe you have identified a security issue in DigitalOcean’s products, please report it via our bug bounty program.

Share

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!Sign up

Related Articles

Contextual Vulnerability Management With Security Risk As Debt
Trust & Security

Contextual Vulnerability Management With Security Risk As Debt

Regresshion vulnerability: Recommended actions and steps we've taken
Trust & Security

Regresshion vulnerability: Recommended actions and steps we've taken

DigitalOcean and HIPAA: Enabling Healthcare Innovation on our Platform
Trust & Security

DigitalOcean and HIPAA: Enabling Healthcare Innovation on our Platform