Validate Audita report bounds with constant memory

This commit is contained in:
2026-11-27 21:21:22 +00:00
parent aa0c1f1c03
commit 89f5a6a0ad
5 changed files with 76 additions and 5 deletions

View File

@@ -190,7 +190,7 @@ func discoverReports(reportDir string) (ReportBundle, error) {
if !info.Mode().IsRegular() {
return reports, fmt.Errorf("audita report %q is not a regular file", path)
}
if _, err := fileops.ReadFileBounded(path, MaxReportOutputBytes); err != nil {
if err := fileops.CheckFileBounded(path, MaxReportOutputBytes); err != nil {
return reports, fmt.Errorf("audita report %q exceeds or cannot be read within %d-byte limit: %w", path, MaxReportOutputBytes, err)
}
*report.dest = path