• 
      

    Make password decryption with broken keys more reliable.

    Review Request #14855 — Created Feb. 25, 2026 and submitted — Latest diff uploaded

    Information

    Review Board
    release-7.x

    Reviewers

    I've been seeing inconsistent results for
    RepositoryTests.test_password_decryption_failed, which tests that we
    don't crash when the SECRET_KEY has been mistakenly changed and stored
    passwords cannot be decrypted. While this works most of the time by
    properly catching the decode error, occasionally the random IV used
    during AES-CFB causes the decoded result to be valid(ish) unicode. These
    almost always result in unprintable characters, however.

    This change adds a step to decrypt_password to check if the result is
    printable, and if not, raise a ValueError. This should make it so this
    test (and handling of the situation in production) is much more
    reliable.

    Ran unit tests.

    Commits

    Files