A container registry that uses the AT Protocol for manifest storage and S3 for blob storage. atcr.io
docker container atproto go
80
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implements linter for pkg/hold missing warnings

authored by

Eduardo Cuducos and committed by tangled.org c82dad81 2d5039d3

+28 -8
+9 -4
pkg/hold/admin/admin.go
··· 150 150 151 151 // Session management 152 152 153 - func (ui *AdminUI) createSession(did, handle string) string { 153 + func (ui *AdminUI) createSession(did, handle string) (string, error) { 154 154 b := make([]byte, 32) 155 - rand.Read(b) 155 + if _, err := rand.Read(b); err != nil { 156 + return "", fmt.Errorf("failed to create session token: %w", err) 157 + } 156 158 token := base64.URLEncoding.EncodeToString(b) 157 159 158 160 ui.sessionsMu.Lock() 159 161 ui.sessions[token] = &AdminSession{DID: did, Handle: handle} 160 162 ui.sessionsMu.Unlock() 161 163 162 - return token 164 + return token, nil 163 165 } 164 166 165 167 func (ui *AdminUI) getSession(token string) *AdminSession { ··· 340 342 341 343 w.Header().Set("Content-Type", "application/json") 342 344 w.Header().Set("Cache-Control", "public, max-age=3600") 343 - json.NewEncoder(w).Encode(metadata) 345 + if err := json.NewEncoder(w).Encode(metadata); err != nil { 346 + slog.Error("failed to encode json to http response", "error", err, "path", r.URL.Path) 347 + w.WriteHeader(http.StatusInternalServerError) 348 + } 344 349 } 345 350 346 351 // Close cleans up resources (no-op now, but keeps interface consistent)
+8 -2
pkg/hold/admin/handlers.go
··· 123 123 124 124 // Otherwise return JSON 125 125 w.Header().Set("Content-Type", "application/json") 126 - json.NewEncoder(w).Encode(stats) 126 + if err := json.NewEncoder(w).Encode(stats); err != nil { 127 + slog.Error("failed to encode json to http response", "error", err, "path", r.URL.Path) 128 + w.WriteHeader(http.StatusInternalServerError) 129 + } 127 130 } 128 131 129 132 // UserUsage represents storage usage for a user ··· 192 195 193 196 // Otherwise return JSON 194 197 w.Header().Set("Content-Type", "application/json") 195 - json.NewEncoder(w).Encode(users) 198 + if err := json.NewEncoder(w).Encode(users); err != nil { 199 + slog.Error("failed to encode json to http response", "error", err, "path", r.URL.Path) 200 + w.WriteHeader(http.StatusInternalServerError) 201 + } 196 202 }
+6 -1
pkg/hold/admin/handlers_auth.go
··· 117 117 } 118 118 119 119 // Create session and set cookie 120 - token := ui.createSession(did, handle) 120 + token, err := ui.createSession(did, handle) 121 + if err != nil { 122 + slog.Error("failed to create session token", "error", err, "path", r.URL.Path) 123 + w.WriteHeader(http.StatusInternalServerError) 124 + return 125 + } 121 126 ui.setSessionCookie(w, r, token) 122 127 123 128 slog.Info("Admin login successful", "did", did, "handle", handle)
+5 -1
pkg/hold/admin/handlers_crew.go
··· 319 319 320 320 // Re-apply tier to new record 321 321 if tier != "" { 322 - ui.pds.UpdateCrewMemberTier(ctx, current.Member, tier) 322 + if err := ui.pds.UpdateCrewMemberTier(ctx, current.Member, tier); err != nil { 323 + slog.Error("failed to update crew member tier", "error", err, "path", r.URL.Path) 324 + w.WriteHeader(http.StatusInternalServerError) 325 + return 326 + } 323 327 } 324 328 } 325 329