fix(audit): reserve bounded repair capacity outside user file quota
This commit is contained in:
@@ -157,13 +157,9 @@ func (r *runner) repairSessionExportOwned(ctx context.Context, id int64, sequenc
|
||||
if !info.Mode().IsRegular() || info.Size() <= 0 || info.Size() > stage.SessionExportFileLimit || result.Messages <= 0 || info.Size() != result.HTMLBytes {
|
||||
return recordFailure("repair export missing, empty, non-normal or oversized")
|
||||
}
|
||||
var used int64
|
||||
for _, file := range step.Artifacts {
|
||||
used += file.SizeBytes
|
||||
}
|
||||
if used+info.Size() > maxArtifactTotalBytes {
|
||||
return recordFailure("repaired export exceeds artifact inventory byte bounds")
|
||||
}
|
||||
// Mandatory audit repair has its own bounded allowance: at most twenty
|
||||
// attempts, each capped by SessionExportFileLimit. A full ordinary file
|
||||
// inventory (count OR bytes) must not prevent recovery of the handoff.
|
||||
evidence.HTML = name
|
||||
evidence.HTMLBytes = info.Size()
|
||||
if err := r.store.RecordDeliverable(persistCtx, id, sequence, protocol.StageArtifact{Name: evidence.HTML, SizeBytes: info.Size(), ContentType: "text/html; charset=utf-8", URL: artifactURL(id, sequence, evidence.HTML)}); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user