과도하게 허용적인 CORS 정규식(와일드카드 및 이스케이프되지 않은 점)
Permissive CORS Regex (Wildcard with Unescaped Dot)
Last updated
Permissive CORS Regex (Wildcard with Unescaped Dot)
Last updated
const corsDomains = [
/(.+\.)*example.com$/,
/^(http|https):\/\/.+\.evil\.com$/,
/^(http|https):\/\/(.+)\.my\.site.com$/,
];
// CORS 설정 예시
app.use(cors({
origin: corsDomains,
}));const corsAllowedDomains = [
/^https?:\/\/www\.example\.com$/, // 명확하게 'www.example.com'만 허용
/^https?:\/\/service\.my\.site\.com$/, // 서비스용 서브도메인만 허용
];
app.use(cors({
origin: corsAllowedDomains,
}));