
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Adds backtraces to your SQL queries and query logs, so you know where your queries are coming from. This only works with Rails, and is only tested with Rails 4.0.
Simple. To turn this
into this.
So now, you needn't wonder where that odd-looking or broken SQL query is coming from.
It can also turn this
Reading mysql slow query log from /usr/local/mysql/data/mysqld51-apple-slow.log
Count: 1 Time=4.32s (4s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
SELECT "events".* FROM "events" WHERE "events"."bug_id" = ?
Count: 3 Time=2.53s (7s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
SELECT "deploys".* FROM "deploys" WHERE "deploys"."id" = ?
Count: 3 Time=2.13s (6s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
SELECT * FROM "slugs" WHERE (LOWER("slugs"."slug") = LOWER(?) AND "slugs"."scope" IS NULL AND "slugs"."sluggable_type" = ?) LIMIT 1
into this.
Reading mysql slow query log from /usr/local/mysql/data/mysqld51-apple-slow.log
Count: 1 Time=4.32s (4s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
SELECT "events".* FROM "events" WHERE "events"."bug_id" = ? /* app/models/project.rb:125:in `_callback_after_617' */
Count: 3 Time=2.53s (7s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
SELECT "deploys".* FROM "deploys" WHERE "deploys"."id" = ? /* app/controllers/projects_controller.rb:359:in `require_or_load' */
Count: 3 Time=2.13s (6s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
SELECT * FROM "slugs" WHERE (LOWER("slugs"."slug") = LOWER(?) AND "slugs"."scope" IS NULL AND "slugs"."sluggable_type" = ?) LIMIT 1 /* app/models/observers/bug_observer.rb:23:in `create_open_event' */
To use, add SQL:Origin to your Gemfile:
gem 'sql_origin'
If you would like to add three-line backtraces below every SQL query in your Rails log, add
SQLOrigin.append_to_log
somewhere in your Rails initialization (e.g., application.rb
or a
config/initializer
file).
If you would like to add a one-line backtrace comment to every SQL query, add
SQLOrigin.append_to_query
somewhere in your Rails initialization.
It would be typical to enable append_to_log
for development and test, and
append_to_query
for production, in order to keep production logs small.
By default, files not under your Rails root, and files under vendor
, are
filtered from your backtrace. If you need to filter other files, add them to
{SQLOrigin::LIBRARY_PATHS}:
SQLOrigin::LIBRARY_PATHS << 'config/initializers/active_record_hacks.rb'
FAQs
Unknown package
We found that sql_origin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.