Safeguard
Security Guides•

Copied a CI workflow from a blog or forum? How to review it first

A workflow pasted from a blog post or forum answer runs with your token and secrets. Six review steps to take before it ever runs on your repository.

Safeguard Security Team
4 min read

Treat a pasted workflow like code from a stranger. Read every line, check each action and shell step, remove secrets and broad permissions, run it first in a throwaway repository, and only then bring it into your real one through a pull request. The age of the post tells you little about the safety of the file.

Why pasted workflows deserve more care

A starter workflow from GitHub has a known source and a maintained home. A snippet from a forum answer has an author you cannot check and a date you may not notice. Either way, once it is in .github/workflows, it runs with your repository's token and can reach any secret the job references.

GitHub's secure use guidance puts it directly: a compromise of a single action within a workflow can be very significant, because the compromised action would have access to all secrets configured on your repository and may be able to use the token to write to the repository.

Step 1: read the file top to bottom

Start with on. Which events start this workflow? Then read permissions, then each job. Do not skim the run blocks. A short shell step can fetch and execute anything.

Step 2: look for injection

Search for expressions that drop event data straight into a script, such as a pull request title or branch name inside a run line. GitHub documents this as script injection and explains that the expression is replaced with its value before the shell runs, so a crafted title can add commands. The fix GitHub recommends is to set the value in an intermediate environment variable and read it as a normal variable. Our post on the intermediate environment variable pattern shows it.

Step 3: check every action

For each uses line, find the repository, check the owner, and open the source. Is the reference a tag, a branch or a commit SHA? A full length SHA is harder for an attacker to swap quietly. Make sure the SHA belongs to the action repository and not a fork, as GitHub advises.

Step 4: strip secrets and widen nothing

Delete references to secrets you did not create for this purpose. Keep the token at read access for contents unless a job truly needs more.

Step 5: look for outbound calls

Search for curl, wget, downloads and installers. If the file pipes a download into a shell, replace that with a pinned, checksummed install or drop it. GitHub notes that its hosted runners do not scan for malicious code a job downloads, such as a compromised third party library.

Step 6: run it somewhere harmless

Create an empty repository with no secrets, push the file, and read the log. Only after that, copy it to the real repository in a pull request and ask for a second reviewer.

A quick risk table

SmellWhy it mattersWhat to do
Event data inside a shell lineScript injectionMove to an environment variable
Unpinned third party actionTag can movePin to a reviewed SHA
Broad token permissionsLarger damage if abusedSet read access, raise per job
Download piped to a shellUnchecked code runsPin and verify, or remove
Unfamiliar secret namesPossible exfiltration targetRemove or replace

Quick check

Is a popular answer with many upvotes safe to paste?

Popularity is not review. The file still runs with your token, so read it yourself.

Can I just run it on a branch to see what happens?

A branch in your real repository can still reach repository secrets. Use a throwaway repository first.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.