github / github/codeql

javascript: Property access on null or undefined

未關閉
#12,722 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
JS question
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

I refer to this document
https://codeql.github.com/codeql-query-help/javascript/js-property-access-on-non-object/

I hope to find these `undefined`
```js
window.name // ok
window.abc // undefined
some // undefined

window.a=1
window.a // ok

let obj = {
k1: 1,
}
obj.k1 // ok
obj.k2 // undefined
obj.toString // ok
obj.length // undefined

let arr = []
arr.toString // ok
arr.length // ok
arr.hello // undefined

document.body // ok
document.asd // undefined

location.pathname // ok
location.path // undefined
```

But I didn't find anything
![image](https://user-images.githubusercontent.com/32825326/229015805-ca0494d2-883d-48b4-81f9-ae44ce00b8de.png)

Is there a generic query that finds all `undefined`

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。