We have a customer with very stringent security requirements. So we will encrypt the Rails database using one of Postgres's database encryption options. But that still leaves customer's data exposed in what the Rails logger logs when forms are submitted to create data.
I guess one option is not to encrypt the log file, but to suppress all the parameter values that get logged for POST requests by Rails. What is the best way of doing that?
Another option is to encrypt Rails log files as they are written to disk. Is that a better way to go, and what's a good way to do it?
Rails uses encryption to securely prevent tampering with the session contents, however, users cannot revoke sessions because the contents are stored on the browser.
Rails uses six different log levels: debug, info, warn, error, fatal, and unknown. Each level defines how much information your application will log: Debug: diagnostic information for developers and system administrators, including database calls or inspecting object attributes. This is the most verbose log level.
In a Rails app, logs are stored under the /log folder. In development mode, the development. log file is used & you see log output on the terminal you're running rails server on.
To write in the current log use the logger. (debug|info|warn|error|fatal|unknown) method from within a controller, model, or mailer: logger. debug "Person attributes hash: #{@person.
one thing that you can do is in you config/application.rb file you can add fields that you want to omit from the logs like this
class Application < Rails::Application
...
config.filter_parameters += [:password]
config.filter_parameters += [:ssn]
....
end
I hope that this helps
If you want something better than the filter_parameters for all params, You can write a custom logger. see: http://rubyjunky.com/cleaning-up-rails-4-production-logging.html and the gem someone extracted from it, https://github.com/gshaw/concise_logging
However, you're going to need to store the encryption key somewhere on the same machine as the logs, which potentially means it's un-encryptable too if someone has active access (but not if they just somehow get the logs later).
Some questions to think about:
Your answers will define guidelines on how to attack this problem!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With