-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[App Service] Fix #30030, #10043, #29147, #28987: monitoring, logging, and infrastructure improvements #33073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,7 +12,8 @@ | |||||
| from knack.util import CLIError | ||||||
| from azure.cli.core.azclierror import (InvalidArgumentValueError, | ||||||
| MutuallyExclusiveArgumentError, | ||||||
| AzureResponseError) | ||||||
| AzureResponseError, | ||||||
| RequiredArgumentMissingError) | ||||||
| from azure.cli.command_modules.appservice.custom import (set_deployment_user, | ||||||
| update_git_token, add_hostname, | ||||||
| update_site_configs, | ||||||
|
|
@@ -33,7 +34,9 @@ | |||||
| add_github_actions, | ||||||
| update_app_settings, | ||||||
| update_application_settings_polling, | ||||||
| update_webapp) | ||||||
| update_webapp, | ||||||
| config_diagnostics, | ||||||
| set_traffic_routing) | ||||||
|
|
||||||
| # pylint: disable=line-too-long | ||||||
| from azure.cli.core.profiles import ResourceType | ||||||
|
|
@@ -603,6 +606,68 @@ def test_update_app_settings_success_with_slot_settings(self, mock_build, mock_s | |||||
| mock_client.web_apps.update_slot_configuration_names.assert_called_once() | ||||||
| mock_build.assert_called_once() | ||||||
|
|
||||||
| @mock.patch('azure.cli.command_modules.appservice.custom.web_client_factory') | ||||||
| def test_config_diagnostics_blob_storage_requires_sas_url(self, mock_client_factory): | ||||||
| """Test that RequiredArgumentMissingError is raised when azureblobstorage is set without SAS URL.""" | ||||||
| cmd_mock = _get_test_cmd() | ||||||
|
|
||||||
| mock_client = mock.MagicMock() | ||||||
| mock_client.web_apps.get.return_value = mock.MagicMock() | ||||||
| mock_client_factory.return_value = mock_client | ||||||
|
|
||||||
| with self.assertRaisesRegex(RequiredArgumentMissingError, | ||||||
| '--web-server-log-sas-url is required'): | ||||||
| config_diagnostics(cmd_mock, 'test-rg', 'test-app', | ||||||
| web_server_logging='azureblobstorage') | ||||||
|
|
||||||
| @mock.patch('azure.cli.command_modules.appservice.custom._generic_site_operation') | ||||||
| @mock.patch('azure.cli.command_modules.appservice.custom.web_client_factory') | ||||||
| def test_config_diagnostics_blob_storage_with_sas_url(self, mock_client_factory, mock_site_op): | ||||||
| """Test that blob storage logging is configured when SAS URL is provided.""" | ||||||
| cmd_mock = _get_test_cmd() | ||||||
|
|
||||||
| mock_client = mock.MagicMock() | ||||||
| mock_client.web_apps.get.return_value = mock.MagicMock() | ||||||
| mock_client_factory.return_value = mock_client | ||||||
| mock_site_op.return_value = mock.MagicMock() | ||||||
|
|
||||||
| sas_url = 'https://mystorageaccount.blob.core.windows.net/logs?sv=2021-06-08&sig=abc' | ||||||
| config_diagnostics(cmd_mock, 'test-rg', 'test-app', | ||||||
| web_server_logging='azureblobstorage', | ||||||
| web_server_log_sas_url=sas_url, | ||||||
| web_server_log_retention=7) | ||||||
|
|
||||||
| mock_site_op.assert_called_once() | ||||||
| call_args = mock_site_op.call_args | ||||||
| site_log_config = call_args[0][5] | ||||||
|
||||||
| site_log_config = call_args[0][5] | |
| site_log_config = call_args.args[-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
web_server_log_sas_urlis a credential-bearing SAS URL (containssig=) and will likely be echoed back in theSiteLogsConfigreturned from_generic_site_operation, which meansaz webapp log configoutput can leak the SAS token to the console/logs. Consider redacting/masking the SAS URL in the returned object (or returning a sanitized response) while still sending the full value in the request.