github / github/codeql-cli-binaries
Cannot access CodeQL environment variables in `database create --command`
- 主要語言
- 沒有語言資料
- 星號
- 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