Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
Credscan - revert crypto changes (#406)
Browse files Browse the repository at this point in the history
* Remove crypto changes

* Update system.net.testdata

* fix UriRelativeResolutionTest.cs

* [2.1] Credscan second round (dotnet#43052)

* Credscan second round

* Remove crypto changes

* Update system.net.testdata

* fix UriRelativeResolutionTest.cs

* Add fix for HttpClientHandlerTest.cs

* more credscan

* Add more fixes

Co-authored-by: Dan Moseley <[email protected]>
  • Loading branch information
aik-jahoda and danmoseley authored Mar 25, 2021
1 parent c854782 commit 9aa834a
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 180 deletions.
2 changes: 1 addition & 1 deletion external/test-runtime/XUnit.Runtime.depproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<Version>1.0.2-prerelease</Version>
</PackageReference>
<PackageReference Include="System.Net.TestData">
<Version>1.0.0-prerelease</Version>
<Version>1.0.7</Version>
</PackageReference>
<PackageReference Include="System.Drawing.Common.TestData">
<Version>1.0.7</Version>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ public async Task GetAsync_ServerNeedsNonStandardAuthAndSetCredential_StatusCode
await LoopbackServer.CreateServerAsync(async (server, url) =>
{
HttpClientHandler handler = CreateHttpClientHandler();
handler.Credentials = new NetworkCredential("unused", "unused");
handler.Credentials = new NetworkCredential("unused", "PLACEHOLDER");
using (var client = new HttpClient(handler))
{
Task<HttpResponseMessage> getResponseTask = client.GetAsync(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<SupplementalTestData Include="$(PackagesDir)system.net.testdata\1.0.0-prerelease\content\**\*.*" />
<SupplementalTestData Include="$(PackagesDir)system.net.testdata\1.0.7\content\**\*.*" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsOSX)'=='true'">
<TestCommandLines Include="ulimit -Sn 4096" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<SupplementalTestData Include="$(PackagesDir)system.net.testdata\1.0.0-prerelease\content\**\*.*" />
<SupplementalTestData Include="$(PackagesDir)system.net.testdata\1.0.7\content\**\*.*" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,12 @@ public void GetCacheControlLength_DifferentValidScenariosAndNoExistingCacheContr
expected = new CacheControlHeaderValue();
expected.Public = true;
expected.Private = true;
expected.PrivateHeaders.Add("token1");
expected.PrivateHeaders.Add("PLACEHOLDER1");
expected.MustRevalidate = true;
expected.ProxyRevalidate = true;
expected.Extensions.Add(new NameValueHeaderValue("c", "d"));
expected.Extensions.Add(new NameValueHeaderValue("a", "b"));
CheckGetCacheControlLength(",public, , private=\"token1\", must-revalidate, c=d, proxy-revalidate, a=b", 0,
CheckGetCacheControlLength(",public, , private=\"PLACEHOLDER1\", must-revalidate, c=d, proxy-revalidate, a=b", 0,
null, 72, expected);

expected = new CacheControlHeaderValue();
Expand Down Expand Up @@ -471,11 +471,11 @@ public void GetCacheControlLength_DifferentValidScenariosAndExistingCacheControl
expected = new CacheControlHeaderValue();
expected.Private = true;
expected.PrivateHeaders.Add("token1");
expected.PrivateHeaders.Add("token2");
expected.PrivateHeaders.Add("PLACEHOLDER");
expected.NoCache = true;
expected.NoCacheHeaders.Add("token1");
expected.NoCacheHeaders.Add("token2");
CheckGetCacheControlLength("private=\"token2\", no-cache=\"token1, , token2,\"", 0, storeValue, 46,
expected.NoCacheHeaders.Add("PLACEHOLDER");
CheckGetCacheControlLength("private=\"PLACEHOLDER\", no-cache=\"token1, , PLACEHOLDER,\"", 0, storeValue, 46,
expected);

storeValue = new CacheControlHeaderValue();
Expand All @@ -485,15 +485,15 @@ public void GetCacheControlLength_DifferentValidScenariosAndExistingCacheControl
expected = new CacheControlHeaderValue();
expected.Public = true;
expected.Private = true;
expected.PrivateHeaders.Add("token1");
expected.PrivateHeaders.Add("PLACEHOLDER");
expected.MustRevalidate = true;
expected.ProxyRevalidate = true;
expected.NoTransform = true;
expected.OnlyIfCached = true;
expected.Extensions.Add(new NameValueHeaderValue("a", "\"b\""));
expected.Extensions.Add(new NameValueHeaderValue("c", "d"));
expected.Extensions.Add(new NameValueHeaderValue("x", "y")); // from store result
CheckGetCacheControlLength(",public, , private=\"token1\", must-revalidate, c=d, proxy-revalidate, a=\"b\"",
CheckGetCacheControlLength(",public, , private=\"PLACEHOLDER\", must-revalidate, c=d, proxy-revalidate, a=\"b\"",
0, storeValue, 74, expected);

storeValue = new CacheControlHeaderValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<SupplementalTestData Include="$(PackagesDir)system.net.testdata\1.0.0-prerelease\content\**\*.*" />
<SupplementalTestData Include="$(PackagesDir)system.net.testdata\1.0.7\content\**\*.*" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(CommonTestPath)\System\Diagnostics\RemoteExecutorConsoleApp\RemoteExecutorConsoleApp.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<Compile Include="WebSocketHelper.cs" />
</ItemGroup>
<ItemGroup>
<SupplementalTestData Include="$(PackagesDir)system.net.testdata\1.0.0-prerelease\content\**\*.*" />
<SupplementalTestData Include="$(PackagesDir)system.net.testdata\1.0.7\content\**\*.*" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class UriRelativeResolutionTest
{
// See RFC 3986 Section 5.2.2 and 5.4 http://www.ietf.org/rfc/rfc3986.txt

private readonly Uri _fullBaseUri = new Uri("http://user:psw@host:9090/path1/path2/path3/fileA?query#fragment");
private readonly Uri _fullBaseUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/fileA?query#fragment");

[Fact]
public void Uri_Relative_BaseVsAbsolute_ReturnsFullAbsolute()
Expand Down Expand Up @@ -391,7 +391,7 @@ public void Uri_Relative_BaseVsSlashTrippleDotSlash_ReturnsSlashTrippleDotSlash(
[Fact]
public void Uri_Relative_BaseMadeRelativeToSamePath_ReturnsQueryAndFragment()
{
Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/fileA?AQuery#AFragment");
Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/fileA?AQuery#AFragment");
Uri relative = _fullBaseUri.MakeRelativeUri(compareUri);

String expectedResult = "?AQuery#AFragment"; // compareUri.GetParts(UriComponents.Query | UriComponents.Fragment,UriFormat.Unescaped);
Expand All @@ -401,7 +401,7 @@ public void Uri_Relative_BaseMadeRelativeToSamePath_ReturnsQueryAndFragment()
[Fact]
public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlashPlusQueryAndFragment()
{
Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/?AQuery#AFragment");
Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/?AQuery#AFragment");
Uri relative = _fullBaseUri.MakeRelativeUri(compareUri);
Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric

Expand All @@ -414,7 +414,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlashPlusQueryAnd
[Fact]
public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlash()
{
Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/");
Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/");
Uri relative = _fullBaseUri.MakeRelativeUri(compareUri);
Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric

Expand All @@ -426,7 +426,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlash()
[Fact]
public void Uri_Relative_BaseMadeRelativeToLastSlashWithExtra_ReturnsDotSlashPlusQueryAndFragment()
{
Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/Path4/fileb?AQuery#AFragment");
Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/Path4/fileb?AQuery#AFragment");
Uri relative = _fullBaseUri.MakeRelativeUri(compareUri);
Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric

Expand All @@ -438,7 +438,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlashWithExtra_ReturnsDotSlashPlu
[Fact]
public void Uri_Relative_BaseMadeRelativeToSecondToLastSlash_ReturnsDoubleDotSlashPlusQueryAndFragment()
{
Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/?AQuery#AFragment");
Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/?AQuery#AFragment");
Uri relative = _fullBaseUri.MakeRelativeUri(compareUri);
Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric

Expand All @@ -450,7 +450,7 @@ public void Uri_Relative_BaseMadeRelativeToSecondToLastSlash_ReturnsDoubleDotSla
[Fact]
public void Uri_Relative_BaseMadeRelativeToThirdToLastSlash_ReturnsDoubleDoubleDotSlashPlusQueryAndFragment()
{
Uri compareUri = new Uri("http://user:psw@host:9090/path1/?AQuery#AFragment");
Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/?AQuery#AFragment");
Uri relative = _fullBaseUri.MakeRelativeUri(compareUri);
Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric

Expand All @@ -462,7 +462,7 @@ public void Uri_Relative_BaseMadeRelativeToThirdToLastSlash_ReturnsDoubleDoubleD
[Fact]
public void Uri_Relative_BaseMadeRelativeToEmptyPath_ReturnsTrippleDoubleDotSlashPlusQueryAndFragment()
{
Uri compareUri = new Uri("http://user:psw@host:9090/?AQuery#AFragment");
Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/?AQuery#AFragment");
Uri relative = _fullBaseUri.MakeRelativeUri(compareUri);
Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric

Expand Down
Loading

0 comments on commit 9aa834a

Please sign in to comment.