fix(0.9.3.10): GRID SERVICES masterbank and Firestorm Experience PRIVATE (#172)

* fix(09310): support Firestorm PRIVATE Experience flag

* fix(09310): support Firestorm PRIVATE Experience flag

* fix(09310): support Firestorm PRIVATE Experience flag

* fix(09310): support Firestorm PRIVATE Experience flag

* fix(09310): support Firestorm PRIVATE Experience flag

* fix(09310): assign GRID SERVICES masterbank

* fix(09310): document GRID SERVICES ledger contract

* fix(09310): support Firestorm PRIVATE Experience flag

* test(09310): allow reserved GRID SERVICES bank UUID only in Grid profile
This commit is contained in:
OpenGenesis (MPL 2.0) authored and GitHub committed 2026-10-11 23:27:25 +02:00
1 parent ec05155c3a
commit 648ce812e8
8 files changed
+109 -22

No files matched your search

@@ -187,6 +187,9 @@ namespace NexVerse.Core.Experiences
public Guid GroupId { get; set; }
public NexExperienceMaturity Maturity { get; set; } = NexExperienceMaturity.General;
public bool Enabled { get; set; } = true;
// Firestorm PROPERTY_PRIVATE: hides this profile from public search;
// existing owner and script-bound permissions remain unchanged.
public bool IsPrivate { get; set; }
public HashSet<Guid> Admins { get; set; } = new HashSet<Guid>();
public HashSet<Guid> Contributors { get; set; } = new HashSet<Guid>();
public HashSet<Guid> AllowedResidents { get; set; } = new HashSet<Guid>();
@@ -383,7 +386,7 @@ namespace NexVerse.Core.Experiences
/// <summary>Owner-only profile editing; no group/ACL elevation.</summary>
public NexExperience UpdateViewerExperience(Guid ownerId, Guid id,
string name, string description, NexExperienceMaturity maturity,
bool enabled, string actor)
bool enabled, string actor, bool isPrivate = false)
{
lock (m_Sync)
{
@@ -394,7 +397,7 @@ namespace NexVerse.Core.Experiences
throw new UnauthorizedAccessException(
"Only the owning avatar can edit this Experience.");
return UpdateProfile(id, ownerId, name, description,
existing.GroupId, maturity, enabled, actor);
existing.GroupId, maturity, enabled, actor, isPrivate);
}
}
@@ -420,7 +423,7 @@ namespace NexVerse.Core.Experiences
{
EnsureActive();
IEnumerable<NexExperience> result =
m_State.Experiences.Where(x => x.Enabled);
m_State.Experiences.Where(x => x.Enabled && !x.IsPrivate);
if (normalized.Length > 0)
{
@@ -446,7 +449,7 @@ namespace NexVerse.Core.Experiences
Guid groupId,
NexExperienceMaturity maturity,
bool enabled,
string actor)
string actor, bool? isPrivate = null)
{
lock (m_Sync)
{
@@ -466,6 +469,8 @@ namespace NexVerse.Core.Experiences
experience.GroupId = groupId;
experience.Maturity = maturity;
experience.Enabled = enabled;
if (isPrivate.HasValue)
experience.IsPrivate = isPrivate.Value;
experience.UpdatedAt = DateTimeOffset.UtcNow;
AddLog(experienceId, actor, "experience.update", normalizedName);
Save();
@@ -672,7 +677,7 @@ namespace NexVerse.Core.Experiences
{
EnsureActive();
return m_State.Experiences
.Where(x => x.Enabled && x.GroupId == groupId)
.Where(x => x.Enabled && !x.IsPrivate && x.GroupId == groupId)
.Select(x => x.ExperienceId).ToArray();
}
}
@@ -1171,6 +1176,7 @@ namespace NexVerse.Core.Experiences
GroupId = source.GroupId,
Maturity = source.Maturity,
Enabled = source.Enabled,
IsPrivate = source.IsPrivate,
Admins = new HashSet<Guid>(source.Admins),
Contributors = new HashSet<Guid>(source.Contributors),
AllowedResidents = new HashSet<Guid>(source.AllowedResidents),
@@ -567,9 +567,11 @@ namespace NexVerse.RegionModules.Experiences
_ => throw new ArgumentException("Unsupported viewer maturity.")
};
int properties = rawProperties.AsInteger();
// Privacy/privilege/grid-scope and unsupported fields must not
// be silently accepted as successful edits.
if ((properties & ~(1 << 6)) != 0)
// Firestorm can edit PRIVATE (bit 5) and DISABLED (bit 6).
// PRIVILEGED, GRID, SUSPENDED, INVALID and unknown flags
// must remain rejected: an owner cannot elevate grid scope.
const int editableFlags = (1 << 5) | (1 << 6);
if ((properties & ~editableFlags) != 0)
throw new ArgumentException("Unsupported Experience property flags.");
if (values.TryGetValue("group_id", out OSD group) &&
!group.AsUUID().IsZero())
@@ -586,7 +588,8 @@ namespace NexVerse.RegionModules.Experiences
name,
description,
maturity,
enabled = (properties & (1 << 6)) == 0
enabled = (properties & (1 << 6)) == 0,
is_private = (properties & (1 << 5)) != 0
});
using HttpRequestMessage request =
CreateViewerManageRequest(HttpMethod.Put, payload);
@@ -904,6 +907,8 @@ namespace NexVerse.RegionModules.Experiences
string owner = e.GetProperty("owner_id").GetString();
string group = e.GetProperty("group_id").GetString();
bool enabled = e.GetProperty("enabled").GetBoolean();
bool isPrivate = e.TryGetProperty("is_private", out JsonElement privateFlag) &&
privateFlag.ValueKind == JsonValueKind.True;
UUID.TryParse(id, out UUID publicId);
UUID.TryParse(owner, out UUID ownerId);
UUID.TryParse(group, out UUID groupId);
@@ -922,7 +927,8 @@ namespace NexVerse.RegionModules.Experiences
2 => 42,
_ => 13
}),
["properties"] = OSD.FromInteger(enabled ? 0 : 1 << 6),
["properties"] = OSD.FromInteger((enabled ? 0 : 1 << 6) |
(isPrivate ? 1 << 5 : 0)),
["expiration"] = OSD.FromReal(600.0),
["quota"] = OSD.FromInteger(128)
};
+7 -4
View File
@@ -185,7 +185,8 @@ namespace NexVerse.Server.Api
owner_id = e.OwnerId.ToString("D"),
group_id = e.GroupId.ToString("D"),
maturity = (int)e.Maturity,
enabled = e.Enabled
enabled = e.Enabled,
is_private = e.IsPrivate
});
}
WriteJson(response, new
@@ -251,14 +252,15 @@ namespace NexVerse.Server.Api
string description = BodyString(viewerBody, "description");
string rawMaturity = BodyString(viewerBody, "maturity");
bool enabled = BodyBool(viewerBody, "enabled", true);
if (viewerBody.EnumerateObject().Count() != 6)
bool isPrivate = BodyBool(viewerBody, "is_private", false);
if (viewerBody.EnumerateObject().Count() != 7)
throw new ArgumentException(
"Viewer update accepts exactly owner_id, experience_id, " +
"name, description, maturity and enabled.");
"name, description, maturity, enabled and is_private.");
experience = m_Store.UpdateViewerExperience(
owner, id, name, description,
ParseMaturity(rawMaturity), enabled,
principal.Subject);
principal.Subject, isPrivate);
Audit(principal, "experience.viewer.updated",
experience.ExperienceId, response);
}
@@ -1043,6 +1045,7 @@ namespace NexVerse.Server.Api
group_id = e.GroupId == Guid.Empty ? null : e.GroupId.ToString("D"),
maturity = e.Maturity.ToString().ToLowerInvariant(),
enabled = e.Enabled,
is_private = e.IsPrivate,
admins = e.Admins.Select(x => x.ToString("D")).ToArray(),
contributors = e.Contributors.Select(x => x.ToString("D")).ToArray(),
allowed_residents = e.AllowedResidents.Select(x => x.ToString("D")).ToArray(),
+1 -1
View File
@@ -165,7 +165,7 @@
BalanceRefreshSeconds = 5
AllowHypergridGuests = false
MasterBankEnabled = false
MasterBankAccountId = ""
MasterBankAccountId = "6571e388-6218-4574-87db-f9379718315e"
MasterBankOperatorId = ""
MasterBankAuthorizedScripts = ""
MasterBankMaxPayout = 100
+18 -5
View File
@@ -214,17 +214,30 @@ freigeben. Der Simulator prueft vor *jedem* Vorgang:
```ini
[NexEconomyViewer]
MasterBankEnabled = false
MasterBankAccountId = ""
MasterBankAccountId = "6571e388-6218-4574-87db-f9379718315e"
MasterBankOperatorId = ""
MasterBankAuthorizedScripts = ""
MasterBankMaxPayout = 100
```
Die Bank darf erst nach kontrollierter Einrichtung aktiviert werden.
`MasterBankAccountId` ist eine fest gewaehlte **neue, unbenutzte UUID**
und darf nicht der UUID eines vorhandenen Avatars, Gruppenwallets oder
Systemkontos entsprechen. Der Server legt das Konto beim ersten
autorisierten Einsatz als Business-Wallet mit **0 NV$** an.
Im NexVerse-Grid ist der fest definierte **GRID SERVICES**-Systembenutzer
(`OpenSim.Framework.Constants.servicesGodAgentID` mit der UUID
`6571e388-6218-4574-87db-f9379718315e`) die gewuenschte Bankkontoidentitaet.
Diese UUID bezeichnet bereits eine OpenSimulator-Service-UserAccount-
Identitaet; sie ersetzt **keine** Operator-Autorisierung und ist
keine automatische Geldschoepfung. Die NV$-Ledgerbuchungen liegen separat
vom OpenSimulator-Benutzerkonto. Sofern die UUID im NV$-Ledger noch
unbenutzt ist, wird beim ersten autorisierten Einsatz ein
**Business-Wallet mit 0 NV$** angelegt. Existiert dort bereits ein
anders klassifiziertes Ledgerkonto, muss der Betreiber dessen Klasse
und bestehende Buchungen pruefen; der Server darf es nicht automatisch
umklassifizieren. Die Konto-UUID allein ermoeglicht keine Auszahlung.
`MasterBankOperatorId` muss eine **andere**, echte Avatar-UUID sein,
die die autorisierten Skriptobjekte besitzt und bewusst
`PERMISSION_DEBIT` erteilt. Erst nach Konfiguration der exakten
Root-Objekt-/Task-Skript-Inventaritem-Bindungen kann
`MasterBankEnabled=true` gesetzt werden.
**Beispiel fuer mehrere Skripte:**
`MasterBankAuthorizedScripts = "OBJEKT-UUID-1/SKRIPT-INVENTAR-UUID-1;OBJEKT-UUID-2/SKRIPT-INVENTAR-UUID-2"`
@@ -135,6 +135,40 @@ internal static class Program
renamedViewer.Maturity == NexExperienceMaturity.Moderate &&
renamedViewer.OwnerId == viewerOwner,
"owner profile editor did not persist name, description and maturity");
// A private Firestorm Experience must persist PRIVATE/disabled flags,
// remain owner-editable, and never appear in public/group search.
NexExperience privateViewer = store.UpdateViewerExperience(viewerOwner,
firstViewer.ExperienceId, "NexVerse Private Demo", "private",
NexExperienceMaturity.Moderate, true, "simulator:viewer", true);
Require(privateViewer.IsPrivate &&
!store.Search("NexVerse Private Demo", 0, 10)
.Any(x => x.ExperienceId == firstViewer.ExperienceId) &&
store.GetViewerOwnedExperienceIds(viewerOwner)
.Contains(firstViewer.ExperienceId),
"Firestorm PROPERTY_PRIVATE was not persisted or leaked via search");
NexExperienceSnapshot privateSnapshot =
JsonSerializer.Deserialize<NexExperienceSnapshot>(File.ReadAllText(path));
Require(privateSnapshot.Experiences.Single(x =>
x.ExperienceId == firstViewer.ExperienceId).IsPrivate,
"private Experience lost flag in durable snapshot");
// Editing other profile fields must not reset the PRIVATE bit.
NexExperience retained = store.UpdateProfile(
firstViewer.ExperienceId, viewerOwner, "NexVerse Private Demo",
"owner edit", Guid.Empty, NexExperienceMaturity.Moderate,
true, "api-admin");
Require(retained.IsPrivate, "unrelated update cleared PRIVATE");
NexExperience publicViewer = store.UpdateViewerExperience(viewerOwner,
firstViewer.ExperienceId, "NexVerse Public Demo", "public",
NexExperienceMaturity.Moderate, false, "simulator:viewer", false);
Require(!publicViewer.IsPrivate && !publicViewer.Enabled &&
store.Search("NexVerse Public Demo", 0, 10).Count == 0,
"Firestorm DISABLED should remain unavailable in public search");
store.UpdateViewerExperience(viewerOwner,
firstViewer.ExperienceId, "NexVerse Public Demo", "public",
NexExperienceMaturity.Moderate, true, "simulator:viewer", false);
Require(store.Search("NexVerse Public Demo", 0, 10)
.Any(x => x.ExperienceId == firstViewer.ExperienceId),
"Re-enabling an unprivileged public Experience failed");
for (int i = 1; i < NexExperienceStore.MaxViewerExperiencesPerResident; i++)
store.CreateViewerExperience(viewerOwner, "simulator:viewer");
bool quotaRejected = false;
+14 -1
View File
@@ -230,6 +230,19 @@ for marker in ("unauthorized Master Bank payout delegation accepted",
for p in ("bin/OpenSim.ini", "bin/OpenSim.ini.example"):
config = Path(p).read_text()
assert "MasterBankEnabled = false" in config
assert 'MasterBankAccountId = ""' in config
expected_bank_id = ('6571e388-6218-4574-87db-f9379718315e'
if p == "bin/OpenSim.ini" else '')
assert f'MasterBankAccountId = "{expected_bank_id}"' in config
assert 'MasterBankAuthorizedScripts = ""' in config
assert "NEXVERSE_ECONOMY_API_KEY" not in Path("tools/diagnostics/ogl_master_bank_payout_test.lsl").read_text()
# NexVerse GRID SERVICES is the explicit default bank identity, not an
# implicit operator or unrestricted script payout authorization.
master_bank_id = "6571e388-6218-4574-87db-f9379718315e"
constants = Path("OpenSim/Framework/Constants.cs").read_text()
assert f'servicesAgentIDString = "{master_bank_id}"' in constants
profile = Path("bin/OpenSim.ini").read_text()
assert f'MasterBankAccountId = "{master_bank_id}"' in profile
assert "MasterBankEnabled = false" in profile
assert 'MasterBankOperatorId = ""' in profile
assert 'MasterBankAuthorizedScripts = ""' in profile
+13 -1
View File
@@ -36,7 +36,9 @@ for token in ("FirestormManageCaps", "ViewerManageApiKey",
"NexExperienceStore.MaxViewerExperiencesPerResident",
'if (!IsCurrentViewer(scene, avatar, lease))',
'owner_id = avatar.ToString()', '"experience_keys"',
"properties & ~(1 << 6)",
"properties & ~editableFlags",
"const int editableFlags = (1 << 5) | (1 << 6)",
'is_private = (properties & (1 << 5)) != 0',
'"UpdateExperience"'):
assert token in viewer, "missing Firestorm CAP safety: " + token
@@ -70,3 +72,13 @@ for token in ("TryParse(string requestPath, string capPath,",
assert token in info_parser, "ExperienceInfo CAP URL guard missing: " + token
assert "NexExperienceInfoRequestIds.TryParse(" in viewer
assert "request.Url?.AbsolutePath, infoCapPath" in viewer
# Privacy must round-trip through the authorized World API and the durable store.
assert 'bool isPrivate = BodyBool(viewerBody, "is_private", false);' in api
assert 'viewerBody.EnumerateObject().Count() != 7' in api
assert 'is_private = e.IsPrivate' in api
assert '(isPrivate ? 1 << 5 : 0)' in viewer
storage = (root/"NexVerse/Core/Experiences/NexExperienceStore.cs").read_text()
assert "public bool IsPrivate { get; set; }" in storage
assert "x.Enabled && !x.IsPrivate" in storage
assert "IsPrivate = source.IsPrivate" in storage