Add error handling for when we can't decrypt stored passwords.
Review Request #14276 — Created Dec. 16, 2024 and submitted — Latest diff uploaded
When a repository has a stored password that can not be decrypted
(usually due to theSECRET_KEY
having been changed), we run into some
especially ugly behavior. Any review requests which attempt to access
that repository will just crash entirely with aUnicodeDecodeError
,
and attempting to open the repository form to reset the username and
password will show an empty form because the data cannot be loaded.This change adds some error handling so that if we cannot decrypt the
password, we'll log the error and then returnNone
. This will result
in authentication errors attempting to access the repository, and allows
opening the repository form in the admin to fix it as well.This also fixes the pysvn implementation of normalize_error to pass in
the error message as themsg
parameter to the exception, which makes
it so we don't try to convert that error message to a list for display
(the base SSH authentication error class that SVN auth errors inherit
from has the SSH authentication methods list as its first argument).
Created an authenticated repository with one
SECRET_KEY
and then
changed it.
- Saw that I was able to open the repository settings form and have it
populated with everything except the password. Previously the form
would not only be blank, but the current repository type
("Subversion") wasn't appearing in the tool drop-down at all. - Loaded a review request and diff and saw that instead of getting an
unhandled UnicodeDecodeError exception, I now was able to view the
review request and saw authentication error notices in the diff
content. - Saw that said authentication errors were correctly formatted.