Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Redis instrumentation query sanitization #1572

Merged
merged 16 commits into from
Feb 4, 2023

Commits on Jan 10, 2023

  1. Add Redis instrumentation query sanitization

    Add a query sanitizer to the Redis instrumentation. This can be disabled
    with the `sanitize_query = False` config option.
    
    Given the query `SET key value`, the sanitized query becomes `SET ? ?`.
    Both the keys and values are sanitized, as both can contain PII data.
    
    The Redis queries are sanitized by default. This changes the default
    behavior of this instrumentation. Previously it reported unsanitized
    Redis queries.
    
    This was previously discussed in the previous implementation of this PR
    in PR open-telemetry#1571
    
    Closes open-telemetry#1548
    tombruijn committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    6bbcc99 View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2023

  1. Configuration menu
    Copy the full SHA
    f62d6e3 View commit details
    Browse the repository at this point in the history
  2. Remove uninstrument & instrument from test setup

    The Redis test that performs the tests with the default options, doesn't
    need to uninstrument and then instrument the instrumentor. This commit
    removes the unnecessary setup code. The setup code is already present at
    the top of the file.
    tombruijn committed Jan 11, 2023
    Configuration menu
    Copy the full SHA
    c54e64b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    48a5eeb View commit details
    Browse the repository at this point in the history
  4. Fix code style formatting

    tombruijn committed Jan 11, 2023
    Configuration menu
    Copy the full SHA
    af4957e View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2023

  1. Configuration menu
    Copy the full SHA
    8462981 View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2023

  1. Update Redis functional tests

    - Update the sanitizer to also account for a max `db.statement`
      attribute value length. No longer than 1000 characters.
    - Update the functional tests to assume the queries are sanitized by
      default.
    - Add new tests that test the behavior with sanitization turned off.
      Only for the tests in the first test class. I don't think it's needed
      to duplicate this test for the clustered and async setup combinations.
    tombruijn committed Jan 16, 2023
    Configuration menu
    Copy the full SHA
    8d56c2f View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2023

  1. Test Redis unsanitized queries by default

    Change the Redis functional tests so that they test the unsanitized
    query by default, and test the sanitized query results in the separate
    test functions.
    
    This is a partial revert of the previous commit
    8d56c2f
    tombruijn committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    29041f7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    dcc34c1 View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2023

  1. Disable Redis query sanitization by default

    Update the Redis instrumentation library to not change the default
    behavior for the Redis instrumentation. This can be enabled at a later
    time when the spec discussion about this topic has concluded.
    
    open-telemetry/opentelemetry-specification#3104
    tombruijn committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    5fc865f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b192c31 View commit details
    Browse the repository at this point in the history
  3. Fix pylint issue

    Remove else statement.
    tombruijn committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    bae2cbd View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2023

  1. Configuration menu
    Copy the full SHA
    84eff3d View commit details
    Browse the repository at this point in the history
  2. Update changelog about Redis query sanitization default

    [ci skip]
    
    Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
    tombruijn and srikanthccv committed Feb 3, 2023
    Configuration menu
    Copy the full SHA
    f17ccd7 View commit details
    Browse the repository at this point in the history
  3. Fix potential error on Redis args being 0

    Check the length of the args array and return an empty string if there
    are no args.
    
    That way it won't cause an IndexError if the args array is empty and it
    tries to fetch the first element, which should be the Redis command.
    tombruijn committed Feb 3, 2023
    Configuration menu
    Copy the full SHA
    0d712d2 View commit details
    Browse the repository at this point in the history

Commits on Feb 4, 2023

  1. Configuration menu
    Copy the full SHA
    ead8771 View commit details
    Browse the repository at this point in the history