module Mongo::Monitoring::Event::Secure
Provides behavior to redact sensitive information from commands and replies.
@since 2.1.0
Constants
- REDACTED_COMMANDS
-
The list of commands that has the data redacted for security.
@since 2.1.0
Public Instance Methods
Source
# File lib/mongo/monitoring/event/secure.rb, line 72 def compression_allowed?(command_name) @compression_allowed ||= !REDACTED_COMMANDS.include?(command_name.to_s) end
Is compression allowed for a given command message.
@example Determine if compression is allowed for a given command.
secure.compression_allowed?(selector)
@param [ String, Symbol
] command_name The command name.
@return [ true, false ] Whether compression can be used.
@since 2.5.0
Source
# File lib/mongo/monitoring/event/secure.rb, line 52 def redacted(command_name, document) if REDACTED_COMMANDS.include?(command_name.to_s) && !%w(1 true yes).include?(ENV['MONGO_RUBY_DRIVER_UNREDACT_EVENTS']&.downcase) then BSON::Document.new else document end end
Redact secure information from the document if it’s command is in the list.
@example Get the redacted document.
secure.redacted(command_name, document)
@param [ String, Symbol
] command_name The command name. @param [ BSON::Document ] document The document.
@return [ BSON::Document ] The redacted document.
@since 2.1.0