False positive: Dereferenced variable may be null ignore NRT attributes
- 主要言語
- CodeQL
- スター
- 10.1k
- フォーク
- 2.1k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 141
説明
**Description of the false positive**
NRT attributes appear to be ignored by CodeQL. This results in lots of noise as we have to explicitly mark each point of use as a false positive and so safe.
**Code samples or links to source code**
```cs
if (TryConvertContractState(tradingPhase, state, out Models.ContractState? contractState))
return contractState.Value;
```
when it is defined as:
```cs
private static bool TryConvertContractState(
string tradingPhase, string state,
[NotNullWhen(true)] out PersistedModels.ContractState? cdmState)
{}
```
**URL to the alert on GitHub code scanning (optional)**
Private Repo, but the view query source goes to: https://github.com/github/codeql/blob/aa3000df1310b332ba1c84afec3bacb0aeb4dbbd/csharp/ql/src/CSI/NullMaybe.ql
コントリビューションガイド
調査の方向性
csharp/ql/src/CSI/NullMaybe.ql から始め、レポートにリンクされているクエリソースを確認し、[NotNullWhen(true)] を使用する C# サンプルをどのように処理しているかをレビューします。提供された TryConvertContractState の例で報告されたアラートを再現してください。完了条件は、正しい contractState.Value のデリファレンスが nullability の問題として報告されなくなることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- security
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100