CodeQL unable to find out sources of a chosen dataflow node in Javascript
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
調査の方向性
まず JavaScript スニペットと提供された CodeQL クエリを再現し、次に言及されている DataFlow::Node API、getASuccessor*、getAPredecessor*、getALocalSource*、getALocalUse を読みます。完了とは、単純なクエリで s + c に流れ込む次の5つの期待されるノードを特定できることです: 式、c、""、s、window.location。
索引モデルが issue の本文から書いたものです。
説明
Hi, for the following snippet i'm interested in finding out what nodes flow to s + c node.
function main() {
let s = window.location;
let c = "";
let input = s + c;
eval(input);
}
By looking at the snippet, the answer clearly consists of five dataflow nodes. s + c itself, c , "" , s , window.location.
The followings are methods i tried so far.
CodeQL query for locating s + c explicitly by providing location
import javascript
class SinkNode extends DataFlow::Node {
SinkNode() {
exists(DataFlow::Node node |
node.hasLocationInfo("filepath to the snippet",
4, 15, 4, 19) and
this = node
)
}
}
class TestSucessor extends DataFlow::Node {
TestSucessor() {
exists(DataFlow::Node node |
node instanceof Sink and
exists(DataFlow::Node source |
source.getASuccessor*() = node and
this = source
)
)
}
}
This would only mark s + c as a predecessor.
class TestPredecessor extends DataFlow::Node {
TestPredecessor() {
exists(DataFlow::Node node |
node instanceof Sink and
this = node.getAPredecessor*()
)
}
}
This would only mark s + c as a predecessor.
class TestLocalSource extends DataFlow::Node {
TestLocalSource() {
exists(DataFlow::Node node |
this = node.getALocalSource*() and
node instanceof Sink
)
}
}
class TestLocalUse extends DataFlow::SourceNode {
TestLocalUse() {
exists(DataFlow::SourceNode src |
exists(DataFlow::Node node |
node instanceof Sink and
src.getALocalUse() = node and
this = src
)
)
}
}
Neither mark anything out.
I would see that an overkill for this issue is simply using tainted analysis. Mark s+c as sink and use any() for the source. However, i want to keep it simple. Any idea how to do it simply?
Many thanks.
- 主要言語
- CodeQL
- スター
- 10.1k
- フォーク
- 2.1k
- 平均マージ
- 2日 10時間
- マージ済み PR(30日)
- 134
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
false-positive
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
false-positive
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ScoopInstaller/Nonportable#639 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ScoopInstaller/Extras#18800 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
uqbar-project/website-wollok-ts#84 · コメント 2 件 ·
-
on hold T: core-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100