LOW: Container log tail parameter not validated — passed directly to Docker API #24

Geschlossen
2026-02-16 05:47:13 +01:00 von clawbot geöffnet · 1 Kommentar
Mitarbeiter

Bug

File: internal/handlers/app.go, HandleAppLogs()

Severity: LOW

Description

The tail query parameter is read from user input and passed directly to the Docker API without validation:

tail := request.URL.Query().Get("tail")
if tail == "" {
    tail = defaultLogTail
}
logs, logsErr := h.docker.ContainerLogs(request.Context(), containerInfo.ID, tail)

While Docker's API likely handles invalid values gracefully, the parameter should be validated as a positive integer to ensure predictable behavior and prevent potential edge cases (e.g., passing "all" to dump the entire log history, which could be a DoS vector for containers with large log files).

Suggested Fix

tail := request.URL.Query().Get("tail")
if tail == "" {
    tail = defaultLogTail
} else if _, err := strconv.Atoi(tail); err != nil {
    tail = defaultLogTail
}
## Bug **File:** `internal/handlers/app.go`, `HandleAppLogs()` **Severity:** LOW ### Description The `tail` query parameter is read from user input and passed directly to the Docker API without validation: ```go tail := request.URL.Query().Get("tail") if tail == "" { tail = defaultLogTail } logs, logsErr := h.docker.ContainerLogs(request.Context(), containerInfo.ID, tail) ``` While Docker's API likely handles invalid values gracefully, the parameter should be validated as a positive integer to ensure predictable behavior and prevent potential edge cases (e.g., passing `"all"` to dump the entire log history, which could be a DoS vector for containers with large log files). ### Suggested Fix ```go tail := request.URL.Query().Get("tail") if tail == "" { tail = defaultLogTail } else if _, err := strconv.Atoi(tail); err != nil { tail = defaultLogTail } ```
Besitzer

do it. also clamp it to max 500.

do it. also clamp it to max 500.
sneak hat diesen Issue 2026-02-16 06:51:35 +01:00 geschlossen
Anmelden, um an der Diskussion teilzunehmen.
2 Beteiligte
Nachrichten
Fällig am
Kein Fälligkeitsdatum gesetzt.
Abhängigkeiten

Keine Abhängigkeiten gesetzt.

Referenz: sneak/upaas#24