Language: JavaScript
Label: vulnerable
CWE: CWE-668 \u2014 Exposure of Resource to Wrong Sphere
The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.

Code:
function confirmAjaxAction(action, service, id) {
	$( "#dialog-confirm" ).dialog({
		resizable: false,
		height: "auto",
		width: 400,
		modal: true,
		title: "Are you sure you want to "+ action + " " + id + "?",
		buttons: {
			"Sure": function() {
				$( this ).dialog( "close" );
				if(service == "haproxy") {
					ajaxActionServers(action, id);
					if(action == "restart" || action == "reload") {
						if(localStorage.getItem('restart')) {
							localStorage.removeItem('restart');
							$("#apply").css('display', 'none');
						}
					}
				} else if (service == "waf") {
					ajaxActionWafServers(action, id)
				} else if (service == "nginx") {
					ajaxActionNginxServers(action, id)
				} else if (service == "keepalived") {
					ajaxActionKeepalivedServers(action, id)
				} else if (service == "apache") {
					ajaxActionApacheServers(action, id)
				} else if (service == "waf_nginx") {
					ajaxActionWafNginxServers(action, id)
				}
			},
			Cancel: function() {
				$( this ).dialog( "close" );
			}
		}
	});
}