Skip to content

Commit

Permalink
[COST-4807] fix CWE-547 false positive (#5003)
Browse files Browse the repository at this point in the history
  • Loading branch information
maskarb authored Mar 27, 2024
1 parent 2d57ccf commit 5c7647f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion koku/providers/provider_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ProviderErrors:
"The provided client secret keys for this source are expired. "
"In Azure, refresh your client secret and try again."
)
AZURE_INCORRECT_CLIENT_SECRET_MESSAGE = (
AZURE_CLIENT_SECRET_INCORRECT_MESSAGE = (
"A problem has been detected with the Azure client secret for this source. "
"Refer to the Microsoft Azure troubleshooting guide in the cost management documentation for details."
)
Expand Down
2 changes: 1 addition & 1 deletion koku/sources/sources_error_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def azure_client_errors(self, message):
"""Azure client error messages."""
scrubbed_message = ProviderErrors.AZURE_GENERAL_CLIENT_ERROR_MESSAGE
if any(test in message for test in ["http error: 401", "Authentication failed", "(401) Unauthorized"]):
scrubbed_message = ProviderErrors.AZURE_INCORRECT_CLIENT_SECRET_MESSAGE
scrubbed_message = ProviderErrors.AZURE_CLIENT_SECRET_INCORRECT_MESSAGE
if "AADSTS700016" in message:
scrubbed_message = ProviderErrors.AZURE_INCORRECT_CLIENT_ID_MESSAGE
if "AADSTS90002" in message:
Expand Down
6 changes: 3 additions & 3 deletions koku/sources/test/test_sources_error_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ def test_azure_errors(self):
{
"key": ProviderErrors.AZURE_CLIENT_ERROR,
"internal_message": ", AdalError: Get Token request returned http error: 401 and server response:",
"expected_message": ProviderErrors.AZURE_INCORRECT_CLIENT_SECRET_MESSAGE,
"expected_message": ProviderErrors.AZURE_CLIENT_SECRET_INCORRECT_MESSAGE,
},
{
"key": ProviderErrors.AZURE_CLIENT_ERROR,
"internal_message": "Authentication failed",
"expected_message": ProviderErrors.AZURE_INCORRECT_CLIENT_SECRET_MESSAGE,
"expected_message": ProviderErrors.AZURE_CLIENT_SECRET_INCORRECT_MESSAGE,
},
{
"key": ProviderErrors.AZURE_CLIENT_ERROR,
"internal_message": (
"(401) Unauthorized. Request ID: cca1a5a4-4107-4e7a-b3b4-b88f31e6a674\n"
"Code: 401\nMessage: Unauthorized. Request ID: cca1a5a4-4107-4e7a-b3b4-b88f31e6a674"
),
"expected_message": ProviderErrors.AZURE_INCORRECT_CLIENT_SECRET_MESSAGE,
"expected_message": ProviderErrors.AZURE_CLIENT_SECRET_INCORRECT_MESSAGE,
},
{
"key": ProviderErrors.AZURE_CLIENT_ERROR,
Expand Down

0 comments on commit 5c7647f

Please sign in to comment.