TFS 937650 - SDL: Mitigate against cross-site request forgery (CSRF) attacks

use ValidateAntiForgeryToken for the actions with HttpPost Method for
JobController
This commit is contained in:
huazhan 2017-02-13 19:33:57 -08:00
Родитель 8dc54dbfc2
Коммит b61091e40d
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -176,8 +176,9 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
});
}
[RequirePermission(Permission.ManageJobs)]
[HttpPost]
[RequirePermission(Permission.ManageJobs)]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ScheduleTwinUpdate(ScheduleTwinUpdateModel model)
{
var twin = new Twin();
@ -226,8 +227,9 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
return RedirectToAction("Index", "Job", new { jobId = jobId });
}
[RequirePermission(Permission.ManageJobs)]
[HttpPost]
[RequirePermission(Permission.ManageJobs)]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ScheduleIconUpdate(ScheduleTwinUpdateModel model)
{
var twin = new Twin() { ETag = "*" };
@ -267,8 +269,9 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Web.
});
}
[RequirePermission(Permission.ManageJobs)]
[HttpPost]
[RequirePermission(Permission.ManageJobs)]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ScheduleDeviceMethod(ScheduleDeviceMethodModel model)
{
string methodName = model.MethodName.Split('(').First();