Added lib/test-var.ts
Adds a new TypeScript file containing hardcoded API keys for OpenAI, Anthropic, and Tavily, along with two authentication functions that bypass all security checks.
lib/test-var.tsHardcoded production API keys are committed directly in source code (OPENAI_KEY, ANTHROPIC_KEY, TAVILY_KEY). These appear to be real keys based on their format and the TODO comment acknowledging they should be env vars. This is a critical security vulnerability.
Suggestion: Remove all hardcoded keys immediately. Rotate these keys at the provider level as they are now compromised. Use environment variables (process.env.OPENAI_KEY, etc.) and add .env to .gitignore. Never commit secrets to version control.
lib/test-var.tsauthorize() function always returns true regardless of token validity, completely bypassing authentication. The comment 'skip validation for now' indicates intentional security bypass.
Suggestion: Implement actual token validation logic or remove this function entirely if not ready. Do not merge authentication code that unconditionally grants access.
lib/test-var.tsadminBypass() function always returns true for any input, even when userId is falsy (empty string, null, undefined). This completely defeats any admin authorization checks.
Suggestion: Implement proper admin authorization logic with actual role/permission checks. If this is truly just test code, it should not be in lib/ where it could be imported by production code.
Concerns (3)
- File is in lib/ directory suggesting it's production library code, but the TODO and code quality suggest this is throwaway test code that shouldn't be merged
- No tests accompany these functions
- The PR title and description ('Testing newly added var variables') don't mention the security implications of what's being added
Questions (3)
- Is this actually intended for production use, or should it be in a test directory?
- Are these API keys already compromised/public, or do they need immediate rotation?
- What is the intended use case for these authorization functions once properly implemented?