False positive: Insecure Direct Object Reference (cs/web/insecure-direct-object-reference) and Missing function level access control (cs/web/missing-function-level-access-control)
- 主要言語
- CodeQL
- スター
- 10.1k
- フォーク
- 2.1k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 141
説明
**Description of the false positive**
In a C# project, we have dozens of potential false positives for "Insecure Direct Object Reference (cs/web/insecure-direct-object-reference)" and "Missing function level access control (cs/web/missing-function-level-access-control)" due to the custom authorization that we use via an attribute. Please see the code example below.
What would you suggest as a mitigation in this situation?
**Code samples or links to source code**
```
[Function(Functions.Event.Add)]
public void PublicFunction() {
Function1();
}
private void Function1() {
Function2();
}
private void Function2(id) {
// load object id <= Insecure Direct Object Reference (cs/web/insecure-direct-object-reference)
}
```
where the `[Function]` attribute takes the user's identity and looks if it is authorized for a specific system function. This checks for both authentication and authorization.
The "Missing function level access control (cs/web/missing-function-level-access-control)" is often reported directly on the function declaration:
```
[Function(Functions = new[] { Functions.Location.Edit })]
public async Task Edit(string name) // <= scanner reports insecure function
```
コントリビューションガイド
調査の方向性
Start with the cs/web/insecure-direct-object-reference and cs/web/missing-function-level-access-control query entry points, then compare their findings with the [Function] attribute examples in this issue. A useful outcome would be a maintainer-approved mitigation or a clearly scoped query change that accounts for the custom authentication and authorization checks.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- security
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100