worker: restrict /v1/site-rules publishing to publisher keys - #12
Merged
Conversation
POST /v1/site-rules/:key accepted ANY active API_KEYS entry, so any read/proxy customer key could overwrite the global rules every client fetches. Require `publish: true` on the key as well. Documents the publisher-key shape in wrangler.toml and publish-rules.sh. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying wickproject with
|
| Latest commit: |
54cb7ba
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7b3688e8.wickproject.pages.dev |
| Branch Preview URL: | https://tighten-publish-auth.wickproject.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restrict rule publishing to designated publisher keys
POST /v1/site-rules/:keygated onactiveonly, so any activeAPI_KEYSentry (a read/proxy/CAPTCHA customer key) could overwrite the global site-rules every client fetches. This adds a requiredpublish: trueflag on the key, so publishing is limited to keys you explicitly designate.Backward-compatible: existing keys keep working for their existing endpoints; they just can't publish. A publisher entry:
{ "<token>": { "customer": "self-improvement-loop", "active": true, "publish": true } }Docs updated in
wrangler.tomlandbench/publish-rules.sh.After merge: redeploy the worker (
cd worker && npx wrangler deploy) and add a publisher entry to theAPI_KEYSsecret.🤖 Generated with Claude Code