I am seeking to deepen my comprehension of how CORS functions and why it operates in its particular manner.
According to the insights I gained from this article, when a page from www.a.com initiates an AJAX request to www.b.com, it is entirely up to www.b.com to determine whether or not the request should be permitted.
However, what aspects are actually safeguarded on the client within this framework? For instance, if a malicious actor manages to carry out an XSS script injection on my webpage, they could then execute an AJAX request to their domain for storing user data. Consequently, the hacker's domain would undoubtedly authorize such a request.
My initial impression was that www.a.com should be the entity responsible for determining which domains can receive requests. Therefore, in theory, I envisioned compiling a comprehensive list of approved domains for AJAX CORS requests within the header Access-Control-Allow-Origin.
Can someone elucidate the security challenges that the current CORS implementation addresses?