Files
pezkuwi-telegram-miniapp/supabase/functions/ask
SatoshiQaziMuhammed 1372978298 fix(ask): use the project's secret key; fail closed when the rate limit cannot count (#20)
The DKSapp project's legacy anon/service_role keys were disabled on
2026-10-02, after the service_role key leaked through a public commit.
ask read SUPABASE_SERVICE_ROLE_KEY, so its rate limiter stopped working.

- Read the secret key from SUPABASE_SECRET_KEYS ('default'), the variable
  Supabase provides alongside the legacy one, and send it on the apikey
  header only: as a Bearer token the gateway rejects it as a malformed JWT.
- The limiter read a missing content-range as a count of zero, so a
  rejected key let every request through to the paid model. A failed
  count, a failed log write or a missing key now refuses the request.
2026-10-02 21:00:04 +04:00
..