Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

opentelemetry-helpers-sql-obfuscation

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentelemetry-helpers-sql-obfuscation

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

OpenTelemetry Instrumentation Helpers: SQL Obfuscation

This Ruby gem contains logic to obfuscate SQL. It's intended for use by by gem authors instrumenting SQL adapter libraries, such as mysql2, pg, and trilogy.

The logic is largely drawn from the New Relic Ruby agent's SQL Obfuscation Helpers module.

Usage

Add the gem to your instrumentation's gemspec file:

# opentelemetry-instrumentation-your-gem.gemspec
  spec.add_dependency 'opentelemetry-helpers-sql-obfuscation'

Add the gem to your instrumentation's Gemfile:

# Gemfile

group :test, :development do
  gem 'opentelemetry-helpers-sql-obfuscation', path: '../../helpers/sql-obfuscation'
end

Make sure the Instrumentation class for your gem contains configuration options for:

  • :obfuscation_limit: the length at which the SQL string will not be obfuscated Example: option :obfuscation_limit, default: 2000, validate: :integer

If you want to add support for a new adapter, update the following constants to include keys for your adapter:

  • DIALECT_COMPONENTS
  • CLEANUP_REGEX

You must also add a new constant that calls the generate_regex method with your adapter's DIALECT_COMPONENTS that is named like <ADAPTER>_COMPONENTS_REGEX, such as: MYSQL_COMPONENTS_REGEX.

Check New Relic's SQL Obfuscation Helpers module to see if regular expressions for your adapter already exist.

Examples

To obfuscate sql in your library:

OpenTelemetry::Helpers::SqlObfuscation.obfuscate_sql(sql, obfuscation_limit: config[:obfuscation_limit], adapter: :postgres)

How can I get involved?

The opentelemetry-helpers-sql-obfuscation gem source is on github, along with related gems including opentelemetry-instrumentation-pg and opentelemetry-instrumentation-trilogy.

The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special interest group (SIG). You can get involved by joining us on our GitHub Discussions, Slack Channel or attending our weekly meeting. See the meeting calendar for dates and times. For more information on this and other language SIGs, see the OpenTelemetry community page.

License

The opentelemetry-helpers-sql-obfuscation gem is distributed under the Apache 2.0 license. See LICENSE for more information.

FAQs

Package last updated on 27 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc