diff --git a/.github/workflows/nexjast-ci.yml b/.github/workflows/nexjast-ci.yml
index 97b5aceb..f8695f5d 100644
--- a/.github/workflows/nexjast-ci.yml
+++ b/.github/workflows/nexjast-ci.yml
@@ -365,6 +365,10 @@ jobs:
shell: bash
run: python3 tools/ci/verify_nexgroups_security.py
+ - name: Verify one-click World API group land key issuance
+ shell: bash
+ run: python3 tools/ci/verify_worldapi_group_land_key_setup.py
+
- name: Verify Firestorm Experience acquire and editor security
shell: bash
run: python3 tools/ci/verify_experience_viewer_purchase.py
diff --git a/NexVerse/Server/Api/NexApiDocsPage.cs b/NexVerse/Server/Api/NexApiDocsPage.cs
index 565da090..dc70489e 100644
--- a/NexVerse/Server/Api/NexApiDocsPage.cs
+++ b/NexVerse/Server/Api/NexApiDocsPage.cs
@@ -608,6 +608,7 @@ Archivprüfungen bleiben auch für freigegebene Importe aktiv.
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.
+
@@ -616,8 +617,10 @@ Archivprüfungen bleiben auch für freigegebene Importe aktiv.
+
Für die Stadtportal-Registrierung genügt dieser einzelne Schlüssel. Der Button ignoriert die Vorauswahl für Experiences und NexBus und verlangt keine NexBus-URLs. NEXVERSE_REGISTER_API_KEY gehört ausschließlich in die geschützte Umgebung des Stadtportal-Backends, niemals in Browser-JavaScript oder auf öffentliche Seiten.
+
Der Gruppenland-Button erstellt ausschließlich groups:read, unabhängig von den anderen Häkchen und ohne NexBus-URLs. NEXVERSE_GROUP_LAND_API_KEY gehört nur in die geschützte Environment-Datei der Simulatoren. Bereits aktive Schlüssel werden vor einer Neuausstellung geprüft.
Der NexBus-SharedKey ist kein World-API-Key. Er wird lokal im Browser per kryptografisch sicherem Zufall erzeugt und muss auf allen beteiligten Nodes identisch sein.
@@ -1687,7 +1690,8 @@ function secretValidateEndpoint(text) {
return url.href;
}
function secretBuildLines(values) {
- const names=['NEXVERSE_REGISTER_API_KEY','NEXVERSE_ECONOMY_API_KEY','NEXVERSE_EXPERIENCES_API_KEY',
+ const names=['NEXVERSE_REGISTER_API_KEY','NEXVERSE_ECONOMY_API_KEY',
+ 'NEXVERSE_GROUP_LAND_API_KEY','NEXVERSE_EXPERIENCES_API_KEY',
'NEXVERSE_EXPERIENCES_VIEWER_PERMISSIONS_API_KEY',
'NEXVERSE_EXPERIENCES_VIEWER_MANAGE_API_KEY',
'NEXVERSE_NEXBUS_SHARED_KEY','NEXVERSE_NEXBUS_PEER_URL','NEXVERSE_NEXBUS_PEERS'];
@@ -1787,20 +1791,23 @@ async function secretAdminToken() {
return token;
}
let secretIssuePending=false;
-async function secretGenerate(onlyRegistration=false) {
+async function secretGenerate(onlyRegistration=false, onlyGroupLand=false) {
if(secretIssuePending)return;
- const wantRegister=onlyRegistration||$('secretRegister').checked;
- const wantEconomy=!onlyRegistration&&$('secretEconomy').checked;
- const wantExperiences=!onlyRegistration&&$('secretExperiences').checked;
- const wantPermissions=!onlyRegistration&&$('secretExperiencePermissions').checked;
- const wantManage=!onlyRegistration&&$('secretExperienceManage').checked;
- const wantBus=!onlyRegistration&&$('secretNexBus').checked;
- if(!wantRegister&&!wantEconomy&&!wantExperiences&&!wantPermissions&&!wantManage&&!wantBus){
+ const onlyOne=onlyRegistration||onlyGroupLand;
+ const wantRegister=onlyRegistration||(!onlyOne&&$('secretRegister').checked);
+ const wantGroupLand=onlyGroupLand||(!onlyOne&&$('secretGroupLand').checked);
+ const wantEconomy=!onlyOne&&$('secretEconomy').checked;
+ const wantExperiences=!onlyOne&&$('secretExperiences').checked;
+ const wantPermissions=!onlyOne&&$('secretExperiencePermissions').checked;
+ const wantManage=!onlyOne&&$('secretExperienceManage').checked;
+ const wantBus=!onlyOne&&$('secretNexBus').checked;
+ if(!wantRegister&&!wantGroupLand&&!wantEconomy&&!wantExperiences&&!wantPermissions&&!wantManage&&!wantBus){
secretStatus('Bitte mindestens einen Schlüssel auswählen.',false);return;
}
secretIssuePending=true;
$('secretGenerate').disabled=true;
$('secretGenerateRegistration').disabled=true;
+ $('secretGenerateGroupLand').disabled=true;
const values={};
let peers=[];
let peerUrl='';
@@ -1815,6 +1822,8 @@ async function secretGenerate(onlyRegistration=false) {
const plan=[
{wanted:wantRegister,name:'OGL Stadtportal Registrierung',
scopes:['users:register'],env:'NEXVERSE_REGISTER_API_KEY'},
+ {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'},
{wanted:wantExperiences,name:'OGL Simulator Experiences',
@@ -1839,6 +1848,8 @@ async function secretGenerate(onlyRegistration=false) {
}
if(!window.confirm(onlyRegistration?
'Neuen dedizierten Registrierungs-API-Key (nur users:register) für das Stadtportal-Backend erstellen?':
+ onlyGroupLand?
+ 'Neuen dedizierten Gruppenland-API-Key (nur groups:read) für die Simulatoren erstellen?':
'Neue Maschinen-API-Schlüssel werden sofort serverseitig registriert. Erstellung starten?'))return;
$('secretCopy').disabled=true;
$('secretOutput').value='';
@@ -1864,6 +1875,8 @@ async function secretGenerate(onlyRegistration=false) {
}
secretStatus(onlyRegistration?
'Registrierungs-API-Key erstellt. NEXVERSE_REGISTER_API_KEY jetzt ausschließlich ins Stadtportal-Backend kopieren.':
+ onlyGroupLand?
+ 'Gruppenland-API-Key erstellt. NEXVERSE_GROUP_LAND_API_KEY jetzt in die geschützte Simulator-Environment-Datei kopieren.':
'Alle ausgewählten Schlüssel erstellt. Konfigurationsblock jetzt sicher kopieren.',true);
if(plan.length)await secretLoadKeys();
}catch(err){
@@ -1874,6 +1887,7 @@ async function secretGenerate(onlyRegistration=false) {
secretIssuePending=false;
$('secretGenerate').disabled=false;
$('secretGenerateRegistration').disabled=false;
+ $('secretGenerateGroupLand').disabled=false;
}
}
async function secretCopy() {
@@ -1964,6 +1978,7 @@ $('adminLoginPassword').addEventListener('keydown',event=>{if(event.key==='Enter
$('adminLoginTotp').addEventListener('keydown',event=>{if(event.key==='Enter'){event.preventDefault();adminLogin()}});
$('secretGenerate').addEventListener('click',()=>secretGenerate());
$('secretGenerateRegistration').addEventListener('click',()=>secretGenerate(true));
+$('secretGenerateGroupLand').addEventListener('click',()=>secretGenerate(false,true));
$('secretCopy').addEventListener('click',secretCopy);
$('secretClear').addEventListener('click',secretClear);
$('secretLoadKeys').addEventListener('click',secretLoadKeys);
diff --git a/bin/nexverse.env.example b/bin/nexverse.env.example
index f3b5d534..50125927 100644
--- a/bin/nexverse.env.example
+++ b/bin/nexverse.env.example
@@ -12,6 +12,9 @@ NEXVERSE_NATIVE_TOKEN_SIGNING_KEY=
# SIMULATOR: dedizierte Machine API Keys, nicht auf Robust publizieren.
# Die Gueltigkeit und Scopes werden zentral im World API Key Store verwaltet.
NEXVERSE_ECONOMY_API_KEY=
+# Gruppenland-Verzeichnis, ausschließlich groups:read.
+# Über /api/v1/docs -> Schlüssel & Einrichtung -> Nur Gruppenland-API-Key erstellen.
+NEXVERSE_GROUP_LAND_API_KEY=
NEXVERSE_EXPERIENCES_API_KEY=
# Firestorm Allow/Block/Forget: NUR bei kontrolliert aktiviertem
# [NexExperiencesViewer] FirestormPermissionCaps=true.
diff --git a/doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md b/doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md
index 89dcad23..83c22506 100644
--- a/doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md
+++ b/doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md
@@ -36,6 +36,28 @@ expliziten Scope `groups:read` für die Simulator-Landverzeichnisse
erstellen. Nicht das Admin-Token und keinen Avatar-Token verwenden.
Dieser Schlüssel muss nur für den Simulator erreichbar sein.
+**Ein-Klick-Erstellung im World-API-Control-Center:**
+
+1. `https://world.stadt-nexverse.de/api/v1/docs` über HTTPS öffnen,
+ unter **Admin-Anmeldung** mit einem Administrator (UserLevel mindestens
+ 200, `admin:*`) anmelden.
+2. Unter **Schlüssel & Einrichtung** auf **Nur Gruppenland-API-Key erstellen**
+ klicken. Die anderen Vorauswahlen für Experiences/NexBus werden
+ ignoriert; NexBus-URLs sind dafür nicht erforderlich.
+3. Den Hinweis bestätigen. Die World API erstellt nur einen Schlüssel
+ namens `OGL Simulator Group Land` mit exakt `groups:read` und zeigt
+ `NEXVERSE_GROUP_LAND_API_KEY=` zum Kopieren.
+4. Die Zeile in `/etc/nexverse/nexverse.env` auf **jedem betroffenen
+ Simulator-Host** speichern, Dateiberechtigungen auf `600` setzen
+ und den Simulator neu starten.
+
+Alternativ die Checkbox **NexGroups / Gridweite Landabfrage** im
+Mehrfachgenerator auswählen. Bereits vorhandene aktive Schlüssel mit
+gleichem Namen und denselben Scopes werden erkannt und nicht
+überschrieben. Verlorene API-Secrets lassen sich nicht erneut anzeigen:
+für eine Rotation den bisherigen Schlüssel gezielt deaktivieren und einen
+neuen ausstellen. Keine Schlüssel ins Git-Repository committen.
+
Im Simulator:
```ini
diff --git a/tools/ci/NexApiKeyRegression/Program.cs b/tools/ci/NexApiKeyRegression/Program.cs
index 76745d61..445df29f 100644
--- a/tools/ci/NexApiKeyRegression/Program.cs
+++ b/tools/ci/NexApiKeyRegression/Program.cs
@@ -83,6 +83,26 @@ internal static class Program
out _),
"disabled API key remained valid");
+ // Dedicated groups:read-only simulator key must be accepted,
+ // persisted and must not accidentally obtain finance/admin scopes.
+ NexApiKeyRegistration groupLand = reloaded.Create(
+ "OGL Simulator Group Land",
+ new[] { NexScopes.GroupsRead });
+ Require(
+ reloaded.TryValidate(groupLand.ApiKey,
+ out NexApiKeyRecord groupLandRecord) &&
+ groupLandRecord.Scopes.Length == 1 &&
+ string.Equals(groupLandRecord.Scopes[0],
+ NexScopes.GroupsRead, StringComparison.OrdinalIgnoreCase),
+ "Group land API key did not retain exactly groups:read");
+ PersistentNexApiKeyStore groupsReloaded =
+ new PersistentNexApiKeyStore(path);
+ Require(groupsReloaded.TryValidate(groupLand.ApiKey,
+ out NexApiKeyRecord persistedLand) &&
+ persistedLand.Scopes.Length == 1 &&
+ persistedLand.Scopes[0] == NexScopes.GroupsRead,
+ "Group land API key did not survive restart with least privilege");
+
bool rejectedAdmin = false;
try
{
@@ -211,7 +231,7 @@ internal static class Program
}
catch (InvalidOperationException) { rejectedDuplicate = true; }
Require(rejectedDuplicate, "Duplicate enabled service key accepted");
- Require(experiencesReloaded.List().Count == 4,
+ Require(experiencesReloaded.List().Count == 5,
"Duplicate rejection modified the persistent key inventory");
// Deletion is an irreversible second step after explicit disable.
@@ -241,7 +261,7 @@ internal static class Program
"Last-used metadata lost when cloning records");
PersistentNexApiKeyStore afterCleanup =
new PersistentNexApiKeyStore(path);
- Require(afterCleanup.List().Count == 4 &&
+ Require(afterCleanup.List().Count == 5 &&
afterCleanup.TryValidate(replacement.ApiKey, out _),
"Key cleanup or replacement did not survive restart");
diff --git a/tools/ci/verify_experiences_nexbus_enabled.py b/tools/ci/verify_experiences_nexbus_enabled.py
index cb7e08cd..354ea4c8 100644
--- a/tools/ci/verify_experiences_nexbus_enabled.py
+++ b/tools/ci/verify_experiences_nexbus_enabled.py
@@ -92,15 +92,15 @@ for marker in ('data-page="adminlogin"','id="page-adminlogin"','id="adminLoginPa
assert 'id="secretExperienceManage"' in ui
assert "'NEXVERSE_EXPERIENCES_VIEWER_MANAGE_API_KEY'" in ui
assert "scopes:['experiences:viewer:manage']" in ui
-assert "const wantManage=!onlyRegistration&&$('secretExperienceManage').checked;" in ui
+assert "const wantManage=!onlyOne&&$('secretExperienceManage').checked;" in ui
# Registration credential: the browser issues a dedicated server-only key,
# never a generic users:write/admin key. The shortcut must ignore existing
# Experiences/NexBus defaults (and must not demand NexBus peer URLs).
for marker in ('id="secretRegister"', 'id="secretGenerateRegistration"',
"'NEXVERSE_REGISTER_API_KEY'",
"scopes:['users:register'],env:'NEXVERSE_REGISTER_API_KEY'",
- "const wantRegister=onlyRegistration||$('secretRegister').checked;",
- "const wantBus=!onlyRegistration&&$('secretNexBus').checked;",
+ "const wantRegister=onlyRegistration||(!onlyOne&&$('secretRegister').checked);",
+ "const wantBus=!onlyOne&&$('secretNexBus').checked;",
"secretGenerate(true)"):
assert marker in ui, f"Registration API key control missing: {marker}"
assert "let secretIssuePending=false;" in ui
diff --git a/tools/ci/verify_worldapi_group_land_key_setup.py b/tools/ci/verify_worldapi_group_land_key_setup.py
new file mode 100644
index 00000000..f3891d67
--- /dev/null
+++ b/tools/ci/verify_worldapi_group_land_key_setup.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python3
+"""Guard the one-click NexGroups groups:read key setup in the World API UI."""
+
+from pathlib import Path
+
+root = Path(__file__).resolve().parents[2]
+page = (root / "NexVerse/Server/Api/NexApiDocsPage.cs").read_text(encoding="utf-8")
+keys = (root / "NexVerse/Core/Security/NexApiKeyStore.cs").read_text(encoding="utf-8")
+docs = (root / "doc/NexVerse/NEXGROUPS_GRID_LAND_HISTORY.md").read_text(encoding="utf-8")
+auth = (root / "NexVerse/Server/Api/NexVerseUserApi.cs").read_text(encoding="utf-8")
+
+# The chooser and single-purpose shortcut are separate controls.
+assert page.count('id="secretGroupLand"') == 1
+assert page.count('id="secretGenerateGroupLand"') == 1
+assert "NexGroups / Gridweite Landabfrage" in page
+assert "groups:read" in page
+assert "$('secretGenerateGroupLand').addEventListener('click',()=>secretGenerate(false,true));" in page
+
+generator = page.split("async function secretGenerate(onlyRegistration=false, onlyGroupLand=false) {", 1)[1].split(
+ "async function secretCopy()", 1
+)[0]
+# Quick-create must not inherit the checked Experiences/NexBus selections.
+assert "const onlyOne=onlyRegistration||onlyGroupLand;" in generator
+assert "const wantRegister=onlyRegistration||(!onlyOne&&$('secretRegister').checked);" in generator
+assert "const wantGroupLand=onlyGroupLand||(!onlyOne&&$('secretGroupLand').checked);" in generator
+for control in ("secretEconomy", "secretExperiences", "secretExperiencePermissions",
+ "secretExperienceManage", "secretNexBus"):
+ assert f"const want" in generator
+ assert f"!onlyOne&&$('{control}').checked" in generator
+assert "if(wantBus){" in generator
+assert generator.index("if(wantBus){") < generator.index("const plan=[")
+assert "{wanted:wantGroupLand,name:'OGL Simulator Group Land'," in generator
+assert "scopes:['groups:read'],env:'NEXVERSE_GROUP_LAND_API_KEY'" in generator
+assert "onlyGroupLand?" in generator
+assert "$('secretGenerateGroupLand').disabled=true;" in generator
+assert "$('secretGenerateGroupLand').disabled=false;" in generator
+assert "const inventory=await secretJson('/api/v1/auth/api-keys'" in generator
+assert "if(match)throw new Error(" in generator
+assert "window.isSecureContext" in generator
+assert "const token=await secretAdminToken();" in generator
+assert "'Authorization':'Bearer '+token" in generator
+assert "values[item.env]=data.api_key;" in generator
+assert "secretBuildLines(values);" in generator
+
+# The rendered copy block must contain the exact simulator env assignment.
+builder = page.split("function secretBuildLines(values) {", 1)[1].split(
+ "function secretKeyFingerprint", 1
+)[0]
+assert "'NEXVERSE_GROUP_LAND_API_KEY'" in builder
+assert "name+'='+values[name]" in builder
+
+# Reuse the real admin-only API key issuer; never issue wildcard/admin scopes.
+assert "NexScopes.GroupsRead," in keys
+assert "NexScopes.AdminAll" not in keys.split("HashSet supportedScopes", 1)[1].split(
+ "foreach (string scope", 1
+)[0]
+assert 'NexScopes.AdminAll,' in auth
+assert '"/api/v1/auth/api-keys"' in auth
+assert "Nur Gruppenland-API-Key erstellen" in docs
+assert "/etc/nexverse/nexverse.env" in docs
+
+print("World API one-click group land key: scoped, isolated, and documented")