From 1b40ad6573e52feb19109b14c30a2958da26d44b Mon Sep 17 00:00:00 2001 From: ErenAri Date: Fri, 19 Jun 2026 14:10:16 +0300 Subject: [PATCH] Guard validate UI against submitting with no artifact Clicking Run in the Validate panel without selecting a .bpf.o (artifact tab) or providing source (source tab) sent a request with no artifact, so the server rejected it with a raw HTTP 400 ("provide artifact_file, source_file, or source_code"). Add a client-side check that blocks the submit and shows a clear, actionable message before the request is sent. Co-Authored-By: Claude Opus 4.8 --- internal/api/ui.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/api/ui.go b/internal/api/ui.go index 2b2aea16..d6c07571 100644 --- a/internal/api/ui.go +++ b/internal/api/ui.go @@ -2750,6 +2750,8 @@ programs: if (mode === "artifact") { if (byId("artifactFile").files[0]) { fd.append("artifact_file", byId("artifactFile").files[0]); + } else { + throw new Error("Choose a compiled BPF object (.bpf.o) to validate, or switch to the source tab."); } } else { if (byId("sourceFile").files[0]) { @@ -2758,6 +2760,9 @@ programs: if (byId("sourceCode").value.trim()) { fd.append("source_code", byId("sourceCode").value); } + if (!byId("sourceFile").files[0] && !byId("sourceCode").value.trim()) { + throw new Error("Provide BPF source (upload a .c file or paste source code) before running."); + } if (byId("clangFlags").value.trim()) { fd.append("clang_flags", byId("clangFlags").value.trim()); }