All right, so I want to so while folks catch up there and feel free to just go to the guidebook and copy paste the workflow configuration out of there if you're having trouble. I'm going to move on to the next step, just start describing what we're going to do.
So we're going to use Dependabot. Dependabot is a free SCA for GitHub repositories. There's a lot of other options out there for really great SCAs. You'll even find it embedded in a lot of the artifact repositories these days. I know JFrog and Nexus each have something like this.
It'll just check your dependencies right there in the artifact repository. Dependabot in GitHub is actually enabled by default on public repositories. But if you fork a repo, it's not enabled by default, even if it's public. It's also easy to add to private repositories, and it's free for both. It finds libraries with vulnerabilities, it'll take your dependencies file, if that's your Gradle file or Maven file, Palm file, just search through it, and it will even try and blow out all of the sub-dependencies that are implied by the dependencies you've pulled in. And then it will go through and just check each and every one of those to see if there's known vulnerabilities out there, and it'll let you know.
And Dependabot's super cool. There's other tools that do this too. When it finds an issue, it'll tell you exactly what to do to fix it. And if it can, it will actually create a PR for the fix. And in our case, that PR will kick off our workflow again, so it'll go through any tests that you have, and it will make sure that it builds okay, and then all you have to do to fix it is accept the PR. It does have some false positives in practice, even though everything that it finds really is a vulnerability. It can be false positive because you might pull in a giant library that has a little bug over here in all of the tools that you use are, none of them really touch that bug. So it's possible theoretically that it would report on something that is a vulnerability, but it doesn't really affect you. Still we all know it's best to keep up with these things on a cadence, and it's nice to have something just reminding you, just reminding you, hey, there's updates you should be looking at, and here's an easy way to fix it.
All right, I'm going to jump into fixing it. Hopefully, everybody's kind of caught up with us, and let's do it. So I'm going to go back to my code base. I'm in my fork of Vuln GraphQL API, and I'm going to just go to the security tab over here. And under the security tab, there's a number of cool things, and we're going to use two of them, but first, we're just going to do dependabot alerts.
So we want to enable dependabot alerts so that we get notified when one of our dependencies has a vulnerability. Click on the security tab, hit enable dependabot alerts, and now it's got all these options. We're going to do these first three. We're not going to do this one yet. We'll do this one later. We just want to do these three. So first, Dependency Graph enables GitHub to check out your dependency file, whatever it is, if it's a POM file or in our case, a package.json file, and process it essentially, and go find all the sub-dependencies. We want that. It'll find more stuff. We want dependabot alerts so that we'll get alerts we'll get alerts anytime new vulnerabilities are found. It's an easy one. Then dependabout security updates. Easily upgrade to nonvulnerable dependencies. So this is the feature where it will actually issue a PR to your repo, and that's pretty awesome. So we'll enable that. All right, and if you've enabled these three things, but don't worry about this one yet, if you've enabled these three things, very shortly you should see a new badge next to your security tab. It says, in my case, 11, I suspect everybody else has 11 as well. Click into there, and you'll see a badge that says 11 over by dependabout alerts. Click into there, and you can see 11 different alerts. So this has figured out that we've got a bunch of NPM dependencies that we have specified, and they're problematic. So let's just click on one as an example, this tar dependency. So it found that we've got version 4.4.13, and it recommends that we bump to 4.4.19 because there's five different vulnerabilities in it, and it shows us how we can make this change just by editing our Yarn file, and it gives us a bunch of details on what the problem is, arbitrary file creation, override, and code execution. Pretty bad, you don't want that in your tar utility.
Comments