Independent AI intelligence Two editions daily · ET
Fervor AI

Analysis · November 26, 2026 · concept

DefangGitHub Actionsagent-securityagent-identityagent-infrastructure

Release Tags Became Production Keys at Defang. Here's How to Lock Yours.

A breach postmortem shows how "deploy on any tag" hands production to whoever can push. Three GitHub settings take it back.

Most deploy pipelines treat a release tag as a moment of human intent. Someone decided the code was ready, typed git tag v1.4.0, and pushed. The pipeline (the CI system that builds and deploys your code) sees the tag and ships.

The pipeline never checks who typed it.

That gap used to be mostly theoretical, because the list of things that could push to a repo was short: a few engineers and maybe a CI bot. That list is longer now. GitHub Apps, dependency bots, release tools and coding agents with write access can all create tags. If your production deploy trusts any tag, every one of them holds a production key, whether you meant to hand it out or not.

Defang, a deployment platform, just published a postmortem that shows exactly how that plays out. This piece walks through what happened, why the mistake is so common, and the three GitHub settings that close it, with the commands to find out whether you are exposed today.

What happened at Defang

On November 24, Defang published a detailed breach postmortem. The short version: the attack ran through an app's permissions, not a person's login.

Defang ran a separate GitHub App for local development and testing. It was installed on two of the company's own repositories and, in Defang's words, "had more permissions than it needed, including permission to change deployment environments." Acting as that app on November 12, the attacker pushed a commit to one of those repositories and tagged it as a release.

Here is the line that matters: "Our production environment trusted release tags, so their code ran in our CI with access to our production credentials, and the attacker copied them."

The rest of the timeline follows from that one rule. Production credentials were copied at 06:26 UTC. The main database was copied between 07:57 and 08:10 UTC. Defang did not find out until a routine scan on November 23, and the stolen credentials stayed valid until it replaced them that day. Defang says it is "still checking" whether they were used after November 12, because some of its logs are not detailed enough to rule it out.

The damage spread past Defang. The stolen set included the key for the Defang GitHub App that customers install. Until November 23, anyone holding it could push commits, change workflow files, overwrite Actions secrets, and change deployment environments and branch protection in connected repositories. Defang also notes that a workflow started that way could receive customers' cloud credentials, because the deploy role it set up for them trusts workflows in their repository.

Why "deploy on tag" is such an easy mistake

Tag-triggered deploys feel safe because tags feel deliberate. A branch moves all day. A tag is a named point that someone chose.

But a GitHub workflow that starts on a tag push looks like this:

on:
  push:
    tags:
      - "v*"

That trigger answers one question: did a ref (a branch or tag name) matching v* appear? It says nothing about who created it. On a default repository, anyone or anything with write access can push a tag, and GitHub Apps with the contents permission count.

So the real security boundary is not the tag. It is the list of identities that can create one. Defang's development app was on that list, and nobody had looked at the list in terms of production.

Think of a tag like a signature on a check. The bank accepts a signature because it trusts that only the account holder can produce one. If anyone in the building can sign, the signature stops meaning anything, and the bank does not know.

The three locks

GitHub gives you three separate places to enforce who can deploy. Defang's own advice to customers uses two of them. Each one covers a gap the others leave open, so use all three.

Lock 1: restrict who can create deploy tags

Repository rulesets can target tags, not just branches. The rule you want is Restrict creations: "only users with bypass permissions can create branches or tags whose name matches the pattern you specify."

Create a tag ruleset that targets v* (or whatever your release pattern is), turn on Restrict creations, Restrict updates and Restrict deletions, and put only your release owners, or one dedicated release app, on the bypass list. Development apps, dependency bots and coding agents stay off it.

This is the lock Defang was missing. Its dev app could create a release tag, and nothing said otherwise.

One plan note: rulesets work on public repos on GitHub Free, and on public and private repos with GitHub Pro, Team and Enterprise Cloud, per GitHub's docs.

Lock 2: gate the deploy environment by ref

A deployment environment is a named target like production that holds its own secrets and rules. A job that references it must pass those rules before it runs or sees the environment's secrets.

Open the repo's Settings, then Environments, pick your production environment, and set Deployment branches and tags to "Selected branches and tags." Add a rule for your deploy branch. Add a tag rule (Ref type: Tag) only if Lock 1 is in place, because a tag rule without a creation restriction just moves the problem.

This is what Defang told its own customers to do: set every defang- environment's "Deployment branches and tags" to the deploy branch only, so "a workflow on any other branch" cannot receive cloud credentials.

Two details catch teams out here.

First, the job has to reference the environment (environment: production in the workflow) or none of these rules apply. And GitHub's docs say that running a workflow that references an environment that does not exist creates one with no protection rules. Anyone who can edit workflow files can do that. A typo in an environment name gives you an unprotected twin.

Second, plan limits. For private repos, environments and deployment branches need GitHub Pro, Team or Enterprise, and on Free, Pro and Team, extra rules like required reviewers and wait timers only work on public repositories.

Lock 3: pin your cloud trust to the environment

Most teams now deploy with OpenID Connect (OIDC): instead of storing a cloud key in GitHub, the workflow asks GitHub for a short-lived signed token, and your cloud account swaps it for temporary credentials. The cloud decides whether to accept the token by looking at its subject claim (sub), a string describing where the workflow ran.

GitHub's OIDC reference lists the formats. The one you want for production is the environment form:

repo:ORG-NAME/REPO-NAME:environment:ENVIRONMENT-NAME

The subject only takes that shape when the job references an environment. A tag-triggered job without one gets repo:ORG/REPO:ref:refs/tags/TAG-NAME instead. So if your cloud trusts the environment subject, a stray tag workflow that skips the environment simply cannot assume the role.

One format catch: repositories created after July 15, 2026, repositories that opted in, and repositories renamed or transferred since then use immutable subjects that add the owner and repository IDs, like repo:your-org@123456/your-repo@456789:environment:production. Check which format your repo uses before you edit a trust policy (the repository's or organization's OIDC settings show whether immutable subjects are on), or the role will refuse every deploy, including the good ones. The workflow also needs permissions: id-token: write to request a token at all.

On AWS, GitHub's setup guide notes that IAM recommends checking the token.actions.githubusercontent.com:sub key in the role's trust policy. A production role should look like this:

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

The dangerous version uses StringLike with repo:your-org/your-repo:*, which trusts every branch, tag and pull request in the repo. Defang told customers to narrow exactly this: "Narrow that role's trust to the branch or environment you deploy from, if it currently allows any branch." It also told them the role it had set up for GitHub deploys has administrator access to their account.

Together the three locks chain: only release owners can make the tag, only that ref can enter the environment, and only that environment can reach the cloud.

Put this into practice

This takes about an hour per repo the first time. Start with the repo that deploys production.

Step 1: find what deploys on tags. From the repo root:

grep -rlE "tags:|release:|workflow_run:" .github/workflows/
grep -rl "environment:" .github/workflows/

Treat this as a rough first pass, not an audit. Open every file in the first list and check whether each job that deploys declares an environment. A deploy job without one is a path no environment rule can see. Reusable workflows and environments chosen by expressions will not show up cleanly in a text search, so read those by hand.

Step 2: list who can push. In the repo's Settings, check Collaborators and teams, then check installed GitHub Apps and their permissions under your organization's settings. Any app with write access to contents can push a tag. Flag dev and test apps first, since that is exactly the kind of app that bit Defang.

Step 3: add the tag ruleset. Settings, Rules, Rulesets, New tag ruleset. Target v*, enable Restrict creations, updates and deletions, and set the bypass list. Then test it with an account that is not on the list:

git tag v0.0.0-ruleset-test && git push origin v0.0.0-ruleset-test

You should see the push rejected. If it goes through, check three things: the ruleset is set to Active, the pattern really matches v0.0.0-ruleset-test, and the test account is not a bypass actor. Then clean up with git tag -d v0.0.0-ruleset-test && git push origin --delete v0.0.0-ruleset-test (run the remote delete from an account with bypass rights, since the ruleset now blocks deletions too).

Step 4: lock the environment. Set Deployment branches and tags to your deploy branch (plus the tag pattern, now that creation is restricted). Turn off "Allow administrators to bypass configured protection rules" if your plan offers it.

Step 5: tighten the cloud role. Open the trust policy for every role your workflows assume. Replace wildcards with the environment subject, in whichever format (legacy or immutable) your repo uses. Then run one real deploy to confirm the role still accepts it.

Step 6: check the logs once. Defang's checklist is a good template even if you never used Defang: look for new tags, changes under .github/workflows, workflow runs nobody started, changed Actions secrets, and new deploy keys or collaborators. On AWS, search CloudTrail for AssumeRoleWithWebIdentity calls on your deploy roles from refs you do not deploy from.

Honest limitations

These locks do not stop someone who is on the bypass list. If a release owner's account or your one release app is compromised, the tag is still trusted. Keep that list tiny and protect those accounts hardest.

They also do not inspect what is in the tagged commit. A ruleset controls who creates the tag, not whether the code under it was reviewed. Pair the tag rule with branch protection on the branch you tag from, so a release can only point at reviewed code.

Required reviewers on environments, the most human check of all, are limited to public repos unless you pay for Enterprise. Many private teams will run on locks 1 and 3 plus a branch restriction, which is still far better than a bare tag trigger.

Some release flows will break. Tools that create tags from CI, monorepos with per-package tags, and hotfix flows that tag from side branches all need explicit bypass entries or patterns. Expect a day of fixing release scripts.

And none of this fixes the root cause in Defang's case, which was an app with more permissions than its job needed. Audit app permissions on a schedule, not after a breach.

The question to ask this week

Defang's postmortem is unusually honest about one uncomfortable fact: the step that reached production needed no exploit. The attacker acted as an identity that was already allowed to push and tag, against a pipeline that was already willing to trust the result.

So the useful question for your team is not "are we using tags?" It is "who on our list of pushers could cut a release right now, and would anything stop them?" Count the apps, the bots and the agents. If the answer is longer than the list of people you would trust with production, you have your weekend project.

Sources: Defang security incident postmortem (November 24, 2026); GitHub Docs: Managing environments for deployment; GitHub Docs: Available rules for rulesets; GitHub Docs: OpenID Connect reference; GitHub Docs: Configuring OpenID Connect in AWS. All read November 26, 2026.