fix: reject requests targeting a cachew playpen when not running as one#204
Merged
alecthomas merged 1 commit intomainfrom Mar 20, 2026
Merged
fix: reject requests targeting a cachew playpen when not running as one#204alecthomas merged 1 commit intomainfrom
alecthomas merged 1 commit intomainfrom
Conversation
Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d0345-d564-743f-ad25-f1063ade61da
a87d005 to
a0485ea
Compare
alecthomas
approved these changes
Mar 20, 2026
alecthomas
reviewed
Mar 20, 2026
| @@ -0,0 +1 @@ | |||
| selected_org: cash | |||
alecthomas
added a commit
that referenced
this pull request
Mar 20, 2026
#206) …ning as one (#204)" This reverts commit 2f3c5c3. @jrobotham-square I'd prefer not to have anything bespoke in Cachew. We have OPA enforcement now, we can add an OPA policy to do the same thing: ```hcl opa { policy = <<EOF package cachew.authz default allow := false allow if { permitted not deny } permitted if input.method == "GET" permitted if input.method == "HEAD" permitted if startswith(input.remote_addr, "127.0.0.1:") deny if { data.IS_PLAYPEN != "true" contains(input.headers.baggage, "cachew-playpen=") } EOF data = <<EOF {"IS_PLAYPEN": "${IS_PLAYPEN}"} EOF } ``` We can extend the OPA integration to support returning a message or a different HTTP status if required. Co-authored-by: Claude Code <noreply@anthropic.com>
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.
Adds a middleware that returns 503 when a request includes a
cachew-playpenbaggage header but the instance is not a playpen. Prevents requests from silently falling through to staging when the target playpen is unavailable. Disabled whenIS_PLAYPEN=true.