Developer mistakes and indirect dependencies are the two main sources of vulnerabilities in open source software projects, which together are expected to cause the majority of security alerts in the next year, according to GitHub's annual Octoverse report, published today.
Developers must anticipate the need to fix issues quickly and improve open source security, rather than finding ways to reduce reliance on open source, says Maya Kaczorowski, senior director of product management for GitHub.
"Rather than try to offset the use of open source, embrace it," Kaczorowski says. "Increased transparency and information about what you're consuming in your software supply chain allows you to feel more confident that you're appropriately addressing risks, such as security vulnerabilities, that you may be consuming."
Developers should focus on minimizing their applications' attack surface area by removing unnecessary dependencies and updating their dependencies regularly, Kaczorowski says.
"Proactively, security teams should help developers shift left to catch security issues early by looking for security issues before they are introduced," she says. "All developers, not just those using NPM, should keep the dependencies up to date and prune dependencies that aren't needed. You don't have to patch something that's not in your environment."
In addition, developers should use security tests and automated tools to catch vulnerabilities in their code, and they should also watch out for malicious attempts to insert backdoors into their projects.
A survey of 521 random samples of vulnerabilities found that 17% were maliciously inserted into software projects, but those only accounted for 0.2% of malicious activity because those projects were rarely used, accordin to the GitHub report. Every so often, however, attackers are successful in inserting code into an open source library, and if other projects rely on that library, it can lead to widespread impact.
Yet, by far, the vast majority of security impact was created by developer mistakes that resulted in vulnerabilities.
"A big part of the challenge of maintaining trust in open source is assuring downstream consumers of code integrity and continuity in an ecosystem where volunteer commit access is the norm," GitHub states in the report. "This requires better understanding of a project's contribution graph, consistent peer review, commit and release signing, and enforced account security through multifactor authenticatition (MFA)."
The report also highlights the success of GitHub's Security Advisory service, which gives projects a place to post security advisories about newly discovered flaws. While the advisory service started only 18 months ago, after GitHub officially became a CVE Numbering Authority (CNA) for the Common Vulnerability Enumeration (CVE) project, the service has already accounted for more than 3,000 new vulnerability reports.
"For projects that didn't have existing disclosure lists or processes, this is a marked improvement," Kaczorowski says. "We want to avoid purposely or accidentally reporting security issues where they might get lost or be hard to find, and instead enable users to come to a single place to see what affects their environment."