Skip to content

Commit

Permalink
ensure decode_password function properly handles plaintext but vali…
Browse files Browse the repository at this point in the history
…d base64 passwords (#5698)
  • Loading branch information
adamsachs authored Jan 21, 2025
1 parent 7043171 commit bbba31d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Changes can also be flagged with a GitHub label for tracking purposes. The URL o
- Fixed column ordering issue in the Data Map report [#5649](https://github.com/ethyca/fides/pull/5649)
- Fixed issue where the Data Map report filter dialog was missing an Accordion item label [#5649](https://github.com/ethyca/fides/pull/5649)
- Improved database session management for long running access request tasks [#5667](https://github.com/ethyca/fides/pull/5667)
- Ensured decode_password function properly handles plaintext but valid base64 passwords [#5698](https://github.com/ethyca/fides/pull/5698)

## [2.52.0](https://github.com/ethyca/fides/compare/2.51.2...2.52.0)

Expand Down
2 changes: 1 addition & 1 deletion src/fides/api/cryptography/cryptographic_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def decode_password(password: str) -> str:
"""
try:
return b64_str_to_str(password)
except Error:
except (Error, UnicodeDecodeError):
return password


Expand Down
5 changes: 5 additions & 0 deletions tests/lib/test_cryptography_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ def test_str_to_b64_str() -> None:
"password, expected",
[
("Testpassword1!", "Testpassword1!"),
(
"Test_1234",
"Test_1234",
), # this is actually valid base64 (but should be treated as plaintext), so this represents an edge case
(str_to_b64_str("Testpassword1!"), "Testpassword1!"),
(str_to_b64_str("Test_1234"), "Test_1234"),
],
)
def test_decode_password(password, expected):
Expand Down

0 comments on commit bbba31d

Please sign in to comment.