Fix Unkey API Key Verification and Improve Diagnostic Logs - #100
Conversation
- Prioritize Unkey validation when configured, and gracefully fallback to local validation if the key is valid locally (e.g., test or fallback keys). - Secure local key bypass: disable automatic `mk_test_` bypass in production to prevent authentication bypass vulnerabilities. - Add detailed diagnostic logging in `apiGuard` to log the presence of UNKEY_API_ID and other variables to help users debug Vercel environment loading. - Return explicit 503 error responses if Unkey verification fails with technical/network errors instead of a misleading 401. Co-authored-by: Simonc44 <216070312+Simonc44@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…x build imports - Prioritize Unkey validation when configured, and gracefully fallback to local validation if the key is valid locally (e.g., test or fallback keys). - Secure local key bypass: disable automatic `mk_test_` bypass in production to prevent authentication bypass vulnerabilities. - Add detailed diagnostic logging in `apiGuard` to log the presence of UNKEY_API_ID and other variables to help users debug Vercel environment loading. - Return explicit 503 error responses if Unkey verification fails with technical/network errors instead of a misleading 401. - Install missing build dependencies for @shadergradient/react (three, @react-three/fiber, @react-three/drei) to fix the Rolldown resolution build error. Co-authored-by: Simonc44 <216070312+Simonc44@users.noreply.github.com>
…x shadergradient canvas R3F hooks - Prioritize Unkey validation when configured, and gracefully fallback to local validation if the key is valid locally (e.g., test or fallback keys). - Secure local key bypass: disable automatic `mk_test_` bypass in production to prevent authentication bypass vulnerabilities. - Add detailed diagnostic logging in `apiGuard` to log the presence of UNKEY_API_ID and other variables to help users debug Vercel environment loading. - Return explicit 503 error responses if Unkey verification fails with technical/network errors instead of a misleading 401. - Install missing build dependencies for @shadergradient/react (three, @react-three/fiber, @react-three/drei). - Fix "R3F: Hooks can only be used within the Canvas component" error by dynamically importing and wrapping `ShaderGradient` inside `ShaderGradientCanvas`. Co-authored-by: Simonc44 <216070312+Simonc44@users.noreply.github.com>
…e visual effects - Implemented detailed logging and service fallback logic in `src/lib/api-auth.server.ts` to debug and secure Unkey key verification. - Locked local bypass for `mk_test_` keys strictly to non-production environments to prevent security vulnerabilities. - Set dynamic shader gradient background to fixed position to maintain visual continuity when scrolling. - Created `DispersingTitle` in `src/routes/index.tsx` with smooth CSS-based 3D air dispersion hover animation. - Rendered description text, Turso, and GitHub trust logos/texts in full white for contrast, leaving search and daily update texts as requested. - Installed `@shadergradient/react` and `@react-three/fiber` peer dependencies and wrapped with canvas to fix dynamic import errors. Co-authored-by: Simonc44 <216070312+Simonc44@users.noreply.github.com>
… shader gradient background - Removed the title air dispersion hover effect entirely as requested. - Enhanced the "votre député a voté." title line with a highly visible, bright neon `.text-gradient-bright` gradient. - Adjusted hero styles so the dynamic shader gradient background remains fully visible as a continuous background when scrolling down instead of shifting into a flat gray background. Co-authored-by: Simonc44 <216070312+Simonc44@users.noreply.github.com>
- Adds the UNKEY_ROOT_KEY in the Authorization header for Unkey keys.verifyKey requests. - Checks both UNKEY_ROOT_KEY and UNKEY_API_ID to trigger Unkey verification. - Updates diagnostic logs to print the status of UNKEY_ROOT_KEY, UNKEY_API_ID, and MANDAT_API_KEYS. - Updates unit tests to verify authorization header handling during Unkey check. Co-authored-by: Simonc44 <216070312+Simonc44@users.noreply.github.com>
This PR resolves the 401 Unauthorized error reported by the user when calling the api with their key. It makes the key verification robust and highly diagnostic:
UNKEY_API_IDpresent/missing) on every API request. This will immediately show the user if their newly added Vercel environment variables are actually loaded in the current deployment (as Vercel requires a re-deploy for new env vars to take effect).MANDAT_API_KEYSormk_test_keys).mk_test_keys is strictly disabled in production (process.env.NODE_ENV !== "production"). It remains enabled in development and test environments to make unit tests and local runs work flawlessly.npm testand all 46 tests pass successfully.PR created automatically by Jules for task 11353562886668436631 started by @Simonc44