v1.3.55: validate zip magic bytes on upload (UI + backend)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user