github / github/codeql

javascript: Property access on null or undefined

Đang mở
#12,722 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
JS question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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`

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.