Best practices to keep your projects secure on GitHub
github.blog
github.blog
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/
You can find all of our security related blogs here: https://github.blog/category/security/
And thanks for sharing that blog, I'll pass it along to my colleagues in the Actions team.
That said, the article does indeed seem to focus entirely on dependencies.
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.
* OpenSSF Scorecard Action - https://github.com/ossf/scorecard#scorecards-github-action
* Step Security Harden Action - 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-...
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.
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.
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.
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?
Note: I'm not taking a stance on if I agree or not with this argument.
TBH most best practices preach for security by obscurity.
If you talk to any good vulnerabilities researcher - they will tell you what to really look out for.
Which means that their provider also did not run any dependency scans.
Tho if they fetched that from github open source repo -> yup thats just incompetence.
The biggest correlated constant for bugs is that more lines of code = more bugs. As dependencies get updated they add more new features that I probably don't care about which adds more lines of code and therefore more bugs and security vulnerabilities.
I appreciate there is a balance between the two, but in my experience updating dependencies has broken things a lot more often than not updating things has broken things, and when that happens I find it a bit of a ridiculous idea that the maintainer has somehow made their product "more secure"(something that is usually a low dev priority) while at the same time introducing new bugs with the new features (something which is a higher dev priority) and they didn't even get that right.
I guess you just proved my point. Thanks.
That way means you give a bit of trust to anyone, in the end we all work for a purpose, rouge agents are rare in any community, but not more than a bit, so updating is a must, not doing it means having someone who work for nothing, but with checks.
If that's overburden it's because actual IT development model, separate stuff for anything instead of an operating-system-environment-framework with a unique language (like ALL from the past) and a single application formed by tons of individual functions/methods/modules (again like ALL from the past) and such issue can't be solved keeping up the actual paradigm.
This used to be a pain so automatically updating was an easy way to stay up to date and reduce risk. But now with dependabot, I can pin to specific versions and leave it there forever, until dependabot detects the vulnerability and submits a PR.
It's not a perfect strategy, since there's non-zero risk that the latest version was hijacked by a malicious user, but the chances of a hijacked dependency are much lower than the chances of relying on something with a known vulnerability.
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.
ignore-scripts=true
As previously discussed,
https://blog.uidrafter.com/getting-rid-of-npm-scripts