luci-app-upnp: protect lease delete call with csrf token
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 20 Oct 2015 22:11:28 +0000 (00:11 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 20 Oct 2015 22:11:28 +0000 (00:11 +0200)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
applications/luci-app-upnp/luasrc/controller/upnp.lua
applications/luci-app-upnp/luasrc/view/upnp_status.htm

index 790bf29..a0e2fd5 100644 (file)
@@ -15,7 +15,7 @@ function index()
        page.dependent = true
 
        entry({"admin", "services", "upnp", "status"}, call("act_status")).leaf = true
        page.dependent = true
 
        entry({"admin", "services", "upnp", "status"}, call("act_status")).leaf = true
-       entry({"admin", "services", "upnp", "delete"}, call("act_delete")).leaf = true
+       entry({"admin", "services", "upnp", "delete"}, post("act_delete")).leaf = true
 end
 
 function act_status()
 end
 
 function act_status()
index ce735cf..e358dcd 100644 (file)
@@ -1,6 +1,6 @@
 <script type="text/javascript">//<![CDATA[
        function upnp_delete_fwd(idx) {
 <script type="text/javascript">//<![CDATA[
        function upnp_delete_fwd(idx) {
-               XHR.get('<%=url('admin/services/upnp/delete')%>/' + idx, null,
+               (new XHR()).post('<%=url('admin/services/upnp/delete')%>/' + idx, { token: '<%=token%>' },
                        function(x)
                        {
                                var tb = document.getElementById('upnp_status_table');
                        function(x)
                        {
                                var tb = document.getElementById('upnp_status_table');