Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: bind browser CDP to localhost for security

Adam Eivy255cf5af5dd9
diff --git a/browser/server.js b/browser/server.js
index 609da4a032..895bc6d2d3 100644
--- a/browser/server.js
+++ b/browser/server.js
@@ -3,17 +3,20 @@ import { createServer } from 'http';
const CDP_PORT = parseInt(process.env.CDP_PORT || '5556', 10);
const HEALTH_PORT = parseInt(process.env.PORT || '5557', 10);
+// Security: CDP binds to localhost only - remote access should go through
+// portos-server which can proxy connections with proper authentication
+const CDP_HOST = process.env.CDP_HOST || '127.0.0.1';
let browser = null;
async function launchBrowser() {
- console.log(`🌐 Launching persistent Chromium browser with CDP on port ${CDP_PORT}`);
+ console.log(`🌐 Launching persistent Chromium browser with CDP on ${CDP_HOST}:${CDP_PORT}`);
browser = await chromium.launch({
headless: true,
args: [
`--remote-debugging-port=${CDP_PORT}`,
- '--remote-debugging-address=0.0.0.0',
+ `--remote-debugging-address=${CDP_HOST}`,
'--no-first-run',
'--no-default-browser-check',
'--disable-background-networking',
@@ -30,7 +33,7 @@ async function launchBrowser() {
setTimeout(launchBrowser, 1000);
});
- console.log(`✅ Browser launched, CDP available at ws://0.0.0.0:${CDP_PORT}`);
+ console.log(`✅ Browser launched, CDP available at ws://${CDP_HOST}:${CDP_PORT}`);
return browser;
}
@@ -42,17 +45,19 @@ const healthServer = createServer((req, res) => {
res.end(JSON.stringify({
status,
cdpPort: CDP_PORT,
- cdpEndpoint: `ws://0.0.0.0:${CDP_PORT}`
+ cdpHost: CDP_HOST,
+ cdpEndpoint: `ws://${CDP_HOST}:${CDP_PORT}`
}));
} else if (req.url === '/') {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
service: 'portos-browser',
cdpPort: CDP_PORT,
+ cdpHost: CDP_HOST,
healthPort: HEALTH_PORT,
endpoints: {
health: '/health',
- cdp: `ws://0.0.0.0:${CDP_PORT}`
+ cdp: `ws://${CDP_HOST}:${CDP_PORT}`
}
}));
} else {
diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs
index 4b705bf422..1ac388f0a6 100644
--- a/ecosystem.config.cjs
+++ b/ecosystem.config.cjs
@@ -87,13 +87,13 @@ module.exports = {
script: 'browser/server.js',
cwd: __dirname,
interpreter: 'node',
- // Browser service exposes CDP on 0.0.0.0 for Tailscale remote access
- // Unlike cos-runner, this is safe because CDP already has its own auth
- // and browser instances are sandboxed. Accessed via PortOS UI remotely.
+ // Security: CDP binds to 127.0.0.1 by default (set CDP_HOST=0.0.0.0 to expose)
+ // Remote access should go through portos-server proxy with authentication
ports: { cdp: 5556, health: 5557 },
env: {
NODE_ENV: 'development',
CDP_PORT: 5556,
+ CDP_HOST: '127.0.0.1',
PORT: 5557
},
watch: false,