Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Cache delete endpoint #51

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

(WIP) Cache delete endpoint #51

wants to merge 11 commits into from

Conversation

yum25
Copy link
Member

@yum25 yum25 commented Apr 21, 2024

Pulling this out of #50 since there might be some additional concerns with exposing an endpoint that gives access to our cache.

This would allow the worker to access the cache from the pages side, allowing the worker to invalidate a cache from a different data center. Haven't tested if this would actually work yet. (Which I should probably do before actually considering the rest of this lol)

However, there are two concerns:

  1. I imagine (maybe) some CORS stuff will need to be set up to enable the worker to access the endpoint
  2. The current implementation is vulnerable to a side channel attack, because the === operator in javascript terminates early if the string deviates earlier in number of letters from the secret key. In addition to this, if this gets implemented, it may be good to private this repo so outside people don't know the header used to share the auth/api key.

Been thinking about a way to compare letter by letter manually to prevent a timing attack. Or maybe computing a hash so the user input and secret key have the same length. Or maybe it's not that big of a deal anyway lol, worst thing that happens is the cache gets invalidated.

These considerations do take up more time though so I'm breaking this out into its own thing.

yum25 added 11 commits April 19, 2024 18:05
return cache response json

return none, log output
log cache status

use standard js datetimeoptions type
remove trailing slash
use waitUntil on load and update

change error code

change production type to accurately reflect what it is

change PRODUCTION comparison to be more explicit

reverse conditional url order

revert change

log production variable

log url origin
remove url origin log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant