File tree Expand file tree Collapse file tree 4 files changed +23
-12
lines changed
packages/dotnet/ReadMe/HarJsonTranslationLogics Expand file tree Collapse file tree 4 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ cleanup-failure:
16
16
test-metrics-dotnet : # # Run Metrics tests against the .NET SDK
17
17
docker compose up --build --detach integration_dotnet_metrics_v6.0
18
18
sleep 5
19
- npm run test:integration-metrics || make cleanup-failure
19
+ SUPPORTS_HASHING=true npm run test:integration-metrics || make cleanup-failure
20
20
@make cleanup
21
21
22
22
test-webhooks-dotnet : # # Run webhooks tests against the .NET SDK
23
23
docker compose up --build --detach integration_dotnet_webhooks_v6.0
24
- npm run test:integration-webhooks || make cleanup-failure
24
+ SUPPORTS_HASHING=true npm run test:integration-webhooks || make cleanup-failure
25
25
@make cleanup
26
26
27
27
# #
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public async Task<string> BuildHar()
44
44
private Group BuildGroup ( )
45
45
{
46
46
Group group = new Group ( ) ;
47
- group . id = this . configValues . group . id ;
47
+ group . id = MaskHelper . Mask ( this . configValues . group . id ) ;
48
48
group . label = this . configValues . group . label ;
49
49
group . email = this . configValues . group . email ;
50
50
return group ;
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Security . Cryptography ;
3
+ using System . Text ;
4
+
5
+ public static class MaskHelper
6
+ {
7
+ public static string Mask ( string data )
8
+ {
9
+ using ( SHA512 sha512 = SHA512 . Create ( ) )
10
+ {
11
+ byte [ ] hashBytes = sha512 . ComputeHash ( Encoding . UTF8 . GetBytes ( data ) ) ;
12
+ string base64Hash = Convert . ToBase64String ( hashBytes ) ;
13
+ string opts = data . Length >= 4 ? data . Substring ( data . Length - 4 ) : data ;
14
+ return $ "sha512-{ base64Hash } ?{ opts } ";
15
+ }
16
+ }
17
+ }
Original file line number Diff line number Diff line change @@ -145,31 +145,25 @@ private List<Headers> GetHeaders()
145
145
{
146
146
foreach ( var reqHeader in this . request . Headers )
147
147
{
148
+ Headers header = new Headers ( ) ;
149
+ header . name = reqHeader . Key ;
150
+ header . value = reqHeader . Key == "Authorization" ? MaskHelper . Mask ( reqHeader . Value ) : reqHeader . Value . ToString ( ) ;
148
151
if ( ! this . configValues . options . isAllowListEmpty )
149
152
{
150
153
if ( this . CheckAllowList ( reqHeader . Key ) )
151
154
{
152
- Headers header = new Headers ( ) ;
153
- header . name = reqHeader . Key ;
154
- header . value = reqHeader . Value ;
155
155
headers . Add ( header ) ;
156
156
}
157
157
}
158
158
else if ( ! this . configValues . options . isDenyListEmpty )
159
159
{
160
160
if ( ! this . CheckDenyList ( reqHeader . Key ) )
161
161
{
162
- Headers header = new Headers ( ) ;
163
- header . name = reqHeader . Key ;
164
- header . value = reqHeader . Value ;
165
162
headers . Add ( header ) ;
166
163
}
167
164
}
168
165
else
169
166
{
170
- Headers header = new Headers ( ) ;
171
- header . name = reqHeader . Key ;
172
- header . value = reqHeader . Value ;
173
167
headers . Add ( header ) ;
174
168
}
175
169
}
You can’t perform that action at this time.
0 commit comments