5 ms·
Best practices to keep your projects secure on GitHub
- efortis 5y agoSpeaking of NPM deps, another mitigation is setting: ignore-scripts=true As previously discussed, https://blog.uidrafter.com/getting-rid-of-npm-scripts https://blog.uidrafter.com/getting-rid-of-npm-scripts
- mcraiha 5y agoArticle is all about dependencies. And it only mentions JavaScript. So maybe a better topic would be: "How to use GitHub dependency tool to secure your Javascript project"
- Dragory 5y agoIt looks like they support other package ecosystems as well: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph#supported-package-ecosystems https://docs.github.com/en/code-security/supply-chain-securi... That said, the article does indeed seem to focus entirely on dependencies.
- cebert 5y agoI’ve noticed Dependabot isn’t always even the greatest for JS projects. There are popular front-end frameworks such as Angular or React. When it makes PRs for currency updates, it seems unaware that it should update all packages for a particular framework or update @types imports when it updates a package import.
- jhutchings0 5y agoHi from the Dependabot team! We're working on a fix for the Typescript @types problem that should be available very soon.
- kevin_nisbet 5y agoArticle doesn't talk about much, just a bit on dependencies apparently from someone focused on supply chain security at Github. At previous role, the more we looked at some of the technical controls around security within github itself, and had a number of security concerns. There's alot of nuance which is hard to go through and comment on, but the defaults and controls caused us lots of concern. Here's a good writeup for anyone interested: https://cycode.com/blog/github-actions-vulnerabilities/ https://cycode.com/blog/github-actions-vulnerabilities/
- jhutchings0 5y agoThanks for your comment! I'm Justin Hutchings, the author of that blog, and you're right that it was pretty narrowly focused on dependencies. We've been making a concerted effort to post about a number of security topics lately to provide best practices for users, everything from coordinated vulnerability disclosure, to how to protect from supply chain risks. You can find all of our security related blogs here: https://github.blog/category/security/ https://github.blog/category/security/ And thanks for sharing that blog, I'll pass it along to my colleagues in the Actions team.
- cebert 5y agoOn the topic of security, I am surprised there aren’t more safeguards for marketplace actions. I work in a larger organization and see that folks very much want to pull in actions that solve an immediate need without any type of vetting process. These actions are part of your build pipeline and can pose a substantial security threat. Dependabot does not currently scan for outdated or vulnerable marketplace actions. It’s difficult for Enterprise Orgs to ensure only vetted actions are used. I think this area of GitHub is ripe for security and governance improvements.
- newman314 5y agoSo if you are concerned about this, I'd suggest looking at the following: * OpenSSF Scorecard Action - https://github.com/ossf/scorecard#scorecards-github-action https://github.com/ossf/scorecard#scorecards-github-action * Step Security Harden Action - https://github.com/step-security/harden-runner https://github.com/step-security/harden-runner I realize that this means trusting these providers but they seem at least tacitly blessed by GitHub. https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions https://docs.github.com/en/actions/security-guides/security-...
- cebert 5y agoThanks, those are great resources!
- twistedpair 5y ago> It’s difficult for Enterprise Orgs to ensure only vetted actions are used. You can already to this 1. Visit Settings > Actions > General Actions Permissions > Policies 2. Select "Allow non-org actions and reusable workflows" You can then allow GitHub authored actions, verified publish actions, and OR provide an explicit allow list of actions.
- onionisafruit 5y agoI maintain a somewhat popular action and advise people to specify a commit if they use my action, but they want to just depend on v1 and trust me to never screw up. They don’t know me. Why do they think I’m not going to sell out to the first person who offers me a six pack to merge their code?
- hdjjhhvvhga 5y ago...don't let them be scanned by HackerRank folks.
- newman314 5y agoFrom what I can tell, there appears to be two camps. 1) Do not update dependencies (because updating to the latest version just because is silly) 2) Update dependencies (because security) Personally, I fall into the second group (with caveats). I've found that Dependabot helps with the tedious work of updating versions by hand but at the same time provides a check so that I manually approve. This seems to work out to be a decent balance. I've also moved away from using :latest or @v2 etc. and switched to using commit hashes/image digests. Once again, Dependabot is helpful for tracking changes/updates once you switch over. The one annoying thing is that Dependabot does not always trigger on a regular basis (once a day) but I've found that bumping .github/dependabot.yml reliably triggers it.
- yjftsjthsd-h 5y ago> Do not update dependencies (because updating to the latest version just because is silly) That's quite the straw man; I seriously doubt that anybody is saying you shouldn't update because it's "silly". Blindly pulling updates is how you get compromised by supply chain attacks.
- newman314 5y agoNot naming names but certainly I've encountered open source projects that reject updating until the last possible second (end of life, security vulnerability etc.)
- yjftsjthsd-h 5y agoThat can be a function of effort, too; updates can be disruptive, and not everyone has the CI+testing infrastructure to handle it without significant manual work. There's a reason LTS distros are a thing.
- mbesto 5y ago> 1) Do not update dependencies We regularly ding companies that don't update dependencies. No offense, but how do developers sleep at night having their application littered with known vulnerabilities?
- jefurii 5y agoMany popular Python libraries are available as Debian packages. Replacing pip/virtualenv dependencies with their distro-packaged equivalents firmly ties your projects to your distro and comes with other issues, but could also mean nearly automated updates for security patches. Advantages: 1. Security patches for free with distro package updates. 2. More consistency of dependency versions across projects. 3. Dependencies won't fall too far behind. 4. Major upgrades only need to happen with new distro release. Disadvantages: 1. Less control over dependency versions - can't lock to specific versions. May be forced to upgrade when security patches drop. 2. Not getting the very latest versions - your distro e.g. Debian Stable is often a bit behind. 3. Having to upgrade everything at once with a new distro release. 4. Can't run apps with different versions of dependency on same VM. 5. App will be closely tied to a particular release of your distro. Mitigations of disadvantages: 1. Distros like Debian are pretty good about fixing security issues without affecting functionality/APIs. 2. If you like "boring" tech more than bleeding-edge this may not be a problem. You'd be insulated from version churn, while a major distro's install numbers will hopefully bring stability. 1,2. You can still use virtualenv for certain dependencies if you absolutely have to have the latest version or lock at an old version. 3. Distros like Debian keep their old releases around for awhile and the upgrade window is pretty long. 4. If you run apps in own their own VMs that removes a major need for virtualenv in the first place.
- physicsguy 5y agoAnother disadvantage: the specific package you want might not be packaged by your distro, and may not be compatible with the versions of dependencies that your distro does package.
- s-xyz 5y agoLove the Dependabot Alerts page which scans for vulnerabilities. We use Sonarcube and Dependabot to apply static code analysis. Anyone has an idea if this is enough or some other tips?