Repository navigation
Featherframe Cloud keeps the owner's AI key at the front door, never in the server's data (W-937) - #377
Merged
Conversation
…in the server's data (W-937) The key sat in plain text in the household's database, which is copied to R2 after every update and onto every Container that starts. Now the front door keeps it, sealed under a Worker secret, and the database keeps only a stand-in with the key's mask. The server's AI requests go to <vendor>.vendor.internal, which Cloudflare's outbound interception hands to a gate in the Worker: it adds the key, only for the calls Featherframe makes and, for a paid call, only while the spend gate holds that purchase open. A key from before moves at a start, and only once the vendor answers it through the gate as it does directly, so a gate that does not work leaves the key where it is, working. The database is then compacted, since SQLite keeps a replaced value in its free pages. Cloud no longer offers the Self-hosted image provider or the Local text provider, which a Container cannot reach. Self-hosted is unchanged. Refs: W-937
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.
What changes
On Featherframe Cloud, the owner's AI keys (the image key and the text key) are no longer in the household's database. That database is copied to R2 after every update and onto every Container that starts.
AI_KEY_SECRET) and bound to the household and the key's slot. The database keeps a stand-in (held:<mask>:<fingerprint>) so the page still showssk-pr…wxyz.<vendor>.vendor.internal.HouseholdServerintercepts that name on its Container (ctx.container.interceptOutboundHttp) and hands it toVendorGate, a Worker entrypoint with the household in its props. The gate adds the key, but only for the paths Featherframe calls, and for a paid call only while the spend gate holds that purchase open. Its own refusals carryX-FF-Gate.Test plan
make test: server suite, including the newtests/test_keys.py(routing for every model class, the save path, the move, compaction, the Cloud page)hosted:npx tsc,npx vitest run, includingtest/gate.test.ts(allowed paths, header stripping, seal and unseal, the purchase check, the gate end to end)Refs W-937