Skip to content

Commit 2c8c089

Browse files
author
Todd Lair
committed
Merge branch 'develop'
2 parents bc1ff5b + 3077fbe commit 2c8c089

File tree

13 files changed

+54
-27
lines changed

13 files changed

+54
-27
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ static void StackifyAPILogger_OnLogMessage(string data)
8787
}
8888
```
8989

90+
## Additional Settings
91+
92+
These settings are available to further customize what information is captured and transmitted to Stackify.
93+
94+
```xml
95+
<appSettings>
96+
<add key="Stackify.CaptureErrorHeaders" value="true" />
97+
<add key="Stackify.CaptureServerVariables" value="false" />
98+
<add key="Stackify.CaptureSessionVariables" value="false" />
99+
<add key="Stackify.CaptureErrorCookies" value="false" />
100+
<add key="Stackify.CaptureErrorUserName" value="true" />
101+
<add key="Stackify.CaptureErrorPostdata" value="false" />
102+
</appSettings>
103+
```
104+
90105

91106
## Errors and Logs
92107

Src/NLog.Targets.Stackify/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[assembly: AssemblyCopyright("Copyright © 2015")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
16-
[assembly: AssemblyKeyFileAttribute("..\\StackifyLib\\Netreo.snk")]
16+
//[assembly: AssemblyKeyFile("..\\StackifyLib\\Netreo.snk")]
1717

1818
// Setting ComVisible to false makes the types in this assembly not visible
1919
// to COM components. If you need to access a type in this assembly from

Src/StackifyLib.AspNetCore/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[assembly: AssemblyCompany("Stackify")]
1010
[assembly: AssemblyProduct("StackifyLib.AspNetCore")]
1111
[assembly: AssemblyTrademark("")]
12-
[assembly: AssemblyKeyFileAttribute("..\\StackifyLib\\Netreo.snk")]
12+
//[assembly: AssemblyKeyFile("..\\StackifyLib\\Netreo.snk")]
1313

1414
// Setting ComVisible to false makes the types in this assembly not visible
1515
// to COM components. If you need to access a type in this assembly from

Src/StackifyLib.CoreLogger/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[assembly: AssemblyCompany("Stackify")]
1010
[assembly: AssemblyProduct("StackifyLib.CoreLogger")]
1111
[assembly: AssemblyTrademark("")]
12-
[assembly: AssemblyKeyFileAttribute("..\\StackifyLib\\Netreo.snk")]
12+
//[assembly: AssemblyKeyFile("..\\StackifyLib\\Netreo.snk")]
1313

1414
// Setting ComVisible to false makes the types in this assembly not visible
1515
// to COM components. If you need to access a type in this assembly from

Src/StackifyLib.ELMAH/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[assembly: AssemblyCopyright("Copyright © 2015")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
16-
[assembly: AssemblyKeyFileAttribute("..\\StackifyLib\\Netreo.snk")]
16+
//[assembly: AssemblyKeyFile("..\\StackifyLib\\Netreo.snk")]
1717

1818
// Setting ComVisible to false makes the types in this assembly not visible
1919
// to COM components. If you need to access a type in this assembly from

Src/StackifyLib.StackifyTraceListener/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[assembly: AssemblyCompany("Stackify")]
1010
[assembly: AssemblyProduct("StackifyLib.StackifyTraceListener")]
1111
[assembly: AssemblyTrademark("")]
12-
[assembly: AssemblyKeyFileAttribute("..\\StackifyLib\\Netreo.snk")]
12+
//[assembly: AssemblyKeyFile("..\\StackifyLib\\Netreo.snk")]
1313

1414
// Setting ComVisible to false makes the types in this assembly not visible
1515
// to COM components. If you need to access a type in this assembly from

Src/StackifyLib.log4net/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[assembly: AssemblyCopyright("Copyright © 2015")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
16-
[assembly: AssemblyKeyFileAttribute("..\\StackifyLib\\Netreo.snk")]
16+
//[assembly: AssemblyKeyFile("..\\StackifyLib\\Netreo.snk")]
1717

1818
// Setting ComVisible to false makes the types in this assembly not visible
1919
// to COM components. If you need to access a type in this assembly from

Src/StackifyLib/Config.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public static void LoadSettings()
6262

6363
CaptureErrorCookies = Get("Stackify.CaptureErrorCookies", bool.FalseString).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase);
6464

65+
CaptureErrorUserName = Get("Stackify.CaptureErrorUserName", bool.TrueString).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase);
66+
67+
CaptureErrorPostdata = Get("Stackify.CaptureErrorPostdata", bool.FalseString).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase);
68+
6569
ApiKey = Get("Stackify.ApiKey", ApiKey ?? string.Empty);
6670

6771
AppName = Get("Stackify.AppName", AppName ?? string.Empty);
@@ -183,21 +187,14 @@ public static void LoadSettings()
183187
public static bool CaptureErrorPostdata { get; set; }
184188
public static bool CaptureErrorHeaders { get; set; } = true;
185189
public static bool CaptureErrorCookies { get; set; }
186-
190+
public static bool CaptureErrorUserName { get; set; } = true;
187191
public static string CaptureErrorSessionWhitelist { get; set; }
188-
189192
public static string CaptureErrorHeadersWhitelist { get; set; }
190-
191193
public static string CaptureErrorHeadersBlacklist { get; set; } = "cookie,authorization";
192-
193194
public static string CaptureErrorCookiesWhitelist { get; set; }
194-
195195
public static string CaptureErrorCookiesBlacklist { get; set; } = ".ASPXAUTH";
196-
197196
public static int Ec2InstanceMetadataUpdateThresholdMinutes { get; set; } = 60;
198-
199197
public static bool? IsEc2 { get; set; }
200-
201198
public static bool? ApiLog { get; set; }
202199

203200
public static int LoggingJsonMaxFields { get; set; } = 50;

Src/StackifyLib/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[assembly: AssemblyCopyright("Copyright © 2018-2020")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
16-
[assembly: AssemblyKeyFileAttribute("Netreo.snk")]
16+
//[assembly: AssemblyKeyFile("Netreo.snk")]
1717

1818
// Setting ComVisible to false makes the types in this assembly not visible
1919
// to COM components. If you need to access a type in this assembly from

Src/StackifyLib/StackifyError.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private void Init()
153153
{
154154
WebRequestDetail = new WebRequestDetail(this);
155155

156-
if (HttpContext.Current.User != null && HttpContext.Current.User.Identity != null)
156+
if (Config.CaptureErrorUserName && HttpContext.Current.User != null && HttpContext.Current.User.Identity != null)
157157
{
158158
UserName = HttpContext.Current.User.Identity.Name;
159159
}
@@ -163,7 +163,7 @@ private void Init()
163163
#else
164164
WebRequestDetail = new WebRequestDetail(this);
165165
#endif
166-
166+
167167
//Fire event
168168
OnCaptureDetail?.Invoke(this);
169169

Src/StackifyLib/StackifyLib.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<AssemblyTitle>Stackify API</AssemblyTitle>
5-
<VersionPrefix>2.2.7</VersionPrefix>
5+
<VersionPrefix>2.2.9</VersionPrefix>
66
<TargetFrameworks>netstandard2.0;net40;net45;net451;net452;net46;net461;net462</TargetFrameworks>
77
<AssemblyName>StackifyLib</AssemblyName>
88
<PackageId>StackifyLib</PackageId>
@@ -13,15 +13,15 @@
1313
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
1414
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1515
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
16-
<Version>2.2.7</Version>
16+
<Version>2.2.9</Version>
1717
<Authors>StackifyLib</Authors>
1818
<PackageProjectUrl>https://github.com/stackify/stackify-api-dotnet</PackageProjectUrl>
1919
<PackageLicenseUrl>https://github.com/stackify/stackify-api-dotnet/blob/master/LICENSE</PackageLicenseUrl>
2020
<RepositoryUrl>https://github.com/stackify/stackify-api-dotnet</RepositoryUrl>
2121
<RepositoryType>git</RepositoryType>
2222
<PackageIconUrl>https://stackify.com/wp-content/uploads/2017/02/stk.png</PackageIconUrl>
23-
<AssemblyVersion>2.2.7.0</AssemblyVersion>
24-
<FileVersion>2.2.7.0</FileVersion>
23+
<AssemblyVersion>2.2.9.0</AssemblyVersion>
24+
<FileVersion>2.2.9.0</FileVersion>
2525
<PackageReleaseNotes>Remove default internal file logger</PackageReleaseNotes>
2626
<SignAssembly>false</SignAssembly>
2727
</PropertyGroup>

Src/StackifyLib/Web/RealUserMonitoring.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
1+
using System;
2+
using System.Security.Cryptography;
43
using Newtonsoft.Json;
54
using Newtonsoft.Json.Linq;
65
using StackifyLib.Utils;
@@ -9,6 +8,8 @@ namespace StackifyLib.Web
98
{
109
public static class RealUserMonitoring
1110
{
11+
private static readonly RandomNumberGenerator Rng = new RNGCryptoServiceProvider();
12+
1213
public static string GetHeaderScript()
1314
{
1415
var rumScriptUrl = Config.RumScriptUrl;
@@ -51,8 +52,13 @@ public static string GetHeaderScript()
5152
settings["Trans"] = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(reportingUrl));
5253
}
5354

54-
return string.Format(@"<script type=""text/javascript"">(window.StackifySettings || (window.StackifySettings = {0}))</script><script src=""{1}"" data-key=""{2}"" async></script>",
55-
settings.ToString(Formatting.None), rumScriptUrl, rumKey);
55+
// generate nonce for strict CSP rules
56+
var nonceBytes = new byte[20];
57+
Rng.GetNonZeroBytes(nonceBytes);
58+
var nonce = Convert.ToBase64String(nonceBytes);
59+
60+
return string.Format("<script type=\"text/javascript\" nonce=\"{3}\">(window.StackifySettings || (window.StackifySettings = {0}))</script><script src=\"{1}\" data-key=\"{2}\" async></script>",
61+
settings.ToString(Formatting.None), rumScriptUrl, rumKey, nonce);
5662
}
5763
}
5864
}

azure-pipelines.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,16 @@ steps:
4343
inputs:
4444
targetType: inline
4545
script: >
46-
(Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace '<PackageId>StackifyLib</PackageId>','<PackageId>StackifyLib.signed</PackageId>' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj
46+
(Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace '<PackageId>StackifyLib</PackageId>','<PackageId>StackifyLib.signed</PackageId>' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj -Encoding utf8
47+
48+
# note: the signing attribute here is commented out so we can build locally
49+
- powershell: |
50+
$filename = Get-ChildItem ".\src\*\AssemblyInfo.cs" -Recurse
51+
$filename | %{
52+
(gc $_) -replace ([regex]::Escape("//[assembly: AssemblyKeyFile")), "[assembly: AssemblyKeyFile" | Set-Content $_.FullName -Encoding utf8
53+
}
54+
displayName: Uncoment signing attribute
55+
4756
- task: PowerShell@2
4857
displayName: 'Setup Code Signing'
4958
inputs:

0 commit comments

Comments
 (0)