fix: patch path traversal and baseUrl normalization in scene generator

- server.js: sanitize static file paths to prevent directory traversal
  (GET /../../sgclaw_config.json would expose API key)
- config-loader.js: fix normalizeBaseUrl to strip /v1 before appending,
  preventing double /v1 for non-standard base URLs

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
木炎
2026-04-16 22:30:35 +08:00
parent ea6be128e7
commit 23845413c5
2 changed files with 9 additions and 3 deletions

View File

@@ -64,8 +64,8 @@ function loadConfig() {
function normalizeBaseUrl(url) {
url = url.replace(/\/+$/, "");
if (!url.endsWith("/v1")) url = url + "/v1";
return url;
url = url.replace(/\/v1\/?$/, "");
return url + "/v1";
}
function getDefaults() {