2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 17:39:39 -04:00

Remove plugin signature enforcement.

This commit is contained in:
Xjph 2021-06-08 17:27:30 -02:30
parent 7d3f7c50de
commit 2bc47a8647

View File

@ -152,44 +152,44 @@ namespace Observatory.PluginManagement
if (Directory.Exists(pluginPath)) if (Directory.Exists(pluginPath))
{ {
//Temporarily skipping signature checks. Need to do this the right way later.
var pluginLibraries = Directory.GetFiles($".{Path.DirectorySeparatorChar}plugins", "*.dll"); var pluginLibraries = Directory.GetFiles($".{Path.DirectorySeparatorChar}plugins", "*.dll");
var coreToken = Assembly.GetExecutingAssembly().GetName().GetPublicKeyToken(); //var coreToken = Assembly.GetExecutingAssembly().GetName().GetPublicKeyToken();
foreach (var dll in pluginLibraries) foreach (var dll in pluginLibraries)
{ {
try try
{ {
var pluginToken = AssemblyName.GetAssemblyName(dll).GetPublicKeyToken(); //var pluginToken = AssemblyName.GetAssemblyName(dll).GetPublicKeyToken();
PluginStatus signed; //PluginStatus signed;
if (pluginToken.Length == 0) //if (pluginToken.Length == 0)
{ //{
errorList.Add($"Warning: {dll} not signed."); // errorList.Add($"Warning: {dll} not signed.");
signed = PluginStatus.Unsigned; // signed = PluginStatus.Unsigned;
} //}
else if (!coreToken.SequenceEqual(pluginToken)) //else if (!coreToken.SequenceEqual(pluginToken))
{ //{
errorList.Add($"Warning: {dll} signature does not match."); // errorList.Add($"Warning: {dll} signature does not match.");
signed = PluginStatus.InvalidSignature; // signed = PluginStatus.InvalidSignature;
} //}
else //else
{ //{
errorList.Add($"OK: {dll} signed."); // errorList.Add($"OK: {dll} signed.");
signed = PluginStatus.Signed; // signed = PluginStatus.Signed;
} //}
if (signed == PluginStatus.Signed || Properties.Core.Default.AllowUnsigned) //if (signed == PluginStatus.Signed || Properties.Core.Default.AllowUnsigned)
{ //{
string error = LoadPluginAssembly(dll, observatoryWorkers, observatoryNotifiers); string error = LoadPluginAssembly(dll, observatoryWorkers, observatoryNotifiers);
if (!string.IsNullOrWhiteSpace(error)) if (!string.IsNullOrWhiteSpace(error))
{ {
errorList.Add(error); errorList.Add(error);
} }
} //}
else //else
{ //{
LoadPlaceholderPlugin(dll, signed, observatoryNotifiers); // LoadPlaceholderPlugin(dll, signed, observatoryNotifiers);
} //}
} }