Repository navigation
fix(cdn): refuse cache paths with dot segments - #14887
Conversation
Purge paths are joined onto provider API routes, and HTTP clients resolve `.` and `..` segments before sending, so a path carrying one could move a token-bearing request off the purge route. No cached URL contains such a segment, so Domain::validatePaths refuses them, percent-encoded or not; dots elsewhere in a path, query or fragment are unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review complete. No issues found — approved ✅. This PR hardens the CDN package against path traversal by rejecting
Reviewed commit: db2cbfa |
🟢 Tier S · Ready to merge
📂 Walkthrough · 4
Reviewed |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
…t-segments fix(cdn): refuse cache paths with dot segments (cherry picked from commit c3af82f)
Summary
Domain::validatePaths(used byCache::purgePaths()and by every adapter'spurgePaths()) now refuses a cache path that has a.or..segment, including the percent-encoded forms (%2e,%2E,.%2e, …).Fastly purges a path by appending it to its API route (
/purge/{domain}{path}), and HTTP clients resolve dot segments before sending, so such a segment would move the request, with itsFastly-Key, off the purge route. No cached URL contains a dot segment, so refusing them changes nothing for real paths. Dots inside a segment (/app.js,/.well-known/…,/..png) and anything in the query or fragment are still accepted.Tests
DomainTest: dot-segment paths (plain, at start/middle/end, before a query, encoded and half-encoded) are refused; dotted names, query strings and fragments are accepted. These cases fail without the change.FastlyTest: a traversal path is refused before any request is sent.🤖 Generated with Claude Code