AWS Builder Center

How I check a GitHub Action before letting it run on my repo

Three checks I run before a third-party action gets access to my repo: read the source, pin the version to a commit SHA, and check what it can touch.

Full-stack Developer & Security Researcher
A third-party GitHub Action runs with the permissions my workflow gives it. I treat it like code I did not write, because that is what it is. These are the three checks I run before I let one run on my repo.
1. Read the source I open the action repo and read action.yml first. That file lists the inputs and the code it runs. Then I read the entry point. If the action downloads and runs a script from somewhere else, I read that too. If I cannot find the code it runs, I do not use the action.
2. Pin to a commit SHA I never use a moving tag like @v4. Tags can move. I pin the action to a full commit SHA I have read, and I note the version that SHA belongs to in a comment next to it. Dependabot can propose updates, and I read the diff before I accept one.
3. Check what it can touch I check the permissions block in my workflow and the secrets I pass in. An action that only needs to read code should not get write access or a token that can push. If the action asks for write access and does not need it, I set the permissions to read-only and pass no extra secrets.
If an action fails any of these checks, I either fork it and pin my fork, or I write the few lines myself. Most actions pass. The ones that fail are the ones that would have hurt.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article