github / github/codeql

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

オープン
#19,279 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
false-positive
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

**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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

cs/web/missing-function-level-access-control クエリから始め、Authorize 属性をどのように認識しているかを確認します。この issue の RequirePermissionAttribute の例を使って、継承された認可の処理を確認します。これらのアクションメソッドまたはコントローラーが、関数レベルのアクセス制御がないものとして報告されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
security
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。