* fix(gen1): allow Radegast-ng and Radegast channel aliases under existing viewer policy * fix(gen1): allow Radegast-ng and Radegast channel aliases under existing viewer policy * fix(gen1): allow Radegast-ng and Radegast channel aliases under existing viewer policy * fix(gen1): return HTTP 503 for NexBus requests racing disposed NodeAgent on shutdown * docs(gen1): include Radegast-ng in access policy and rejection messages * docs(gen1): include Radegast-ng in access policy and rejection messages * docs(gen1): include Radegast-ng in access policy and rejection messages * feat(gen1): reproducible opt-in build of pinned Wolfvoice WebRTC region addon * feat(gen1): optional Wolfvoice region configuration with TLS, key, and CAPS-conflict preflight * docs(gen1): Wolfvoice 0.2.0 integration, upstream hard dependency and safe opt-in procedure * chore(gen1): avoid accidentally vendoring fetched Wolfvoice addon sources * test(gen1): verify NexBus shutdown, Radegast-ng and Wolfvoice opt-in safety * test(gen1): verify NexBus shutdown, Radegast-ng and Wolfvoice opt-in safety * ci(gen1): enforce Radegast-ng, NodeAgent shutdown and optional Wolfvoice integration contracts * ci(gen1): independently build pinned Wolfvoice region addon against NexVerse and validate opt-in config * test(gen1): scope shutdown exception-handler ordering to Receive branch
89 lines
2.8 KiB
C#
89 lines
2.8 KiB
C#
// SPDX-License-Identifier: MPL-2.0
|
|
using System;
|
|
|
|
namespace OpenSim.Framework
|
|
{
|
|
/// <summary>
|
|
/// Generation 1 admission policy for self-reported viewer names.
|
|
/// This is a compatibility allowlist, NOT verified client attestation:
|
|
/// a modified viewer can forge both the channel and version strings.
|
|
/// </summary>
|
|
public static class OglApprovedViewerPolicy
|
|
{
|
|
private static readonly string[] s_AllowedNames =
|
|
{
|
|
"Firestorm", "OpenGenesisLINK", "OGL Viewer", "Radegast-ng", "Radegast"
|
|
};
|
|
|
|
private static readonly string[] s_KnownCopybotNames =
|
|
{
|
|
"Darkstorm", "Hydrastorm", "Copybot"
|
|
};
|
|
|
|
public static bool IsAllowed(string viewer, string channel)
|
|
{
|
|
if (ContainsKnownCopybotName(viewer) || ContainsKnownCopybotName(channel))
|
|
return false;
|
|
|
|
if (StartsWithApprovedName(viewer))
|
|
return string.IsNullOrWhiteSpace(channel) ||
|
|
StartsWithApprovedName(channel) ||
|
|
IsNumericVersion(channel);
|
|
|
|
return StartsWithApprovedName(channel) && IsNumericVersion(viewer);
|
|
}
|
|
|
|
private static bool ContainsKnownCopybotName(string value)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
return false;
|
|
|
|
foreach (string name in s_KnownCopybotNames)
|
|
{
|
|
if (value.Contains(name, StringComparison.OrdinalIgnoreCase))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private static bool StartsWithApprovedName(string value)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
return false;
|
|
|
|
string normalized = value.Trim();
|
|
foreach (string name in s_AllowedNames)
|
|
{
|
|
if (!normalized.StartsWith(name, StringComparison.OrdinalIgnoreCase))
|
|
continue;
|
|
|
|
if (normalized.Length == name.Length)
|
|
return true;
|
|
|
|
char next = normalized[name.Length];
|
|
if (char.IsWhiteSpace(next) || next == '-' || next == '_')
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private static bool IsNumericVersion(string value)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
return true;
|
|
|
|
string normalized = value.Trim();
|
|
if (!char.IsDigit(normalized[0]))
|
|
return false;
|
|
|
|
foreach (char c in normalized)
|
|
{
|
|
if (!char.IsDigit(c) && c != '.' && c != '-' &&
|
|
c != '_' && c != '(' && c != ')' && !char.IsWhiteSpace(c))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|