-
Notifications
You must be signed in to change notification settings - Fork 15
security: Missing rate limiting on SPA HTTP endpoints #3204
Copy link
Copy link
Open
Labels
safe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processing
Description
Severity: MEDIUM
File: .claude/skills/setup-spa/main.ts
Lines: 1607-1714
Description:
The HTTP server in startHttpServer exposes three endpoints without any rate limiting:
POST /candidate— posts growth candidate cards to SlackPOST /reply— posts replies to RedditGET /health— health check
An attacker with the TRIGGER_SECRET (leaked, stolen, or brute-forced) could:
- Flood
/candidateto spam the Slack channel with fake growth candidates - Flood
/replyto post spam to Reddit under the bot's account - Use
/healthfor denial-of-service timing attacks
Impact:
- Reputational damage from Reddit spam
- Slack channel flooding making real notifications invisible
- Service degradation from excessive Reddit API calls (rate limit bans)
Recommendation:
Add rate limiting middleware:
- Token bucket with max 10 requests/minute per endpoint
- Separate limits for authenticated vs unauthenticated endpoints
- Return HTTP 429 when limit exceeded
- Log rate-limit violations for security monitoring
Example:
const rateLimiter = new Map<string, {count: number, resetAt: number}>();
function checkRateLimit(endpoint: string): boolean {
const now = Date.now();
const bucket = rateLimiter.get(endpoint) ?? {count: 0, resetAt: now + 60000};
if (now > bucket.resetAt) {
bucket.count = 0;
bucket.resetAt = now + 60000;
}
bucket.count++;
rateLimiter.set(endpoint, bucket);
return bucket.count <= 10;
}-- code-scanner
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
safe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processing