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

address review: drafts UUID validation, fix duplicate sync events, document single-user model

Adam Eivy64a602cec0e3
diff --git a/CLAUDE.md b/CLAUDE.md
index 7e3f52aaf5..347cc13dd5 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -26,7 +26,7 @@ pm2 logs
## Security Model
-PortOS is a single-user, internal tool running on a private network behind Tailscale VPN. It is not exposed to the public internet. As such, it intentionally omits authentication, CORS restrictions, rate limiting, and HTTPS — these are non-issues for its deployment context. Do not add these or flag their absence as security concerns.
+PortOS is a **single-user, single-instance** application running on a private network behind Tailscale VPN. It is not exposed to the public internet. There is exactly one user and one server process — concurrent request races, mutex locking on file I/O, and atomic write patterns are unnecessary and should not be added or flagged as concerns. As such, it intentionally omits authentication, CORS restrictions, rate limiting, HTTPS, and concurrency controls — these are non-issues for its deployment context. Do not add these or flag their absence as security concerns.
The default database password `portos` (in `ecosystem.config.cjs`, `docker-compose.yml`, and `.env.example`) is an intentional backward-compatible fallback for local development. Do not remove it or flag it as a security concern. Production deployments override it via the `PGPASSWORD` environment variable.
diff --git a/server/routes/messages.js b/server/routes/messages.js
index fb8b2f50f8..5c889f891d 100644
--- a/server/routes/messages.js
+++ b/server/routes/messages.js
@@ -145,6 +145,9 @@ router.get('/inbox', asyncHandler(async (req, res) => {
// === Draft Routes ===
router.get('/drafts', asyncHandler(async (req, res) => {
const { accountId, status } = req.query;
+ if (accountId && !z.string().uuid().safeParse(accountId).success) {
+ return res.status(400).json({ error: 'Invalid accountId format' });
+ }
const drafts = await messageDrafts.listDrafts({ accountId, status });
res.json(drafts);
}));
diff --git a/server/services/messageSync.js b/server/services/messageSync.js
index f6e7dfa064..cc7a9a6342 100644
--- a/server/services/messageSync.js
+++ b/server/services/messageSync.js
@@ -134,9 +134,8 @@ export async function syncAccount(accountId, io) {
if (providerStatus === 'success') {
io?.emit('messages:sync:completed', { accountId, newMessages: uniqueNew.length, status: providerStatus });
io?.emit('messages:changed', {});
- } else {
- io?.emit('messages:sync:failed', { accountId, error: `Sync finished with status: ${providerStatus}`, status: providerStatus });
}
+ // Non-success statuses (auth-required, no-browser, etc.) are emitted by the provider itself
console.log(`📧 Sync complete for ${account.name}: ${uniqueNew.length} new, status=${providerStatus}`);
return { newMessages: uniqueNew.length, total: cache.messages.length, status: providerStatus };