Who will read the error?

Also, can you give some examples of the most descriptive errors you would
likely give so I can see the severity of the leak?   (No need to go
overboard and print a private key in an exception string or similar.)


On Mon, Sep 30, 2013 at 8:56 PM, Vladimir Diaz <notifications@github.com>wrote:

> In tuf/repo/keystore.py:
>
> > @@ -583,7 +609,11 @@ def _encrypt(key_data, derived_key_information):
> >    # repetitions are performed by AES, 14 cycles for 256-bit keys.
> >    try:
> >      ciphertext = aes_cipher.encrypt(key_data)
> > -  except:
> > +
> > +  # Raise generic exception message to avoid revealing sensitive information,
> > +  # such as invalid passwords, encryption keys, etc., that an attacker can use
> > +  # to his advantage.
> > +  except Exception, e:
>
> I prefer generic exceptions for the following reasons:
> https://www.owasp.org/index.php/Error_Handling
> https://www.owasp.org/index.php/Top_10_2007-A6
> http://cwe.mitre.org/data/definitions/209.html
>
> http://stackoverflow.com/questions/14922130/which-error-message-is-better-when-users-entered-a-wrong-password
>
> Is "The key could not be decrypted" insufficient?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/theupdateframework/tuf/pull/124/files#r6676119>
> .
>