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: validate clean level in cleanImageBuffer for non-route callers

Adam Eivye434fccfc257
diff --git a/server/routes/imageClean.js b/server/routes/imageClean.js
index 1f1a6766b5..8cae59817c 100644
--- a/server/routes/imageClean.js
+++ b/server/routes/imageClean.js
@@ -105,6 +105,12 @@ function applyEncoder(pipeline, format) {
// Throws ServerError (400) on invalid input so callers get a consistent
// status instead of a sharp stack trace surfacing as a 500.
export async function cleanImageBuffer(buffer, level = 'light') {
+ if (!CLEAN_LEVELS.includes(level)) {
+ throw new ServerError(`Invalid clean level "${level}" (expected one of: ${CLEAN_LEVELS.join(', ')})`, {
+ status: 400,
+ code: 'VALIDATION_ERROR',
+ });
+ }
if (!Buffer.isBuffer(buffer) || buffer.length === 0) {
throw new ServerError('Decoded payload is empty', { status: 400, code: 'VALIDATION_ERROR' });
}