github / github/codeql

[JS]General issue: ES6 Analysis Seems Unsupported

Aperta
#20,261 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

## **ES6 Analysis Seems Unsupported**

When I use:

```javascript
const { chromium } = require('playwright');

// ... other code ...

const newBrowser = await chromium.launch({ headless: true });
```

The following CodeQL cannot track the variable `chromium`:

```ql
SourceNode playwright(TypeTracker t) {
t.start() and
(
result = globalVarRef("chromium")
or
result = moduleImport("playwright")
)
or
exists(TypeTracker t2 |
result = playwright(t2).track(t2, t)
)
}

SourceNode playwright() {
result = playwright(TypeTracker::end())
}

SourceNode playwrightLaunch(TypeTracker t) {
t.start() and
result = playwright().getAMethodCall("launch")
or
exists(TypeTracker t2 |
result = playwrightLaunch(t2).track(t2, t)
)
}

SourceNode playwrightLaunch() {
result = playwrightLaunch(TypeTracker::end())
}
```

However, if it is:

```javascript
const path = require('path');

// ... other code ...

path.join(...);
```

It works!

So, what should I do to track `chromium` in `{chromium}`?

Looking forward to your response.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the provided JavaScript destructuring example and the CodeQL entry points `globalVarRef("chromium")`, `moduleImport("playwright")`, and the `playwright` and `playwrightLaunch` predicates. Compare their behavior with the working `path.join(...)` example; done means the analysis tracks `chromium` from `{ chromium }` through `chromium.launch(...)`.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
security
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.