Live data from Hacker News

How to harden GitHub Actions

wiz.io

51–60 of 74 posts

Re: How to harden GitHub Actions

#51
These suggestions make a lot of sense.

At Namespace (namespace.so), we also take things one step further: GitHub jobs run under a cgroup with a subset of privileges by default.

Running a job with full capabilities, requires an explicit opt-in, you need to enable "privileged" mode.

Building a secure system requires many layers of protection, and we believe that the runtime should provide more of these layers out of the box (while managing the impact to the user experience).

(Disclaimer: I'm a founder at Namespace)

Re: How to harden GitHub Actions

#52
> Safely Writing GitHub Workflows

If you are looking for ways to identify common (and uncommon) vulnerabilities in Action workflows, last month GitHub shipped support for workflow security analysis in CodeQL and GitHub Code Scanning (free for public repos): https://github.blog/changelog/2025-04-22-github-actions-work....

The GitHub Security Lab also shared a technical deep dive and details of vulnerabilities that they found while helping develop and test this new static analysis capability: https://github.blog/security/application-security/how-to-sec...

Re: How to harden GitHub Actions

#53
Timely article... I recently learned about self-hosted runners and set one up on a Hetzner instance. Pretty smooth experience overall. If your action contains any SSH commands and you'd like to avoid setting up a firewall with 5000+ rules[0], I would recommend self-hosting a runner to help secure your target server's SSH port.

[0] https://api.github.com/meta

Re: How to harden GitHub Actions

#54

Earlier quoted context omitted.

I can confirm there's real wisdom in this approach, lol. Nothing bad had happened to me for a while so I decided to update that one computer to ubuntu noble and YUP, immediately bricked by some UEFI problem. Ok cool, it's not like 2004 anymore, this will probably be a quick fix.. 3 hours later...

An OS upgrade broke UEFI. Huh? That doesn't sound right.

In the newest iteration of a time-honored tradition, grub (and/or whatever distro's treatment of it) has been finding all kinds of ways to break upgrades for 30 years. If you're on the happy path you can probably go a long time without a problem.

But when you're the unlucky one and need to search for a fix, and you're checking hardware/distro/date details in whatever forums or posts, and that's when you notice that the problems don't actually ever stop.. it just hasn't happened to you lately.

Re: How to harden GitHub Actions

#55

GHA Newbie here: what are all these 3rd-party actions that people are using? How complicated is your build / deployment pipeline that you need a bunch of premade special steps for it? Surely it's simple: use a base OS container, install packages, run a makefile. For deployment, how can you use pre-made deployment scripts? Either your environment is bespoke VPS/on-prem, In which case you write your deployment scripts…

Can't speak for everyone, but workflows can get pretty crazy in my personal experience.

For example the last place I worked had a mono repo that contained ~80 micro services spread across three separate languages. It also contained ~200 shared libraries used by different subsets of the services. Running the entire unit-test suite took about 1.5 hours. Running the integration tests for everything took about 8 hours and the burn-in behavioral QA tests took 3-4 days. Waiting for the entire test suite to run for every PR is untenable so you start adding complexity to trim down what gets run only to what is relevant to the changes.

A PR would run the unit tests only for the services that had changes included in it. Library changes would also trigger the unit tests in any of the services that depended on them. Some sets of unit tests still required services, some didn't. We used an in-house action that mapped the files changed to relevant sets of tests to run.

When we updated a software dependency, we had a separate in-house action that would locate all the services that use that dependency and attempt to set them attempt to set them to the same value, running the subsequent tests.

Dependency caching is a big one and frankly Github's built-in cacheing is so incredibly buggy and inconsistent it can't be relied on... So third party there. It keeps going on:

- Associating bug reports to recent changes

- Ensuring PRs and issues meet your compliance obligations around change management

- Ensuring changes touching specific lines of code have specific reviewers (CODEOWNERS is not always sufficiently granular)

- Running vulnerability scans

- Running a suite of different static and lint checkers

- Building, tagging, and uploading container artifacts for testing and review

- Building and publishing documentation and initial set of release notes for editing and review

- Notifying out to slack when new releases are available

- Validating certain kinds of changes are backported to supported versions

Special branches might trigger additional processes like running a set of upgrade and regression tests from previously deployed versions (especially if you're supporting long-term support releases).

That was a bit off the top of my head. Splitting that from a mono-repo doesn't simplify the problem unfortunately it just moves it.

Re: How to harden GitHub Actions

#56

Earlier quoted context omitted.

An OS upgrade broke UEFI. Huh? That doesn't sound right.

In the newest iteration of a time-honored tradition, grub (and/or whatever distro's treatment of it) has been finding all kinds of ways to break upgrades for 30 years. If you're on the happy path you can probably go a long time without a problem. But when you're the unlucky one and need to search for a fix, and you're checking hardware/distro/date details in whatever forums or posts, and that's when you notice that t…

No that's not what I mean, I mean technologically, UEFI is flashed in your motherboard and there isn't any way for an OS to mess with that. You need to boot from a specially prepared USB with compatible firmware in order to change it. Your problem must have been above UEFI, or an error in your OS that mentioned UEFI.

Re: How to harden GitHub Actions

#58
post #26

Earlier quoted context omitted.

Depending on your circumstances (and if the license of the action allows it) it's "easy" to fork the action and use your own fork. Instant "pinning".

But how does that solve the issue with the forked action not using pinned versions itself. You need to recursively fork and modify every version of the GHA and do that to its sub-actions. You'd need something like a lockgile mechanism to prevent this.

Yes, that is completely true -- transitive dependencies are a problem. What I suggested only works in the simplest cases and isn't a great solution, more of a bandaid.

Re: How to harden GitHub Actions

#59
post #11
post #5

Great article! I also found this open source tool for sandboxing to be useful: https://github.com/bullfrogsec/bullfrog

I came across this the other day but I couldn’t really grok how it works. Does it run at a higher privilege level than the workflow or the same? Can a sophisticated enough attack just bypass it?

Yep, and there's an opt-in to disable sudo which prevents circumvention. However this can break some actions especially ones deployed as Docker images. It also doesn't work with macos.

Re: How to harden GitHub Actions

#60
post #27

Been tracking this project for a while https://github.com/chains-project/ghasum . It creates a verifiable checksum manifest for all actions - still in development but looks very promising. Will be a good compliment to Github's Immutable Actions when they arrive.

Here is an example in the wild: https://github.com/actions/checkout/actions/workflows/publis...
Post reply on HN