-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9455 from NuGet/dev
[ReleasePrep][2023.04.05]RI of dev into main
- Loading branch information
Showing
13 changed files
with
84 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
tests/NuGetGallery.Core.Facts/Infrastructure/TableErrorLogFacts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Linq; | ||
using Elmah; | ||
using Xunit; | ||
|
||
namespace NuGetGallery.Infrastructure | ||
{ | ||
public class TableErrorLogFacts | ||
{ | ||
public class TheObfuscateMethod | ||
{ | ||
[Fact] | ||
public void HandlesMissingForwardedHeader() | ||
{ | ||
// Arrange | ||
var error = new Error(); | ||
|
||
// Act | ||
TableErrorLog.Obfuscate(error); | ||
|
||
// Assert | ||
Assert.DoesNotContain("HTTP_X_FORWARDED_FOR", error.ServerVariables.Keys.Cast<string>()); | ||
} | ||
|
||
[Theory] | ||
[InlineData("", "")] | ||
[InlineData(",", ",")] | ||
[InlineData(" ", " ")] | ||
[InlineData("127.0.0.1", "127.0.0.0")] | ||
[InlineData("127.1.2.3,127.1.2.4", "127.1.2.0,127.1.2.0")] | ||
[InlineData("127.1.2.3 , 127.1.2.4", "127.1.2.0,127.1.2.0")] | ||
public void ObfuscatesForwardedHeader(string input, string expected) | ||
{ | ||
// Arrange | ||
var error = new Error(); | ||
error.ServerVariables["HTTP_X_FORWARDED_FOR"] = input; | ||
|
||
// Act | ||
TableErrorLog.Obfuscate(error); | ||
|
||
// Assert | ||
Assert.Equal(expected, error.ServerVariables["HTTP_X_FORWARDED_FOR"]); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters