diff --git a/src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs b/src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs index 35ec0bf4132..c09151247dd 100644 --- a/src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs +++ b/src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs @@ -72,7 +72,6 @@ public void GetBuiltInConfiguration_NoParameter_ReturnsBuiltInConfigurationWithA ""level"": ""warning"", ""disallowedhosts"": [ ""api.loganalytics.io"", - ""asazure.windows.net"", ""azuredatalakeanalytics.net"", ""azuredatalakestore.net"", ""batch.core.windows.net"", @@ -211,7 +210,6 @@ public void GetBuiltInConfiguration_DisableAnalyzers_ReturnsBuiltInConfiguration ""level"": ""off"", ""disallowedhosts"": [ ""api.loganalytics.io"", - ""asazure.windows.net"", ""azuredatalakeanalytics.net"", ""azuredatalakestore.net"", ""batch.core.windows.net"", diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoHardcodedEnvironmentUrlsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoHardcodedEnvironmentUrlsRuleTests.cs index 33c5c740258..25a336b8b7f 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoHardcodedEnvironmentUrlsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoHardcodedEnvironmentUrlsRuleTests.cs @@ -133,7 +133,7 @@ public void InsideExpressions(int diagnosticCount, string text) } [DataTestMethod] - // valid matches + // valid matches (i.e., linter rule fails) [DataRow("aschema.management.azure.com", true)] [DataRow("azure.aschema.management.azure.com", true)] [DataRow("management.azure.com", true)] @@ -142,7 +142,7 @@ public void InsideExpressions(int diagnosticCount, string text) [DataRow("subdomain1.management.azure.com", true)] [DataRow("http://subdomain1.management.azure.com", true)] [DataRow("https://subdomain1.management.azure.com", true)] - // should not match + // should not match (i.e., linter rule passes) [DataRow("azure.schema.management.azure.com", false)] [DataRow("othermanagement.azure.com", false)] [DataRow("azure.schema.mannnnagement.azure.com", false)] @@ -152,6 +152,8 @@ public void InsideExpressions(int diagnosticCount, string text) [DataRow("subdomain1.management.azzzure.com", false)] [DataRow("http://subdomain1.manageeeement.azure.com", false)] [DataRow("https://subdomain1.managemeeeent.azure.com", false)] + [DataRow("asazure.windows.net/servers}", false)] + [DataRow("${'location'}.asazure.windows.net/servers/${'aasServerName'}", false)] public void DisallowedHostsMatchingTest(string testString, bool isMatch) { AssertLinterRuleDiagnostics(NoHardcodedEnvironmentUrlsRule.Code, @$"output str string = '{testString}'", diags => @@ -168,15 +170,17 @@ public void DisallowedHostsMatchingTest(string testString, bool isMatch) } [DataTestMethod] - // valid matches + // valid matches (i.e. it will be excluded and there should be no linter failures) [DataRow("schema.management.azure.com", true)] [DataRow("http://schema.management.azure.com", true)] [DataRow("https://schema.management.azure.com", true)] [DataRow("subany.schema.management.azure.com", true)] [DataRow("http://subany.schema.management.azure.com", true)] [DataRow("https://subany.schema.management.azure.com", true)] + [DataRow("https://subany.SCHEMA.MANAGEMENT.Azure.Com", true)] [DataRow("all the world is a stage, but subdomain1.schema.management.azure.com should not be hardcoded", true)] - // should not match + [DataRow("rasazure.windows.net/servers}", true)] + // should not match (i.e. it will not be excluded and there *should* be linter failures) [DataRow("aschema.management.azure.com", false)] [DataRow("azure.aschema.management.azure.com", false)] [DataRow("management.azure.com", false)] @@ -186,7 +190,7 @@ public void DisallowedHostsMatchingTest(string testString, bool isMatch) [DataRow("http://subdomain1.management.azure.com", false)] [DataRow("https://subdomain1.management.azure.com", false)] [DataRow("all the world is a stage, but subdomain1.management.azure.com should not be hardcoded", false)] - [DataRow("all the world is a stage, but subdomain1.schema.management.azure.com should not be hardcoded", true)] + [DataRow("all the world is a stage, but subdomain1.1schema.management.azure.com should not be hardcoded", false)] public void ExcludedHostsMatchingTest(string testString, bool isMatch) { AssertLinterRuleDiagnostics(NoHardcodedEnvironmentUrlsRule.Code, @$"output str string = '{testString}'", diags => diff --git a/src/Bicep.Core/Configuration/bicepconfig.json b/src/Bicep.Core/Configuration/bicepconfig.json index b7903e99ae3..287165950db 100644 --- a/src/Bicep.Core/Configuration/bicepconfig.json +++ b/src/Bicep.Core/Configuration/bicepconfig.json @@ -39,7 +39,6 @@ "level": "warning", "disallowedhosts": [ "api.loganalytics.io", - "asazure.windows.net", "azuredatalakeanalytics.net", "azuredatalakestore.net", "batch.core.windows.net", diff --git a/src/vscode-bicep/schemas/bicepconfig.schema.json b/src/vscode-bicep/schemas/bicepconfig.schema.json index 0d822399167..c80d56cce0a 100644 --- a/src/vscode-bicep/schemas/bicepconfig.schema.json +++ b/src/vscode-bicep/schemas/bicepconfig.schema.json @@ -331,7 +331,6 @@ "type": "array", "default": [ "api.loganalytics.io", - "asazure.windows.net", "azuredatalakeanalytics.net", "azuredatalakestore.net", "batch.core.windows.net",