Skip to content

Commit 8b20cae

Browse files
sangwaclaude
andcommitted
fix: respect no-cache/no-store TTL=0 from parseCacheTTL
parseCacheTTL returns 0 to signal "do not cache" (no-cache, no-store, or expired Expires header). The ttl <= 0 guard in endorsements.go and cosign.go was overriding this with the default TTL, causing responses that should not be cached to be cached. Changed to ttl < 0 so only truly invalid values get the fallback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 97ef623 commit 8b20cae

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

internal/cosign.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (s *Server) fetchCosignSignatures(ctx context.Context, urls []*url.URL, cli
131131
ttl = t
132132
}
133133
}
134-
if ttl <= 0 {
134+
if ttl < 0 {
135135
ttl = s.cfg.HTTPCacheDefaultTTL
136136
}
137137

internal/endorsements.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (s *Server) fetchEndorsementDocumentsWithClient(ctx context.Context, urls [
101101
ttl = t
102102
}
103103
}
104-
if ttl <= 0 {
104+
if ttl < 0 {
105105
ttl = s.cfg.HTTPCacheDefaultTTL
106106
}
107107

0 commit comments

Comments
 (0)