|
1 | 1 |
|
2 | | -var apiServerUrl = "https://api.topcoder.com/v3/users"; |
| 2 | +var apiServerUrl = "https://api.{{DOMAIN}}/v3/users"; |
3 | 3 | var qs = (function (a) { |
4 | 4 | if (a == "") return {}; |
5 | 5 | var b = {}; |
@@ -46,14 +46,21 @@ $(document).ready(function () { |
46 | 46 | if (result.result.status === 200 && result.result.content.valid) { |
47 | 47 | $("#error").closest(".message").fadeOut(); |
48 | 48 | $("#error").html(""); |
49 | | - document.getElementById("signup").action = qs["formAction"]; |
50 | | - document.getElementById("state").value = qs["state"]; |
51 | | - document.getElementById("regSource").value = qs["regSource"]; |
52 | | - document.getElementById("utmSource").value = qs["utmSource"]; |
53 | | - document.getElementById("utmMedium").value = qs["utmMedium"]; |
54 | | - document.getElementById("utmCampaign").value = qs["utmCampaign"]; |
55 | | - document.getElementById("returnUrl").value = qs["returnUrl"]; |
56 | | - document.getElementById("signup").submit(); |
| 49 | + let formAction = qs["formAction"]; |
| 50 | + const opt1 = 'https://auth.{{DOMAIN}}/continue'; |
| 51 | + const opt2 = 'https://{{AUTH0DOMAIN}}/continue'; |
| 52 | + if (!formAction.startsWith(opt1) && !formAction.startsWith(opt2)) { |
| 53 | + // looks like XSS attack |
| 54 | + formAction = "#"; |
| 55 | + } |
| 56 | + $('#signup').attr('action', formAction); |
| 57 | + $("#state").val(qs["state"]); |
| 58 | + $("#regSource").val(qs["regSource"]); |
| 59 | + $("#utmSource").val(qs["utmSource"]); |
| 60 | + $("#utmMedium").val(qs["utmMedium"]); |
| 61 | + $("#utmCampaign").val(qs["utmCampaign"]); |
| 62 | + $("#returnUrl").val(qs["returnUrl"]); |
| 63 | + $("#signup").submit(); |
57 | 64 | } |
58 | 65 | }, |
59 | 66 | }); |
|
0 commit comments