Python: Call analysis fails in some scenarios
まだ誰も着手していません。
評価
調査の方向性
まず、提供された CodeQL クエリを最小限の Python の例に対して実行し、動作するとマークされた呼び出しと壊れているとマークされた呼び出しを比較します。代入式に対する Python extractor と pointsTo の動作を確認し、ターゲットが Value を持つ呼び出しをクエリが報告しなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
説明
While trying to use the 'pointsTo' approach for some basic control-flow-based queries (please let me know if there's a better approach to find 'all statements reachable from a function entry-point'), I've noticed that currently, some calls are incorrectly picked up without any value to point to.
MWE:
import sys
def mwe_callable():
print("Hello, World!") # works
def mwe_broken():
if herp := sys.argv[1]:
raise Exception("merp") # broken
mwe_callable() # broken
def mwe_broken2():
if herp := "derp":
print("merp") # broken
mwe_callable() # works
def mwe_works():
if sys.argv[1] == "derp":
raise Exception("merp") # works
mwe_callable() # works
def mwe_works2():
print("merp") # works
mwe_callable() # works
Test query:
import python
from Function f, Call c, Expr e
where
f.contains(c) and
e = c.getFunc() and
not exists(Value v | e.pointsTo() = v)
select f, c, e
Every call I've marked here as 'broken' is returned by the query as not having any Value to point to, whereas the other calls are correctly identified and associated with their target.
I am using:
- CodeQL CLI 2.21.0
- CodeQL VSCode extension 1.17.2
- codeql/python-all@4.0.4
- Python extractor 1.22.1
- 主要言語
- CodeQL
- スター
- 10.1k
- フォーク
- 2.1k
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 143
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql のほかの issue
-
agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
false-positive javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
false-positive
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nightscout/nocturne#1424 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success オープンarea: repo bug perceived difficulty: 2
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
paritytech/zombienet-sdk#591 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mruangutai/harness#1897 ·