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: enforce deploy flag allowlist, gate deploy to non-Windows, validate submodule paths, surface status flags in UI, restore input on error, handle resume modal errors

Adam Eivyebf95b6a8eaa
diff --git a/client/src/components/QuickBrainCapture.jsx b/client/src/components/QuickBrainCapture.jsx
index b133883b5d..234da879fe 100644
--- a/client/src/components/QuickBrainCapture.jsx
+++ b/client/src/components/QuickBrainCapture.jsx
@@ -40,6 +40,7 @@ export default function QuickBrainCapture() {
} else {
toast.error(err.message || 'Failed to save link');
}
+ setInput(text);
return null;
});
if (result) {
@@ -48,6 +49,7 @@ export default function QuickBrainCapture() {
} else {
const result = await api.captureBrainThought(text).catch(err => {
toast.error(err.message || 'Failed to capture thought');
+ setInput(text);
return null;
});
if (result) {
diff --git a/client/src/components/cos/tabs/ResumeAgentModal.jsx b/client/src/components/cos/tabs/ResumeAgentModal.jsx
index 5731adc30e..a77a0be529 100644
--- a/client/src/components/cos/tabs/ResumeAgentModal.jsx
+++ b/client/src/components/cos/tabs/ResumeAgentModal.jsx
@@ -62,8 +62,11 @@ export default function ResumeAgentModal({ agent, taskType = 'user', providers,
app: formData.app,
type: taskType,
screenshots: screenshots.length > 0 ? screenshots.map(s => s.path) : undefined
- }).catch(() => {});
- setIsSubmitting(false);
+ }).catch(err => {
+ toast.error(err?.message || 'Failed to resume agent');
+ }).finally(() => {
+ setIsSubmitting(false);
+ });
};
return (
diff --git a/client/src/pages/Submodules.jsx b/client/src/pages/Submodules.jsx
index 8e127686a7..e42afd9728 100644
--- a/client/src/pages/Submodules.jsx
+++ b/client/src/pages/Submodules.jsx
@@ -98,7 +98,19 @@ export default function Submodules() {
<div className="flex items-center gap-2 mb-1">
<GitBranch size={16} className="text-port-accent shrink-0" />
<h3 className="text-lg font-semibold text-white truncate">{sub.name}</h3>
- {sub.behind > 0 ? (
+ {!sub.initialized ? (
+ <span className="px-2 py-0.5 text-xs rounded-full bg-gray-500/20 text-gray-400 shrink-0">
+ not initialized
+ </span>
+ ) : sub.conflicted ? (
+ <span className="px-2 py-0.5 text-xs rounded-full bg-port-error/20 text-port-error shrink-0">
+ merge conflict
+ </span>
+ ) : sub.outOfSync ? (
+ <span className="px-2 py-0.5 text-xs rounded-full bg-port-warning/20 text-port-warning shrink-0">
+ out of sync
+ </span>
+ ) : sub.behind > 0 ? (
<span className="px-2 py-0.5 text-xs rounded-full bg-port-warning/20 text-port-warning shrink-0">
{sub.behind} behind
</span>
@@ -131,7 +143,7 @@ export default function Submodules() {
</div>
<button
onClick={() => handleUpdate(sub.path)}
- disabled={!!updating || sub.behind === 0}
+ disabled={!!updating || (!sub.behind && !sub.outOfSync && sub.initialized && !sub.conflicted)}
className="px-3 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 text-sm shrink-0 min-h-[40px]"
>
{updating === sub.path ? (
diff --git a/server/lib/socketValidation.js b/server/lib/socketValidation.js
index 7bbf848287..534f31e2b2 100644
--- a/server/lib/socketValidation.js
+++ b/server/lib/socketValidation.js
@@ -59,11 +59,11 @@ export const appStandardizeSchema = z.object({
});
// app:deploy — app ID and optional flags for Xcode deploy
-const appDeployFlagSchema = z.string()
- .trim()
- .min(1, 'flag cannot be empty')
- .max(64, 'flag must be 64 characters or fewer')
- .regex(/^--?[A-Za-z0-9][A-Za-z0-9-]*$/, 'flag must be a valid CLI flag (e.g. -f or --force)');
+// Must match VALID_FLAGS in appDeployer.js
+const ALLOWED_DEPLOY_FLAGS = ['--ios', '--macos', '--all', '--skip-tests'];
+const appDeployFlagSchema = z.enum(ALLOWED_DEPLOY_FLAGS, {
+ errorMap: () => ({ message: `flag must be one of: ${ALLOWED_DEPLOY_FLAGS.join(', ')}` })
+});
export const appDeploySchema = z.object({
appId: z.string().min(1, 'appId is required'),
diff --git a/server/routes/git.js b/server/routes/git.js
index 72a00c29b3..850a2ee99d 100644
--- a/server/routes/git.js
+++ b/server/routes/git.js
@@ -28,10 +28,19 @@ router.get('/submodules/status', asyncHandler(async (req, res) => {
// POST /api/git/submodules/update - Update a specific submodule
router.post('/submodules/update', asyncHandler(async (req, res) => {
- const { path } = req.body;
- if (!path || typeof path !== 'string') {
+ const rawPath = req.body?.path;
+ if (!rawPath || typeof rawPath !== 'string') {
+ throw new ServerError('path must be a non-empty string', { status: 400, code: 'VALIDATION_ERROR' });
+ }
+ const path = rawPath.trim();
+ if (!path) {
throw new ServerError('path must be a non-empty string', { status: 400, code: 'VALIDATION_ERROR' });
}
+ // Validate that this is a known submodule path
+ const submodules = await git.getSubmodules();
+ if (!submodules.some(s => s.path === path)) {
+ throw new ServerError(`Unknown submodule path: ${path}`, { status: 400, code: 'VALIDATION_ERROR' });
+ }
const newCommit = await git.updateSubmodule(path);
res.json({ success: true, newCommit });
}));
diff --git a/server/services/appDeployer.js b/server/services/appDeployer.js
index 304a311e88..8025a54723 100644
--- a/server/services/appDeployer.js
+++ b/server/services/appDeployer.js
@@ -13,6 +13,7 @@ const deployingApps = new Set();
* Check whether an app has a deploy.sh script
*/
export function hasDeployScript(app) {
+ if (process.platform === 'win32') return false;
if (!app?.repoPath) return false;
if (!NON_PM2_TYPES.has(app.type)) return false;
return existsSync(join(app.repoPath, 'deploy.sh'));