मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी75k · #2793

cross-origin-security

यह क्या करती है

यह स्किल जाँचती है कि साइट origins के बीच जाने वाले अनुरोधों और संदेशों को कैसे संभालती है। यह उन डेवलपर के लिए है जो हमलावरों को उपयोगकर्ता का डेटा पढ़ने या उनकी ओर से कार्य करने से रोकना चाहते हैं।

कब इस्तेमाल करें

  • ✓जब साइट दूसरी विंडो या iframe से आने वाले संदेश सुनती है।
  • ✓जब लॉगिन वाले रूट पर CORS सेटिंग कोई भी origin अनुमति देती है।
  • ✓जब redirect पैरामीटर उपयोगकर्ता को किसी भी बाहरी पते पर भेज सकते हैं।

Skill का लिंक

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/cross-origin-security/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/cross-origin-security/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरी साइट के message listeners और CORS सेटिंग जाँचें कि कोई ऐसी चीज़ तो नहीं जिससे दूसरी साइटें उपयोगकर्ता का डेटा पढ़ सकें।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट जाँचता है कि message listeners हर संदेश का स्रोत सत्यापित करें, प्रमाणीकृत रूटों पर CORS सीमित हो, और redirects सिर्फ़ स्वीकृत गंतव्यों पर जाएँ।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Handle cross-origin requests securely

The Same-Origin Policy is the browser's primary defense against malicious sites stealing data or performing actions on behalf of your users. Misconfiguring CORS or failing to validate postMessage origins can allow attackers to bypass this protection — reading private data, submitting forms as users, or injecting content into your pages.

Quick Reference

  • Always verify event.origin before processing postMessage data
  • Never set Access-Control-Allow-Origin: * for authenticated endpoints
  • Validate and sanitize all data received from cross-origin messages
  • Use SameSite cookies to prevent CSRF from cross-origin requests
  • Reject unvalidated redirect targets such as next, redirect, or callbackUrl

Check

Check this code for insecure cross-origin patterns: missing origin validation in postMessage listeners, overly permissive CORS settings, and missing CSRF protections. Flag redirect parameters that accept arbitrary external URLs.

Fix

Add origin validation to postMessage listeners and review CORS configuration to ensure it's not overly permissive for authenticated routes. Reject or allow-list untrusted redirect destinations before navigating.

Explain

Explain the Same-Origin Policy, how CORS works, and how to securely use postMessage for cross-origin communication.

Code Review

Review scripts, client components, and browser execution paths related to Handle cross-origin requests securely. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser. Check login, logout, SSO, and return-to flows for open redirects.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/cross-origin-security

अक्सर पूछे जाने वाले सवाल

Same-Origin Policy क्या है?

स्किल इसे दुर्भावनापूर्ण साइटों से उपयोगकर्ता के डेटा को पढ़ने या उस पर कार्य करने के खिलाफ़ ब्राउज़र का मुख्य बचाव बताती है।

एजेंट संदेशों में क्या जाँचता है?

कि किसी भी डेटा के उपयोग से पहले संदेश का origin सत्यापित हो।

redirect पैरामीटर जोखिम भरे क्यों हैं?

स्किल कहती है कि जब तक उनकी जाँच या स्वीकृति न हो, वे उपयोगकर्ताओं को किसी भी बाहरी साइट पर भेज सकते हैं।

जानकारी

लेखक का मूल विवरण

Use when reviewing scripts, client components, bundles, or runtime behavior related to Handle cross-origin requests securely. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.

repo: thedaviddias/Front-End-Checklist

लोकप्रियता

GitHub स्टार
75k
रैंकिंग में स्थान
#2793
लाइसेंस
MIT
अपडेट की गई
31/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills