Skip to content
  • Petrik's avatar
    3f1526ae
    Don't show secrets for MessageEncryptor#inspect · 3f1526ae
    Petrik authored
    If anyone calls a message encryptor in the console it will
    show the secret of the encryptor.
    
    By overriding the `inspect` method to only show the class name we can
    avoid accidentally outputting sensitive information.
    
    Before:
    
    ```ruby
    ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
    "#<ActiveSupport::MessageEncryptor:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
    ```
    
    After:
    
    ```ruby
    ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
    "#<ActiveSupport::MessageEncryptor:0x0000000104888038>"
    ```
    3f1526ae
    Don't show secrets for MessageEncryptor#inspect
    Petrik authored
    If anyone calls a message encryptor in the console it will
    show the secret of the encryptor.
    
    By overriding the `inspect` method to only show the class name we can
    avoid accidentally outputting sensitive information.
    
    Before:
    
    ```ruby
    ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
    "#<ActiveSupport::MessageEncryptor:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
    ```
    
    After:
    
    ```ruby
    ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
    "#<ActiveSupport::MessageEncryptor:0x0000000104888038>"
    ```
Loading