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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex r5): validate no-step passthrough + report C2PA present-but-kept (#1763)
[._.]/ Adam Eivy4e5400e923bf
diff --git a/client/src/pages/ImageClean.jsx b/client/src/pages/ImageClean.jsxindex 27b0ac5c8b..9f7f13726a 100644--- a/client/src/pages/ImageClean.jsx+++ b/client/src/pages/ImageClean.jsx@@ -323,9 +323,11 @@ export default function ImageClean() {</div><div><div className="text-xs text-gray-500 uppercase tracking-wide">C2PA</div>- <div className={`font-medium flex items-center gap-1 ${result.c2paStripped ? 'text-port-success' : 'text-gray-400'}`}>+ <div className={`font-medium flex items-center gap-1 ${+ result.c2paStripped ? 'text-port-success' : result.c2paPresent ? 'text-port-warning' : 'text-gray-400'+ }`}>{result.c2paStripped && <ShieldCheck size={14} />}- {result.c2paStripped ? 'Stripped' : 'None found'}+ {result.c2paStripped ? 'Stripped' : result.c2paPresent ? 'Present (kept)' : 'None found'}</div></div></div>diff --git a/server/lib/imageClean.js b/server/lib/imageClean.jsindex be73be9636..32650e6fb9 100644--- a/server/lib/imageClean.js+++ b/server/lib/imageClean.js@@ -328,10 +328,14 @@ export async function cleanImageBuffer(buffer, options = {}) {height = info.height || null;steps.push({ step: 'metadata', status: 'applied', lossless: false, detail: 'dropped via re-encode (lossy)' });} else {- // No steps selected — return the input untouched, but still report dims.- const meta = await sharp(buffer, { limitInputPixels: MAX_PIXELS }).metadata();- width = meta.width || null;- height = meta.height || null;+ // No steps selected — return the input untouched, but still decode-validate+ // (raw, no re-encode) so the endpoint never hands back known-corrupt bytes+ // as a success, and report the post-decode dims. Mirrors the lossless PNG+ // path's header-only validation gap fix.+ const { info } = await sharp(buffer, { limitInputPixels: MAX_PIXELS })+ .raw().toBuffer({ resolveWithObject: true });+ width = info.width || null;+ height = info.height || null;}} catch (err) {// Wrap sharp errors (truncated/corrupt buffer that still passed the@@ -352,6 +356,10 @@ export async function cleanImageBuffer(buffer, options = {}) {width,height,c2paStripped,+ // Whether a C2PA chunk was present in the source — distinct from whether it+ // was stripped. Lets the UI distinguish "present but kept" (metadata step+ // off) from "none found", instead of conflating both as c2paStripped:false.+ c2paPresent: hadC2PA,steps,};}diff --git a/server/routes/imageClean.js b/server/routes/imageClean.jsindex df044bcace..061715698e 100644--- a/server/routes/imageClean.js+++ b/server/routes/imageClean.js@@ -72,6 +72,7 @@ router.post(width: result.width,height: result.height,c2paStripped: result.c2paStripped,+ c2paPresent: result.c2paPresent,steps: result.steps,};diff --git a/server/routes/imageClean.test.js b/server/routes/imageClean.test.jsindex c56d63ce01..b0d4eb4866 100644--- a/server/routes/imageClean.test.js+++ b/server/routes/imageClean.test.js@@ -120,9 +120,11 @@ describe('POST /api/image-clean (raw transport)', () => {expect(res.status).toBe(200);const report = reportOf(res);expect(report.steps).toEqual([]);- // Untouched passthrough — the caBX chunk is left in place.+ // Untouched passthrough — the caBX chunk is left in place, but the report+ // still tells the truth: present-but-kept, not "none found".expect(report.sizeAfter).toBe(report.sizeBefore);expect(report.c2paStripped).toBe(false);+ expect(report.c2paPresent).toBe(true);});it('accepts a multi-MB raw payload without a 413/FILE_TOO_LARGE (40MB cap removed)', async () => {