lukeed / lukeed/worktop

`isCacheable` allowed cache by default if the `cache-control` header is empty may leading to a security flaw in ssg content

Open
#176 2 comments 1 reaction 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.