Module: Mongo::Monitoring::Event::Secure
- Included in:
- CommandStarted, CommandSucceeded, Protocol::Msg, Protocol::Query
- Defined in:
- lib/mongo/monitoring/event/secure.rb
Overview
Provides behavior to redact sensitive information from commands and replies.
Constant Summary collapse
- REDACTED_COMMANDS =
The list of commands that has the data redacted for security.
[ 'authenticate', 'saslStart', 'saslContinue', 'getnonce', 'createUser', 'updateUser', 'copydbgetnonce', 'copydbsaslstart', 'copydb' ].freeze
Instance Method Summary collapse
-
#compression_allowed?(command_name) ⇒ true, false
Is compression allowed for a given command message.
-
#redacted(command_name, document) ⇒ BSON::Document
Redact secure information from the document if it’s command is in the list.
Instance Method Details
#compression_allowed?(command_name) ⇒ true, false
Is compression allowed for a given command message.
66 67 68 |
# File 'lib/mongo/monitoring/event/secure.rb', line 66 def compression_allowed?(command_name) @compression_allowed ||= !REDACTED_COMMANDS.include?(command_name.to_s) end |
#redacted(command_name, document) ⇒ BSON::Document
Redact secure information from the document if it’s command is in the list.
52 53 54 |
# File 'lib/mongo/monitoring/event/secure.rb', line 52 def redacted(command_name, document) REDACTED_COMMANDS.include?(command_name.to_s) ? BSON::Document.new : document end |