Commit Graph

12 Commits

Author SHA1 Message Date
Diego Rodrigues de Sa e Souza
de369fcc59 fix(security): container/Fly REQUIRE_API_KEY posture + free-tier usage leak (#13679) (#13911)
PR E of the #13679 insecure-defaults umbrella (items #6, #7; item #8 analyzed
as by-design, no change). The published Docker image and fly.toml shipped
without REQUIRE_API_KEY set, so a bare `docker run` (README/QUICK-START
one-liners, no --env-file) or a `fly deploy` combined "keyless" with
"world-reachable" for the anonymous /v1 LLM proxy. docker-compose.yml already
mitigates this via loopback-only binding (#12568) and correctly keeps
following the operator's own .env, so it is untouched. The npm/CLI
local-first REQUIRE_API_KEY=false default in featureFlagDefinitions.ts is
also untouched per the owner's decision.

/api/free-tier/summary ships an unconditional Access-Control-Allow-Origin: "*"
and always included the operator's own local usedThisMonth/remaining usage
regardless of auth — a low-severity info leak to any reachable origin. Both
fields are now withheld from unauthenticated callers while the intentionally
public catalog data stays served to everyone.

The gemini-SSE (openai-to-gemini-sse.ts) sub-finding needed no code change:
/v1beta/models/*:streamGenerateContent is already classified CLIENT_API and
fronted by clientApiPolicy through src/proxy.ts before the translator ever
runs, and its CORS-header echo was already hardened fail-closed by #12573.
REQUIRE_API_KEY=true (this PR's container/Fly default) closes the dependency
that finding cited. Added a locking regression test confirming this chain.

Regression tests:
- tests/unit/issue-13679-container-posture-require-api-key.test.ts
- tests/unit/issue-13679-free-tier-summary-usage-leak.test.ts
- tests/unit/issue-13679-gemini-sse-requires-api-key.test.ts (confirmation)

Refs #13679
2026-09-17 10:45:07 -03:00
xiaoge1688
57ef0ad41d chore(deploy): keep fork fly.toml 2026-04-02 20:37:54 +08:00
Fly.io
8f162cd57c New files from Fly.io Launch 2026-04-02 08:02:40 +00:00
xiaoge1688
d9341e033b Update fly.toml 2026-04-02 15:46:04 +08:00
Fly.io
2a3a0c758a New files from Fly.io Launch 2026-04-02 07:23:37 +00:00
xiaoge1688
c81c79ad52 chore(deploy): update Fly.io app name 2026-04-02 14:42:49 +08:00
xiaoge1688
520a89f5f6 chore(deploy): keep fork fly.toml 2026-04-02 12:14:19 +08:00
Fly.io
b7316353f4 New files from Fly.io Launch 2026-04-02 03:51:09 +00:00
xiaoge1688
902a2723ae chore(deploy): revise Fly.io runtime config 2026-04-02 11:36:42 +08:00
Fly.io
6a2bc1ef2b New files from Fly.io Launch 2026-04-02 03:24:47 +00:00
xiaoge1688
41f9f96819 chore(deploy): update Fly.io app config 2026-04-02 11:15:26 +08:00
Fly.io
1fca80e27d New files from Fly.io Launch 2026-04-01 14:49:27 +00:00