SEBWIN-312: Ensured application start failure does not crash SEB and clarified URL filter specification.

This commit is contained in:
dbuechel 2019-11-21 16:07:13 +01:00
parent 0a939e19ac
commit 48511d996c
2 changed files with 19 additions and 12 deletions

View file

@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using SafeExamBrowser.Applications.Contracts;
@ -42,17 +43,22 @@ namespace SafeExamBrowser.Applications
public void Start()
{
logger.Info("Starting application...");
try
{
logger.Info("Starting application...");
// TODO: Ensure that SEB does not crash if an application cannot be started!!
var process = processFactory.StartNew(executablePath);
var id = new ApplicationInstanceIdentifier(process.Id);
var instance = new ExternalApplicationInstance(Info.Icon, id, logger.CloneFor($"{Info.Name} {id}"), process);
var process = processFactory.StartNew(executablePath);
var id = new ApplicationInstanceIdentifier(process.Id);
var instance = new ExternalApplicationInstance(Info.Icon, id, logger.CloneFor($"{Info.Name} {id}"), process);
instance.Initialize();
instances.Add(instance);
InstanceStarted?.Invoke(instance);
instance.Initialize();
instances.Add(instance);
InstanceStarted?.Invoke(instance);
}
catch (Exception e)
{
logger.Error("Failed to start application!", e);
}
}
public void Terminate()

View file

@ -84,10 +84,11 @@ namespace SafeExamBrowser.Browser.UnitTests.Filters.Rules
var positive = new[]
{
$"scheme://{expression}",
$"scheme://{expression}.org", // TODO: Is this correct?
// TODO: All these below should not be allowed!
$"scheme://{expression}.org",
$"scheme://www.{expression}.org",
$"scheme://subdomain.{expression}.com",
$"scheme://www.realhost.{expression}", // TODO: Is this correct?
$"scheme://www.realhost.{expression}",
$"scheme://subdomain-1.subdomain-2.{expression}.org",
$"scheme://user:password@www.{expression}.org/path/file.txt?param=123#fragment"
};
@ -122,7 +123,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Filters.Rules
"scheme://hostname-12.org",
"scheme://hostname-abc-def-123-456.org",
"scheme://www.hostname-abc.org",
"scheme://www.realhost.hostname", //TODO: Is this correct?
"scheme://www.realhost.hostname",
"scheme://subdomain.hostname-xyz.com",
"scheme://hostname.realhost.org",
"scheme://subdomain.hostname.realhost.org",