v1.3.55: validate zip magic bytes on upload (UI + backend)

This commit is contained in:
“Naeel”
2026-05-04 10:57:32 +04:00
parent 4980eb4efa
commit d09348b6b9
4 changed files with 10 additions and 3 deletions
+6
View File
@@ -1333,6 +1333,12 @@ func (s *Server) handleCreateFunctionFromArchive(w http.ResponseWriter, r *http.
archiveFilenameCreate = fhCreate.Filename
}
// Проверяем magic bytes: zip должен начинаться с PK (0x50 0x4B)
if len(archiveBytes) < 4 || archiveBytes[0] != 0x50 || archiveBytes[1] != 0x4B {
writeJSONError(w, http.StatusBadRequest, "загруженный файл не является zip-архивом (ожидается .zip)")
return
}
nsCtx, nsCancel := context.WithTimeout(r.Context(), 60*time.Second)
defer nsCancel()
if err := s.nsManager.EnsureUserNS(nsCtx, ns); err != nil {