thevoidforge 21.0.16 → 21.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,7 +21,8 @@ import { getSessionPassword } from './credentials.js';
|
|
|
21
21
|
import { getServerPort, getServerHost } from '../lib/server-config.js';
|
|
22
22
|
import { parseJsonBody } from '../lib/body-parser.js';
|
|
23
23
|
import { createSession, writeToSession, onSessionData, resizeSession, killSession, listSessions, } from '../lib/pty-manager.js';
|
|
24
|
-
import { validateSession, parseSessionCookie, getClientIp, isRemoteMode } from '../lib/tower-auth.js';
|
|
24
|
+
import { validateSession, parseSessionCookie, getClientIp, isRemoteMode, isLanMode } from '../lib/tower-auth.js';
|
|
25
|
+
import { isPrivateOrigin } from '../lib/network.js';
|
|
25
26
|
import { hasProjectAccess } from '../lib/user-manager.js';
|
|
26
27
|
import { findByDirectory } from '../lib/project-registry.js';
|
|
27
28
|
import { sendJson } from '../lib/http-helpers.js';
|
|
@@ -168,7 +169,11 @@ export function handleTerminalUpgrade(req, socket, head, userSession) {
|
|
|
168
169
|
if (remoteHost) {
|
|
169
170
|
allowedOrigins.push(`https://${remoteHost}`);
|
|
170
171
|
}
|
|
171
|
-
|
|
172
|
+
// LAN mode: accept any private IP origin (matches CORS handler in server.ts)
|
|
173
|
+
const isAllowed = allowedOrigins.includes(origin)
|
|
174
|
+
|| (isLanMode() && isPrivateOrigin(origin));
|
|
175
|
+
if (!origin || !isAllowed) {
|
|
176
|
+
console.log(` PTY WS rejected: origin=${origin} allowed=${JSON.stringify(allowedOrigins)} lan=${isLanMode()}`);
|
|
172
177
|
socket.write('HTTP/1.1 403 Forbidden\r\n\r\n');
|
|
173
178
|
socket.destroy();
|
|
174
179
|
return;
|