GitLab GLAZ Gem

[!WARNING] This gem is currently designed entirely for internal use at GitLab.

Ruby bindings for the Glaz authorization engine. It wraps the Rust-backed glaz-ruby crate via Magnus FFI, exposing the Glaz CheckEngine to Ruby without leaving the Ruby process.

Requirements

  • Ruby >= 3.1
  • Rust toolchain (for building the native extension)

Installation

Add to your Gemfile:

gem 'gitlab-glaz', path: 'gems/gitlab-glaz'

Building

The gem contains a Rust extension that must be compiled before use:

bundle exec rake compile

This compiles the Rust crate in ext/glaz/ and places the resulting native library under lib/glaz/.

Usage

require 'gitlab-glaz'

# Use the Glaz CheckEngine via the compiled native extension

Architecture

Layer Technology Purpose
Ruby API lib/gitlab-glaz.rb Entry point, loads the native extension
FFI bridge Magnus + rb-sys Bridges Ruby ↔ Rust
Rust extension ext/glaz/ Thin #[magnus::init] shim that delegates to glaz-ruby
Core engine glaz-ruby Rust crate implementing the Glaz authorization engine

Development

The workspace root Cargo.toml declares all shared Rust dependencies. The extension crate lives in ext/glaz/.

To build only the Rust extension:

cargo build --release

To run the full compile via Rake (used during gem installation):

bundle exec rake

Releasing a new version

To release a new version, create a merge request and use the Release template, following its instructions. Once merged, the new version with precompiled, native gems will automatically be published to RubyGems.

License

Released under the MIT License.