diff --git a/.gemini/settings.json b/.gemini/settings.json deleted file mode 100644 index c57a84a..0000000 --- a/.gemini/settings.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "mcpServers": { - "GitHubApprecio": { - "command": "npx", - "args": [ - "-y", - "mcp-remote@0.1.15", - "https://mcp-github-323381129796.us-central1.run.app/sse", - "--transport", - "sse-only" - ] - } - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 16801b8..6803d6c 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ dist/ coverage/ comandos.txt debug/ +.gemini/ diff --git a/src/middleware/auth.ts b/src/middleware/auth.ts index 66bc1b1..198dcc3 100644 --- a/src/middleware/auth.ts +++ b/src/middleware/auth.ts @@ -2,26 +2,30 @@ import { Request, Response, NextFunction } from 'express'; import { config } from '#config/index'; import { logger } from '#core/logger'; -export const authenticate = (req: Request, res: Response, next: NextFunction) => { + +export const authenticate = (req: Request, res: Response, next: NextFunction): void => { const authHeader = req.headers['authorization']; if (!authHeader) { logger.warn('Authentication failed: No Authorization header'); - return res.status(401).json({ error: 'Authorization header required' }); + res.status(401).json({ error: 'Authorization header required' }); + return; } const tokenParts = authHeader.split(' '); if (tokenParts.length !== 2 || tokenParts[0].toLowerCase() !== 'bearer') { logger.warn('Authentication failed: Invalid token format'); - return res.status(401).json({ error: 'Invalid token format. Expected "Bearer "' }); + res.status(401).json({ error: 'Invalid token format. Expected "Bearer "' }); + return; } const token = tokenParts[1]; if (token !== config.apiKey) { logger.warn('Authentication failed: Invalid API key'); - return res.status(401).json({ error: 'Invalid API key' }); + res.status(401).json({ error: 'Invalid API key' }); + return; } logger.info('Authentication successful');