`isCacheable` allowed cache by default if the `cache-control` header is empty may leading to a security flaw in ssg content
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
This problem appeared in [@sveltejs/adapter-cloudflare@2.2.2](https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fadapter-cloudflare%402.2.2) that let `Cache.save` handle whether to cache the response or not.
The scenario that leads to the problem is when [`Cache-Control` is empty](https://github.com/lukeed/worktop/blob/master/src/cache.ts#L37-L38) and the user is logged in without any problem all the content is generated and cached to the CF server. Then another tries to access directly to the dashboard without any authorization CF server response cached content of another user directly to them.
I think that we should not allow cache by default and let the developer decide which response to cache to avoid this issue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Cache.save and the referenced src/cache.ts behavior for an empty Cache-Control header. Confirm how cacheability is decided when the header is empty, then define completion as preventing caching by default while preserving an explicit developer choice for responses that should be cached.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100