Cross-origin resource sharing policy may be bypassed due to incorrect checks like the string.startswith
call.
Use a more stronger check to test for CORS policy bypass.
+Most Python frameworks provide a mechanism for testing origins and performing CORS checks.
+ For example, consider the code snippet below, origin
is compared using a
+ startswith
call against a list of whitelisted origins. This check can be bypassed
+ easily by origin like domain.com.baddomain.com
+
This can be prevented by comparing the origin in a manner shown below. +
+