Skip to content

Commit 2f2a485

Browse files
Szczyrkwitcher112
authored andcommitted
Filtering the secret in the patcher logs
1 parent 62c7be0 commit 2f2a485

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

Assets/PatchKit Patcher/Scripts/Debug/UnityMessageWriter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public UnityMessageWriter([NotNull] IMessageFormatter formatter)
1818

1919
public void Write(Message message, MessageContext messageContext)
2020
{
21-
var text = _formatter.Format(message, messageContext);
21+
var patcher = Patcher.Instance;
22+
var text = _formatter.Format(message, messageContext)
23+
.Replace(patcher.AppSecret, patcher.TraceableAppSecret);
2224

2325
switch (message.Type)
2426
{

Assets/PatchKit Patcher/Scripts/Patcher.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ public static Patcher Instance
8787

8888
private PatchKit.Unity.Patcher.Cancellation.CancellationTokenSource _updateAppCancellationTokenSource;
8989

90+
public string TraceableAppSecret { get; private set; }
91+
92+
public string AppSecret { get; private set; }
93+
9094
public ErrorDialog ErrorDialog;
9195

9296
public string EditorAppSecret;
@@ -512,7 +516,9 @@ private void ThreadLoadPatcherData()
512516
var inputArgumentsPatcherDataReader = new InputArgumentsPatcherDataReader();
513517
_data.Value = inputArgumentsPatcherDataReader.Read();
514518
#endif
515-
DebugLogger.LogVariable(_data.Value.AppSecret, "Data.AppSecret");
519+
AppSecret = _data.Value.AppSecret;
520+
BuildTraceableAppSecret(AppSecret);
521+
DebugLogger.LogVariable(AppSecret, "Data.AppSecret");
516522
DebugLogger.LogVariable(_data.Value.AppDataPath, "Data.AppDataPath");
517523
DebugLogger.LogVariable(_data.Value.OverrideLatestVersionId, "Data.OverrideLatestVersionId");
518524
DebugLogger.LogVariable(_data.Value.LockFilePath, "Data.LockFilePath");
@@ -953,5 +959,11 @@ private bool ThreadTryRestartWithRequestForPermissions()
953959
return false;
954960
}
955961
}
962+
963+
private void BuildTraceableAppSecret(string appSecret)
964+
{
965+
TraceableAppSecret = string.Format("{0}...{1}", appSecret.Substring(0, 6),
966+
appSecret.Substring(appSecret.Length - 6));
967+
}
956968
}
957969
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [3.17.3.0]
8+
### Added
9+
- Filtering the secret in the patcher logs (#2040)
10+
711
## [3.17.2.0]
812
### Added
913
- Attempting to repair content on failed installation

0 commit comments

Comments
 (0)