Restore SEBPatch

This commit is contained in:
2025-06-01 11:44:20 +02:00
commit 8c656e3137
1297 changed files with 142172 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Contracts.Filters
{
/// <summary>
/// Defines the filter for browser requests.
/// </summary>
public interface IRequestFilter
{
/// <summary>
/// The default result to be returned by <see cref="Process(Request)"/> if no rule matches.
/// </summary>
FilterResult Default { get; set; }
/// <summary>
/// Loads the given filter rule to be used when processing requests.
/// </summary>
void Load(IRule rule);
/// <summary>
/// Filters the given request according to the loaded rules.
/// </summary>
FilterResult Process(Request request);
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Contracts.Filters
{
/// <summary>
/// Defines a request filter rule.
/// </summary>
public interface IRule
{
/// <summary>
/// The filter result to be used if the rule matches a request.
/// </summary>
FilterResult Result { get; }
/// <summary>
/// Initializes the rule for processing requests.
/// </summary>
void Initialize(FilterRuleSettings settings);
/// <summary>
/// Indicates whether the rule applies for the given request.
/// </summary>
bool IsMatch(Request request);
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Contracts.Filters
{
/// <summary>
/// Builds request filter rules.
/// </summary>
public interface IRuleFactory
{
/// <summary>
/// Creates a filter rule for the given type.
/// </summary>
IRule CreateRule(FilterRuleType type);
}
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Browser.Contracts.Filters
{
/// <summary>
/// Holds data relevant for filtering requests.
/// </summary>
public class Request
{
/// <summary>
/// The full URL of the request.
/// </summary>
public string Url { get; set; }
}
}