cors-security

仓库创建 2026年7月1日最近提交 23 天前SkillHot 收录 22 天前
▸ 精选理由

简单清晰,适合前后端安全联调与自动检查

这个 Skill 做什么

提供严格的 CORS 配置建议,避免通配符与凭据泄露。

教你怎么配置安全的 CORS:用来源白名单而不是通配符,只有在 Origin 精确匹配时才反射,凭证(cookie/Authorization)出现时严格配合 Access-Control-Allow-Credentials 并指定具体来源,同时控制预检缓存和暴露的头。适用于对外提供 API、跨域请求较多或者担心凭据泄露的场景。特点是以最小暴露和明确允许为原则,避免一开大口就泄露凭证。

▸ 展开 SKILL.md 英文原文

Strict CORS configuration: no wildcard with credentials, allowlist-based origins, sensible preflight cache, minimal exposed headers

开发编程CORS前端安全通用
2
Stars
0
Forks
40
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/ShieldNet-360/secure-vibe/main/skills/cors-security/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/ShieldNet-360/secure-vibe/main/skills/cors-security/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# CORS Security

## Rules (for AI agents)

### ALWAYS
- Use an **allowlist** of origins, not `*`. Reflect the incoming `Origin`
  header only when it matches a known entry from configuration (or matches
  a precompiled regex of operator-controlled hostnames).
- If responses include credentials (cookies, `Authorization`), set
  `Access-Control-Allow-Credentials: true` **and** ensure
  `Access-Control-Allow-Origin` is a single specific origin string —
  never `*`.
- Include `Vary: Origin` on responses whose body depends on the request
  `Origin`, so caches don't serve one origin's response to another.
- Restrict preflight `Access-Control-Allow-Methods` to the actual methods
  the endpoint acce
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有