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: restrict attachment URL to http/https, strip previewUrl from messages state

[._.]/ Adam Eivyd746084d5e48
diff --git a/client/src/pages/OpenClaw.jsx b/client/src/pages/OpenClaw.jsx
index ddac84ee70..f97b073e49 100644
--- a/client/src/pages/OpenClaw.jsx
+++ b/client/src/pages/OpenClaw.jsx
@@ -374,7 +374,7 @@ export default function OpenClaw() {
content: message || `[Sent ${attachments.length} attachment${attachments.length === 1 ? '' : 's'}]`,
createdAt: new Date().toISOString(),
status: 'completed',
- attachments: attachments.map(({ id, data, ...attachment }) => ({ id, ...attachment }))
+ attachments: attachments.map(({ id, data, previewUrl, ...attachment }) => ({ id, ...attachment }))
};
setMessages(current => [...current, userMessage, {
diff --git a/server/routes/openclaw.js b/server/routes/openclaw.js
index b3cb5c2a9e..77d90bd0e9 100644
--- a/server/routes/openclaw.js
+++ b/server/routes/openclaw.js
@@ -25,7 +25,10 @@ const attachmentSchema = z.object({
mediaType: z.string().trim().min(1).optional(),
mimeType: z.string().trim().min(1).optional(),
data: z.string().trim().min(1).max(ATTACHMENT_BASE64_MAX_CHARS, 'Attachment base64 data exceeds the 10 MB per-attachment limit.').optional(),
- url: z.string().trim().url().optional()
+ url: z.string().trim().url().refine(
+ url => url.startsWith('http://') || url.startsWith('https://'),
+ 'Attachment url must use http or https scheme.'
+ ).optional()
}).superRefine((value, ctx) => {
const hasData = typeof value.data === 'string' && value.data.trim().length > 0;
const hasUrl = typeof value.url === 'string' && value.url.trim().length > 0;