diff --git a/audit/internal/webui/ipmi_fru.go b/audit/internal/webui/ipmi_fru.go index e4ddcd7..8ad5c9e 100644 --- a/audit/internal/webui/ipmi_fru.go +++ b/audit/internal/webui/ipmi_fru.go @@ -94,7 +94,8 @@ func fruFieldMeta(name string) (editable bool, area string, index int) { if e, ok := fruEditableFields[name]; ok { return true, e.Area, e.Index } - return false, "", 0 + // All fields are shown as editable; server will reject unknown fields. + return true, "", 0 } func (h *handler) handleAPIIPMIFRURead(w http.ResponseWriter, r *http.Request) { @@ -128,7 +129,17 @@ func (h *handler) handleAPIIPMIFRUWrite(w http.ResponseWriter, r *http.Request) return } validAreas := map[string]bool{"c": true, "b": true, "p": true} - for _, c := range req.Changes { + for i, c := range req.Changes { + if c.Area == "" { + e, ok := fruEditableFields[c.Name] + if !ok { + writeError(w, http.StatusUnprocessableEntity, "field not writable via ipmitool: "+c.Name) + return + } + req.Changes[i].Area = e.Area + req.Changes[i].Index = e.Index + c = req.Changes[i] + } if !validAreas[c.Area] { writeError(w, http.StatusUnprocessableEntity, "invalid area: "+c.Area) return @@ -196,106 +207,78 @@ func renderIPMIFRUCard() string {

Reads and edits FRU fields via ipmitool (In-Band, device 0). Works on any server with IPMI support.

- ` } diff --git a/audit/internal/webui/saa_dmi.go b/audit/internal/webui/saa_dmi.go index e10421f..32c33c4 100644 --- a/audit/internal/webui/saa_dmi.go +++ b/audit/internal/webui/saa_dmi.go @@ -213,98 +213,85 @@ func runSAADMIWriteTask(ctx context.Context, j *jobState, exportDir string, p ta } func renderSAADMICard() string { - return `
Supermicro — DMI
+ return `
Supermicro — DMI

Reads and edits DMI fields via SAA (In-Band).

- +
-
` +` }