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 1
1
using Microsoft . AspNetCore . Mvc ;
2
2
using Microsoft . AspNetCore . Authorization ;
3
3
4
+ public class RequirePermissionAttribute : AuthorizeAttribute { }
5
+
4
6
public class ProfileController : Controller
5
7
{
6
8
private void doThings ( ) { }
@@ -32,6 +34,13 @@ public ActionResult Delete3(int id)
32
34
return View ( ) ;
33
35
}
34
36
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
+ }
35
44
}
36
45
37
46
[ Authorize ]
You can’t perform that action at this time.
0 commit comments