github / github/codeql-cli-binaries

Cannot access CodeQL environment variables in `database create --command`

オープン
#2 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
CLI
主要言語
言語のデータがありません
スター
1k
フォーク
184
PR マージ指標
30日以内にマージされた PR はありません

説明

I would like to explicitly invoke the JavaScript autobuilder as part of `codeql database create`, with the ultimate goal of passing it some custom options. However, even invoking it without any options isn't as easy as I would have hoped, since I cannot figure out how to access CodeQL environment variables to specify the path to the autobuilder.

My first attempt of

```sh
codeql database create -l javascript --command '${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh /path/to/database
```

was met with

```sh
A fatal error occurred: Failed to expand '${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh' as an argument list.
(eventual cause: UserError "Attempting to expand unknown variable: CODEQL_EXTRACTOR_JAVASCRIPT_ROOT, available variables are: []")
```

@lcartey suggested adding `env.` like so:

```sh
codeql database create -l javascript --command '${env.CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh' /path/to/database
```

but that resulted in

```
A fatal error occurred: Failed to expand '${env.CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh' as an argument list.
(eventual cause: UserError "Attempting to expand unknown variable: env.CODEQL_EXTRACTOR_JAVASCRIPT_ROOT, ava...")
```

I am pretty sure this is the right environment variable name, cf. [here](https://git.semmle.com/Semmle/code/blob/master/language-packs/javascript/tools/autobuild.sh#L28).

Specifying the full path to the autobuild script is, of course, possible, but annoying.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the `codeql database create --command` entry point and its argument-variable expansion, using the reported `CODEQL_EXTRACTOR_JAVASCRIPT_ROOT` and `env.` examples as reproduction cases. Trace why the command environment is unavailable during expansion; done when the JavaScript autobuilder path can be supplied through the CodeQL environment variable and the behavior is covered by an appropriate test.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, shell
領域
cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。