feat: switch agent identity from openclaw.json to agents-sanitized.json
CI - Build & Test / Backend (.NET) (push) Successful in 33s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 17s
CI - Build & Test / Security Check (push) Successful in 2s
CI - Build & Test / Deploy Nexus (push) Failing after 19s

Completes P4 migration: Nexus API no longer reads openclaw.json.

Changes:
- AgentService: default path -> agents-sanitized.json
- OpenClawGatewayClient: LoadAgentIdsFromConfig + GetAvailableModels
  both now read from agents-sanitized.json
- compose.yaml: mount agents-sanitized.json instead of openclaw.json

The deploy script (.gitea/scripts/deploy-nexus.sh) already generates
agents-sanitized.json during deployment, extracting only the
section (list + defaults) without gateway/auth/password secrets.

DoD:
- No read access to openclaw.json from Nexus API container
- No uid-1654 ACL dependency for agent identity resolution
- No secrets in agent responses or config files
This commit is contained in:
2026-07-12 22:07:11 +02:00
parent 8ad8c956eb
commit 17dc84082c
3 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -235,7 +235,7 @@ public sealed class AgentService(IConfiguration configuration, IAgentRuntime run
private async Task<IReadOnlyList<AgentConfig>> LoadAgentConfigsAsync(CancellationToken cancellationToken) private async Task<IReadOnlyList<AgentConfig>> LoadAgentConfigsAsync(CancellationToken cancellationToken)
{ {
var path = configuration.GetValue<string>("AgentConfigPath") var path = configuration.GetValue<string>("AgentConfigPath")
?? "/home/node/.openclaw/openclaw.json"; ?? "/home/node/.openclaw/agents-sanitized.json";
if (!File.Exists(path)) if (!File.Exists(path))
return BuildFallbackConfigs(); return BuildFallbackConfigs();
+6 -5
View File
@@ -123,7 +123,7 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
) )
}; };
// Load agent IDs from openclaw.json config // Load agent IDs from sanitized agents config (no secrets)
var agentIds = LoadAgentIdsFromConfig(); var agentIds = LoadAgentIdsFromConfig();
var agents = new List<DashboardAgentInfo>(); var agents = new List<DashboardAgentInfo>();
@@ -227,7 +227,8 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
} }
/// <summary> /// <summary>
/// Loads agent IDs from the OpenClaw config file (openclaw.json). /// Loads agent IDs from the sanitized agents config (agents-sanitized.json).
/// No secrets — only agent list and defaults are exposed.
/// Falls back to the known list if the config file is unavailable. /// Falls back to the known list if the config file is unavailable.
/// </summary> /// </summary>
private List<string> LoadAgentIdsFromConfig() private List<string> LoadAgentIdsFromConfig()
@@ -235,7 +236,7 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
try try
{ {
var configPath = configuration.GetValue<string>("AgentConfigPath") var configPath = configuration.GetValue<string>("AgentConfigPath")
?? "/home/node/.openclaw/openclaw.json"; ?? "/home/node/.openclaw/agents-sanitized.json";
if (!System.IO.File.Exists(configPath)) if (!System.IO.File.Exists(configPath))
return GetDefaultAgentIds(); return GetDefaultAgentIds();
@@ -1077,7 +1078,7 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
} }
/// <summary> /// <summary>
/// Returns the list of available models by reading from the OpenClaw config, /// Returns the list of available models by reading from the sanitized agents config,
/// with fallback to hardcoded list. /// with fallback to hardcoded list.
/// </summary> /// </summary>
public List<ModelOption> GetAvailableModels() public List<ModelOption> GetAvailableModels()
@@ -1085,7 +1086,7 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
try try
{ {
var configPath = configuration.GetValue<string>("AgentConfigPath") var configPath = configuration.GetValue<string>("AgentConfigPath")
?? "/home/node/.openclaw/openclaw.json"; ?? "/home/node/.openclaw/agents-sanitized.json";
if (!System.IO.File.Exists(configPath)) if (!System.IO.File.Exists(configPath))
return GetDefaultModels(); return GetDefaultModels();
+1 -1
View File
@@ -68,7 +68,7 @@ services:
retries: 3 retries: 3
start_period: 15s start_period: 15s
volumes: volumes:
- /home/projekte_bao/openclaw/data/openclaw/openclaw.json:/home/node/.openclaw/openclaw.json:ro - /home/projekte_bao/openclaw/data/openclaw/agents-sanitized.json:/home/node/.openclaw/agents-sanitized.json:ro
- /home/projekte_bao/openclaw/data/openclaw/workspace-iris:/mnt/workspace-iris - /home/projekte_bao/openclaw/data/openclaw/workspace-iris:/mnt/workspace-iris
- /home/projekte_bao/openclaw/data/openclaw/workspace-programmer:/mnt/workspace-programmer - /home/projekte_bao/openclaw/data/openclaw/workspace-programmer:/mnt/workspace-programmer
- /home/projekte_bao/openclaw/data/openclaw/workspace-reviewer:/mnt/workspace-reviewer - /home/projekte_bao/openclaw/data/openclaw/workspace-reviewer:/mnt/workspace-reviewer