Skip to content

Release tags as a CI backdoor: how a dev GitHub App reached production, and the audit to run on your repos

In Defang's November 2026 incident, an over-permissioned development GitHub App pushed a commit, tagged it as a release, and production trusted release tags, so attacker code ran in CI with production credentials. Who can create tags, what environments trust, what Apps can change, and how to scope cloud OIDC.

By Nishant Gauraw, NG-NeXTPublished Updated 7 min read

On 24 November, Defang published a post-incident write-up that is worth reading slowly. The chain fits in one paragraph from it:

We used a separate GitHub App for local development and testing. It was installed on two of our own repositories and had more permissions than it needed, including permission to change deployment environments. Acting as that app, the attacker pushed a commit to one of those repositories and tagged it as a release. Our production environment trusted release tags, so their code ran in our CI with access to our production credentials, and the attacker copied them.

Defang says the activity ran from about 06:00 to 10:30 UTC on 12 November, that production credentials were copied at 06:26 and the database between 07:57 and 08:10, and that it was found by a routine security scan on 23 November. The credentials stayed valid for eleven days.

A day later, 1Password disclosed a different entry point that also reached CI/CD: an attacker gained access to an employee's corporate GitHub account, used it to "push malicious code to backend services", copied customer names and email addresses, and "gained access to our CI/CD system." 1Password says vault contents were not affected.

The pattern to look for in your own estate is a pipeline that treats "a tag matching v* exists" as "a human decided to release." This post is an audit for that assumption, using GitHub's own controls.

Why tags are a weak trust signal#

A tag is a ref. Anyone, or any App, that can push to a repository can usually create one, and nothing about the tag says who approved it. If a workflow is triggered by on: { push: { tags: ['v*'] } }, the production environment allows deployments from tags matching v*, and there are no required reviewers or other deployment protection rules, then pushing a tag is the whole approval process. Branch protection on main does not help, because the tag can point at a commit that never went through main.

The audit below has four parts: who can create release tags, what your deployment environments trust, what your GitHub Apps can change, and what your cloud trusts.

1. Restrict who can create release tags#

GitHub repository rulesets can target tags as well as branches. A tag ruleset matching your release pattern with Restrict creations, Restrict updates and Restrict deletions means that, while the ruleset's enforcement is set to Active, only actors on its bypass list can create, move or delete matching tags. A ruleset in Disabled or Evaluate mode blocks nothing. Keep that bypass list to a release team or a single release App, and leave everything else out.

List what a repository has today:

gh api --paginate repos/OWNER/REPO/rulesets --jq '.[] | {id, name, source_type, enforcement}'
gh api repos/OWNER/REPO/rulesets/RULESET_ID --jq '{name, target, enforcement, conditions, rules, bypass_actors}'

The list includes organization-level rulesets that apply to the repository (source_type shows which). Read rules to confirm the creation, update and deletion restrictions are really there; bypass_actors is only returned to callers with write access to the ruleset, so a missing value does not prove an empty list. If no active ruleset has "target": "tag", a condition covering your release pattern and those rules, anyone with write access can generally create a release tag. Rulesets depend on the plan: on a private repository under a free plan, the list call returns HTTP 403 with a message asking you to upgrade to GitHub Pro or make the repository public, and organization rulesets need GitHub Team or Enterprise.

2. Make production environments demand more than a tag#

Deployment environments control which jobs receive the environment's secrets. Two settings matter here:

  • Deployment branches and tags. Defang says its production environment trusted release tags. "Selected branches and tags" with a tag pattern is only as strong as the rule that controls who can create that tag, so combine it with step 1. The alternative, "Protected branches only", is defined in terms of branch protection rules, and GitHub's docs note that if no branch protection rules exist, all branches can deploy, so check that the rules really exist.
  • Required reviewers. A job that references the environment waits until one of the listed people or teams approves it. Turn on the option that prevents the person who triggered the run from approving their own deployment, and clear "Allow administrators to bypass configured protection rules", which is on by default. On GitHub Free, Pro and Team, required reviewers and the administrator-bypass setting are available only for public repositories, and environments in private repositories need a paid plan.

Check every repository that deploys:

gh api --paginate repos/OWNER/REPO/environments \
  --jq '.environments[] | {name, protection_rules, deployment_branch_policy}'

If deployment_branch_policy shows custom_branch_policies: true, list the patterns with:

gh api --paginate repos/OWNER/REPO/environments/production/deployment-branch-policies

An environment that holds production secrets with no required-reviewer rule in protection_rules deserves attention first. Defang's own advice to its users points the same way: restrict "Deployment branches and tags" to the deploy branch, and add required reviewers.

3. Find every App that can change the rules#

The dev App in Defang's account had "permission to change deployment environments." An actor that can edit an environment's configuration can remove its reviewers or widen its deployment rules. In GitHub's App permission model, that configuration, like rulesets and branch protection, sits under repository administration. Permissions that sound like development conveniences are, in practice, production permissions.

As an organization owner, list installed Apps and what each can do:

gh api --paginate orgs/ORG/installations \
  --jq '.installations[] | {app_slug, repository_selection, permissions}'

Look for these repository permissions in particular, and ask why each App needs them:

  • administration: write (repository settings, including rulesets, branch protection and environment configuration)
  • environments: write (environment secrets and variables)
  • workflows: write (changing files under .github/workflows)
  • contents: write (pushing commits, branches and tags)
  • secrets: write (Actions secrets)

Install development and test Apps only on repositories that cannot deploy to production, with repository_selection set to selected repositories rather than all. Remove Apps nobody owns. And remember that rulesets have bypass lists: an App on the bypass list in "always" mode can push past the rule.

4. Scope cloud credentials to the environment, with OIDC#

Defang's production credentials were available to CI, so a job could copy them, and they stayed valid until Defang replaced them. Where a pipeline holds long-lived cloud keys as secrets, GitHub Actions can request a short-lived token from the cloud provider through OpenID Connect instead, so there is no standing key in the repository to steal.

The detail that matters is the trust condition. GitHub's OIDC token carries a sub claim. In the name-based format, a job that references an environment gets repo:ORG/REPO:environment:production, and a job that runs on a tag without an environment gets repo:ORG/REPO:ref:refs/tags/v1.2.3. Repositories created, renamed or transferred after 15 July 2026, or opted in, use immutable subjects that include owner and repository IDs, such as repo:ORG@OWNER_ID/REPO@REPO_ID:environment:production; copy the exact format from the docs or from a real token rather than assuming. If the cloud role trusts the environment subject, only jobs that GitHub admitted to that environment get a matching token, so the assurance is exactly as strong as the environment's protection rules. If it trusts a wildcard such as repo:ORG/REPO:* (with StringLike on AWS), any workflow in the repository can.

On AWS, that is a condition on token.actions.githubusercontent.com:sub in the role's trust policy:

"Condition": {
  "StringEquals": {
    "token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
    "token.actions.githubusercontent.com:sub": "repo:ORG/REPO:environment:production"
  }
}

Defang's notice tells its users to check their cloud logs for exactly this: on AWS, CloudTrail AssumeRoleWithWebIdentity calls on the deploy role, and "a token from a branch or workflow you don't deploy from is a sign of misuse."

If you run your own runners#

Self-hosted runners on your own hardware are a good fit for a cloud-exit estate, but they change the threat model. A runner that keeps production credentials on disk, or that can reach production and runs jobs from any branch, gives those jobs a path to production. Keep production runners in a runner group limited to the repositories that deploy (and, where your plan supports it, to specific workflows), prefer ephemeral runners that take one job and are then replaced, and get credentials per job through OIDC rather than files on the machine.

The audit, as a checklist#

  1. For each deploying repository: an actively enforced tag ruleset covers the release pattern, restricts creation, update and deletion, and has a short bypass list.
  2. Each production environment has required reviewers where your plan supports them, self-review and administrator bypass blocked, and branch/tag rules that match step 1.
  3. Every installed App's permissions are justified; dev Apps are not installed on deploying repositories.
  4. Cloud roles trust the environment subject in your repository's actual sub format (or a protected branch), never a repository-wide wildcard.
  5. Search the organization audit log for changes to environments, rulesets and App installations. Tag pushes are Git events, which GitHub does not show in the web audit log; on Enterprise Cloud the REST audit API keeps them for seven days, and older events exist only if you were already streaming the audit log elsewhere. For older tags, compare the tag list against your release records.

These are general controls, not a reconstruction of either company's setup. If you would like your CI/CD trust boundaries reviewed, or your build runners moved onto hardware you control, NG-NeXT does consulting and turnkey builds. Reach us through the contact page.

— Nishant Gauraw, Founder and CEO, NG-NeXT Tech

Talk to us directly.

We reply within one business day. The site assistant answers at any hour.