Bereits eingerichtete Schlüssel nicht unnötig neu erzeugen. Neue API-Schlüssel bleiben zusätzlich zu bestehenden registriert, bis sie ausdrücklich deaktiviert werden.
-
+
@@ -1825,7 +1825,7 @@ async function secretGenerate(onlyRegistration=false, onlyGroupLand=false) {
{wanted:wantGroupLand,name:'OGL Simulator Group Land',
scopes:['groups:read'],env:'NEXVERSE_GROUP_LAND_API_KEY'},
{wanted:wantEconomy,name:'OGL Simulator Economy',
- scopes:['economy:read','economy:transfer'],env:'NEXVERSE_ECONOMY_API_KEY'},
+ scopes:['economy:read','economy:transfer','groups:read'],env:'NEXVERSE_ECONOMY_API_KEY'},
{wanted:wantExperiences,name:'OGL Simulator Experiences',
scopes:['experiences:script'],env:'NEXVERSE_EXPERIENCES_API_KEY'},
{wanted:wantPermissions,name:'OGL Simulator Experience Permissions',
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
index e0dbee95..be779b17 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
@@ -209,7 +209,22 @@ namespace OpenSim.Region.ClientStack.Linden
for (int i = 0; i < numberMeshs; i++)
{
ameshCostParam curCost = new ameshCostParam();
- byte[] data = (byte[])resources.mesh_list.Array[i];
+ if (resources.mesh_list.Array[i] is not OSD meshData)
+ {
+ error = "Invalid mesh list entry at index " + i;
+ return false;
+ }
+ if (meshData == null || meshData.Type != OSDType.Binary)
+ {
+ error = "Invalid mesh binary data at index " + i;
+ return false;
+ }
+ byte[] data = meshData.AsBinary();
+ if (data == null || data.Length == 0)
+ {
+ error = "Missing mesh binary data at index " + i;
+ return false;
+ }
if (!MeshCost(data, curCost, out curskeleton, out curAvatarPhys, out error))
{
@@ -235,21 +250,20 @@ namespace OpenSim.Region.ClientStack.Linden
// instances (prims) cost
- int mesh;
int skipedSmall = 0;
for (int i = 0; i < numberInstances; i++)
{
- Hashtable inst = (Hashtable)resources.instance_list.Array[i];
-
- ArrayList ascale = (ArrayList)inst["scale"];
- Vector3 scale;
- double tmp;
- tmp = (double)ascale[0];
- scale.X = (float)tmp;
- tmp = (double)ascale[1];
- scale.Y = (float)tmp;
- tmp = (double)ascale[2];
- scale.Z = (float)tmp;
+ if (resources.instance_list.Array[i] is not OSD rawInstance)
+ {
+ error = "Invalid LLSD instance entry at index " + i;
+ return false;
+ }
+ if (!TryParseModelInstance(rawInstance, numberMeshs,
+ out Vector3 scale, out int mesh, out error))
+ {
+ error = "Invalid model instance " + i + ": " + error;
+ return false;
+ }
if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin)
{
@@ -263,15 +277,8 @@ namespace OpenSim.Region.ClientStack.Linden
return false;
}
- if (haveMeshs && inst.ContainsKey("mesh"))
+ if (haveMeshs && mesh >= 0)
{
- mesh = (int)inst["mesh"];
-
- if (mesh >= numberMeshs)
- {
- error = "Incoerent model information.";
- return false;
- }
// streamming cost
@@ -339,6 +346,56 @@ namespace OpenSim.Region.ClientStack.Linden
return true;
}
+ ///
+ /// Decode a viewer's model instance from LLSD. The capability's
+ /// instance_list contains OSDMap/OSDArray values, not Hashtable
+ /// and ArrayList; invalid casts used to reject otherwise valid models.
+ ///
+ public static bool TryParseModelInstance(OSD instance, int meshCount,
+ out Vector3 scale, out int meshIndex, out string error)
+ {
+ scale = Vector3.Zero;
+ meshIndex = -1;
+ error = string.Empty;
+
+ if (instance is not OSDMap map ||
+ !map.TryGetValue("scale", out OSD rawScale) ||
+ rawScale is not OSDArray values || values.Count != 3)
+ {
+ error = "missing or invalid scale array";
+ return false;
+ }
+
+ double x = values[0].AsReal();
+ double y = values[1].AsReal();
+ double z = values[2].AsReal();
+ if (!double.IsFinite(x) || !double.IsFinite(y) || !double.IsFinite(z) ||
+ x <= 0 || y <= 0 || z <= 0 ||
+ x > float.MaxValue || y > float.MaxValue || z > float.MaxValue)
+ {
+ error = "scale components must be finite positive numbers";
+ return false;
+ }
+
+ scale = new Vector3((float)x, (float)y, (float)z);
+ if (map.TryGetValue("mesh", out OSD rawIndex))
+ {
+ if (rawIndex.Type != OSDType.Integer)
+ {
+ error = "mesh index is not an integer";
+ return false;
+ }
+ meshIndex = rawIndex.AsInteger();
+ if (meshIndex < 0 || meshIndex >= meshCount)
+ {
+ error = "mesh index out of bounds";
+ return false;
+ }
+ }
+
+ return true;
+ }
+
// single mesh asset cost
private bool MeshCost(byte[] data, ameshCostParam cost,out bool skeleton, out bool avatarPhys, out string error)
{
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
index 16b341a2..2eb744f0 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
@@ -159,6 +159,23 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
///
/// Test an attempt to put a message on the queue of a user that is not in the region.
///
+ [Test]
+ public void TestEmptyQueueReturnsExpectedEventQueueProtocolStatus()
+ {
+ TestHelpers.InMethod();
+ UUID agentId = TestHelpers.ParseTail(0x1);
+ SceneHelpers.AddScenePresence(m_scene, agentId);
+
+ // EventQueueGet long polling intentionally returns 502 when a
+ // valid agent has no queued events (not a failed mesh upload).
+ Hashtable empty = m_eqgMod.NoEvents(UUID.Zero, agentId);
+ Assert.That((int)empty["int_response_code"],
+ Is.EqualTo((int)HttpStatusCode.BadGateway));
+ Hashtable missing = m_eqgMod.NoEvents(UUID.Zero, UUID.Random());
+ Assert.That((int)missing["int_response_code"],
+ Is.EqualTo((int)HttpStatusCode.NotFound));
+ }
+
[Test]
public void TestEnqueueMessageNoUser()
{
diff --git a/doc/NexVerse/MESH_UPLOAD_EVENTQUEUE_502_DIAGNOSTICS.md b/doc/NexVerse/MESH_UPLOAD_EVENTQUEUE_502_DIAGNOSTICS.md
new file mode 100644
index 00000000..c59cb436
--- /dev/null
+++ b/doc/NexVerse/MESH_UPLOAD_EVENTQUEUE_502_DIAGNOSTICS.md
@@ -0,0 +1,70 @@
+# Mesh-Upload in Firestorm: CE/502 und LLSD-Kostenschätzung
+
+## Diagnose (2026-10-22)
+
+Firestorm meldet beim Mesh-Upload wiederholt:
+
+```
+POST http://mainland.stadt-nexverse.de:9000/CE/ 502 Bad Gateway
+```
+
+`/CE/` ist in OGL der **EventQueueGet**-Long-Poll-Endpunkt, nicht
+der Mesh-Upload-Endpunkt. `EventQueueGetModule.NoEvents()` liefert
+für eine vorhandene, aktuell leere Queue absichtlich `502 Bad Gateway`;
+für eine unbekannte/geschlossene Queue dagegen `404`.
+Daher ist **502 allein kein Beweis**, dass der Mesh-Upload oder der
+Reverse-Proxy defekt ist. EventQueue-502 darf nicht ohne ein
+Protokoll-/Viewer-Kompatibilitätstest zu 200 geändert werden.
+
+Ein eigenständiger Fehler war jedoch in der **Mesh-Gebührenberechnung**
+vorhanden: `MeshModelCost()` versuchte, LLSD-`instance_list`-Elemente
+als `Hashtable` und `scale` als `ArrayList` zu lesen.
+Die Viewer-Daten sind `OSDMap` und `OSDArray`; gültige Uploads
+konnten dadurch einen `InvalidCastException` auslösen, anschließend
+`state=error` und eine leere `uploader`-URL liefern. Der neue Parser
+liest typisierte LLSD-Daten und lehnt ungültige Skalierungen und
+Mesh-Indizes ausdrücklich ab. Binäre Mesh-Blöcke werden ebenfalls
+typgeprüft.
+
+## Nach Update überprüfen
+
+1. ROBUST und **betroffenen Simulator** mit demselben neuen
+ GitHub-`main`-Stand bauen. Bestehende Deployment-Secrets behalten.
+2. Den Simulator neu starten. Sicherstellen, dass Port
+ `mainland.stadt-nexverse.de:9000` extern wirklich beim **aktiven**
+ Simulator-HTTP-Listener ankommt. Bei `[NexVerseAutoPorts] Enabled=true`
+ kann der Prozess eine andere Portnummer aus 9000–9099 wählen.
+ Reverse-Proxy-Port/Portfreigaben entsprechend abgleichen. HTTP-Port
+ nicht mit dem UDP-Regionsport verwechseln.
+3. In Firestorm dasselbe Mesh erneut hochladen; zuerst die
+ **Kostenberechnung**, dann den separaten **POST an die zurückgelieferte
+ `uploader`-URL** beurteilen. Nach erfolgreicher Gebührenanfrage muss
+ das LLSD-Feld `state=upload` und eine nichtleere `uploader`-URL
+ geliefert werden.
+4. Serverlog unmittelbar zum Upload-Zeitpunkt betrachten:
+
+```bash
+grep -Ei 'MESH UPLOAD|NewAgentInventory|AssetUploader|BUNCH OF CAPS|EVENTQUEUE|Exception|HTTP' /opt/developer/bin/OpenSim.log | tail -n 120
+```
+
+Wenn `[MESH UPLOAD]: Fee validation rejected` erscheint, die konkrete
+Fehlermeldung prüfen. `Insufficient funds` bzw.
+`Insufficient permissions to upload` sind eigenständige Gründe.
+Ein `/CE/`-502 ohne fehlgeschlagenen Upload-/Gebühren-HTTP-Aufruf kann
+ein normales EventQueue-Long-Poll-Ende sein.
+
+**Nicht durch CI abgedeckt:** Öffentliche Proxy-Erreichbarkeit,
+Firewall-Regeln und der tatsächliche Mesh-Upload von Firestorm
+gegen die produktive Region. Dafür sind Simulatorzugriff und ein echter
+Viewer-Praxistest nötig.
+
+## Economy-Key und Gruppenhistorie
+
+Der World-API-Control-Center-Economy-Generator gibt für **neue**
+Simulator-Economy-Schlüssel die Scopes
+`economy:read`, `economy:transfer` und `groups:read` aus.
+Damit kann die Firestorm-Gruppenhistorie nach lokaler
+`GroupPowers.Accountable`-Prüfung geladen werden. Bereits erzeugte
+Schlüssel werden nicht stillschweigend umgestellt. Für Rotation erst
+den neuen Schlüssel generieren, Simulatoren umstellen und danach
+den alten Schlüssel deaktivieren.
diff --git a/doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md b/doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md
index 83c22506..9b638084 100644
--- a/doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md
+++ b/doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md
@@ -88,8 +88,11 @@ Avatars und überträgt die Buchungszeilen anschließend in die nativen
`GroupAccountDetailsReply`- und `GroupAccountTransactionsReply`-Pakete.
**Konfiguration:** Der Simulator-Key unter `[NexEconomyViewer] ApiKey`
-muss für diese neue Funktion zusätzlich zu `economy:read` auch
-`groups:read` enthalten. Die World API akzeptiert für den
+muss für diese Funktion zusätzlich zu `economy:read` auch
+`groups:read` enthalten. **Der aktualisierte World-API-Schlüsselgenerator**
+für Economy stellt neue Schlüssel mit `economy:read`,
+`economy:transfer` und `groups:read` aus. Bestehende Economy-Schlüssel
+bleiben unverändert und müssen bei Bedarf explizit rotiert werden. Die World API akzeptiert für den
Gruppenverlauf nur einen ausdrücklich doppelt berechtigten Maschinen-Key
oder einen tatsächlich berechtigten Bewohner-Token. Ohne die zusätzliche
Berechtigung bleibt der Kontostand funktionsfähig, der Verlauf kann jedoch
diff --git a/tools/ci/NexApiKeyRegression/Program.cs b/tools/ci/NexApiKeyRegression/Program.cs
index 445df29f..9c8d03d8 100644
--- a/tools/ci/NexApiKeyRegression/Program.cs
+++ b/tools/ci/NexApiKeyRegression/Program.cs
@@ -103,6 +103,27 @@ internal static class Program
persistedLand.Scopes[0] == NexScopes.GroupsRead,
"Group land API key did not survive restart with least privilege");
+ // New simulator Economy keys may read NV$ group history only
+ // when groups:read is explicitly included. No admin scope.
+ NexApiKeyRegistration groupHistoryEconomy = reloaded.Create(
+ "OGL Simulator Economy",
+ new[] {
+ NexScopes.EconomyRead,
+ NexScopes.EconomyTransfer,
+ NexScopes.GroupsRead
+ });
+ PersistentNexApiKeyStore economyReloaded =
+ new PersistentNexApiKeyStore(path);
+ Require(economyReloaded.TryValidate(
+ groupHistoryEconomy.ApiKey,
+ out NexApiKeyRecord economyScopes) &&
+ economyScopes.Scopes.Length == 3 &&
+ economyScopes.Scopes.Contains(NexScopes.EconomyRead) &&
+ economyScopes.Scopes.Contains(NexScopes.EconomyTransfer) &&
+ economyScopes.Scopes.Contains(NexScopes.GroupsRead) &&
+ !economyScopes.Scopes.Contains(NexScopes.AdminAll),
+ "Group-history Economy key lacks correct persistent scopes");
+
bool rejectedAdmin = false;
try
{
@@ -231,7 +252,7 @@ internal static class Program
}
catch (InvalidOperationException) { rejectedDuplicate = true; }
Require(rejectedDuplicate, "Duplicate enabled service key accepted");
- Require(experiencesReloaded.List().Count == 5,
+ Require(experiencesReloaded.List().Count == 6,
"Duplicate rejection modified the persistent key inventory");
// Deletion is an irreversible second step after explicit disable.
@@ -261,7 +282,7 @@ internal static class Program
"Last-used metadata lost when cloning records");
PersistentNexApiKeyStore afterCleanup =
new PersistentNexApiKeyStore(path);
- Require(afterCleanup.List().Count == 5 &&
+ Require(afterCleanup.List().Count == 6 &&
afterCleanup.TryValidate(replacement.ApiKey, out _),
"Key cleanup or replacement did not survive restart");
diff --git a/tools/ci/NexMeshUploadFeeRegression/NexMeshUploadFeeRegression.csproj b/tools/ci/NexMeshUploadFeeRegression/NexMeshUploadFeeRegression.csproj
new file mode 100644
index 00000000..09c01d71
--- /dev/null
+++ b/tools/ci/NexMeshUploadFeeRegression/NexMeshUploadFeeRegression.csproj
@@ -0,0 +1,14 @@
+
+
+ Exe
+ net8.0
+ disable
+ disable
+
+
+
+ ../../../bin/OpenMetaverse.dllTrue
+ ../../../bin/OpenMetaverse.StructuredData.dllTrue
+ ../../../bin/OpenMetaverseTypes.dllTrue
+
+
diff --git a/tools/ci/NexMeshUploadFeeRegression/Program.cs b/tools/ci/NexMeshUploadFeeRegression/Program.cs
new file mode 100644
index 00000000..960f2600
--- /dev/null
+++ b/tools/ci/NexMeshUploadFeeRegression/Program.cs
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: MPL-2.0
+// Real LLSD instance structures as sent in mesh upload fee requests.
+using System;
+using OpenMetaverse;
+using OpenMetaverse.StructuredData;
+using OpenSim.Region.ClientStack.Linden;
+
+internal static class Program
+{
+ private static void Assert(bool result, string reason)
+ {
+ if (!result) throw new InvalidOperationException("Mesh fee LLSD regression: " + reason);
+ }
+
+ private static OSDMap Instance(OSD scale, OSD mesh = null)
+ {
+ var map = new OSDMap { ["scale"] = scale };
+ if (mesh != null) map["mesh"] = mesh;
+ return map;
+ }
+
+ private static OSDArray Scale(double x, double y, double z)
+ {
+ return new OSDArray {
+ OSD.FromReal(x), OSD.FromReal(y), OSD.FromReal(z)
+ };
+ }
+
+ private static void Main()
+ {
+ // These are OSD maps/arrays after real LLSD decoding, NOT
+ // legacy Hashtable/ArrayList. Valid uploads used to throw.
+ var ok = Instance(Scale(1.5, 2.0, 0.5), OSD.FromInteger(0));
+ Assert(ModelCost.TryParseModelInstance(ok, 1, out Vector3 scale,
+ out int mesh, out string error),
+ "valid mesh instance rejected: " + error);
+ Assert(mesh == 0 && scale.X == 1.5f && scale.Y == 2f &&
+ scale.Z == 0.5f, "valid LLSD values were not preserved");
+
+ var other = Instance(Scale(1, 1, 1), OSD.FromInteger(2));
+ Assert(ModelCost.TryParseModelInstance(other, 3, out _,
+ out mesh, out _) && mesh == 2,
+ "multi-mesh index rejected");
+ var prim = Instance(Scale(1, 2, 3));
+ Assert(ModelCost.TryParseModelInstance(prim, 0, out _,
+ out mesh, out _) && mesh == -1,
+ "non-mesh instance rejected");
+ Assert(!ModelCost.TryParseModelInstance(other, 2, out _,
+ out _, out error) && error.Contains("bounds"),
+ "out-of-range mesh index accepted");
+ Assert(!ModelCost.TryParseModelInstance(
+ Instance(Scale(1, 1, 1), OSD.FromInteger(-1)), 2,
+ out _, out _, out _), "negative mesh index accepted");
+ Assert(!ModelCost.TryParseModelInstance(
+ Instance(Scale(1, 1, 1), OSD.FromString("0")), 2,
+ out _, out _, out _), "noninteger mesh reference accepted");
+ Assert(!ModelCost.TryParseModelInstance(
+ Instance(new OSDArray { OSD.FromInteger(1) }), 2,
+ out _, out _, out _), "truncated scale accepted");
+ Assert(!ModelCost.TryParseModelInstance(
+ Instance(Scale(1, 0, 1)), 1,
+ out _, out _, out _), "zero scale accepted");
+ Assert(!ModelCost.TryParseModelInstance(
+ Instance(Scale(double.NaN, 1, 1)), 1,
+ out _, out _, out _), "NaN scale accepted");
+ Assert(!ModelCost.TryParseModelInstance(
+ Instance(Scale(double.PositiveInfinity, 1, 1)), 1,
+ out _, out _, out _), "infinite scale accepted");
+ Assert(!ModelCost.TryParseModelInstance(
+ Instance(Scale(double.MaxValue, 1, 1)), 1,
+ out _, out _, out _), "overflow scale accepted");
+ Assert(!ModelCost.TryParseModelInstance(new OSDMap(), 1,
+ out _, out _, out _), "missing scale accepted");
+ Assert(!ModelCost.TryParseModelInstance(OSD.FromString("bad"), 1,
+ out _, out _, out _), "non-map instance accepted");
+ Console.WriteLine("OpenGenesisLINK Mesh upload fee LLSD instance regression: OK");
+ }
+}