Relintio WAF Protection Agent SDK (Ruby)

Official Ruby WAF integration for Rack-based web frameworks (Sinatra, Rails, Hanami).

Installation

Add the gem to your application's Gemfile:

gem 'relintio-agent', github: 'Relintio/relintio-ruby-agent'

And then execute:

bundle install

Features

  • Rule Cache Sync: Periodically syncs active rules in a thread-safe background thread.
  • WAF Check Engine: Instant threat analysis against local cached rules.
  • Rack Middleware: Standard Rack integration supporting all major Ruby web frameworks.
  • Telemetry Loop: Non-blocking telemetry reporting back to the Relintio console.

Quickstart

Sinatra Integration

# config.ru
require 'sinatra'
require 'relintio-agent'

class App < Sinatra::Base
  get '/' do
    "Protected App"
  end
end

# Initialize Relintio Agent
agent = Relintio::Agent.new(
  license_key: "YOUR_LICENSE_KEY",
  api_url: "https://api.relintio.com/api"
)
agent.start_sync

# Register Relintio Middleware
use Relintio::Middleware, agent

run App

Rails Integration

Add the middleware in your Rails configuration:

# config/application.rb
module YourApp
  class Application < Rails::Application
    # Initialize Relintio Agent
    config.after_initialize do
      $relintio_agent = Relintio::Agent.new(
        license_key: ENV['RELINTIO_LICENSE_KEY'] || 'YOUR_LICENSE_KEY'
      )
      $relintio_agent.start_sync
    end

    # Register Rack Middleware
    config.middleware.use Relintio::Middleware, -> { $relintio_agent }
  end
end