ankane/lockbox
63.5
Adequate · 6 November 2026
1.7k
lines of production code
Ruby
primary language
4
measurements over time
What this system is
This system is a Ruby library that provides encryption capabilities for ActiveRecord and Mongoid models, supporting both standard and hybrid encryption algorithms. It enables secure handling of sensitive data fields and integrates with Active Storage, CarrierWave, and Shrine for encrypted file uploads. The library also includes tools for auditing data access and managing key rotation, ensuring compatibility with modern Rails and Ruby versions.
Features
Added Lockbox audit trail generator templates
The library now includes generator templates for creating an audit trail system. Users can generate a new \LockboxAudit\ model and a corresponding database migration that tracks encrypted data access. The migration creates a \lockbox\_audits\ table with polymorphic references to the \subject\ and \viewer\, a \data\ column (serialized as JSON if the type is text), and fields for \context\, \ip\, and \created\_at\. The generated model establishes the necessary associations to link audit records to the resources being viewed and the users viewing them.
lib/generators/lockbox/templates · high confidence
Added generator for Lockbox audit tracking
A new generator has been added to scaffold the necessary files for Lockbox audit functionality. Running this generator creates a database migration (targeting \db/migrate/create\_lockbox\_audits.rb\) and a model file (\app/models/lockbox\_audit.rb\). The generated migration intelligently selects the appropriate data type for the audit payload—using \jsonb\ for PostgreSQL, \json\ for MySQL, or \text\ as a fallback—ensuring compatibility across different database adapters.
lib/generators/lockbox · high confidence
Behavioural changes
Lockbox 2.2 requires Active Record 7.2+ and Ruby 3.3+, dropping older versions
This release enforces stricter version requirements for supported frameworks and languages. The library now raises an error if used with Active Record versions below 7.2 or Mongoid versions below 8, and it requires Ruby 3.3 or higher. This change removes support for older Active Record and Mongoid versions, as well as Ruby versions below 3.3, to align with current maintenance standards and ensure compatibility with the latest features.
lib · high confidence
Lockbox 2.2.0: Major rewrite with hybrid encryption, pluck support, and Active Storage integration
Lockbox has been rewritten as a module and upgraded to version 2.2.0, introducing hybrid encryption support (Curve25519) alongside existing algorithms, and adding support for the \pluck\ method to efficiently retrieve and decrypt encrypted columns. The gem now integrates with Active Storage via \CreateOne\ and \Attachment\ extensions to handle encrypted file uploads and downloads, and includes a new \Migrator\ class to facilitate data migration and key rotation. Configuration has shifted to use \has\_encrypted\ instead of \encrypts\, and the library now supports Rails credentials for master key management.
lib/lockbox · high confidence
Test coverage
Added test support fixtures for ActiveRecord, Mongoid, CarrierWave, Shrine, and Action Text; Expanded test coverage for encryption, migration, and file storage features; Expanded test database schema for comprehensive encryption coverage; Removed test fixture model User.
Dependencies
Added CI gemfiles for Rails 7.2, Rails 8.0, Mongoid 8, and Mongoid 9
The project now includes dedicated gemfiles to support testing against newer versions of its dependencies. Specifically, new gemfiles have been added for Rails 7.2 and Rails 8.0, as well as for Mongoid 8 and Mongoid 9. These files define the specific gem versions (such as carrierwave \~\> 3 for newer Rails/Mongoid setups and json \< 3) required to run the test suite against these versions, enabling continuous integration to verify compatibility with these updates.
gemfiles · high confidence
Updated dependencies and raised minimum Ruby version to 3.3
The project now requires Ruby 3.3 or higher, dropping support for older versions. Development dependencies have been consolidated into the Gemfile, specifying Rails 8.1.0, CarrierWave \~\> 3, and database adapters including sqlite3, pg, mysql2, and trilogy. Additional test dependencies such as minitest, nokogiri, ruby-vips, combustion, rbnacl, shrine, and json (\< 3) are now explicitly listed.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 64 → 64 (-0.0)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 60 → 60 (+0.0)
- Architecture 100 → 100 (+0.0)
- Maturity 54 → 54 (+0.0)
- Readiness 70 → 70 (+0.0)
- Security 99 → 99 (-0.4)
Resolved (3)
- Duplicate key generation logic. Lockbox.attribute_key is a static method that takes master_key as an argument, while Lockbox.KeyGenerator is a class that takes master_key in its constructor and then generates keys. This splits the responsibility of key derivation between a utility method and a dedicated class, confusing the API surface.
- Duplicate migration functionality. The top-level Lockbox.migrate method appears to be a convenience wrapper that likely instantiates and runs Lockbox.Migrator. This creates two entry points for the same operation, confusing users about whether to use the static method or the class-based approach.
- Duplicate rotation functionality. Similar to migration, Lockbox.rotate is a static convenience method that duplicates the intent of Lockbox.Migrator.rotate. The static method accepts batch_size in the call, while the instance method accepts it in the constructor, leading to inconsistent usage patterns for the same domain operation.
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
ankane/lockbox was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 2a84e87bba1c86128182beee76d0cbe150f65286 — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.