github / github/codeql

False positive `Explicit export is not defined` for item backed by `__getattr__`

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

説明

**Description of the false positive**

The `__all__` array includes a string which is handled by `def __getattr__(name: str):`, but CodeQL complains:

Image

**Code samples or links to source code**

https://github.com/check-spelling-sandbox/adk-python/blob/79db5168aefdf658a36b4833809602c819c3740b/src/google/adk/tools/retrieval/__init__.py#L19

https://github.com/check-spelling-sandbox/adk-python/blob/79db5168aefdf658a36b4833809602c819c3740b/src/google/adk/tools/retrieval/__init__.py#L25-L30

**URL to the alert on GitHub code scanning (optional)**

https://github.com/check-spelling-sandbox/adk-python/security/quality/rules/py%2Fundefined-export

Sorry, there doesn't appear to be a standard url for it

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

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

調査の方向性

Read the linked Python __init__.py sample and inspect the py/undefined-export rule that reports the alert. Trace how the rule handles __all__ and __getattr__, then use the CodeQL query tests to reproduce the case. Done means a valid export supplied through __getattr__ is no longer reported as undefined.

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

評価

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

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

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