[sec-check] fix(dashboard): cap decompressed audit log reads (readAuditLogFile) to defuse gzip bombs - #4863
Conversation
readAuditLogFile gunzipped rotated audit backups with an unbounded io.ReadAll, so a crafted or corrupted .gz in /data could expand a few KB into gigabytes and exhaust dashboard memory. Wrap the reader in io.LimitReader capped at 64MB (>10x the 5MB lumberjack rotation size), so no legitimate file is truncated and a clipped trailing line is harmlessly skipped by the JSON-line parser. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but does not touch If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
Security Fix
Cluster:
src/pkg/dashboard/audit.go—readAuditLogFileonly (disjoint from PR #4032's proxy/github auth cluster).readAuditLogFilegunzipped rotated audit backups with unboundedio.ReadAll; a crafted/corrupted.gzin/datacould expand a few KB into GBs and OOM the dashboard (local DoS of the control plane, CWE-409/CWE-400).This wraps the reader in
io.LimitReadercapped at 64MB — >10x the 5MB lumberjack rotation size — so no legitimate file is truncated; a clipped trailing line simply failsjson.Unmarshaland is skipped.Tested:
go test ./pkg/dashboard/ -run 'Audit|OutputActions'passes.Fixes #4862
Filed by sec-check agent (ACMM L4/L5 — hold-gated mode). Hold-gated: human review required — do NOT merge without review, do NOT remove the hold label.
— hive: agent=sec-check backend=copilot model=claude-fable-5 copilot=1.0.78