Skip to content

Commit a9e673f

Browse files
aishwaryabhliliankasem
authored andcommitted
Check if URI is valid in token expiration service (#9562)
* check if uri is valid * Update src/WebJobs.Script/Utility.cs Co-authored-by: Lilian Kasem <[email protected]> * utility update --------- Co-authored-by: Lilian Kasem <[email protected]>
1 parent f45eb6b commit a9e673f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/WebJobs.Script/Utility.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,10 @@ public static string GetSasTokenExpirationDate(string valueToParse, bool isAzure
893893
}
894894
else
895895
{
896+
if (!Uri.IsWellFormedUriString(valueToParse, UriKind.Absolute))
897+
{
898+
return null;
899+
}
896900
var resourceUri = new Uri(valueToParse);
897901
queryParams = HttpUtility.ParseQueryString(resourceUri.Query);
898902
}

test/WebJobs.Script.Tests/TokenExpirationServiceTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public TokenExpirationServiceTests()
4242
[InlineData("UseDevelopmentStorage=true", true, false)]
4343
[InlineData("BlobEndpoint=https://storage.blob.core.windows.net;TableEndpoint=https://table.core.windows.net;SharedAccessSignature=sv=2015-07-08&sig=f%2BGLvBih%2BoFuQvckBSHWKMXwqGJHlPkESmZh9pjnHuc%3D&spr=https&st=2016-04-12T03%3A24%3A31Z&srt=s&ss=bf&sp=rwl", true, false)]
4444
[InlineData("BlobEndpoint=https://storage.blob.core.windows.net;TableEndpoint=https://table.core.windows.net;SharedAccessSignature=sv=2015-07-08&sig=f%2BGLvBih%2BoFuQvckBSHWKMXwqGJHlPkESmZh9pjnHuc%3D&spr=https&st=2016-04-12T03%3A24%3A31Z&se=2023-07-20T05:27:05Z&srt=s&ss=bf&sp=rwl", true, true)]
45+
[InlineData("1", false, false)]
4546
public async Task StartAsync_Tests(string input, bool isAzureWebJobsStorage, bool shouldEmitEvent)
4647
{
4748
var options = new StandbyOptions { InStandbyMode = true };

0 commit comments

Comments
 (0)