Join our Newsletter — 33% off our NHI Course

Gems

Gems are small, reusable packages or components that provide a specific function in software development, most commonly in the Ruby ecosystem. They are installed and managed by a package manager, and can include application code, dependencies, or command-line tools. Because gems execute within a build or runtime environment, they can affect application integrity and supply chain trust.

What Gems Are in Software Delivery

Gems are packaged software components that extend Ruby applications, but the idea generalises to reusable build-time or runtime packages in modern development pipelines. They matter because each added component expands the trusted software base.

How Gems Fit Into the Build and Runtime Supply Chain

A gem can contribute application logic, libraries, executables, or transitive dependencies. That makes it part of the software supply chain, not just a convenience layer, because the package may be fetched, installed, unpacked, and executed before the application itself is considered complete.

This is why package provenance, dependency resolution, and lockfile discipline matter. A gem that is benign in one release can become risky if its maintainer account, publishing process, or dependency graph is compromised.

Why Gems Can Affect Application Integrity

Because gems can run code during install or execution, they can alter application behavior in ways that are not always obvious to the developer. A dependency may introduce new commands, monkey-patch existing logic, or change the trust boundary between source code and delivered artifact.

The security concern is not that packages are inherently unsafe, but that they are executable supply-chain inputs. The more widely a gem is reused, the more important it becomes to verify that it comes from the expected source and matches the intended version.

Supply-chain control frameworks treat this as a provenance and integrity problem, which is why software artifact integrity practices such as SLSA are directly relevant to gem-based delivery pipelines.

Common Control Points for Gems

Teams usually manage gems through dependency pinning, source allowlists, signature or checksum verification where available, and regular review of the dependency tree. Those controls help reduce surprise changes and make rebuilds more deterministic.

For broader governance, organisations often map package handling to secure development and hardening baselines, especially when gems are installed in CI/CD, containers, or production images. Guidance from CIS Benchmarks and OWASP SAMM can help structure that discipline without overcomplicating the developer workflow.

When the question is whether a gem is trustworthy enough to deploy, the practical answer is to treat it like any other third-party code dependency: verify it, constrain it, and monitor it over time. For runtime enforcement and least-privilege segmentation around the systems that consume it, NIST Cybersecurity Framework 2.0 provides a useful governance lens.

Risk and Threat Considerations

Gems create supply-chain exposure because a compromised package, maintainer account, or dependency can introduce malicious behavior into builds and deployments. The risk is amplified when organisations install packages automatically, mirror them without inspection, or allow them to execute with broad filesystem or network access.

Failure mechanism: A trusted package channel delivers altered code, a dependency is substituted or updated unexpectedly, or an installation hook runs with more privilege than intended, letting malicious logic enter the build or runtime path.

Impact: The result can be application tampering, secret theft, poisoned releases, persistence inside build systems, or downstream compromise of every system that consumes the affected artifact.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

SLSA, CIS Controls v8, OWASP SAMM, NIST CSF 2.0 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
SLSA Supply-chain Levels for Software Artifacts Gems are software artifacts whose provenance and integrity affect trust.
Recommendation — Verify gem provenance and artifact integrity before promotion into builds and releases.
CIS Controls v8 CIS-16 — Application Software Security Package selection and dependency control are part of secure software handling.
Recommendation — Review third-party gems as part of secure software acquisition and change control.
OWASP SAMM Software Assurance Maturity Model Gem governance fits secure build and dependency-management maturity practices.
Recommendation — Embed dependency review and release governance into your software delivery process.
NIST CSF 2.0 GV.SC-01 — Cyber Supply Chain Risk Management Gem trust depends on supply-chain governance over externally sourced software components.
Recommendation — Define supply-chain risk ownership for third-party gems and their publishers.
NIST SP 800-53 Rev 5 SA-12 — Supply Chain Protection Gems are externally sourced components requiring supply-chain protections and provenance checks.
Recommendation — Apply supply-chain protections to third-party gems before they enter production.

Practitioner Guidance

Why practitioners should care: Treat gem selection as a security decision, not only a developer convenience choice. The package ecosystem is part of the trust boundary, so ownership for approval, update cadence, and emergency removal should be explicit.

What to watch for: Sudden maintainer changes, unexplained dependency growth, install-time behavior, and packages that request broad execution or network reach are all signals that deserve review. In higher-risk delivery chains, pair dependency governance with NIST SP 800-53 Rev 5 Security and Privacy Controls to anchor accountability and integrity checks.