File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
csharp/ql/test/query-tests/Security Features/CWE-285/MissingAccessControl/MVCTests Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1- | ProfileController.cs:10:25:10:31 | Delete1 | This action is missing an authorization check. |
1+ #select
2+ | ProfileController.cs:12:25:12:31 | Delete1 | This action is missing an authorization check. |
3+ | ProfileController.cs:39:25:39:31 | Delete4 | This action is missing an authorization check. |
4+ testFailures
5+ | ProfileController.cs:39:25:39:31 | This action is missing an authorization check. | Unexpected result: Alert |
Original file line number Diff line number Diff line change 11using Microsoft . AspNetCore . Mvc ;
22using Microsoft . AspNetCore . Authorization ;
33
4+ public class RequirePermissionAttribute : AuthorizeAttribute { }
5+
46public class ProfileController : Controller
57{
68 private void doThings ( ) { }
@@ -32,6 +34,13 @@ public ActionResult Delete3(int id)
3234 return View ( ) ;
3335 }
3436
37+ // GOOD: The RequirePermission attribute is used (which extends AuthorizeAttribute).
38+ [ RequirePermission ]
39+ public ActionResult Delete4 ( int id )
40+ {
41+ doThings ( ) ;
42+ return View ( ) ;
43+ }
3544}
3645
3746[ Authorize ]
You can’t perform that action at this time.
0 commit comments