github / github/codeql

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

未關閉
#20,764 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
false-positive
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
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 摘要。