Files
Homelab-manager/server/package.json
T
bobbanandClaude Sonnet 5.5 a641211484 Stop IDs in a request from being turned into other calls to connected systems
The Tailscale device, Proxmox node, Cloudflare zone/record and Azure record/zone IDs
were put into the outgoing request path as typed. An operator could send a crafted ID
("x/../../tailnet/-/keys/k1") and make the app call a different endpoint than the button
meant -- delete an auth key instead of a device, stop every guest on a node, delete a whole
DNS zone -- under the integration's own credential. Gitea and Dockhand encoded their IDs but
still passed "..".

- utils/pathSegment.ts: checks an ID against what a real one looks like, then encodes it
  (encodeURIComponent alone leaves ".." untouched). Used by the Tailscale, Proxmox,
  Cloudflare, Azure, Gitea and Dockhand adapters.
- The routes refuse a bad ID with a 400 before anything is sent, and the DNS routes turn the
  adapters' refusal into a 400. A server's Proxmox node name is validated when saved.
- Azure: a zone ID without "::" is now refused instead of being cut into two bogus pieces.
- Regression tests (npm test --workspace server, Node's built-in runner): the crafted IDs
  are refused for every adapter and route, real IDs still work, viewers are still refused.
  Against the old code 13 of the 22 tests fail.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 21:02:22 +02:00

41 lines
1.1 KiB
JSON

{
"name": "server",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc -p tsconfig.json",
"start": "node dist/index.js",
"test": "tsx --test \"test/**/*.test.ts\"",
"db:generate": "drizzle-kit generate",
"db:migrate": "tsx src/db/migrate.ts"
},
"dependencies": {
"@libsql/client": "^0.14.0",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.45.2",
"express": "^4.21.2",
"express-session": "^1.18.1",
"mysql2": "^3.24.5",
"node-schedule": "^2.1.1",
"nodemailer": "^6.9.14",
"openid-client": "^6.1.7",
"session-file-store": "^1.5.0",
"xml2js": "^0.6.2",
"zod": "^3.24.1"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/express-session": "^1.18.1",
"@types/node": "^22.10.5",
"@types/node-schedule": "^2.1.7",
"@types/nodemailer": "^6.4.17",
"@types/session-file-store": "^1.2.5",
"@types/xml2js": "^0.4.14",
"drizzle-kit": "^0.31.10",
"tsx": "^4.19.2",
"typescript": "^5.7.3"
}
}