Optional gate to restrict Apollo to known clients (idea)#537
Closed
elias-ba wants to merge 3 commits into
Closed
Conversation
…t trust Builds on the concept PR with a tested, dependency-injected foundation: - createInstanceAuth(config) with DI; no module globals or test seams. Typed AuthContext replaces ad-hoc any. - resolveAuthConfigFromEnv() owns env/DB/Bun.SQL resolution and fails CLOSED (deny-all) when enabled but the table/runtime is unusable. - createDbLookup(): TTL cache + single-flight refresh + serve-stale on error. - Internal service-to-service auth via auto-generated APOLLO_INTERNAL_SECRET (inherited by spawned services); never network-address trust. - External requests: strip caller-supplied api_key, inject the resolved key. - Fix: handlers reference ctx.body directly so Elysia parses the body. - Lazy Bun.SQL import (requires Bun >= 1.2); bump local .tool-versions only. Prod/CI already install a newer Bun, so the Dockerfile and CI are untouched. - Tests: gate, cache, env fail-closed, and a pinned TS<->Python hash invariant. Full suite green (34 TS + 1 py). - Changeset added.
45a38a1 to
7a314e9
Compare
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.
Description
This branch holds an optional access gate for Apollo. When turned on, every request to
/services/*must carry a valid client token, and anything without one is rejected. It's the stricter sibling of the per-client key mapping in #536: that one only recognises tokens, this one requires them.It builds on the same
lightning_clientstable and token hashing, and adds:Why it's parked
Parked here so the work isn't lost. We can pick it back up if we ever want an Apollo that only known clients can call.
Related: #536.