afu-it/security-for-vibecoders/cors-configuration
Claude Code and agent skill by afu-it/security-for-vibecoders
- community
Checking that the SKILL.md file is still in the repository.
Configure CORS correctly to prevent credential leaks and unauthorized cross-origin access. Covers Express, Next.js, Cloudflare Workers, Laravel, and FastAPI. Use when setting up CORS, fixing preflight errors, or auditing cross-origin policies.
Install
npx vskill@latest install afu-it/security-for-vibecoders/cors-configurationSKILL.md
CORS Configuration
Configure Cross-Origin Resource Sharing correctly. Misconfigured CORS is one of the most common vibe-coder mistakes -- wildcard origins with credentials enabled is equivalent to having no security at all.
The Rule
NEVER use `Access-Control-Allow-Origin: *` with credentials. ALWAYS whitelist specific origins.
Common Mistakes
| Mistake | Risk | Fix | |
|---|---|---|---|
Origin: * with credentials | Any site can steal user data | Whitelist specific origins | |
Reflecting Origin header without validation | Attacker controls allowed origin | Check against allowlist | |
Allowing null origin | Sandboxed iframes can exploit | Never allow null | |
Overly broad regex (*.example.com) | evil-example.com matches | Use exact string matching | |
| Exposing all headers | Information leakage | Only expose needed headers |
Framework Implementations
Cloudflare Workers
Express.js
BAD:
GOOD:
Next.js API Routes
Laravel
Python FastAPI
CORS Checklist
- [ ] Origins are explicitly whitelisted (no wildcards with credentials)
- [ ]
Access-Control-Allow-Originnever reflects untrusted input - [ ]
nullorigin is not in the allowlist - [ ] Preflight (OPTIONS) requests are handled correctly
- [ ]
Access-Control-Max-Ageis set to reduce preflight requests - [ ] Only necessary methods and headers are allowed
- [ ] Development origins (localhost) are excluded in production
PDPA 2024 Relevance
Misconfigured CORS that allows any website to access authenticated API endpoints constitutes a failure to implement langkah keselamatan yang munasabah (reasonable security measures). If user data is exfiltrated through CORS misconfiguration, the developer faces liability under Seksyen 5(1).
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cors-configuration/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/afu-it/security-for-vibecoders/cors-configuration)