v2.15.3 - Python code analysis fails
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- github-actions, python, typescript
调研方向
从 issue 中的 CodeQL Debug Logs 开始,并将 codeql.yml 中的工作流与所引用的 .github/codeql/codeql-config.yml 进行比较。跟踪 Python autobuild 和 tracer 调用,然后在仓库的 self-hosted 容器中重现该失败;当针对已配置路径的 Python 分析成功完成时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Hi there, I am trying to setup CodeQL analysis on a repo in our github enterprise server. This is a monorepo with TypeScript and Python code. The directory structure is like so
Repo
├── engine <- Python
├── cli <- Python
└── ui <- TypeScript
While analyzing the Python code, the CodeQL action fails with below error. Could you please help me figure out what I might be doing wrong?
2023-12-15T20:53:40.9634252Z ##[debug]Artifact debug-artifacts-python has been successfully uploaded, total size in bytes: 282039
2023-12-15T20:53:40.9635669Z Artifact has been finalized. All files have been successfully uploaded!
2023-12-15T20:53:40.9639065Z
2023-12-15T20:53:40.9639865Z The raw size of all the files that were specified for upload is 282039 bytes
2023-12-15T20:53:40.9641501Z The size of all the files that were uploaded is 18399 bytes. This takes into account any gzip compression used to reduce the upload size, time and storage
2023-12-15T20:53:40.9642371Z
2023-12-15T20:53:40.9643575Z Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads
2023-12-15T20:53:40.9644542Z
2023-12-15T20:53:40.9646099Z ::group::CodeQL Debug Logs - python - database-trace-command-20231215.205329.488.log from file at path /__w/_temp/codeql_databases/python/log/database-trace-command-20231215.205329.488.log
2023-12-15T20:53:40.9648212Z ##[group]CodeQL Debug Logs - python - database-trace-command-20231215.205329.488.log from file at path /__w/_temp/codeql_databases/python/log/database-trace-command-20231215.205329.488.log
2023-12-15T20:53:40.9649754Z [2023-12-15 20:53:29] This is codeql database trace-command --index-traceless-dbs /__w/_temp/codeql_databases/python
2023-12-15T20:53:40.9650693Z [2023-12-15 20:53:29] Log file was started late.
2023-12-15T20:53:40.9651674Z [2023-12-15 20:53:29] Using autobuild script /__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/autobuild.sh.
2023-12-15T20:53:40.9652989Z [2023-12-15 20:53:29] [PROGRESS] database trace-command> Running command in /__w/nila/nila: [/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/autobuild.sh]
2023-12-15T20:53:40.9654275Z [2023-12-15 20:53:29] [build-stderr] /bin/sh: 1: python2: not found
2023-12-15T20:53:40.9655462Z [2023-12-15 20:53:29] [build-stdout] No directories containing root identifiers were found. Returning working directory as root.
2023-12-15T20:53:40.9656656Z [2023-12-15 20:53:29] [build-stdout] Will try to guess Python version, as it was not specified in `lgtm.yml`
2023-12-15T20:53:40.9657791Z [2023-12-15 20:53:29] [build-stdout] Trying to guess Python version based on Trove classifiers in setup.py
2023-12-15T20:53:40.9658896Z [2023-12-15 20:53:29] [build-stdout] Did not find setup.py (expected it to be at /__w/nila/nila/setup.py)
2023-12-15T20:53:40.9659906Z [2023-12-15 20:53:29] [build-stdout] Trying to guess Python version based on travis file
2023-12-15T20:53:40.9661145Z [2023-12-15 20:53:29] [build-stdout] Did not find any travis files (expected them at either ['/__w/nila/nila/.travis.yml', '/__w/nila/nila/travis.yml'])
2023-12-15T20:53:40.9662300Z [2023-12-15 20:53:29] [build-stdout] Trying to guess Python version based on installed versions
2023-12-15T20:53:40.9663400Z [2023-12-15 20:53:29] [build-stdout] Wanted to run Python 2, but it is not available. Using Python 3 instead
2023-12-15T20:53:40.9664755Z [2023-12-15 20:53:29] [build-stdout] This script is running Python 3, but Python 2 is also available (as 'python3')
2023-12-15T20:53:40.9666131Z [2023-12-15 20:53:29] [build-stdout] Could not guess Python version, will use default: Python 3
2023-12-15T20:53:40.9667251Z [2023-12-15 20:53:29] [build-stdout] Calling python3 /__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/get_venv_lib.py
2023-12-15T20:53:40.9669253Z [2023-12-15 20:53:29] [build-stdout] Calling python3 -S /__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/python_tracer.py -v -z all -c /__w/_temp/codeql_databases/python/working/trap_cache -p /github/home/.local/lib/python3.6/site-packages --filter include:engine/engine/*.py --filter include:cli/cli/*.py --filter include:ui/packages/**/*.ts
2023-12-15T20:53:40.9670699Z [2023-12-15 20:53:30] [build-stderr] Process ForkProcess-1:
2023-12-15T20:53:40.9671590Z [2023-12-15 20:53:30] [build-stderr] Traceback (most recent call last):
2023-12-15T20:53:40.9672693Z [2023-12-15 20:53:30] [build-stderr] File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
2023-12-15T20:53:40.9673610Z [2023-12-15 20:53:30] [build-stderr] self.run()
2023-12-15T20:53:40.9674889Z [2023-12-15 20:53:30] [build-stderr] File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
2023-12-15T20:53:40.9675910Z [2023-12-15 20:53:30] [build-stderr] self._target(*self._args, **self._kwargs)
2023-12-15T20:53:40.9677133Z [2023-12-15 20:53:30] [build-stderr] File "/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/python3src.zip/semmle/logging.py", line 116, in _message_loop
2023-12-15T20:53:40.9678252Z [2023-12-15 20:53:30] [build-stderr] sys.stdout.reconfigure(encoding='utf-8')
2023-12-15T20:53:40.9679360Z [2023-12-15 20:53:30] [build-stderr] AttributeError: '_io.TextIOWrapper' object has no attribute 'reconfigure'
2023-12-15T20:53:40.9680377Z [2023-12-15 20:53:30] [build-stderr] Traceback (most recent call last):
2023-12-15T20:53:40.9681694Z [2023-12-15 20:53:30] [build-stderr] File "/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/python_tracer.py", line 53, in <module>
2023-12-15T20:53:40.9682937Z [2023-12-15 20:53:30] [build-stderr] semmle.populator.main(original_path)
2023-12-15T20:53:40.9684356Z [2023-12-15 20:53:30] [build-stderr] File "/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/python3src.zip/semmle/populator.py", line 43, in main
2023-12-15T20:53:40.9685586Z [2023-12-15 20:53:30] [build-stderr] AttributeError: '_io.TextIOWrapper' object has no attribute 'reconfigure'
2023-12-15T20:53:40.9686589Z [2023-12-15 20:53:30] [build-stderr] Traceback (most recent call last):
2023-12-15T20:53:40.9687685Z [2023-12-15 20:53:30] [build-stderr] File "/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/index.py", line 23, in <module>
2023-12-15T20:53:40.9688650Z [2023-12-15 20:53:30] [build-stderr] buildtools.index.main()
2023-12-15T20:53:40.9689831Z [2023-12-15 20:53:30] [build-stderr] File "/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/python3src.zip/buildtools/index.py", line 222, in main
2023-12-15T20:53:40.9691161Z [2023-12-15 20:53:30] [build-stderr] File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
2023-12-15T20:53:40.9692190Z [2023-12-15 20:53:30] [build-stderr] raise CalledProcessError(retcode, cmd)
2023-12-15T20:53:40.9694789Z [2023-12-15 20:53:30] [build-stderr] subprocess.CalledProcessError: Command '['python3', '-S', '/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/python_tracer.py', '-v', '-z', 'all', '-c', '/__w/_temp/codeql_databases/python/working/trap_cache', '-p', '/github/home/.local/lib/python3.6/site-packages', '--filter', 'include:engine/engine/*.py', '--filter', 'include:cli/cli/*.py', '--filter', 'include:ui/packages/**/*.ts']' returned non-zero exit status 1.
2023-12-15T20:53:40.9696854Z [2023-12-15 20:53:30] [ERROR] Spawned process exited abnormally (code 1; tried to run: [/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/autobuild.sh])
2023-12-15T20:53:40.9698225Z [2023-12-15 20:53:30] Exception caught at top level: Exit status 1 from command: [/__w/_tool/CodeQL/2.15.3/x64/codeql/python/tools/autobuild.sh]
2023-12-15T20:53:40.9699488Z com.semmle.cli2.Commandline.executeAndCheckResult(Commandline.java:170)
2023-12-15T20:53:40.9700478Z com.semmle.cli2.Commandline.runWithoutReturn(Commandline.java:123)
2023-12-15T20:53:40.9701720Z com.semmle.cli2.database.DatabaseProcessCommandCommon.executeSubcommand(DatabaseProcessCommandCommon.java:226)
2023-12-15T20:53:40.9703107Z com.semmle.cli2.database.TraceCommandCommand.executeSubcommand(TraceCommandCommand.java:110)
2023-12-15T20:53:40.9704593Z com.semmle.cli2.picocli.SubcommandCommon.lambda$executeSubcommandWithMessages$5(SubcommandCommon.java:803)
2023-12-15T20:53:40.9705867Z com.semmle.cli2.picocli.SubcommandCommon.withCompilationMessages(SubcommandCommon.java:442)
2023-12-15T20:53:40.9707183Z com.semmle.cli2.picocli.SubcommandCommon.executeSubcommandWithMessages(SubcommandCommon.java:801)
2023-12-15T20:53:40.9708421Z com.semmle.cli2.picocli.SubcommandCommon.toplevelMain(SubcommandCommon.java:685)
2023-12-15T20:53:40.9709472Z com.semmle.cli2.picocli.SubcommandCommon.call(SubcommandCommon.java:666)
2023-12-15T20:53:40.9710507Z com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:237)
2023-12-15T20:53:40.9711523Z com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:247)
2023-12-15T20:53:40.9712412Z com.semmle.cli2.CodeQL.main(CodeQL.java:115)
2023-12-15T20:53:40.9713399Z ::endgroup::
2023-12-15T20:53:40.9714036Z ##[endgroup]
codeql.yml
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
pull_request:
branches: [ "main" ]
push:
branches: [ "main" ]
jobs:
analyze:
name: Analyze
runs-on: [ self-hosted, Linux ]
container:
image: <custom image>
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
codeql-config.yml
paths:
- engine/engine/*.py
- cli/cli/*.py
- ui/packages/**/*.ts
- 主要语言
- TypeScript
- 星标
- 1.6k
- 派生
- 493
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 44
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/codeql-action 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
github/codeql-action#4052 · 4 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
github/codeql-action#4078 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 48/100
github/codeql-action#4008 · 9 条评论 ·
-
难度 4/5 3-5 天 新手友好度 52/100
github/codeql-action#3978 · 4 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 48/100
github/codeql-action#3915 · 6 条评论 · 3 个 reaction ·
查看 github/codeql-action 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·