HIGH: Template rendering bypass in HandleAppCreate/HandleAppUpdate can produce partial HTML #121
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
Several error paths in
HandleAppCreateandHandleAppUpdatecalltmpl.ExecuteTemplate(writer, ...)directly instead of usingh.renderTemplate(writer, tmpl, ...). TherenderTemplatemethod renders into a buffer first and only writes to the ResponseWriter on success, preventing partial/corrupt HTML. The direct calls bypass this safety.Affected Code
internal/handlers/app.go—HandleAppCreate:internal/handlers/app.go—HandleAppUpdate:Other error paths in the same functions correctly use
h.renderTemplate.Impact
If template execution fails partway through (e.g., missing template data), a partial HTML response is sent to the browser. This is unlikely in practice but violates the safety invariant that
renderTemplatewas specifically designed to enforce.Fix
Replace all
tmpl.ExecuteTemplate(writer, ...)calls withh.renderTemplate(writer, tmpl, ...).