Skip to content

Commit 47a1de9

Browse files
Merge pull request #322 from microsoft/main
Fork Sync: Update from parent repository
2 parents 7e28393 + 13b7272 commit 47a1de9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/ApiService/ApiService/Functions/ReproVmss.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System.Net;
2+
using System.Security.Cryptography;
3+
using System.Text;
24
using Microsoft.Azure.Functions.Worker;
35
using Microsoft.Azure.Functions.Worker.Http;
46

@@ -81,6 +83,14 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
8183
"repro_vm create");
8284
}
8385

86+
// we’d like to track the usage of this feature;
87+
// anonymize the user ID so we can distinguish multiple requests
88+
{
89+
var data = userInfo.OkV.UserInfo.ToString(); // rely on record ToString
90+
var hash = Convert.ToBase64String(SHA256.HashData(Encoding.UTF8.GetBytes(data)));
91+
_log.Event($"created repro VM, user distinguisher: {hash:Tag:UserHash}");
92+
}
93+
8494
var response = req.CreateResponse(HttpStatusCode.OK);
8595
await response.WriteAsJsonAsync(vm.OkV);
8696
return response;

src/ApiService/ApiService/Log.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.OneFuzz.Service;
1212
[InterpolatedStringHandler]
1313
public struct LogStringHandler {
1414

15-
private StringBuilder _builder;
15+
private readonly StringBuilder _builder;
1616
private Dictionary<string, string>? _tags;
1717

1818
public LogStringHandler(int literalLength, int formattedCount) {

0 commit comments

Comments
 (0)