Safeguard
Supply Chain•

Do RubyGems MFA and trusted publishing make a gem safe to install?

They lower the chance of a hijacked maintainer account or leaked token, but are no safety guarantee. What each control does and what you still check.

Safeguard Security Team
3 min read

No, they lower risk but do not guarantee safety. Multi-factor authentication makes account takeover harder, and trusted publishing removes long lived API keys from release pipelines. Neither reviews the code. As a consumer you still lock versions, scan advisories and watch for unexpected releases.

What each control does

ControlWhat it protectsWhat it does not cover
MFA on the author accountStops login with only a stolen passwordA maintainer who publishes bad code on purpose
WebAuthn or passkeysResists phishing better than one time codesCompromised developer machines
Trusted publishingShort lived tokens for CI releases, no key to leakA compromised repository or workflow
Scoped API keysLimits what a stolen key can doKeys with broad scope

The RubyGems security guide calls MFA the most effective defense against account takeover, and prefers WebAuthn, which resists the phishing behind recent account takeovers in other packaging ecosystems. The command line page states that owners of any gem with more than 180 million cumulative downloads must enable MFA.

How trusted publishing works

The Trusted Publishing guide describes OpenID Connect exchanging short lived identity tokens between GitHub Actions and RubyGems.org. You register a repository, workflow and optional environment as a publisher for a gem. A release is then a git tag push, with no API token to create, rotate or store. The tokens it mints are scoped to push only to that gem.

What this means when you choose dependencies

These are signals, not proof. A gem whose maintainers use these controls is harder to hijack through a stolen password. It can still ship a vulnerable version or be abandoned.

A consumer checklist

  1. Lock versions and review every Gemfile.lock diff.
  2. Record the checksums in the lock file, as in our guide to the CHECKSUMS section.
  3. Scan the lock file for known advisories in CI.
  4. Watch for new versions of critical gems with no matching changelog or tag.
  5. Prefer gems with active maintainers and recent releases.
  6. Consider a delay on brand new versions so the community has time to spot a bad one.

If you publish gems

Turn on MFA with WebAuthn, scope your API keys, add owners sparingly, and switch release pipelines to trusted publishing. The security guide notes that every owner has the same permissions you do, including pushing, yanking and adding other owners.

Try it yourself

Click through it at your own pace, or open it full screen. Watch how new events are surfaced against the packages you actually use.

Where Safeguard fits

Safeguard's SBOM and dependency scanning reads composer.lock and Gemfile.lock and flags known advisories. A free scan takes a few minutes.

Quick check

Is a gem with trusted publishing audited?

No. It only changes how releases are authenticated. The code itself is not reviewed by the mechanism.

Does SMS count as an MFA method on RubyGems?

The setup guide says SMS based authentication or recovery is not supported.

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.