github / github/codeql

False positive: missing-function-level-access-control with custom Authorize attribute

Đang mở
#19,279 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
false-positive
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

**Description of the false positive**

We are using .NET and C# code scanning.

The issue raised is 'cs/web/missing-function-level-access-control'

We have a custom attribute 'RequirePermission' on the action methods (or sometimes on the controller) that inherits from [Authorize] attribute. This is providing the access control.

**e.g. Action Method**
```
[RequirePermission(OnSendPermissions.ManagePricing)]
[HttpDelete("{extraId:int:min(1)}/rates/{rateId:int:min(1)}")]
public async Task DeleteDeliveryExtraRate(int extraId, int rateId)
```
**e.g. Custom Authorize Attribute that checks permissions**
```
public class RequirePermissionAttribute : AuthorizeAttribute
```

Presumably you are not checking attribute inheritance.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start with the cs/web/missing-function-level-access-control query and review how it recognizes Authorize attributes. Use the RequirePermissionAttribute examples in this issue to check inherited authorization handling. Done means these action methods or controllers are no longer reported as missing function-level access control.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp
Lĩnh vực
security
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.