Add 300 CheckerBench tasks, dataset card, and restoration tools
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitignore +6 -0
- README.md +120 -0
- SHA256SUMS +12 -0
- data/test.parquet +3 -0
- dataset/manifest.json +18 -0
- dataset/selected_tasks.csv +301 -0
- dataset/selected_tasks.jsonl +300 -0
- dataset/tasks.jsonl +300 -0
- docs/environment.md +32 -0
- environment/versions.json +11 -0
- release-manifest.json +134 -0
- reports/archive-validation.json +45 -0
- reports/huggingface-validation.json +33 -0
- reports/privacy-check.json +8 -0
- reports/validation.json +62 -0
- scripts/download.py +51 -0
- scripts/prepare.py +239 -0
- scripts/restore.py +92 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/patch.diff +70 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/post_context.md +420 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/pre_context.md +412 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/task.json +55 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/task_prompt.md +82 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/patch.diff +277 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/post_context.md +449 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/pre_context.md +200 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/task.json +47 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/task_prompt.md +82 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/patch.diff +15 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/post_context.md +378 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/pre_context.md +378 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/task.json +44 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/task_prompt.md +82 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/patch.diff +161 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/post_context.md +1034 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/pre_context.md +998 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/task.json +53 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/task_prompt.md +82 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/patch.diff +128 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/post_context.md +1177 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/pre_context.md +1169 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/task.json +50 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/task_prompt.md +82 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/patch.diff +34 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/post_context.md +234 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/pre_context.md +231 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/task.json +47 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/task_prompt.md +82 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-14446e68cdc53bc98807/patch.diff +98 -0
- tasks/codeql_go_benchmark_top30_v1/morefixes-14446e68cdc53bc98807/post_context.md +123 -0
.gitignore
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/downloads/
|
| 2 |
+
/runtime_data/
|
| 3 |
+
/work/
|
| 4 |
+
__pycache__/
|
| 5 |
+
*.pyc
|
| 6 |
+
.DS_Store
|
README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: CheckerBench
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
size_categories:
|
| 6 |
+
- n<1K
|
| 7 |
+
tags:
|
| 8 |
+
- code
|
| 9 |
+
- static-analysis
|
| 10 |
+
- vulnerability-detection
|
| 11 |
+
- codeql
|
| 12 |
+
- clang-static-analyzer
|
| 13 |
+
- benchmark
|
| 14 |
+
configs:
|
| 15 |
+
- config_name: default
|
| 16 |
+
data_files:
|
| 17 |
+
- split: test
|
| 18 |
+
path: data/test.parquet
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# CheckerBench Dataset
|
| 22 |
+
|
| 23 |
+
**300 static-analysis tasks with complete runtime assets: 159 CSA tasks and 141 CodeQL tasks.**
|
| 24 |
+
|
| 25 |
+
| Backend / language | Tasks |
|
| 26 |
+
|---|---:|
|
| 27 |
+
| CSA (C/C++) | 159 |
|
| 28 |
+
| CodeQL Go | 30 |
|
| 29 |
+
| CodeQL Java | 30 |
|
| 30 |
+
| CodeQL JavaScript | 30 |
|
| 31 |
+
| CodeQL Python | 51 |
|
| 32 |
+
| **Total** | **300** |
|
| 33 |
+
|
| 34 |
+
`dataset/tasks.jsonl` is the authoritative portable roster. `tasks/` contains browsable task inputs. The `assets/` directory provides complete task bundles, reference implementations, source snapshots, CodeQL databases, CSA build assets, refinement environments, and a frozen Docker image.
|
| 35 |
+
|
| 36 |
+
## Load the task table
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
from datasets import load_dataset
|
| 40 |
+
|
| 41 |
+
tasks = load_dataset("Benchanything/checkerbench", split="test")
|
| 42 |
+
assert len(tasks) == 300
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
The single `test` split contains all 300 benchmark tasks; no training or validation split is provided. Each row includes the task ID, backend, language, CVE and source-project identifiers, task prompt, patch, before/after context, and task configuration as JSON text. `checker_template` contains the CSA starter implementation and is null for CodeQL tasks. The original browsable inputs are also available under `tasks/`. `task_path` identifies the task inside its restored bundle, while `environment_id` identifies its runtime environment.
|
| 46 |
+
|
| 47 |
+
## Download and restore
|
| 48 |
+
|
| 49 |
+
Requirements: Linux x86-64, Docker, Python 3.10+, and at least 100 GB of available disk space. Additional task workspaces require additional storage.
|
| 50 |
+
|
| 51 |
+
Download the complete distribution, including the datasets and frozen runtime image (approximately 13.3 GB of compressed assets):
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
pip install -U huggingface_hub
|
| 55 |
+
hf download Benchanything/checkerbench --repo-type dataset --local-dir checkerbench
|
| 56 |
+
cd checkerbench
|
| 57 |
+
python3 scripts/restore.py --assets assets --data runtime_data --load-image
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
For a private repository, authenticate with `hf auth login` using an account with access before downloading. Public downloads do not require authentication.
|
| 61 |
+
|
| 62 |
+
To download only dataset archives using a local copy of this repository's scripts:
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
python3 scripts/download.py --kind dataset --output assets
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
The downloader verifies every part against its SHA-256 checksum, and the restore script also verifies the complete compressed stream. Split archives are extracted or loaded directly without writing an extra combined copy. Verified downloads and completed restores can be reused.
|
| 69 |
+
|
| 70 |
+
## Create a task workspace
|
| 71 |
+
|
| 72 |
+
The `checkerbench-runtime:review-v1` image targets `linux/amd64` and includes LLVM/Clang 18.1.8, CodeQL 2.26.4, language toolchains, and Python dependencies. Model-service credentials are supplied separately by the operator.
|
| 73 |
+
|
| 74 |
+
Start a container with stable paths:
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
mkdir -p work
|
| 78 |
+
docker run --rm -it --network none --entrypoint /bin/bash \
|
| 79 |
+
-v "$PWD:/release:ro" -v "$PWD/runtime_data:/data:ro" \
|
| 80 |
+
-v "$PWD/work:/work" checkerbench-runtime:review-v1
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
Prepare a CSA task:
|
| 84 |
+
|
| 85 |
+
```bash
|
| 86 |
+
python /release/scripts/prepare.py csa pair_134943 \
|
| 87 |
+
--data-root /data --output /work/pair_134943
|
| 88 |
+
cd /work/pair_134943
|
| 89 |
+
# Write checker.cpp, then compile and scan.
|
| 90 |
+
bash compile.sh
|
| 91 |
+
CHECKER_NAME=YOUR_CHECKER_NAME bash scan/scan_before.sh
|
| 92 |
+
CHECKER_NAME=YOUR_CHECKER_NAME bash scan/scan_after.sh
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
Prepare a CodeQL task:
|
| 96 |
+
|
| 97 |
+
```bash
|
| 98 |
+
python /release/scripts/prepare.py codeql morefixes-32ed35a8bd8aba7b47ad \
|
| 99 |
+
--language go --data-root /data --output /work/go-example
|
| 100 |
+
cd /work/go-example/tasks/morefixes-32ed35a8bd8aba7b47ad
|
| 101 |
+
# Edit query/vulnerability.ql, then compile and scan.
|
| 102 |
+
bash scripts/compile_query.sh
|
| 103 |
+
bash scripts/run_before.sh
|
| 104 |
+
bash scripts/run_after.sh
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
Only tasks in the fixed 300-task roster are accepted. Maintainers can add `--reference` to reproduce a bundled reference implementation. Keep the same container paths after preparing a workspace. CSA uses shared Git objects from the read-only dataset; CodeQL databases are copied into the task workspace.
|
| 108 |
+
|
| 109 |
+
## Dataset contents
|
| 110 |
+
|
| 111 |
+
- **CSA:** 159 tasks with source snapshots, captured build assets, reference implementations, and refinement environments. Shared runtime assets preserve restoration dependencies.
|
| 112 |
+
- **CodeQL:** four task bundles containing 30 Go, 30 Java, 30 JavaScript, and 51 Python tasks, with their captured analysis databases.
|
| 113 |
+
- `scripts/prepare.py` restores before/after scanning workspaces. The CSA bundle also includes `scripts/rehydrate_benchmark_env.py` for full refinement worktrees. Historical refinement assets contain absolute paths and symbolic links; see `docs/environment.md` for the restoration boundary.
|
| 114 |
+
- References and evaluator assets are maintainer material. During evaluation, expose only a prepared single-task workspace and its required runtime assets to the evaluated agent.
|
| 115 |
+
|
| 116 |
+
## Integrity and validation
|
| 117 |
+
|
| 118 |
+
`release-manifest.json` records archive and part sizes, SHA-256 checksums, and the image fingerprint. `environment/versions.json` records the toolchain versions; the exported image is the direct restoration entry point. `reports/validation.json` records the checks actually performed and their limits.
|
| 119 |
+
|
| 120 |
+
Third-party source and tools retain their own license files. This repository does not assign a new blanket license to all bundled third-party content.
|
SHA256SUMS
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
f1c061beb65d425414f8d20938b8918e521c6c908a706cbcdab2db568e269bd2 codeql_go_benchmark_top30_v1.tar.gz
|
| 2 |
+
94584869e15e944bdf4b48df044debff02a4607a60ba360ccc9db554037595bb codeql_java_benchmark_top30_v2.tar.gz
|
| 3 |
+
229fcbf134d2df605599a341245bef39dbce57d44b3e15a612bedb2e2fc21607 codeql_javascript_benchmark_top30_v1.tar.gz.part000
|
| 4 |
+
f47cfe368d0f645445f5abc4b35c900640f0e97f5303a3e4704dce2178421183 codeql_javascript_benchmark_top30_v1.tar.gz.part001
|
| 5 |
+
c19e99879456b637ded3ad3b8b524f0d7cf29d81af261fdb5d1086e57d7ae78c codeql_python_benchmark51_v2.tar.gz.part000
|
| 6 |
+
37c12d1e099d89f65fdcb69677adca1e9f94e35f7372fb89ae92ea6dcee72d42 codeql_python_benchmark51_v2.tar.gz.part001
|
| 7 |
+
7fddb3afd80e67d8eec2694e9704e24e65ce318dfb5d1260b8058dbc84c23830 checkerbench-csa159.tar.gz.part000
|
| 8 |
+
0615ba64af1cb7e526c741eca523c1dd2a98ef9214b4834e229c92f7d6113706 checkerbench-csa159.tar.gz.part001
|
| 9 |
+
54d83cf819a8d0777f1bcded9848cfe96605a7201878cbc563205880ab5ae85a checkerbench-csa159.tar.gz.part002
|
| 10 |
+
b483ff23fcb3a303032ce2f7956e3e5280849491d917d8e565333077b818ba43 checkerbench-csa159.tar.gz.part003
|
| 11 |
+
6dcc402d563e599525e9fb748244d754a983a48318ec6c871a85cfa18c854976 checkerbench-environment-linux-amd64.tar.gz.part000
|
| 12 |
+
976c8e16a733cd76540f5374756c155a122edef44585b0eea12589d6f0ac09b9 checkerbench-environment-linux-amd64.tar.gz.part001
|
data/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf6583507a74e33e53515bfdfd3bfb00acd4878f8e9e3772972e549f4fdfdf4e
|
| 3 |
+
size 2851404
|
dataset/manifest.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 1,
|
| 3 |
+
"task_count": 300,
|
| 4 |
+
"backend_counts": {
|
| 5 |
+
"csa": 159,
|
| 6 |
+
"codeql": 141
|
| 7 |
+
},
|
| 8 |
+
"language_counts": {
|
| 9 |
+
"c": 159,
|
| 10 |
+
"go": 30,
|
| 11 |
+
"java": 30,
|
| 12 |
+
"javascript": 30,
|
| 13 |
+
"python": 51
|
| 14 |
+
},
|
| 15 |
+
"csa_project_count": 32,
|
| 16 |
+
"selection_rule": "All tasks from the fixed 300-task evaluation roster. CSA is treated as a single group.",
|
| 17 |
+
"selected_roster_sha256": "ccc8ec0a88a1972fe649caf034454fb67183116ff7a3b5745286d3e4ab740a92"
|
| 18 |
+
}
|
dataset/selected_tasks.csv
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
backend,cve_id,dataset,environment_id,group,language,project_id,task_id,task_path
|
| 2 |
+
codeql,CVE-2022-4741,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78,CodeQL go,go,morefixes__sajari__docconv,morefixes-02cb4e0a6c5aaabd6a78,codeql_go_benchmark_top30_v1/tasks/morefixes-02cb4e0a6c5aaabd6a78
|
| 3 |
+
codeql,CVE-2025-47281,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406,CodeQL go,go,morefixes__kyverno__kyverno,morefixes-08d699b1f7c72c366406,codeql_go_benchmark_top30_v1/tasks/morefixes-08d699b1f7c72c366406
|
| 4 |
+
codeql,CVE-2020-29243,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb,CodeQL go,go,morefixes__dhowden__tag,morefixes-096cbfbd1d27f9ce86fb,codeql_go_benchmark_top30_v1/tasks/morefixes-096cbfbd1d27f9ce86fb
|
| 5 |
+
codeql,CVE-2023-34236,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f,CodeQL go,go,morefixes__weaveworks__tf-controller,morefixes-0adb0a489b07a50d6b2f,codeql_go_benchmark_top30_v1/tasks/morefixes-0adb0a489b07a50d6b2f
|
| 6 |
+
codeql,CVE-2022-41939,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28,CodeQL go,go,morefixes__knative__func,morefixes-110ab7950a2c0b2c6f28,codeql_go_benchmark_top30_v1/tasks/morefixes-110ab7950a2c0b2c6f28
|
| 7 |
+
codeql,CVE-2023-27582,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555,CodeQL go,go,morefixes__foxcpp__maddy,morefixes-1218ce956f8120d59555,codeql_go_benchmark_top30_v1/tasks/morefixes-1218ce956f8120d59555
|
| 8 |
+
codeql,CVE-2024-39315,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-14446e68cdc53bc98807,CodeQL go,go,morefixes__pomerium__pomerium,morefixes-14446e68cdc53bc98807,codeql_go_benchmark_top30_v1/tasks/morefixes-14446e68cdc53bc98807
|
| 9 |
+
codeql,CVE-2022-2582,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-1d20aba9f4be2de73db5,CodeQL go,go,morefixes__aws__aws-sdk-go,morefixes-1d20aba9f4be2de73db5,codeql_go_benchmark_top30_v1/tasks/morefixes-1d20aba9f4be2de73db5
|
| 10 |
+
codeql,CVE-2025-66626,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-2331a664751876781460,CodeQL go,go,morefixes__argoproj__argo-workflows,morefixes-2331a664751876781460,codeql_go_benchmark_top30_v1/tasks/morefixes-2331a664751876781460
|
| 11 |
+
codeql,CVE-2019-12496,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-2cc25dee5f2a118bcb26,CodeQL go,go,morefixes__hybridgroup__gobot,morefixes-2cc25dee5f2a118bcb26,codeql_go_benchmark_top30_v1/tasks/morefixes-2cc25dee5f2a118bcb26
|
| 12 |
+
codeql,CVE-2026-40890,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-30e495de2402bd4bed4b,CodeQL go,go,morefixes__gomarkdown__markdown,morefixes-30e495de2402bd4bed4b,codeql_go_benchmark_top30_v1/tasks/morefixes-30e495de2402bd4bed4b
|
| 13 |
+
codeql,CVE-2024-7773,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-32ed35a8bd8aba7b47ad,CodeQL go,go,morefixes__ollama__ollama,morefixes-32ed35a8bd8aba7b47ad,codeql_go_benchmark_top30_v1/tasks/morefixes-32ed35a8bd8aba7b47ad
|
| 14 |
+
codeql,CVE-2023-40586,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-398ac78e3981b77e4ee2,CodeQL go,go,morefixes__corazawaf__coraza,morefixes-398ac78e3981b77e4ee2,codeql_go_benchmark_top30_v1/tasks/morefixes-398ac78e3981b77e4ee2
|
| 15 |
+
codeql,CVE-2022-41920,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-461c7bace102119cf443,CodeQL go,go,morefixes__duke-git__lancet,morefixes-461c7bace102119cf443,codeql_go_benchmark_top30_v1/tasks/morefixes-461c7bace102119cf443
|
| 16 |
+
codeql,CVE-2026-10722,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-50b28fbf07dd2d79022e,CodeQL go,go,morefixes__cilium__ebpf,morefixes-50b28fbf07dd2d79022e,codeql_go_benchmark_top30_v1/tasks/morefixes-50b28fbf07dd2d79022e
|
| 17 |
+
codeql,CVE-2023-47105,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-5ad30634efaa1d03593c,CodeQL go,go,morefixes__chaosblade-io__chaosblade,morefixes-5ad30634efaa1d03593c,codeql_go_benchmark_top30_v1/tasks/morefixes-5ad30634efaa1d03593c
|
| 18 |
+
codeql,CVE-2024-23840,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-5c2773bb1de86a62a247,CodeQL go,go,morefixes__goreleaser__goreleaser,morefixes-5c2773bb1de86a62a247,codeql_go_benchmark_top30_v1/tasks/morefixes-5c2773bb1de86a62a247
|
| 19 |
+
codeql,CVE-2022-30428,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-5cfa41b8575717ecee17,CodeQL go,go,morefixes__gphper__ginadmin,morefixes-5cfa41b8575717ecee17,codeql_go_benchmark_top30_v1/tasks/morefixes-5cfa41b8575717ecee17
|
| 20 |
+
codeql,CVE-2020-36568,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-6e40429ff01c5ab8b71b,CodeQL go,go,morefixes__revel__revel,morefixes-6e40429ff01c5ab8b71b,codeql_go_benchmark_top30_v1/tasks/morefixes-6e40429ff01c5ab8b71b
|
| 21 |
+
codeql,CVE-2023-33965,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-7c57d35438d22210ced2,CodeQL go,go,morefixes__txthinking__brook,morefixes-7c57d35438d22210ced2,codeql_go_benchmark_top30_v1/tasks/morefixes-7c57d35438d22210ced2
|
| 22 |
+
codeql,CVE-2026-8275,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-7e2af82757795db7f69a,CodeQL go,go,morefixes__bettercap__bettercap,morefixes-7e2af82757795db7f69a,codeql_go_benchmark_top30_v1/tasks/morefixes-7e2af82757795db7f69a
|
| 23 |
+
codeql,CVE-2024-41270,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-9fbea0e4da10bfc882d4,CodeQL go,go,morefixes__appleboy__gorush,morefixes-9fbea0e4da10bfc882d4,codeql_go_benchmark_top30_v1/tasks/morefixes-9fbea0e4da10bfc882d4
|
| 24 |
+
codeql,CVE-2023-46132,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-a469597c1a5d38baeb5d,CodeQL go,go,morefixes__hyperledger__fabric,morefixes-a469597c1a5d38baeb5d,codeql_go_benchmark_top30_v1/tasks/morefixes-a469597c1a5d38baeb5d
|
| 25 |
+
codeql,CVE-2023-34105,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-a9ee7c2085f2981a7be1,CodeQL go,go,morefixes__ossrs__srs,morefixes-a9ee7c2085f2981a7be1,codeql_go_benchmark_top30_v1/tasks/morefixes-a9ee7c2085f2981a7be1
|
| 26 |
+
codeql,CVE-2018-1002207,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-c254bd7b8a82b4ef45c1,CodeQL go,go,morefixes__mholt__archiver,morefixes-c254bd7b8a82b4ef45c1,codeql_go_benchmark_top30_v1/tasks/morefixes-c254bd7b8a82b4ef45c1
|
| 27 |
+
codeql,CVE-2017-1000070,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-cd95b2e4d63395291cd3,CodeQL go,go,morefixes__bitly__oauth2_proxy,morefixes-cd95b2e4d63395291cd3,codeql_go_benchmark_top30_v1/tasks/morefixes-cd95b2e4d63395291cd3
|
| 28 |
+
codeql,CVE-2025-67499,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-d3400ed5292d19661685,CodeQL go,go,morefixes__containernetworking__plugins,morefixes-d3400ed5292d19661685,codeql_go_benchmark_top30_v1/tasks/morefixes-d3400ed5292d19661685
|
| 29 |
+
codeql,CVE-2022-21698,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-e3f3ac87786e2080b81f,CodeQL go,go,morefixes__prometheus__client_golang,morefixes-e3f3ac87786e2080b81f,codeql_go_benchmark_top30_v1/tasks/morefixes-e3f3ac87786e2080b81f
|
| 30 |
+
codeql,CVE-2021-3538,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-f0d857f4ad82fae5a3a9,CodeQL go,go,morefixes__satori__go.uuid,morefixes-f0d857f4ad82fae5a3a9,codeql_go_benchmark_top30_v1/tasks/morefixes-f0d857f4ad82fae5a3a9
|
| 31 |
+
codeql,CVE-2025-32445,codeql_go_benchmark_top30_v1,codeql_go_benchmark_top30_v1/morefixes-fb75b5c545e3cb24f7ae,CodeQL go,go,morefixes__argoproj__argo-events,morefixes-fb75b5c545e3cb24f7ae,codeql_go_benchmark_top30_v1/tasks/morefixes-fb75b5c545e3cb24f7ae
|
| 32 |
+
codeql,CVE-2023-2196,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-02f75a63a6f0b8d6c6c7,CodeQL java,java,morefixes__jenkinsci__codedx-plugin,morefixes-02f75a63a6f0b8d6c6c7,codeql_java_benchmark_top30_v2/tasks/morefixes-02f75a63a6f0b8d6c6c7
|
| 33 |
+
codeql,CVE-2021-21656,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-04bdb708bf23aabdc444,CodeQL java,java,morefixes__jenkinsci__xcode-plugin,morefixes-04bdb708bf23aabdc444,codeql_java_benchmark_top30_v2/tasks/morefixes-04bdb708bf23aabdc444
|
| 34 |
+
codeql,CVE-2021-21632,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-05d6240fd5a9017a44ec,CodeQL java,java,morefixes__jenkinsci__dependency-track-plugin,morefixes-05d6240fd5a9017a44ec,codeql_java_benchmark_top30_v2/tasks/morefixes-05d6240fd5a9017a44ec
|
| 35 |
+
codeql,CVE-2020-2132,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-0608482232bb0119b561,CodeQL java,java,morefixes__jenkinsci__environment-manager-tools-plugin,morefixes-0608482232bb0119b561,codeql_java_benchmark_top30_v2/tasks/morefixes-0608482232bb0119b561
|
| 36 |
+
codeql,CVE-2020-2311,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-0709c903a0f96b124bd5,CodeQL java,java,morefixes__jenkinsci__aws-global-configuration-plugin,morefixes-0709c903a0f96b124bd5,codeql_java_benchmark_top30_v2/tasks/morefixes-0709c903a0f96b124bd5
|
| 37 |
+
codeql,CVE-2020-14297,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-09002f4d38e9ecf8238a,CodeQL java,java,morefixes__wildfly__jboss-ejb-client,morefixes-09002f4d38e9ecf8238a,codeql_java_benchmark_top30_v2/tasks/morefixes-09002f4d38e9ecf8238a
|
| 38 |
+
codeql,CVE-2020-25023,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-13b1b3610eb300ab9704,CodeQL java,java,morefixes__rweather__noise-java,morefixes-13b1b3610eb300ab9704,codeql_java_benchmark_top30_v2/tasks/morefixes-13b1b3610eb300ab9704
|
| 39 |
+
codeql,CVE-2023-25141,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-149c5507d76b198944c3,CodeQL java,java,morefixes__apache__sling-org-apache-sling-jcr-base,morefixes-149c5507d76b198944c3,codeql_java_benchmark_top30_v2/tasks/morefixes-149c5507d76b198944c3
|
| 40 |
+
codeql,CVE-2022-43183,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-19d7bda86b839e7fc493,CodeQL java,java,morefixes__xuxueli__xxl-job,morefixes-19d7bda86b839e7fc493,codeql_java_benchmark_top30_v2/tasks/morefixes-19d7bda86b839e7fc493
|
| 41 |
+
codeql,CVE-2025-29908,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-1f67e1cf382f2e332752,CodeQL java,java,morefixes__netty__netty-incubator-codec-quic,morefixes-1f67e1cf382f2e332752,codeql_java_benchmark_top30_v2/tasks/morefixes-1f67e1cf382f2e332752
|
| 42 |
+
codeql,CVE-2020-25022,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-21b89e6983680bd0068c,CodeQL java,java,morefixes__rweather__noise-java,morefixes-21b89e6983680bd0068c,codeql_java_benchmark_top30_v2/tasks/morefixes-21b89e6983680bd0068c
|
| 43 |
+
codeql,CVE-2021-22573,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-23c03b1bf7a3c44f444b,CodeQL java,java,morefixes__googleapis__google-oauth-java-client,morefixes-23c03b1bf7a3c44f444b,codeql_java_benchmark_top30_v2/tasks/morefixes-23c03b1bf7a3c44f444b
|
| 44 |
+
codeql,CVE-2021-39196,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-2b14860afe0d3bf8094a,CodeQL java,java,morefixes__jdhwpgmbca__pcapture,morefixes-2b14860afe0d3bf8094a,codeql_java_benchmark_top30_v2/tasks/morefixes-2b14860afe0d3bf8094a
|
| 45 |
+
codeql,CVE-2022-4641,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-35510b21cf51a9acf072,CodeQL java,java,morefixes__tdunning__pig-vector,morefixes-35510b21cf51a9acf072,codeql_java_benchmark_top30_v2/tasks/morefixes-35510b21cf51a9acf072
|
| 46 |
+
codeql,CVE-2025-67030,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-378f408f498b20422fe9,CodeQL java,java,morefixes__codehaus-plexus__plexus-utils,morefixes-378f408f498b20422fe9,codeql_java_benchmark_top30_v2/tasks/morefixes-378f408f498b20422fe9
|
| 47 |
+
codeql,CVE-2024-39118,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-3cc69a690ef991c8bd71,CodeQL java,java,morefixes__mommyheather__advancedbackups,morefixes-3cc69a690ef991c8bd71,codeql_java_benchmark_top30_v2/tasks/morefixes-3cc69a690ef991c8bd71
|
| 48 |
+
codeql,CVE-2024-36114,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-462566b2f857f458bf20,CodeQL java,java,morefixes__airlift__aircompressor,morefixes-462566b2f857f458bf20,codeql_java_benchmark_top30_v2/tasks/morefixes-462566b2f857f458bf20
|
| 49 |
+
codeql,CVE-2020-36640,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-4a0720656247f4fdd55d,CodeQL java,java,morefixes__bonitasoft__bonita-connector-webservice,morefixes-4a0720656247f4fdd55d,codeql_java_benchmark_top30_v2/tasks/morefixes-4a0720656247f4fdd55d
|
| 50 |
+
codeql,CVE-2023-48299,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-623c5f3c0558ba463c5a,CodeQL java,java,morefixes__pytorch__serve,morefixes-623c5f3c0558ba463c5a,codeql_java_benchmark_top30_v2/tasks/morefixes-623c5f3c0558ba463c5a
|
| 51 |
+
codeql,CVE-2024-1102,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-6c80dd14ea98e73d8b2e,CodeQL java,java,morefixes__jberet__jsr352,morefixes-6c80dd14ea98e73d8b2e,codeql_java_benchmark_top30_v2/tasks/morefixes-6c80dd14ea98e73d8b2e
|
| 52 |
+
codeql,CVE-2022-41967,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-76076416f1349da24444,CodeQL java,java,morefixes__hyperadev__dragonfly,morefixes-76076416f1349da24444,codeql_java_benchmark_top30_v2/tasks/morefixes-76076416f1349da24444
|
| 53 |
+
codeql,CVE-2025-4641,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-80a186235f1faf976a71,CodeQL java,java,morefixes__bonigarcia__webdrivermanager,morefixes-80a186235f1faf976a71,codeql_java_benchmark_top30_v2/tasks/morefixes-80a186235f1faf976a71
|
| 54 |
+
codeql,CVE-2020-1729,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-8641a4da2de2d0610576,CodeQL java,java,morefixes__smallrye__smallrye-config,morefixes-8641a4da2de2d0610576,codeql_java_benchmark_top30_v2/tasks/morefixes-8641a4da2de2d0610576
|
| 55 |
+
codeql,CVE-2022-29631,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-8e4d1bd2b930ae852ae1,CodeQL java,java,morefixes__oblac__jodd-http,morefixes-8e4d1bd2b930ae852ae1,codeql_java_benchmark_top30_v2/tasks/morefixes-8e4d1bd2b930ae852ae1
|
| 56 |
+
codeql,CVE-2020-17534,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-9db4a0f5f07f59debbce,CodeQL java,java,morefixes__apache__netbeans-html4j,morefixes-9db4a0f5f07f59debbce,codeql_java_benchmark_top30_v2/tasks/morefixes-9db4a0f5f07f59debbce
|
| 57 |
+
codeql,CVE-2025-67721,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-a624a25672727b30851a,CodeQL java,java,morefixes__airlift__aircompressor,morefixes-a624a25672727b30851a,codeql_java_benchmark_top30_v2/tasks/morefixes-a624a25672727b30851a
|
| 58 |
+
codeql,CVE-2022-24913,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-ab625a5d0d2a27547494,CodeQL java,java,morefixes__cowtowncoder__java-merge-sort,morefixes-ab625a5d0d2a27547494,codeql_java_benchmark_top30_v2/tasks/morefixes-ab625a5d0d2a27547494
|
| 59 |
+
codeql,CVE-2024-57699,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-ac88413b62ef5803c04f,CodeQL java,java,morefixes__netplex__json-smart-v2,morefixes-ac88413b62ef5803c04f,codeql_java_benchmark_top30_v2/tasks/morefixes-ac88413b62ef5803c04f
|
| 60 |
+
codeql,CVE-2025-67721,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-cf8752e9dc2f57b1d5c8,CodeQL java,java,morefixes__airlift__aircompressor,morefixes-cf8752e9dc2f57b1d5c8,codeql_java_benchmark_top30_v2/tasks/morefixes-cf8752e9dc2f57b1d5c8
|
| 61 |
+
codeql,CVE-2022-4494,codeql_java_benchmark_top30_v2,codeql_java_benchmark_top30_v2/morefixes-f298b6158c5168025365,CodeQL java,java,morefixes__bspkrs__mcpmappingviewer,morefixes-f298b6158c5168025365,codeql_java_benchmark_top30_v2/tasks/morefixes-f298b6158c5168025365
|
| 62 |
+
codeql,CVE-2023-33194,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-040d724ca8211a3aaf1d,CodeQL javascript,javascript,morefixes__craftcms__cms,morefixes-040d724ca8211a3aaf1d,codeql_javascript_benchmark_top30_v1/tasks/morefixes-040d724ca8211a3aaf1d
|
| 63 |
+
codeql,CVE-2026-25642,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-04314885419e817d3b17,CodeQL javascript,javascript,morefixes__hedgedoc__hedgedoc,morefixes-04314885419e817d3b17,codeql_javascript_benchmark_top30_v1/tasks/morefixes-04314885419e817d3b17
|
| 64 |
+
codeql,CVE-2025-59526,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-08f7e6287de57ef9a5c8,CodeQL javascript,javascript,morefixes__eladnava__mailgen,morefixes-08f7e6287de57ef9a5c8,codeql_javascript_benchmark_top30_v1/tasks/morefixes-08f7e6287de57ef9a5c8
|
| 65 |
+
codeql,CVE-2018-3758,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-0e82cb4ad70fc2c896ef,CodeQL javascript,javascript,morefixes__mrvautin__expresscart,morefixes-0e82cb4ad70fc2c896ef,codeql_javascript_benchmark_top30_v1/tasks/morefixes-0e82cb4ad70fc2c896ef
|
| 66 |
+
codeql,CVE-2026-45787,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-0e8f49f3d1cc46668f9b,CodeQL javascript,javascript,morefixes__electerm__electerm,morefixes-0e8f49f3d1cc46668f9b,codeql_javascript_benchmark_top30_v1/tasks/morefixes-0e8f49f3d1cc46668f9b
|
| 67 |
+
codeql,CVE-2021-3801,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-0ea8f5f13e7432539721,CodeQL javascript,javascript,morefixes__prismjs__prism,morefixes-0ea8f5f13e7432539721,codeql_javascript_benchmark_top30_v1/tasks/morefixes-0ea8f5f13e7432539721
|
| 68 |
+
codeql,CVE-2025-49590,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-0f4271d4851600835c47,CodeQL javascript,javascript,morefixes__cryptpad__cryptpad,morefixes-0f4271d4851600835c47,codeql_javascript_benchmark_top30_v1/tasks/morefixes-0f4271d4851600835c47
|
| 69 |
+
codeql,CVE-2024-25981,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-135296414af3a0faf089,CodeQL javascript,javascript,morefixes__moodle__moodle,morefixes-135296414af3a0faf089,codeql_javascript_benchmark_top30_v1/tasks/morefixes-135296414af3a0faf089
|
| 70 |
+
codeql,CVE-2014-5273,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-16768fdfa00c963539dc,CodeQL javascript,javascript,morefixes__phpmyadmin__phpmyadmin,morefixes-16768fdfa00c963539dc,codeql_javascript_benchmark_top30_v1/tasks/morefixes-16768fdfa00c963539dc
|
| 71 |
+
codeql,CVE-2024-40761,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-17d21311a4f5af9bbc4f,CodeQL javascript,javascript,morefixes__apache__incubator-answer,morefixes-17d21311a4f5af9bbc4f,codeql_javascript_benchmark_top30_v1/tasks/morefixes-17d21311a4f5af9bbc4f
|
| 72 |
+
codeql,CVE-2025-46344,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-1cf55be2336b09a515a6,CodeQL javascript,javascript,morefixes__auth0__nextjs-auth0,morefixes-1cf55be2336b09a515a6,codeql_javascript_benchmark_top30_v1/tasks/morefixes-1cf55be2336b09a515a6
|
| 73 |
+
codeql,CVE-2026-22819,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-312479357bdfa998bf6e,CodeQL javascript,javascript,morefixes__outray-tunnel__outray,morefixes-312479357bdfa998bf6e,codeql_javascript_benchmark_top30_v1/tasks/morefixes-312479357bdfa998bf6e
|
| 74 |
+
codeql,CVE-2025-10044,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-374e3093d6d5875aa960,CodeQL javascript,javascript,morefixes__keycloak__keycloak,morefixes-374e3093d6d5875aa960,codeql_javascript_benchmark_top30_v1/tasks/morefixes-374e3093d6d5875aa960
|
| 75 |
+
codeql,CVE-2021-4124,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-4b95de19a5da1e74a747,CodeQL javascript,javascript,morefixes__meetecho__janus-gateway,morefixes-4b95de19a5da1e74a747,codeql_javascript_benchmark_top30_v1/tasks/morefixes-4b95de19a5da1e74a747
|
| 76 |
+
codeql,CVE-2021-25990,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-4ffaae63e8f8c0012a0f,CodeQL javascript,javascript,morefixes__ifmeorg__ifme,morefixes-4ffaae63e8f8c0012a0f,codeql_javascript_benchmark_top30_v1/tasks/morefixes-4ffaae63e8f8c0012a0f
|
| 77 |
+
codeql,CVE-2023-47635,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-516c6c53716bba29b7f0,CodeQL javascript,javascript,morefixes__decidim__decidim,morefixes-516c6c53716bba29b7f0,codeql_javascript_benchmark_top30_v1/tasks/morefixes-516c6c53716bba29b7f0
|
| 78 |
+
codeql,CVE-2010-2273,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-550b9b77dc4d0c01e1fe,CodeQL javascript,javascript,morefixes__dojo__dojo,morefixes-550b9b77dc4d0c01e1fe,codeql_javascript_benchmark_top30_v1/tasks/morefixes-550b9b77dc4d0c01e1fe
|
| 79 |
+
codeql,CVE-2024-22411,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-58be9c1811ee7367cce5,CodeQL javascript,javascript,morefixes__avo-hq__avo,morefixes-58be9c1811ee7367cce5,codeql_javascript_benchmark_top30_v1/tasks/morefixes-58be9c1811ee7367cce5
|
| 80 |
+
codeql,CVE-2020-11611,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-60205e347d7f83ebc999,CodeQL javascript,javascript,morefixes__ofirdagan__cross-domain-local-storage,morefixes-60205e347d7f83ebc999,codeql_javascript_benchmark_top30_v1/tasks/morefixes-60205e347d7f83ebc999
|
| 81 |
+
codeql,CVE-2017-1000189,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-633246d79fea5271cdce,CodeQL javascript,javascript,morefixes__mde__ejs,morefixes-633246d79fea5271cdce,codeql_javascript_benchmark_top30_v1/tasks/morefixes-633246d79fea5271cdce
|
| 82 |
+
codeql,CVE-2018-11798,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-88a92b26b3a23d01f412,CodeQL javascript,javascript,morefixes__apache__thrift,morefixes-88a92b26b3a23d01f412,codeql_javascript_benchmark_top30_v1/tasks/morefixes-88a92b26b3a23d01f412
|
| 83 |
+
codeql,CVE-2024-28176,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-941abf85c9b7d820de47,CodeQL javascript,javascript,morefixes__panva__jose,morefixes-941abf85c9b7d820de47,codeql_javascript_benchmark_top30_v1/tasks/morefixes-941abf85c9b7d820de47
|
| 84 |
+
codeql,CVE-2026-39941,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-99aea6539029d3ab985e,CodeQL javascript,javascript,morefixes__churchcrm__crm,morefixes-99aea6539029d3ab985e,codeql_javascript_benchmark_top30_v1/tasks/morefixes-99aea6539029d3ab985e
|
| 85 |
+
codeql,CVE-2024-45312,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-9f8a2d1b597df98c6680,CodeQL javascript,javascript,morefixes__overleaf__overleaf,morefixes-9f8a2d1b597df98c6680,codeql_javascript_benchmark_top30_v1/tasks/morefixes-9f8a2d1b597df98c6680
|
| 86 |
+
codeql,CVE-2025-11222,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-b475f3a535ea41bec3ff,CodeQL javascript,javascript,morefixes__line__centraldogma,morefixes-b475f3a535ea41bec3ff,codeql_javascript_benchmark_top30_v1/tasks/morefixes-b475f3a535ea41bec3ff
|
| 87 |
+
codeql,CVE-2026-10269,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-b61b3848e076036c7b06,CodeQL javascript,javascript,morefixes__decolua__9router,morefixes-b61b3848e076036c7b06,codeql_javascript_benchmark_top30_v1/tasks/morefixes-b61b3848e076036c7b06
|
| 88 |
+
codeql,CVE-2022-39267,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-bd56f8e5b73f132cd962,CodeQL javascript,javascript,morefixes__brokercap__bifrost,morefixes-bd56f8e5b73f132cd962,codeql_javascript_benchmark_top30_v1/tasks/morefixes-bd56f8e5b73f132cd962
|
| 89 |
+
codeql,CVE-2020-7729,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-bd86b40955cabdb21c65,CodeQL javascript,javascript,morefixes__gruntjs__grunt,morefixes-bd86b40955cabdb21c65,codeql_javascript_benchmark_top30_v1/tasks/morefixes-bd86b40955cabdb21c65
|
| 90 |
+
codeql,CVE-2023-37259,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-f1044573e0d15a82a1d0,CodeQL javascript,javascript,morefixes__matrix-org__matrix-react-sdk,morefixes-f1044573e0d15a82a1d0,codeql_javascript_benchmark_top30_v1/tasks/morefixes-f1044573e0d15a82a1d0
|
| 91 |
+
codeql,CVE-2021-21679,codeql_javascript_benchmark_top30_v1,codeql_javascript_benchmark_top30_v1/morefixes-f37103ca8d19c93116f8,CodeQL javascript,javascript,morefixes__jenkinsci__azure-ad-plugin,morefixes-f37103ca8d19c93116f8,codeql_javascript_benchmark_top30_v1/tasks/morefixes-f37103ca8d19c93116f8
|
| 92 |
+
codeql,CVE-2021-21371,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-03252773bde39ba37465,CodeQL python,python,pyvul__tenable__integration-jira-cloud,pyvul-03252773bde39ba37465,codeql_python_benchmark51_v2/tasks/pyvul-03252773bde39ba37465
|
| 93 |
+
codeql,CVE-2023-6977,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-07332271886167133edf,CodeQL python,python,pyvul__mlflow__mlflow,pyvul-07332271886167133edf,codeql_python_benchmark51_v2/tasks/pyvul-07332271886167133edf
|
| 94 |
+
codeql,CVE-2020-12889,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-0e38a9079f90a5ac566e,CodeQL python,python,pyvul__misp__misp-maltego,pyvul-0e38a9079f90a5ac566e,codeql_python_benchmark51_v2/tasks/pyvul-0e38a9079f90a5ac566e
|
| 95 |
+
codeql,CVE-2023-30629,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-10fb77265dc23f305315,CodeQL python,python,pyvul__vyperlang__vyper,pyvul-10fb77265dc23f305315,codeql_python_benchmark51_v2/tasks/pyvul-10fb77265dc23f305315
|
| 96 |
+
codeql,CVE-2019-3830,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-135c7fcada946877931a,CodeQL python,python,pyvul__openstack__ceilometer,pyvul-135c7fcada946877931a,codeql_python_benchmark51_v2/tasks/pyvul-135c7fcada946877931a
|
| 97 |
+
codeql,CVE-2020-10799,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-15c0ad3037992bda1b19,CodeQL python,python,pyvul__deeplook__svglib,pyvul-15c0ad3037992bda1b19,codeql_python_benchmark51_v2/tasks/pyvul-15c0ad3037992bda1b19
|
| 98 |
+
codeql,CVE-2022-0736,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-1a630dd8f83b2e29740d,CodeQL python,python,pyvul__mlflow__mlflow,pyvul-1a630dd8f83b2e29740d,codeql_python_benchmark51_v2/tasks/pyvul-1a630dd8f83b2e29740d
|
| 99 |
+
codeql,CVE-2022-42965,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-1f5068a3fe5ca0192a07,CodeQL python,python,pyvul__snowflakedb__snowflake-connector-python,pyvul-1f5068a3fe5ca0192a07,codeql_python_benchmark51_v2/tasks/pyvul-1f5068a3fe5ca0192a07
|
| 100 |
+
codeql,CVE-2021-46898,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-2ab65d62986b80922362,CodeQL python,python,pyvul__sehmaschine__django-grappelli,pyvul-2ab65d62986b80922362,codeql_python_benchmark51_v2/tasks/pyvul-2ab65d62986b80922362
|
| 101 |
+
codeql,CVE-2023-48224,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-3062589ff0b3b95c2ed7,CodeQL python,python,pyvul__ethyca__fides,pyvul-3062589ff0b3b95c2ed7,codeql_python_benchmark51_v2/tasks/pyvul-3062589ff0b3b95c2ed7
|
| 102 |
+
codeql,CVE-2020-19001,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-3187445bcbbf39128a26,CodeQL python,python,pyvul__tankywoo__simiki,pyvul-3187445bcbbf39128a26,codeql_python_benchmark51_v2/tasks/pyvul-3187445bcbbf39128a26
|
| 103 |
+
codeql,CVE-2022-0845,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-36a40541d7c74a9a7777,CodeQL python,python,pyvul__pytorchlightning__pytorch-lightning,pyvul-36a40541d7c74a9a7777,codeql_python_benchmark51_v2/tasks/pyvul-36a40541d7c74a9a7777
|
| 104 |
+
codeql,CVE-2023-6395,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-3819b1a7530257524a75,CodeQL python,python,pyvul__xsuchy__templated-dictionary,pyvul-3819b1a7530257524a75,codeql_python_benchmark51_v2/tasks/pyvul-3819b1a7530257524a75
|
| 105 |
+
codeql,CVE-2020-29128,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-394adf7b067d96b356ca,CodeQL python,python,pyvul__petl-developers__petl,pyvul-394adf7b067d96b356ca,codeql_python_benchmark51_v2/tasks/pyvul-394adf7b067d96b356ca
|
| 106 |
+
codeql,CVE-2021-41127,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-3994e3622b21c396ef8a,CodeQL python,python,pyvul__rasahq__rasa,pyvul-3994e3622b21c396ef8a,codeql_python_benchmark51_v2/tasks/pyvul-3994e3622b21c396ef8a
|
| 107 |
+
codeql,CVE-2014-1932,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-4954e5890cce23c8b03d,CodeQL python,python,pyvul__python-imaging__pillow,pyvul-4954e5890cce23c8b03d,codeql_python_benchmark51_v2/tasks/pyvul-4954e5890cce23c8b03d
|
| 108 |
+
codeql,CVE-2023-48700,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-4ac3440b9023e6511a91,CodeQL python,python,pyvul__nautobot__nautobot-plugin-device-onboarding,pyvul-4ac3440b9023e6511a91,codeql_python_benchmark51_v2/tasks/pyvul-4ac3440b9023e6511a91
|
| 109 |
+
codeql,CVE-2021-4315,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-4e31b8fba29687b8d792,CodeQL python,python,pyvul__nyuccl__psiturk,pyvul-4e31b8fba29687b8d792,codeql_python_benchmark51_v2/tasks/pyvul-4e31b8fba29687b8d792
|
| 110 |
+
codeql,CVE-2021-32839,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-509b1de3e2277ac89469,CodeQL python,python,pyvul__andialbrecht__sqlparse,pyvul-509b1de3e2277ac89469,codeql_python_benchmark51_v2/tasks/pyvul-509b1de3e2277ac89469
|
| 111 |
+
codeql,CVE-2022-23530,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-533cc1a8c090c7529184,CodeQL python,python,pyvul__datadog__guarddog,pyvul-533cc1a8c090c7529184,codeql_python_benchmark51_v2/tasks/pyvul-533cc1a8c090c7529184
|
| 112 |
+
codeql,CVE-2023-34540,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-5cffd45f7550a060e2cf,CodeQL python,python,pyvul__langchain-ai__langchain,pyvul-5cffd45f7550a060e2cf,codeql_python_benchmark51_v2/tasks/pyvul-5cffd45f7550a060e2cf
|
| 113 |
+
codeql,CVE-2022-0315,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-6b5cf1b92b87b04c09cd,CodeQL python,python,pyvul__horovod__horovod,pyvul-6b5cf1b92b87b04c09cd,codeql_python_benchmark51_v2/tasks/pyvul-6b5cf1b92b87b04c09cd
|
| 114 |
+
codeql,CVE-2021-23393,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-796a152aa965ce44a6db,CodeQL python,python,pyvul__briancappello__flask-unchained,pyvul-796a152aa965ce44a6db,codeql_python_benchmark51_v2/tasks/pyvul-796a152aa965ce44a6db
|
| 115 |
+
codeql,CVE-2021-21274,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-7c3c693e688548564c9a,CodeQL python,python,pyvul__matrix-org__synapse,pyvul-7c3c693e688548564c9a,codeql_python_benchmark51_v2/tasks/pyvul-7c3c693e688548564c9a
|
| 116 |
+
codeql,CVE-2017-16616,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-7c7eaf17f0df49603ae4,CodeQL python,python,pyvul__stranger6667__pyanyapi,pyvul-7c7eaf17f0df49603ae4,codeql_python_benchmark51_v2/tasks/pyvul-7c7eaf17f0df49603ae4
|
| 117 |
+
codeql,CVE-2018-25082,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-810ace2bf3e4aa0f04a1,CodeQL python,python,pyvul__zwczou__weixin-python,pyvul-810ace2bf3e4aa0f04a1,codeql_python_benchmark51_v2/tasks/pyvul-810ace2bf3e4aa0f04a1
|
| 118 |
+
codeql,CVE-2022-31605,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-812f35b535c5e549929b,CodeQL python,python,pyvul__nvidia__nvflare,pyvul-812f35b535c5e549929b,codeql_python_benchmark51_v2/tasks/pyvul-812f35b535c5e549929b
|
| 119 |
+
codeql,CVE-2013-4260,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-8297e406660c92268ba5,CodeQL python,python,pyvul__ansible__ansible,pyvul-8297e406660c92268ba5,codeql_python_benchmark51_v2/tasks/pyvul-8297e406660c92268ba5
|
| 120 |
+
codeql,CVE-2022-36082,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-89a9ff0f9cf4f2f4cc91,CodeQL python,python,pyvul__mansuf__mangadex-downloader,pyvul-89a9ff0f9cf4f2f4cc91,codeql_python_benchmark51_v2/tasks/pyvul-89a9ff0f9cf4f2f4cc91
|
| 121 |
+
codeql,CVE-2020-15239,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-8e39d07d2ff863a3f19e,CodeQL python,python,pyvul__horazont__xmpp-http-upload,pyvul-8e39d07d2ff863a3f19e,codeql_python_benchmark51_v2/tasks/pyvul-8e39d07d2ff863a3f19e
|
| 122 |
+
codeql,CVE-2023-29159,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-8f3613497f18d5cf2684,CodeQL python,python,pyvul__encode__starlette,pyvul-8f3613497f18d5cf2684,codeql_python_benchmark51_v2/tasks/pyvul-8f3613497f18d5cf2684
|
| 123 |
+
codeql,CVE-2019-11340,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-98fc634e79976d5b5241,CodeQL python,python,pyvul__matrix-org__sydent,pyvul-98fc634e79976d5b5241,codeql_python_benchmark51_v2/tasks/pyvul-98fc634e79976d5b5241
|
| 124 |
+
codeql,CVE-2019-14806,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-9ba7c665889bf20611cb,CodeQL python,python,pyvul__pallets__werkzeug,pyvul-9ba7c665889bf20611cb,codeql_python_benchmark51_v2/tasks/pyvul-9ba7c665889bf20611cb
|
| 125 |
+
codeql,CVE-2023-49277,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-9c089aba2c203455d420,CodeQL python,python,pyvul__darrenofficial__dpaste,pyvul-9c089aba2c203455d420,codeql_python_benchmark51_v2/tasks/pyvul-9c089aba2c203455d420
|
| 126 |
+
codeql,CVE-2020-15120,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-9dcb85347ac437354c6f,CodeQL python,python,pyvul__spiral-project__ihatemoney,pyvul-9dcb85347ac437354c6f,codeql_python_benchmark51_v2/tasks/pyvul-9dcb85347ac437354c6f
|
| 127 |
+
codeql,CVE-2022-3301,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-a2d122cb9e3a61ddca7a,CodeQL python,python,pyvul__ikus060__rdiffweb,pyvul-a2d122cb9e3a61ddca7a,codeql_python_benchmark51_v2/tasks/pyvul-a2d122cb9e3a61ddca7a
|
| 128 |
+
codeql,CVE-2020-35653,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-a44d900bae2c75f9ea8d,CodeQL python,python,pyvul__python-pillow__pillow,pyvul-a44d900bae2c75f9ea8d,codeql_python_benchmark51_v2/tasks/pyvul-a44d900bae2c75f9ea8d
|
| 129 |
+
codeql,CVE-2021-34363,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4,CodeQL python,python,pyvul__nvbn__thefuck,pyvul-b10e0389c54d164db5b4,codeql_python_benchmark51_v2/tasks/pyvul-b10e0389c54d164db5b4
|
| 130 |
+
codeql,CVE-2014-1938,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-b5417e7c5b6909a4c5f9,CodeQL python,python,pyvul__alex__rply,pyvul-b5417e7c5b6909a4c5f9,codeql_python_benchmark51_v2/tasks/pyvul-b5417e7c5b6909a4c5f9
|
| 131 |
+
codeql,CVE-2021-21360,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-bae2a9b05bba64edb040,CodeQL python,python,pyvul__zopefoundation__products.genericsetup,pyvul-bae2a9b05bba64edb040,codeql_python_benchmark51_v2/tasks/pyvul-bae2a9b05bba64edb040
|
| 132 |
+
codeql,CVE-2022-24302,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-bf4aded7c76d99f9ef84,CodeQL python,python,pyvul__paramiko__paramiko,pyvul-bf4aded7c76d99f9ef84,codeql_python_benchmark51_v2/tasks/pyvul-bf4aded7c76d99f9ef84
|
| 133 |
+
codeql,CVE-2021-43854,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-c4ca067f7fd871d25376,CodeQL python,python,pyvul__nltk__nltk,pyvul-c4ca067f7fd871d25376,codeql_python_benchmark51_v2/tasks/pyvul-c4ca067f7fd871d25376
|
| 134 |
+
codeql,CVE-2023-2800,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-c52f0447bb0aa65cf9a4,CodeQL python,python,pyvul__huggingface__transformers,pyvul-c52f0447bb0aa65cf9a4,codeql_python_benchmark51_v2/tasks/pyvul-c52f0447bb0aa65cf9a4
|
| 135 |
+
codeql,CVE-2022-4724,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-cb3f3f84ff4550031205,CodeQL python,python,pyvul__ikus060__rdiffweb,pyvul-cb3f3f84ff4550031205,codeql_python_benchmark51_v2/tasks/pyvul-cb3f3f84ff4550031205
|
| 136 |
+
codeql,CVE-2023-49080,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-d005a7cf5935ac7e7aae,CodeQL python,python,pyvul__jupyter-server__jupyter_server,pyvul-d005a7cf5935ac7e7aae,codeql_python_benchmark51_v2/tasks/pyvul-d005a7cf5935ac7e7aae
|
| 137 |
+
codeql,CVE-2021-21386,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-d38a3c1956e86350a0c7,CodeQL python,python,pyvul__dwisiswant0__apkleaks,pyvul-d38a3c1956e86350a0c7,codeql_python_benchmark51_v2/tasks/pyvul-d38a3c1956e86350a0c7
|
| 138 |
+
codeql,CVE-2023-5002,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-dbcc9a178b256c49887e,CodeQL python,python,pyvul__pgadmin-org__pgadmin4,pyvul-dbcc9a178b256c49887e,codeql_python_benchmark51_v2/tasks/pyvul-dbcc9a178b256c49887e
|
| 139 |
+
codeql,CVE-2023-38201,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-e305522c703de57f9ede,CodeQL python,python,pyvul__keylime__keylime,pyvul-e305522c703de57f9ede,codeql_python_benchmark51_v2/tasks/pyvul-e305522c703de57f9ede
|
| 140 |
+
codeql,CVE-2023-45139,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-e73df8c8998a1ddc180a,CodeQL python,python,pyvul__fonttools__fonttools,pyvul-e73df8c8998a1ddc180a,codeql_python_benchmark51_v2/tasks/pyvul-e73df8c8998a1ddc180a
|
| 141 |
+
codeql,CVE-2021-39229,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-f55f7c013a9f5bd1eb0d,CodeQL python,python,pyvul__caronc__apprise,pyvul-f55f7c013a9f5bd1eb0d,codeql_python_benchmark51_v2/tasks/pyvul-f55f7c013a9f5bd1eb0d
|
| 142 |
+
codeql,CVE-2023-45813,codeql_python_benchmark51_v2,codeql_python_benchmark51_v2/pyvul-ff1e02f88768f34e43fb,CodeQL python,python,pyvul__dedsecinside__torbot,pyvul-ff1e02f88768f34e43fb,codeql_python_benchmark51_v2/tasks/pyvul-ff1e02f88768f34e43fb
|
| 143 |
+
csa,CVE-2014-0749,csa159,csa159/pair_134585,CSA,c/c++,adaptivecomputing_torque,pair_134585,csa159/tasks/pair_134585
|
| 144 |
+
csa,CVE-2017-8911,csa159,csa159/pair_135745,CSA,c/c++,verdammelt_tnef,pair_135745,csa159/tasks/pair_135745
|
| 145 |
+
csa,CVE-2014-8127,csa159,csa159/pair_136342,CSA,c/c++,vadz_libtiff,pair_136342,csa159/tasks/pair_136342
|
| 146 |
+
csa,CVE-2019-9893,csa159,csa159/pair_137674,CSA,c/c++,seccomp_libseccomp,pair_137674,csa159/tasks/pair_137674
|
| 147 |
+
csa,CVE-2014-5388,csa159,csa159/pair_137782,CSA,c/c++,qemu_qemu,pair_137782,csa159/tasks/pair_137782
|
| 148 |
+
csa,CVE-2026-9501,csa159,csa159/pair_138263,CSA,c/c++,LibreDWG_libredwg,pair_138263,csa159/tasks/pair_138263
|
| 149 |
+
csa,CVE-2019-20022,csa159,csa159/pair_138473,CSA,c/c++,saitoha_libsixel,pair_138473,csa159/tasks/pair_138473
|
| 150 |
+
csa,CVE-2026-33165,csa159,csa159/pair_138511,CSA,c/c++,strukturag_libde265,pair_138511,csa159/tasks/pair_138511
|
| 151 |
+
csa,CVE-2025-48367,csa159,csa159/pair_138570,CSA,c/c++,redis_redis,pair_138570,csa159/tasks/pair_138570
|
| 152 |
+
csa,CVE-2024-25269,csa159,csa159/pair_138644,CSA,c/c++,strukturag_libheif,pair_138644,csa159/tasks/pair_138644
|
| 153 |
+
csa,CVE-2025-62171,csa159,csa159/pair_138710,CSA,c/c++,ImageMagick_ImageMagick,pair_138710,csa159/tasks/pair_138710
|
| 154 |
+
csa,CVE-2022-48923,csa159,csa159/pair_139922,CSA,c/c++,torvalds_linux,pair_139922,csa159/tasks/pair_139922
|
| 155 |
+
csa,CVE-2022-49375,csa159,csa159/pair_140347,CSA,c/c++,torvalds_linux,pair_140347,csa159/tasks/pair_140347
|
| 156 |
+
csa,CVE-2022-50419,csa159,csa159/pair_141329,CSA,c/c++,torvalds_linux,pair_141329,csa159/tasks/pair_141329
|
| 157 |
+
csa,CVE-2023-53148,csa159,csa159/pair_142288,CSA,c/c++,torvalds_linux,pair_142288,csa159/tasks/pair_142288
|
| 158 |
+
csa,CVE-2023-53532,csa159,csa159/pair_142647,CSA,c/c++,torvalds_linux,pair_142647,csa159/tasks/pair_142647
|
| 159 |
+
csa,CVE-2025-38226,csa159,csa159/pair_147034,CSA,c/c++,torvalds_linux,pair_147034,csa159/tasks/pair_147034
|
| 160 |
+
csa,CVE-2025-39773,csa159,csa159/pair_147640,CSA,c/c++,torvalds_linux,pair_147640,csa159/tasks/pair_147640
|
| 161 |
+
csa,CVE-2025-39810,csa159,csa159/pair_147676,CSA,c/c++,torvalds_linux,pair_147676,csa159/tasks/pair_147676
|
| 162 |
+
csa,CVE-2025-71146,csa159,csa159/pair_148601,CSA,c/c++,torvalds_linux,pair_148601,csa159/tasks/pair_148601
|
| 163 |
+
csa,CVE-2026-23111,csa159,csa159/pair_148834,CSA,c/c++,torvalds_linux,pair_148834,csa159/tasks/pair_148834
|
| 164 |
+
csa,CVE-2026-31747,csa159,csa159/pair_149548,CSA,c/c++,torvalds_linux,pair_149548,csa159/tasks/pair_149548
|
| 165 |
+
csa,CVE-2026-43054,csa159,csa159/pair_149640,CSA,c/c++,torvalds_linux,pair_149640,csa159/tasks/pair_149640
|
| 166 |
+
csa,CVE-2026-43166,csa159,csa159/pair_149751,CSA,c/c++,torvalds_linux,pair_149751,csa159/tasks/pair_149751
|
| 167 |
+
csa,CVE-2026-43185,csa159,csa159/pair_149770,CSA,c/c++,torvalds_linux,pair_149770,csa159/tasks/pair_149770
|
| 168 |
+
csa,CVE-2026-45863,csa159,csa159/pair_150111,CSA,c/c++,torvalds_linux,pair_150111,csa159/tasks/pair_150111
|
| 169 |
+
csa,CVE-2026-46001,csa159,csa159/pair_150247,CSA,c/c++,torvalds_linux,pair_150247,csa159/tasks/pair_150247
|
| 170 |
+
csa,CVE-2026-46180,csa159,csa159/pair_150426,CSA,c/c++,torvalds_linux,pair_150426,csa159/tasks/pair_150426
|
| 171 |
+
csa,CVE-2022-48730,csa159,csa159/pair_156745,CSA,c/c++,torvalds_linux,pair_156745,csa159/tasks/pair_156745
|
| 172 |
+
csa,CVE-2021-42252,csa159,csa159/pair_157090,CSA,c/c++,torvalds_linux,pair_157090,csa159/tasks/pair_157090
|
| 173 |
+
csa,CVE-2022-50010,csa159,csa159/pair_157305,CSA,c/c++,torvalds_linux,pair_157305,csa159/tasks/pair_157305
|
| 174 |
+
csa,CVE-2025-38692,csa159,csa159/pair_157307,CSA,c/c++,torvalds_linux,pair_157307,csa159/tasks/pair_157307
|
| 175 |
+
csa,CVE-2022-48634,csa159,csa159/pair_158826,CSA,c/c++,torvalds_linux,pair_158826,csa159/tasks/pair_158826
|
| 176 |
+
csa,CVE-2021-47437,csa159,csa159/pair_159680,CSA,c/c++,torvalds_linux,pair_159680,csa159/tasks/pair_159680
|
| 177 |
+
csa,CVE-2024-26811,csa159,csa159/pair_161551,CSA,c/c++,torvalds_linux,pair_161551,csa159/tasks/pair_161551
|
| 178 |
+
csa,CVE-2026-23299,csa159,csa159/pair_161587,CSA,c/c++,torvalds_linux,pair_161587,csa159/tasks/pair_161587
|
| 179 |
+
csa,CVE-2020-28374,csa159,csa159/pair_162518,CSA,c/c++,torvalds_linux,pair_162518,csa159/tasks/pair_162518
|
| 180 |
+
csa,CVE-2024-26954,csa159,csa159/pair_162526,CSA,c/c++,torvalds_linux,pair_162526,csa159/tasks/pair_162526
|
| 181 |
+
csa,CVE-2023-53166,csa159,csa159/pair_162993,CSA,c/c++,torvalds_linux,pair_162993,csa159/tasks/pair_162993
|
| 182 |
+
csa,CVE-2022-49639,csa159,csa159/pair_163682,CSA,c/c++,torvalds_linux,pair_163682,csa159/tasks/pair_163682
|
| 183 |
+
csa,CVE-2024-38384,csa159,csa159/pair_164279,CSA,c/c++,torvalds_linux,pair_164279,csa159/tasks/pair_164279
|
| 184 |
+
csa,CVE-2025-21719,csa159,csa159/pair_164760,CSA,c/c++,torvalds_linux,pair_164760,csa159/tasks/pair_164760
|
| 185 |
+
csa,CVE-2025-37780,csa159,csa159/pair_165550,CSA,c/c++,torvalds_linux,pair_165550,csa159/tasks/pair_165550
|
| 186 |
+
csa,CVE-2019-11338,csa159,csa159/pair_17613,CSA,c/c++,FFmpeg_FFmpeg,pair_17613,csa159/tasks/pair_17613
|
| 187 |
+
csa,CVE-2023-39562,csa159,csa159/pair_4253,CSA,c/c++,gpac_gpac,pair_4253,csa159/tasks/pair_4253
|
| 188 |
+
csa,CVE-2017-7866,csa159,csa159/pair_4869,CSA,c/c++,FFmpeg_FFmpeg,pair_4869,csa159/tasks/pair_4869
|
| 189 |
+
csa,CVE-2020-9365,csa159,csa159/pair_134943,CSA,c/c++,jedisct1_pure-ftpd,pair_134943,csa159/tasks/pair_134943
|
| 190 |
+
csa,CVE-2016-5824,csa159,csa159/pair_135175,CSA,c/c++,libical_libical,pair_135175,csa159/tasks/pair_135175
|
| 191 |
+
csa,CVE-2020-26148,csa159,csa159/pair_135384,CSA,c/c++,mity_md4c,pair_135384,csa159/tasks/pair_135384
|
| 192 |
+
csa,CVE-2018-1000091,csa159,csa159/pair_135405,CSA,c/c++,mwarning_KadNode,pair_135405,csa159/tasks/pair_135405
|
| 193 |
+
csa,CVE-2021-33930,csa159,csa159/pair_135446,CSA,c/c++,openSUSE_libsolv,pair_135446,csa159/tasks/pair_135446
|
| 194 |
+
csa,CVE-2018-19826,csa159,csa159/pair_135624,CSA,c/c++,sass_libsass,pair_135624,csa159/tasks/pair_135624
|
| 195 |
+
csa,CVE-2017-6309,csa159,csa159/pair_135749,CSA,c/c++,verdammelt_tnef,pair_135749,csa159/tasks/pair_135749
|
| 196 |
+
csa,CVE-2020-11764,csa159,csa159/pair_136251,CSA,c/c++,openexr_openexr,pair_136251,csa159/tasks/pair_136251
|
| 197 |
+
csa,CVE-2020-11764,csa159,csa159/pair_136252,CSA,c/c++,openexr_openexr,pair_136252,csa159/tasks/pair_136252
|
| 198 |
+
csa,CVE-2023-3745,csa159,csa159/pair_136864,CSA,c/c++,ImageMagick_ImageMagick6,pair_136864,csa159/tasks/pair_136864
|
| 199 |
+
csa,CVE-2017-5627,csa159,csa159/pair_137200,CSA,c/c++,ccxvii_mujs,pair_137200,csa159/tasks/pair_137200
|
| 200 |
+
csa,CVE-2020-23306,csa159,csa159/pair_137357,CSA,c/c++,jerryscript-project_jerryscript,pair_137357,csa159/tasks/pair_137357
|
| 201 |
+
csa,CVE-2021-46349,csa159,csa159/pair_137374,CSA,c/c++,jerryscript-project_jerryscript,pair_137374,csa159/tasks/pair_137374
|
| 202 |
+
csa,CVE-2020-23312,csa159,csa159/pair_137377,CSA,c/c++,jerryscript-project_jerryscript,pair_137377,csa159/tasks/pair_137377
|
| 203 |
+
csa,CVE-2021-46350,csa159,csa159/pair_137389,CSA,c/c++,jerryscript-project_jerryscript,pair_137389,csa159/tasks/pair_137389
|
| 204 |
+
csa,CVE-2019-19795,csa159,csa159/pair_137518,CSA,c/c++,michaelforney_samurai,pair_137518,csa159/tasks/pair_137518
|
| 205 |
+
csa,CVE-2014-0146,csa159,csa159/pair_137750,CSA,c/c++,qemu_qemu,pair_137750,csa159/tasks/pair_137750
|
| 206 |
+
csa,CVE-2018-16847,csa159,csa159/pair_137751,CSA,c/c++,qemu_qemu,pair_137751,csa159/tasks/pair_137751
|
| 207 |
+
csa,CVE-2018-17963,csa159,csa159/pair_137769,CSA,c/c++,qemu_qemu,pair_137769,csa159/tasks/pair_137769
|
| 208 |
+
csa,CVE-2019-20396,csa159,csa159/pair_138126,CSA,c/c++,CESNET_libyang,pair_138126,csa159/tasks/pair_138126
|
| 209 |
+
csa,CVE-2026-32854,csa159,csa159/pair_138203,CSA,c/c++,LibVNC_libvncserver,pair_138203,csa159/tasks/pair_138203
|
| 210 |
+
csa,CVE-2020-6611,csa159,csa159/pair_138249,CSA,c/c++,LibreDWG_libredwg,pair_138249,csa159/tasks/pair_138249
|
| 211 |
+
csa,CVE-2021-36080,csa159,csa159/pair_138280,CSA,c/c++,LibreDWG_libredwg,pair_138280,csa159/tasks/pair_138280
|
| 212 |
+
csa,CVE-2019-13115,csa159,csa159/pair_138328,CSA,c/c++,libssh2_libssh2,pair_138328,csa159/tasks/pair_138328
|
| 213 |
+
csa,CVE-2024-28319,csa159,csa159/pair_138462,CSA,c/c++,gpac_gpac,pair_138462,csa159/tasks/pair_138462
|
| 214 |
+
csa,CVE-2018-21232,csa159,csa159/pair_138485,CSA,c/c++,skvadrik_re2c,pair_138485,csa159/tasks/pair_138485
|
| 215 |
+
csa,CVE-2016-1924,csa159,csa159/pair_138650,CSA,c/c++,uclouvain_openjpeg,pair_138650,csa159/tasks/pair_138650
|
| 216 |
+
csa,CVE-2026-40169,csa159,csa159/pair_138728,CSA,c/c++,ImageMagick_ImageMagick,pair_138728,csa159/tasks/pair_138728
|
| 217 |
+
csa,CVE-2025-46393,csa159,csa159/pair_138746,CSA,c/c++,ImageMagick_ImageMagick,pair_138746,csa159/tasks/pair_138746
|
| 218 |
+
csa,CVE-2026-33905,csa159,csa159/pair_138756,CSA,c/c++,ImageMagick_ImageMagick,pair_138756,csa159/tasks/pair_138756
|
| 219 |
+
csa,CVE-2011-2161,csa159,csa159/pair_138800,CSA,c/c++,FFmpeg_FFmpeg,pair_138800,csa159/tasks/pair_138800
|
| 220 |
+
csa,CVE-2021-47583,csa159,csa159/pair_139579,CSA,c/c++,torvalds_linux,pair_139579,csa159/tasks/pair_139579
|
| 221 |
+
csa,CVE-2022-49563,csa159,csa159/pair_140531,CSA,c/c++,torvalds_linux,pair_140531,csa159/tasks/pair_140531
|
| 222 |
+
csa,CVE-2022-49727,csa159,csa159/pair_140691,CSA,c/c++,torvalds_linux,pair_140691,csa159/tasks/pair_140691
|
| 223 |
+
csa,CVE-2022-50138,csa159,csa159/pair_141072,CSA,c/c++,torvalds_linux,pair_141072,csa159/tasks/pair_141072
|
| 224 |
+
csa,CVE-2022-50374,csa159,csa159/pair_141289,CSA,c/c++,torvalds_linux,pair_141289,csa159/tasks/pair_141289
|
| 225 |
+
csa,CVE-2022-50459,csa159,csa159/pair_141364,CSA,c/c++,torvalds_linux,pair_141364,csa159/tasks/pair_141364
|
| 226 |
+
csa,CVE-2023-52471,csa159,csa159/pair_141754,CSA,c/c++,torvalds_linux,pair_141754,csa159/tasks/pair_141754
|
| 227 |
+
csa,CVE-2023-52609,csa159,csa159/pair_141857,CSA,c/c++,torvalds_linux,pair_141857,csa159/tasks/pair_141857
|
| 228 |
+
csa,CVE-2023-53250,csa159,csa159/pair_142376,CSA,c/c++,torvalds_linux,pair_142376,csa159/tasks/pair_142376
|
| 229 |
+
csa,CVE-2023-53679,csa159,csa159/pair_142793,CSA,c/c++,torvalds_linux,pair_142793,csa159/tasks/pair_142793
|
| 230 |
+
csa,CVE-2024-26927,csa159,csa159/pair_143586,CSA,c/c++,torvalds_linux,pair_143586,csa159/tasks/pair_143586
|
| 231 |
+
csa,CVE-2024-38628,csa159,csa159/pair_144169,CSA,c/c++,torvalds_linux,pair_144169,csa159/tasks/pair_144169
|
| 232 |
+
csa,CVE-2024-53117,csa159,csa159/pair_145442,CSA,c/c++,torvalds_linux,pair_145442,csa159/tasks/pair_145442
|
| 233 |
+
csa,CVE-2024-53203,csa159,csa159/pair_145527,CSA,c/c++,torvalds_linux,pair_145527,csa159/tasks/pair_145527
|
| 234 |
+
csa,CVE-2024-56605,csa159,csa159/pair_145663,CSA,c/c++,torvalds_linux,pair_145663,csa159/tasks/pair_145663
|
| 235 |
+
csa,CVE-2024-57953,csa159,csa159/pair_145933,CSA,c/c++,torvalds_linux,pair_145933,csa159/tasks/pair_145933
|
| 236 |
+
csa,CVE-2024-57996,csa159,csa159/pair_145957,CSA,c/c++,torvalds_linux,pair_145957,csa159/tasks/pair_145957
|
| 237 |
+
csa,CVE-2024-58065,csa159,csa159/pair_146000,CSA,c/c++,torvalds_linux,pair_146000,csa159/tasks/pair_146000
|
| 238 |
+
csa,CVE-2025-21986,csa159,csa159/pair_146389,CSA,c/c++,torvalds_linux,pair_146389,csa159/tasks/pair_146389
|
| 239 |
+
csa,CVE-2025-38415,csa159,csa159/pair_147222,CSA,c/c++,torvalds_linux,pair_147222,csa159/tasks/pair_147222
|
| 240 |
+
csa,CVE-2025-38459,csa159,csa159/pair_147266,CSA,c/c++,torvalds_linux,pair_147266,csa159/tasks/pair_147266
|
| 241 |
+
csa,CVE-2025-40313,csa159,csa159/pair_148175,CSA,c/c++,torvalds_linux,pair_148175,csa159/tasks/pair_148175
|
| 242 |
+
csa,CVE-2026-43160,csa159,csa159/pair_149745,CSA,c/c++,torvalds_linux,pair_149745,csa159/tasks/pair_149745
|
| 243 |
+
csa,CVE-2026-43249,csa159,csa159/pair_149834,CSA,c/c++,torvalds_linux,pair_149834,csa159/tasks/pair_149834
|
| 244 |
+
csa,CVE-2026-43376,csa159,csa159/pair_149959,CSA,c/c++,torvalds_linux,pair_149959,csa159/tasks/pair_149959
|
| 245 |
+
csa,CVE-2026-46045,csa159,csa159/pair_150291,CSA,c/c++,torvalds_linux,pair_150291,csa159/tasks/pair_150291
|
| 246 |
+
csa,CVE-2026-46090,csa159,csa159/pair_150336,CSA,c/c++,torvalds_linux,pair_150336,csa159/tasks/pair_150336
|
| 247 |
+
csa,CVE-2022-49007,csa159,csa159/pair_156097,CSA,c/c++,torvalds_linux,pair_156097,csa159/tasks/pair_156097
|
| 248 |
+
csa,CVE-2024-42272,csa159,csa159/pair_156217,CSA,c/c++,torvalds_linux,pair_156217,csa159/tasks/pair_156217
|
| 249 |
+
csa,CVE-2023-52505,csa159,csa159/pair_156267,CSA,c/c++,torvalds_linux,pair_156267,csa159/tasks/pair_156267
|
| 250 |
+
csa,CVE-2024-26664,csa159,csa159/pair_156473,CSA,c/c++,torvalds_linux,pair_156473,csa159/tasks/pair_156473
|
| 251 |
+
csa,CVE-2025-38568,csa159,csa159/pair_156640,CSA,c/c++,torvalds_linux,pair_156640,csa159/tasks/pair_156640
|
| 252 |
+
csa,CVE-2023-53057,csa159,csa159/pair_156704,CSA,c/c++,torvalds_linux,pair_156704,csa159/tasks/pair_156704
|
| 253 |
+
csa,CVE-2023-52865,csa159,csa159/pair_156860,CSA,c/c++,torvalds_linux,pair_156860,csa159/tasks/pair_156860
|
| 254 |
+
csa,CVE-2022-48818,csa159,csa159/pair_156981,CSA,c/c++,torvalds_linux,pair_156981,csa159/tasks/pair_156981
|
| 255 |
+
csa,CVE-2022-49519,csa159,csa159/pair_157153,CSA,c/c++,torvalds_linux,pair_157153,csa159/tasks/pair_157153
|
| 256 |
+
csa,CVE-2022-48665,csa159,csa159/pair_158138,CSA,c/c++,torvalds_linux,pair_158138,csa159/tasks/pair_158138
|
| 257 |
+
csa,CVE-2026-53322,csa159,csa159/pair_158217,CSA,c/c++,torvalds_linux,pair_158217,csa159/tasks/pair_158217
|
| 258 |
+
csa,CVE-2022-50131,csa159,csa159/pair_158385,CSA,c/c++,torvalds_linux,pair_158385,csa159/tasks/pair_158385
|
| 259 |
+
csa,CVE-2023-1078,csa159,csa159/pair_158831,CSA,c/c++,torvalds_linux,pair_158831,csa159/tasks/pair_158831
|
| 260 |
+
csa,CVE-2022-49208,csa159,csa159/pair_159264,CSA,c/c++,torvalds_linux,pair_159264,csa159/tasks/pair_159264
|
| 261 |
+
csa,CVE-2024-36899,csa159,csa159/pair_159377,CSA,c/c++,torvalds_linux,pair_159377,csa159/tasks/pair_159377
|
| 262 |
+
csa,CVE-2025-37812,csa159,csa159/pair_160021,CSA,c/c++,torvalds_linux,pair_160021,csa159/tasks/pair_160021
|
| 263 |
+
csa,CVE-2023-52569,csa159,csa159/pair_160187,CSA,c/c++,torvalds_linux,pair_160187,csa159/tasks/pair_160187
|
| 264 |
+
csa,CVE-2023-52603,csa159,csa159/pair_160364,CSA,c/c++,torvalds_linux,pair_160364,csa159/tasks/pair_160364
|
| 265 |
+
csa,CVE-2023-28464,csa159,csa159/pair_160434,CSA,c/c++,torvalds_linux,pair_160434,csa159/tasks/pair_160434
|
| 266 |
+
csa,CVE-2025-38129,csa159,csa159/pair_160451,CSA,c/c++,torvalds_linux,pair_160451,csa159/tasks/pair_160451
|
| 267 |
+
csa,CVE-2024-45017,csa159,csa159/pair_160603,CSA,c/c++,torvalds_linux,pair_160603,csa159/tasks/pair_160603
|
| 268 |
+
csa,CVE-2022-49123,csa159,csa159/pair_160628,CSA,c/c++,torvalds_linux,pair_160628,csa159/tasks/pair_160628
|
| 269 |
+
csa,CVE-2024-41059,csa159,csa159/pair_160904,CSA,c/c++,torvalds_linux,pair_160904,csa159/tasks/pair_160904
|
| 270 |
+
csa,CVE-2024-42242,csa159,csa159/pair_160912,CSA,c/c++,torvalds_linux,pair_160912,csa159/tasks/pair_160912
|
| 271 |
+
csa,CVE-2024-26585,csa159,csa159/pair_161027,CSA,c/c++,torvalds_linux,pair_161027,csa159/tasks/pair_161027
|
| 272 |
+
csa,CVE-2024-38593,csa159,csa159/pair_161598,CSA,c/c++,torvalds_linux,pair_161598,csa159/tasks/pair_161598
|
| 273 |
+
csa,CVE-2024-26583,csa159,csa159/pair_161667,CSA,c/c++,torvalds_linux,pair_161667,csa159/tasks/pair_161667
|
| 274 |
+
csa,CVE-2025-21811,csa159,csa159/pair_161782,CSA,c/c++,torvalds_linux,pair_161782,csa159/tasks/pair_161782
|
| 275 |
+
csa,CVE-2023-52843,csa159,csa159/pair_161997,CSA,c/c++,torvalds_linux,pair_161997,csa159/tasks/pair_161997
|
| 276 |
+
csa,CVE-2023-53827,csa159,csa159/pair_162003,CSA,c/c++,torvalds_linux,pair_162003,csa159/tasks/pair_162003
|
| 277 |
+
csa,CVE-2022-4095,csa159,csa159/pair_162331,CSA,c/c++,torvalds_linux,pair_162331,csa159/tasks/pair_162331
|
| 278 |
+
csa,CVE-2022-48735,csa159,csa159/pair_162535,CSA,c/c++,torvalds_linux,pair_162535,csa159/tasks/pair_162535
|
| 279 |
+
csa,CVE-2021-47032,csa159,csa159/pair_162672,CSA,c/c++,torvalds_linux,pair_162672,csa159/tasks/pair_162672
|
| 280 |
+
csa,CVE-2024-36016,csa159,csa159/pair_162700,CSA,c/c++,torvalds_linux,pair_162700,csa159/tasks/pair_162700
|
| 281 |
+
csa,CVE-2024-39509,csa159,csa159/pair_163294,CSA,c/c++,torvalds_linux,pair_163294,csa159/tasks/pair_163294
|
| 282 |
+
csa,CVE-2025-38150,csa159,csa159/pair_163698,CSA,c/c++,torvalds_linux,pair_163698,csa159/tasks/pair_163698
|
| 283 |
+
csa,CVE-2024-36484,csa159,csa159/pair_163737,CSA,c/c++,torvalds_linux,pair_163737,csa159/tasks/pair_163737
|
| 284 |
+
csa,CVE-2023-39194,csa159,csa159/pair_163761,CSA,c/c++,torvalds_linux,pair_163761,csa159/tasks/pair_163761
|
| 285 |
+
csa,CVE-2025-68337,csa159,csa159/pair_163824,CSA,c/c++,torvalds_linux,pair_163824,csa159/tasks/pair_163824
|
| 286 |
+
csa,CVE-2024-56584,csa159,csa159/pair_163861,CSA,c/c++,torvalds_linux,pair_163861,csa159/tasks/pair_163861
|
| 287 |
+
csa,CVE-2023-45863,csa159,csa159/pair_163978,CSA,c/c++,torvalds_linux,pair_163978,csa159/tasks/pair_163978
|
| 288 |
+
csa,CVE-2023-52435,csa159,csa159/pair_164140,CSA,c/c++,torvalds_linux,pair_164140,csa159/tasks/pair_164140
|
| 289 |
+
csa,CVE-2022-48893,csa159,csa159/pair_164624,CSA,c/c++,torvalds_linux,pair_164624,csa159/tasks/pair_164624
|
| 290 |
+
csa,CVE-2021-47109,csa159,csa159/pair_164920,CSA,c/c++,torvalds_linux,pair_164920,csa159/tasks/pair_164920
|
| 291 |
+
csa,CVE-2023-52623,csa159,csa159/pair_164974,CSA,c/c++,torvalds_linux,pair_164974,csa159/tasks/pair_164974
|
| 292 |
+
csa,CVE-2022-28796,csa159,csa159/pair_165542,CSA,c/c++,torvalds_linux,pair_165542,csa159/tasks/pair_165542
|
| 293 |
+
csa,CVE-2022-49580,csa159,csa159/pair_165655,CSA,c/c++,torvalds_linux,pair_165655,csa159/tasks/pair_165655
|
| 294 |
+
csa,CVE-2023-45863,csa159,csa159/pair_165738,CSA,c/c++,torvalds_linux,pair_165738,csa159/tasks/pair_165738
|
| 295 |
+
csa,CVE-2021-40572,csa159,csa159/pair_3538,CSA,c/c++,gpac_gpac,pair_3538,csa159/tasks/pair_3538
|
| 296 |
+
csa,CVE-2020-36138,csa159,csa159/pair_4701,CSA,c/c++,FFmpeg_FFmpeg,pair_4701,csa159/tasks/pair_4701
|
| 297 |
+
csa,CVE-2020-11096,csa159,csa159/pair_6060,CSA,c/c++,FreeRDP_FreeRDP,pair_6060,csa159/tasks/pair_6060
|
| 298 |
+
csa,CVE-2018-8784,csa159,csa159/pair_6105,CSA,c/c++,FreeRDP_FreeRDP,pair_6105,csa159/tasks/pair_6105
|
| 299 |
+
csa,CVE-2020-11038,csa159,csa159/pair_6132,CSA,c/c++,FreeRDP_FreeRDP,pair_6132,csa159/tasks/pair_6132
|
| 300 |
+
csa,CVE-2016-5418,csa159,csa159/pair_7278,CSA,c/c++,libarchive_libarchive,pair_7278,csa159/tasks/pair_7278
|
| 301 |
+
csa,CVE-2013-0211,csa159,csa159/pair_7287,CSA,c/c++,libarchive_libarchive,pair_7287,csa159/tasks/pair_7287
|
dataset/selected_tasks.jsonl
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"backend": "codeql", "cve_id": "CVE-2022-4741", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78", "group": "CodeQL go", "language": "go", "project_id": "morefixes__sajari__docconv", "task_id": "morefixes-02cb4e0a6c5aaabd6a78", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-02cb4e0a6c5aaabd6a78"}
|
| 2 |
+
{"backend": "codeql", "cve_id": "CVE-2025-47281", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406", "group": "CodeQL go", "language": "go", "project_id": "morefixes__kyverno__kyverno", "task_id": "morefixes-08d699b1f7c72c366406", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-08d699b1f7c72c366406"}
|
| 3 |
+
{"backend": "codeql", "cve_id": "CVE-2020-29243", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb", "group": "CodeQL go", "language": "go", "project_id": "morefixes__dhowden__tag", "task_id": "morefixes-096cbfbd1d27f9ce86fb", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-096cbfbd1d27f9ce86fb"}
|
| 4 |
+
{"backend": "codeql", "cve_id": "CVE-2023-34236", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f", "group": "CodeQL go", "language": "go", "project_id": "morefixes__weaveworks__tf-controller", "task_id": "morefixes-0adb0a489b07a50d6b2f", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-0adb0a489b07a50d6b2f"}
|
| 5 |
+
{"backend": "codeql", "cve_id": "CVE-2022-41939", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28", "group": "CodeQL go", "language": "go", "project_id": "morefixes__knative__func", "task_id": "morefixes-110ab7950a2c0b2c6f28", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-110ab7950a2c0b2c6f28"}
|
| 6 |
+
{"backend": "codeql", "cve_id": "CVE-2023-27582", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555", "group": "CodeQL go", "language": "go", "project_id": "morefixes__foxcpp__maddy", "task_id": "morefixes-1218ce956f8120d59555", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-1218ce956f8120d59555"}
|
| 7 |
+
{"backend": "codeql", "cve_id": "CVE-2024-39315", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-14446e68cdc53bc98807", "group": "CodeQL go", "language": "go", "project_id": "morefixes__pomerium__pomerium", "task_id": "morefixes-14446e68cdc53bc98807", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-14446e68cdc53bc98807"}
|
| 8 |
+
{"backend": "codeql", "cve_id": "CVE-2022-2582", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-1d20aba9f4be2de73db5", "group": "CodeQL go", "language": "go", "project_id": "morefixes__aws__aws-sdk-go", "task_id": "morefixes-1d20aba9f4be2de73db5", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-1d20aba9f4be2de73db5"}
|
| 9 |
+
{"backend": "codeql", "cve_id": "CVE-2025-66626", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-2331a664751876781460", "group": "CodeQL go", "language": "go", "project_id": "morefixes__argoproj__argo-workflows", "task_id": "morefixes-2331a664751876781460", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-2331a664751876781460"}
|
| 10 |
+
{"backend": "codeql", "cve_id": "CVE-2019-12496", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-2cc25dee5f2a118bcb26", "group": "CodeQL go", "language": "go", "project_id": "morefixes__hybridgroup__gobot", "task_id": "morefixes-2cc25dee5f2a118bcb26", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-2cc25dee5f2a118bcb26"}
|
| 11 |
+
{"backend": "codeql", "cve_id": "CVE-2026-40890", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-30e495de2402bd4bed4b", "group": "CodeQL go", "language": "go", "project_id": "morefixes__gomarkdown__markdown", "task_id": "morefixes-30e495de2402bd4bed4b", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-30e495de2402bd4bed4b"}
|
| 12 |
+
{"backend": "codeql", "cve_id": "CVE-2024-7773", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-32ed35a8bd8aba7b47ad", "group": "CodeQL go", "language": "go", "project_id": "morefixes__ollama__ollama", "task_id": "morefixes-32ed35a8bd8aba7b47ad", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-32ed35a8bd8aba7b47ad"}
|
| 13 |
+
{"backend": "codeql", "cve_id": "CVE-2023-40586", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-398ac78e3981b77e4ee2", "group": "CodeQL go", "language": "go", "project_id": "morefixes__corazawaf__coraza", "task_id": "morefixes-398ac78e3981b77e4ee2", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-398ac78e3981b77e4ee2"}
|
| 14 |
+
{"backend": "codeql", "cve_id": "CVE-2022-41920", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-461c7bace102119cf443", "group": "CodeQL go", "language": "go", "project_id": "morefixes__duke-git__lancet", "task_id": "morefixes-461c7bace102119cf443", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-461c7bace102119cf443"}
|
| 15 |
+
{"backend": "codeql", "cve_id": "CVE-2026-10722", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-50b28fbf07dd2d79022e", "group": "CodeQL go", "language": "go", "project_id": "morefixes__cilium__ebpf", "task_id": "morefixes-50b28fbf07dd2d79022e", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-50b28fbf07dd2d79022e"}
|
| 16 |
+
{"backend": "codeql", "cve_id": "CVE-2023-47105", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-5ad30634efaa1d03593c", "group": "CodeQL go", "language": "go", "project_id": "morefixes__chaosblade-io__chaosblade", "task_id": "morefixes-5ad30634efaa1d03593c", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-5ad30634efaa1d03593c"}
|
| 17 |
+
{"backend": "codeql", "cve_id": "CVE-2024-23840", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-5c2773bb1de86a62a247", "group": "CodeQL go", "language": "go", "project_id": "morefixes__goreleaser__goreleaser", "task_id": "morefixes-5c2773bb1de86a62a247", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-5c2773bb1de86a62a247"}
|
| 18 |
+
{"backend": "codeql", "cve_id": "CVE-2022-30428", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-5cfa41b8575717ecee17", "group": "CodeQL go", "language": "go", "project_id": "morefixes__gphper__ginadmin", "task_id": "morefixes-5cfa41b8575717ecee17", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-5cfa41b8575717ecee17"}
|
| 19 |
+
{"backend": "codeql", "cve_id": "CVE-2020-36568", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-6e40429ff01c5ab8b71b", "group": "CodeQL go", "language": "go", "project_id": "morefixes__revel__revel", "task_id": "morefixes-6e40429ff01c5ab8b71b", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-6e40429ff01c5ab8b71b"}
|
| 20 |
+
{"backend": "codeql", "cve_id": "CVE-2023-33965", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-7c57d35438d22210ced2", "group": "CodeQL go", "language": "go", "project_id": "morefixes__txthinking__brook", "task_id": "morefixes-7c57d35438d22210ced2", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-7c57d35438d22210ced2"}
|
| 21 |
+
{"backend": "codeql", "cve_id": "CVE-2026-8275", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-7e2af82757795db7f69a", "group": "CodeQL go", "language": "go", "project_id": "morefixes__bettercap__bettercap", "task_id": "morefixes-7e2af82757795db7f69a", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-7e2af82757795db7f69a"}
|
| 22 |
+
{"backend": "codeql", "cve_id": "CVE-2024-41270", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-9fbea0e4da10bfc882d4", "group": "CodeQL go", "language": "go", "project_id": "morefixes__appleboy__gorush", "task_id": "morefixes-9fbea0e4da10bfc882d4", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-9fbea0e4da10bfc882d4"}
|
| 23 |
+
{"backend": "codeql", "cve_id": "CVE-2023-46132", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-a469597c1a5d38baeb5d", "group": "CodeQL go", "language": "go", "project_id": "morefixes__hyperledger__fabric", "task_id": "morefixes-a469597c1a5d38baeb5d", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-a469597c1a5d38baeb5d"}
|
| 24 |
+
{"backend": "codeql", "cve_id": "CVE-2023-34105", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-a9ee7c2085f2981a7be1", "group": "CodeQL go", "language": "go", "project_id": "morefixes__ossrs__srs", "task_id": "morefixes-a9ee7c2085f2981a7be1", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-a9ee7c2085f2981a7be1"}
|
| 25 |
+
{"backend": "codeql", "cve_id": "CVE-2018-1002207", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-c254bd7b8a82b4ef45c1", "group": "CodeQL go", "language": "go", "project_id": "morefixes__mholt__archiver", "task_id": "morefixes-c254bd7b8a82b4ef45c1", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-c254bd7b8a82b4ef45c1"}
|
| 26 |
+
{"backend": "codeql", "cve_id": "CVE-2017-1000070", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-cd95b2e4d63395291cd3", "group": "CodeQL go", "language": "go", "project_id": "morefixes__bitly__oauth2_proxy", "task_id": "morefixes-cd95b2e4d63395291cd3", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-cd95b2e4d63395291cd3"}
|
| 27 |
+
{"backend": "codeql", "cve_id": "CVE-2025-67499", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-d3400ed5292d19661685", "group": "CodeQL go", "language": "go", "project_id": "morefixes__containernetworking__plugins", "task_id": "morefixes-d3400ed5292d19661685", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-d3400ed5292d19661685"}
|
| 28 |
+
{"backend": "codeql", "cve_id": "CVE-2022-21698", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-e3f3ac87786e2080b81f", "group": "CodeQL go", "language": "go", "project_id": "morefixes__prometheus__client_golang", "task_id": "morefixes-e3f3ac87786e2080b81f", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-e3f3ac87786e2080b81f"}
|
| 29 |
+
{"backend": "codeql", "cve_id": "CVE-2021-3538", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-f0d857f4ad82fae5a3a9", "group": "CodeQL go", "language": "go", "project_id": "morefixes__satori__go.uuid", "task_id": "morefixes-f0d857f4ad82fae5a3a9", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-f0d857f4ad82fae5a3a9"}
|
| 30 |
+
{"backend": "codeql", "cve_id": "CVE-2025-32445", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-fb75b5c545e3cb24f7ae", "group": "CodeQL go", "language": "go", "project_id": "morefixes__argoproj__argo-events", "task_id": "morefixes-fb75b5c545e3cb24f7ae", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-fb75b5c545e3cb24f7ae"}
|
| 31 |
+
{"backend": "codeql", "cve_id": "CVE-2023-2196", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-02f75a63a6f0b8d6c6c7", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__codedx-plugin", "task_id": "morefixes-02f75a63a6f0b8d6c6c7", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-02f75a63a6f0b8d6c6c7"}
|
| 32 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21656", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-04bdb708bf23aabdc444", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__xcode-plugin", "task_id": "morefixes-04bdb708bf23aabdc444", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-04bdb708bf23aabdc444"}
|
| 33 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21632", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-05d6240fd5a9017a44ec", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__dependency-track-plugin", "task_id": "morefixes-05d6240fd5a9017a44ec", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-05d6240fd5a9017a44ec"}
|
| 34 |
+
{"backend": "codeql", "cve_id": "CVE-2020-2132", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-0608482232bb0119b561", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__environment-manager-tools-plugin", "task_id": "morefixes-0608482232bb0119b561", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-0608482232bb0119b561"}
|
| 35 |
+
{"backend": "codeql", "cve_id": "CVE-2020-2311", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-0709c903a0f96b124bd5", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__aws-global-configuration-plugin", "task_id": "morefixes-0709c903a0f96b124bd5", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-0709c903a0f96b124bd5"}
|
| 36 |
+
{"backend": "codeql", "cve_id": "CVE-2020-14297", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-09002f4d38e9ecf8238a", "group": "CodeQL java", "language": "java", "project_id": "morefixes__wildfly__jboss-ejb-client", "task_id": "morefixes-09002f4d38e9ecf8238a", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-09002f4d38e9ecf8238a"}
|
| 37 |
+
{"backend": "codeql", "cve_id": "CVE-2020-25023", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-13b1b3610eb300ab9704", "group": "CodeQL java", "language": "java", "project_id": "morefixes__rweather__noise-java", "task_id": "morefixes-13b1b3610eb300ab9704", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-13b1b3610eb300ab9704"}
|
| 38 |
+
{"backend": "codeql", "cve_id": "CVE-2023-25141", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-149c5507d76b198944c3", "group": "CodeQL java", "language": "java", "project_id": "morefixes__apache__sling-org-apache-sling-jcr-base", "task_id": "morefixes-149c5507d76b198944c3", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-149c5507d76b198944c3"}
|
| 39 |
+
{"backend": "codeql", "cve_id": "CVE-2022-43183", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-19d7bda86b839e7fc493", "group": "CodeQL java", "language": "java", "project_id": "morefixes__xuxueli__xxl-job", "task_id": "morefixes-19d7bda86b839e7fc493", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-19d7bda86b839e7fc493"}
|
| 40 |
+
{"backend": "codeql", "cve_id": "CVE-2025-29908", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-1f67e1cf382f2e332752", "group": "CodeQL java", "language": "java", "project_id": "morefixes__netty__netty-incubator-codec-quic", "task_id": "morefixes-1f67e1cf382f2e332752", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-1f67e1cf382f2e332752"}
|
| 41 |
+
{"backend": "codeql", "cve_id": "CVE-2020-25022", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-21b89e6983680bd0068c", "group": "CodeQL java", "language": "java", "project_id": "morefixes__rweather__noise-java", "task_id": "morefixes-21b89e6983680bd0068c", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-21b89e6983680bd0068c"}
|
| 42 |
+
{"backend": "codeql", "cve_id": "CVE-2021-22573", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-23c03b1bf7a3c44f444b", "group": "CodeQL java", "language": "java", "project_id": "morefixes__googleapis__google-oauth-java-client", "task_id": "morefixes-23c03b1bf7a3c44f444b", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-23c03b1bf7a3c44f444b"}
|
| 43 |
+
{"backend": "codeql", "cve_id": "CVE-2021-39196", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-2b14860afe0d3bf8094a", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jdhwpgmbca__pcapture", "task_id": "morefixes-2b14860afe0d3bf8094a", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-2b14860afe0d3bf8094a"}
|
| 44 |
+
{"backend": "codeql", "cve_id": "CVE-2022-4641", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-35510b21cf51a9acf072", "group": "CodeQL java", "language": "java", "project_id": "morefixes__tdunning__pig-vector", "task_id": "morefixes-35510b21cf51a9acf072", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-35510b21cf51a9acf072"}
|
| 45 |
+
{"backend": "codeql", "cve_id": "CVE-2025-67030", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-378f408f498b20422fe9", "group": "CodeQL java", "language": "java", "project_id": "morefixes__codehaus-plexus__plexus-utils", "task_id": "morefixes-378f408f498b20422fe9", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-378f408f498b20422fe9"}
|
| 46 |
+
{"backend": "codeql", "cve_id": "CVE-2024-39118", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-3cc69a690ef991c8bd71", "group": "CodeQL java", "language": "java", "project_id": "morefixes__mommyheather__advancedbackups", "task_id": "morefixes-3cc69a690ef991c8bd71", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-3cc69a690ef991c8bd71"}
|
| 47 |
+
{"backend": "codeql", "cve_id": "CVE-2024-36114", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-462566b2f857f458bf20", "group": "CodeQL java", "language": "java", "project_id": "morefixes__airlift__aircompressor", "task_id": "morefixes-462566b2f857f458bf20", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-462566b2f857f458bf20"}
|
| 48 |
+
{"backend": "codeql", "cve_id": "CVE-2020-36640", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-4a0720656247f4fdd55d", "group": "CodeQL java", "language": "java", "project_id": "morefixes__bonitasoft__bonita-connector-webservice", "task_id": "morefixes-4a0720656247f4fdd55d", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-4a0720656247f4fdd55d"}
|
| 49 |
+
{"backend": "codeql", "cve_id": "CVE-2023-48299", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-623c5f3c0558ba463c5a", "group": "CodeQL java", "language": "java", "project_id": "morefixes__pytorch__serve", "task_id": "morefixes-623c5f3c0558ba463c5a", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-623c5f3c0558ba463c5a"}
|
| 50 |
+
{"backend": "codeql", "cve_id": "CVE-2024-1102", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-6c80dd14ea98e73d8b2e", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jberet__jsr352", "task_id": "morefixes-6c80dd14ea98e73d8b2e", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-6c80dd14ea98e73d8b2e"}
|
| 51 |
+
{"backend": "codeql", "cve_id": "CVE-2022-41967", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-76076416f1349da24444", "group": "CodeQL java", "language": "java", "project_id": "morefixes__hyperadev__dragonfly", "task_id": "morefixes-76076416f1349da24444", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-76076416f1349da24444"}
|
| 52 |
+
{"backend": "codeql", "cve_id": "CVE-2025-4641", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-80a186235f1faf976a71", "group": "CodeQL java", "language": "java", "project_id": "morefixes__bonigarcia__webdrivermanager", "task_id": "morefixes-80a186235f1faf976a71", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-80a186235f1faf976a71"}
|
| 53 |
+
{"backend": "codeql", "cve_id": "CVE-2020-1729", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-8641a4da2de2d0610576", "group": "CodeQL java", "language": "java", "project_id": "morefixes__smallrye__smallrye-config", "task_id": "morefixes-8641a4da2de2d0610576", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-8641a4da2de2d0610576"}
|
| 54 |
+
{"backend": "codeql", "cve_id": "CVE-2022-29631", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-8e4d1bd2b930ae852ae1", "group": "CodeQL java", "language": "java", "project_id": "morefixes__oblac__jodd-http", "task_id": "morefixes-8e4d1bd2b930ae852ae1", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-8e4d1bd2b930ae852ae1"}
|
| 55 |
+
{"backend": "codeql", "cve_id": "CVE-2020-17534", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-9db4a0f5f07f59debbce", "group": "CodeQL java", "language": "java", "project_id": "morefixes__apache__netbeans-html4j", "task_id": "morefixes-9db4a0f5f07f59debbce", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-9db4a0f5f07f59debbce"}
|
| 56 |
+
{"backend": "codeql", "cve_id": "CVE-2025-67721", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-a624a25672727b30851a", "group": "CodeQL java", "language": "java", "project_id": "morefixes__airlift__aircompressor", "task_id": "morefixes-a624a25672727b30851a", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-a624a25672727b30851a"}
|
| 57 |
+
{"backend": "codeql", "cve_id": "CVE-2022-24913", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-ab625a5d0d2a27547494", "group": "CodeQL java", "language": "java", "project_id": "morefixes__cowtowncoder__java-merge-sort", "task_id": "morefixes-ab625a5d0d2a27547494", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-ab625a5d0d2a27547494"}
|
| 58 |
+
{"backend": "codeql", "cve_id": "CVE-2024-57699", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-ac88413b62ef5803c04f", "group": "CodeQL java", "language": "java", "project_id": "morefixes__netplex__json-smart-v2", "task_id": "morefixes-ac88413b62ef5803c04f", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-ac88413b62ef5803c04f"}
|
| 59 |
+
{"backend": "codeql", "cve_id": "CVE-2025-67721", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-cf8752e9dc2f57b1d5c8", "group": "CodeQL java", "language": "java", "project_id": "morefixes__airlift__aircompressor", "task_id": "morefixes-cf8752e9dc2f57b1d5c8", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-cf8752e9dc2f57b1d5c8"}
|
| 60 |
+
{"backend": "codeql", "cve_id": "CVE-2022-4494", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-f298b6158c5168025365", "group": "CodeQL java", "language": "java", "project_id": "morefixes__bspkrs__mcpmappingviewer", "task_id": "morefixes-f298b6158c5168025365", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-f298b6158c5168025365"}
|
| 61 |
+
{"backend": "codeql", "cve_id": "CVE-2023-33194", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-040d724ca8211a3aaf1d", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__craftcms__cms", "task_id": "morefixes-040d724ca8211a3aaf1d", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-040d724ca8211a3aaf1d"}
|
| 62 |
+
{"backend": "codeql", "cve_id": "CVE-2026-25642", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-04314885419e817d3b17", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__hedgedoc__hedgedoc", "task_id": "morefixes-04314885419e817d3b17", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-04314885419e817d3b17"}
|
| 63 |
+
{"backend": "codeql", "cve_id": "CVE-2025-59526", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-08f7e6287de57ef9a5c8", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__eladnava__mailgen", "task_id": "morefixes-08f7e6287de57ef9a5c8", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-08f7e6287de57ef9a5c8"}
|
| 64 |
+
{"backend": "codeql", "cve_id": "CVE-2018-3758", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-0e82cb4ad70fc2c896ef", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__mrvautin__expresscart", "task_id": "morefixes-0e82cb4ad70fc2c896ef", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-0e82cb4ad70fc2c896ef"}
|
| 65 |
+
{"backend": "codeql", "cve_id": "CVE-2026-45787", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-0e8f49f3d1cc46668f9b", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__electerm__electerm", "task_id": "morefixes-0e8f49f3d1cc46668f9b", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-0e8f49f3d1cc46668f9b"}
|
| 66 |
+
{"backend": "codeql", "cve_id": "CVE-2021-3801", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-0ea8f5f13e7432539721", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__prismjs__prism", "task_id": "morefixes-0ea8f5f13e7432539721", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-0ea8f5f13e7432539721"}
|
| 67 |
+
{"backend": "codeql", "cve_id": "CVE-2025-49590", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-0f4271d4851600835c47", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__cryptpad__cryptpad", "task_id": "morefixes-0f4271d4851600835c47", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-0f4271d4851600835c47"}
|
| 68 |
+
{"backend": "codeql", "cve_id": "CVE-2024-25981", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-135296414af3a0faf089", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__moodle__moodle", "task_id": "morefixes-135296414af3a0faf089", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-135296414af3a0faf089"}
|
| 69 |
+
{"backend": "codeql", "cve_id": "CVE-2014-5273", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-16768fdfa00c963539dc", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__phpmyadmin__phpmyadmin", "task_id": "morefixes-16768fdfa00c963539dc", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-16768fdfa00c963539dc"}
|
| 70 |
+
{"backend": "codeql", "cve_id": "CVE-2024-40761", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-17d21311a4f5af9bbc4f", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__apache__incubator-answer", "task_id": "morefixes-17d21311a4f5af9bbc4f", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-17d21311a4f5af9bbc4f"}
|
| 71 |
+
{"backend": "codeql", "cve_id": "CVE-2025-46344", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-1cf55be2336b09a515a6", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__auth0__nextjs-auth0", "task_id": "morefixes-1cf55be2336b09a515a6", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-1cf55be2336b09a515a6"}
|
| 72 |
+
{"backend": "codeql", "cve_id": "CVE-2026-22819", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-312479357bdfa998bf6e", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__outray-tunnel__outray", "task_id": "morefixes-312479357bdfa998bf6e", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-312479357bdfa998bf6e"}
|
| 73 |
+
{"backend": "codeql", "cve_id": "CVE-2025-10044", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-374e3093d6d5875aa960", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__keycloak__keycloak", "task_id": "morefixes-374e3093d6d5875aa960", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-374e3093d6d5875aa960"}
|
| 74 |
+
{"backend": "codeql", "cve_id": "CVE-2021-4124", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-4b95de19a5da1e74a747", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__meetecho__janus-gateway", "task_id": "morefixes-4b95de19a5da1e74a747", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-4b95de19a5da1e74a747"}
|
| 75 |
+
{"backend": "codeql", "cve_id": "CVE-2021-25990", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-4ffaae63e8f8c0012a0f", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__ifmeorg__ifme", "task_id": "morefixes-4ffaae63e8f8c0012a0f", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-4ffaae63e8f8c0012a0f"}
|
| 76 |
+
{"backend": "codeql", "cve_id": "CVE-2023-47635", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-516c6c53716bba29b7f0", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__decidim__decidim", "task_id": "morefixes-516c6c53716bba29b7f0", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-516c6c53716bba29b7f0"}
|
| 77 |
+
{"backend": "codeql", "cve_id": "CVE-2010-2273", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-550b9b77dc4d0c01e1fe", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__dojo__dojo", "task_id": "morefixes-550b9b77dc4d0c01e1fe", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-550b9b77dc4d0c01e1fe"}
|
| 78 |
+
{"backend": "codeql", "cve_id": "CVE-2024-22411", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-58be9c1811ee7367cce5", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__avo-hq__avo", "task_id": "morefixes-58be9c1811ee7367cce5", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-58be9c1811ee7367cce5"}
|
| 79 |
+
{"backend": "codeql", "cve_id": "CVE-2020-11611", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-60205e347d7f83ebc999", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__ofirdagan__cross-domain-local-storage", "task_id": "morefixes-60205e347d7f83ebc999", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-60205e347d7f83ebc999"}
|
| 80 |
+
{"backend": "codeql", "cve_id": "CVE-2017-1000189", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-633246d79fea5271cdce", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__mde__ejs", "task_id": "morefixes-633246d79fea5271cdce", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-633246d79fea5271cdce"}
|
| 81 |
+
{"backend": "codeql", "cve_id": "CVE-2018-11798", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-88a92b26b3a23d01f412", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__apache__thrift", "task_id": "morefixes-88a92b26b3a23d01f412", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-88a92b26b3a23d01f412"}
|
| 82 |
+
{"backend": "codeql", "cve_id": "CVE-2024-28176", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-941abf85c9b7d820de47", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__panva__jose", "task_id": "morefixes-941abf85c9b7d820de47", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-941abf85c9b7d820de47"}
|
| 83 |
+
{"backend": "codeql", "cve_id": "CVE-2026-39941", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-99aea6539029d3ab985e", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__churchcrm__crm", "task_id": "morefixes-99aea6539029d3ab985e", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-99aea6539029d3ab985e"}
|
| 84 |
+
{"backend": "codeql", "cve_id": "CVE-2024-45312", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-9f8a2d1b597df98c6680", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__overleaf__overleaf", "task_id": "morefixes-9f8a2d1b597df98c6680", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-9f8a2d1b597df98c6680"}
|
| 85 |
+
{"backend": "codeql", "cve_id": "CVE-2025-11222", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-b475f3a535ea41bec3ff", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__line__centraldogma", "task_id": "morefixes-b475f3a535ea41bec3ff", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-b475f3a535ea41bec3ff"}
|
| 86 |
+
{"backend": "codeql", "cve_id": "CVE-2026-10269", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-b61b3848e076036c7b06", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__decolua__9router", "task_id": "morefixes-b61b3848e076036c7b06", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-b61b3848e076036c7b06"}
|
| 87 |
+
{"backend": "codeql", "cve_id": "CVE-2022-39267", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-bd56f8e5b73f132cd962", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__brokercap__bifrost", "task_id": "morefixes-bd56f8e5b73f132cd962", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-bd56f8e5b73f132cd962"}
|
| 88 |
+
{"backend": "codeql", "cve_id": "CVE-2020-7729", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-bd86b40955cabdb21c65", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__gruntjs__grunt", "task_id": "morefixes-bd86b40955cabdb21c65", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-bd86b40955cabdb21c65"}
|
| 89 |
+
{"backend": "codeql", "cve_id": "CVE-2023-37259", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-f1044573e0d15a82a1d0", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__matrix-org__matrix-react-sdk", "task_id": "morefixes-f1044573e0d15a82a1d0", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-f1044573e0d15a82a1d0"}
|
| 90 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21679", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-f37103ca8d19c93116f8", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__jenkinsci__azure-ad-plugin", "task_id": "morefixes-f37103ca8d19c93116f8", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-f37103ca8d19c93116f8"}
|
| 91 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21371", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-03252773bde39ba37465", "group": "CodeQL python", "language": "python", "project_id": "pyvul__tenable__integration-jira-cloud", "task_id": "pyvul-03252773bde39ba37465", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-03252773bde39ba37465"}
|
| 92 |
+
{"backend": "codeql", "cve_id": "CVE-2023-6977", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-07332271886167133edf", "group": "CodeQL python", "language": "python", "project_id": "pyvul__mlflow__mlflow", "task_id": "pyvul-07332271886167133edf", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-07332271886167133edf"}
|
| 93 |
+
{"backend": "codeql", "cve_id": "CVE-2020-12889", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-0e38a9079f90a5ac566e", "group": "CodeQL python", "language": "python", "project_id": "pyvul__misp__misp-maltego", "task_id": "pyvul-0e38a9079f90a5ac566e", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-0e38a9079f90a5ac566e"}
|
| 94 |
+
{"backend": "codeql", "cve_id": "CVE-2023-30629", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-10fb77265dc23f305315", "group": "CodeQL python", "language": "python", "project_id": "pyvul__vyperlang__vyper", "task_id": "pyvul-10fb77265dc23f305315", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-10fb77265dc23f305315"}
|
| 95 |
+
{"backend": "codeql", "cve_id": "CVE-2019-3830", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-135c7fcada946877931a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__openstack__ceilometer", "task_id": "pyvul-135c7fcada946877931a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-135c7fcada946877931a"}
|
| 96 |
+
{"backend": "codeql", "cve_id": "CVE-2020-10799", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-15c0ad3037992bda1b19", "group": "CodeQL python", "language": "python", "project_id": "pyvul__deeplook__svglib", "task_id": "pyvul-15c0ad3037992bda1b19", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-15c0ad3037992bda1b19"}
|
| 97 |
+
{"backend": "codeql", "cve_id": "CVE-2022-0736", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-1a630dd8f83b2e29740d", "group": "CodeQL python", "language": "python", "project_id": "pyvul__mlflow__mlflow", "task_id": "pyvul-1a630dd8f83b2e29740d", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-1a630dd8f83b2e29740d"}
|
| 98 |
+
{"backend": "codeql", "cve_id": "CVE-2022-42965", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-1f5068a3fe5ca0192a07", "group": "CodeQL python", "language": "python", "project_id": "pyvul__snowflakedb__snowflake-connector-python", "task_id": "pyvul-1f5068a3fe5ca0192a07", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-1f5068a3fe5ca0192a07"}
|
| 99 |
+
{"backend": "codeql", "cve_id": "CVE-2021-46898", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-2ab65d62986b80922362", "group": "CodeQL python", "language": "python", "project_id": "pyvul__sehmaschine__django-grappelli", "task_id": "pyvul-2ab65d62986b80922362", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-2ab65d62986b80922362"}
|
| 100 |
+
{"backend": "codeql", "cve_id": "CVE-2023-48224", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-3062589ff0b3b95c2ed7", "group": "CodeQL python", "language": "python", "project_id": "pyvul__ethyca__fides", "task_id": "pyvul-3062589ff0b3b95c2ed7", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-3062589ff0b3b95c2ed7"}
|
| 101 |
+
{"backend": "codeql", "cve_id": "CVE-2020-19001", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-3187445bcbbf39128a26", "group": "CodeQL python", "language": "python", "project_id": "pyvul__tankywoo__simiki", "task_id": "pyvul-3187445bcbbf39128a26", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-3187445bcbbf39128a26"}
|
| 102 |
+
{"backend": "codeql", "cve_id": "CVE-2022-0845", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-36a40541d7c74a9a7777", "group": "CodeQL python", "language": "python", "project_id": "pyvul__pytorchlightning__pytorch-lightning", "task_id": "pyvul-36a40541d7c74a9a7777", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-36a40541d7c74a9a7777"}
|
| 103 |
+
{"backend": "codeql", "cve_id": "CVE-2023-6395", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-3819b1a7530257524a75", "group": "CodeQL python", "language": "python", "project_id": "pyvul__xsuchy__templated-dictionary", "task_id": "pyvul-3819b1a7530257524a75", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-3819b1a7530257524a75"}
|
| 104 |
+
{"backend": "codeql", "cve_id": "CVE-2020-29128", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-394adf7b067d96b356ca", "group": "CodeQL python", "language": "python", "project_id": "pyvul__petl-developers__petl", "task_id": "pyvul-394adf7b067d96b356ca", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-394adf7b067d96b356ca"}
|
| 105 |
+
{"backend": "codeql", "cve_id": "CVE-2021-41127", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-3994e3622b21c396ef8a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__rasahq__rasa", "task_id": "pyvul-3994e3622b21c396ef8a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-3994e3622b21c396ef8a"}
|
| 106 |
+
{"backend": "codeql", "cve_id": "CVE-2014-1932", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-4954e5890cce23c8b03d", "group": "CodeQL python", "language": "python", "project_id": "pyvul__python-imaging__pillow", "task_id": "pyvul-4954e5890cce23c8b03d", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-4954e5890cce23c8b03d"}
|
| 107 |
+
{"backend": "codeql", "cve_id": "CVE-2023-48700", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-4ac3440b9023e6511a91", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nautobot__nautobot-plugin-device-onboarding", "task_id": "pyvul-4ac3440b9023e6511a91", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-4ac3440b9023e6511a91"}
|
| 108 |
+
{"backend": "codeql", "cve_id": "CVE-2021-4315", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-4e31b8fba29687b8d792", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nyuccl__psiturk", "task_id": "pyvul-4e31b8fba29687b8d792", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-4e31b8fba29687b8d792"}
|
| 109 |
+
{"backend": "codeql", "cve_id": "CVE-2021-32839", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-509b1de3e2277ac89469", "group": "CodeQL python", "language": "python", "project_id": "pyvul__andialbrecht__sqlparse", "task_id": "pyvul-509b1de3e2277ac89469", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-509b1de3e2277ac89469"}
|
| 110 |
+
{"backend": "codeql", "cve_id": "CVE-2022-23530", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-533cc1a8c090c7529184", "group": "CodeQL python", "language": "python", "project_id": "pyvul__datadog__guarddog", "task_id": "pyvul-533cc1a8c090c7529184", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-533cc1a8c090c7529184"}
|
| 111 |
+
{"backend": "codeql", "cve_id": "CVE-2023-34540", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-5cffd45f7550a060e2cf", "group": "CodeQL python", "language": "python", "project_id": "pyvul__langchain-ai__langchain", "task_id": "pyvul-5cffd45f7550a060e2cf", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-5cffd45f7550a060e2cf"}
|
| 112 |
+
{"backend": "codeql", "cve_id": "CVE-2022-0315", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-6b5cf1b92b87b04c09cd", "group": "CodeQL python", "language": "python", "project_id": "pyvul__horovod__horovod", "task_id": "pyvul-6b5cf1b92b87b04c09cd", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-6b5cf1b92b87b04c09cd"}
|
| 113 |
+
{"backend": "codeql", "cve_id": "CVE-2021-23393", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-796a152aa965ce44a6db", "group": "CodeQL python", "language": "python", "project_id": "pyvul__briancappello__flask-unchained", "task_id": "pyvul-796a152aa965ce44a6db", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-796a152aa965ce44a6db"}
|
| 114 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21274", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-7c3c693e688548564c9a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__matrix-org__synapse", "task_id": "pyvul-7c3c693e688548564c9a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-7c3c693e688548564c9a"}
|
| 115 |
+
{"backend": "codeql", "cve_id": "CVE-2017-16616", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-7c7eaf17f0df49603ae4", "group": "CodeQL python", "language": "python", "project_id": "pyvul__stranger6667__pyanyapi", "task_id": "pyvul-7c7eaf17f0df49603ae4", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-7c7eaf17f0df49603ae4"}
|
| 116 |
+
{"backend": "codeql", "cve_id": "CVE-2018-25082", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-810ace2bf3e4aa0f04a1", "group": "CodeQL python", "language": "python", "project_id": "pyvul__zwczou__weixin-python", "task_id": "pyvul-810ace2bf3e4aa0f04a1", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-810ace2bf3e4aa0f04a1"}
|
| 117 |
+
{"backend": "codeql", "cve_id": "CVE-2022-31605", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-812f35b535c5e549929b", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nvidia__nvflare", "task_id": "pyvul-812f35b535c5e549929b", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-812f35b535c5e549929b"}
|
| 118 |
+
{"backend": "codeql", "cve_id": "CVE-2013-4260", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-8297e406660c92268ba5", "group": "CodeQL python", "language": "python", "project_id": "pyvul__ansible__ansible", "task_id": "pyvul-8297e406660c92268ba5", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-8297e406660c92268ba5"}
|
| 119 |
+
{"backend": "codeql", "cve_id": "CVE-2022-36082", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-89a9ff0f9cf4f2f4cc91", "group": "CodeQL python", "language": "python", "project_id": "pyvul__mansuf__mangadex-downloader", "task_id": "pyvul-89a9ff0f9cf4f2f4cc91", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-89a9ff0f9cf4f2f4cc91"}
|
| 120 |
+
{"backend": "codeql", "cve_id": "CVE-2020-15239", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-8e39d07d2ff863a3f19e", "group": "CodeQL python", "language": "python", "project_id": "pyvul__horazont__xmpp-http-upload", "task_id": "pyvul-8e39d07d2ff863a3f19e", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-8e39d07d2ff863a3f19e"}
|
| 121 |
+
{"backend": "codeql", "cve_id": "CVE-2023-29159", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-8f3613497f18d5cf2684", "group": "CodeQL python", "language": "python", "project_id": "pyvul__encode__starlette", "task_id": "pyvul-8f3613497f18d5cf2684", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-8f3613497f18d5cf2684"}
|
| 122 |
+
{"backend": "codeql", "cve_id": "CVE-2019-11340", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-98fc634e79976d5b5241", "group": "CodeQL python", "language": "python", "project_id": "pyvul__matrix-org__sydent", "task_id": "pyvul-98fc634e79976d5b5241", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-98fc634e79976d5b5241"}
|
| 123 |
+
{"backend": "codeql", "cve_id": "CVE-2019-14806", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-9ba7c665889bf20611cb", "group": "CodeQL python", "language": "python", "project_id": "pyvul__pallets__werkzeug", "task_id": "pyvul-9ba7c665889bf20611cb", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-9ba7c665889bf20611cb"}
|
| 124 |
+
{"backend": "codeql", "cve_id": "CVE-2023-49277", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-9c089aba2c203455d420", "group": "CodeQL python", "language": "python", "project_id": "pyvul__darrenofficial__dpaste", "task_id": "pyvul-9c089aba2c203455d420", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-9c089aba2c203455d420"}
|
| 125 |
+
{"backend": "codeql", "cve_id": "CVE-2020-15120", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-9dcb85347ac437354c6f", "group": "CodeQL python", "language": "python", "project_id": "pyvul__spiral-project__ihatemoney", "task_id": "pyvul-9dcb85347ac437354c6f", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-9dcb85347ac437354c6f"}
|
| 126 |
+
{"backend": "codeql", "cve_id": "CVE-2022-3301", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-a2d122cb9e3a61ddca7a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__ikus060__rdiffweb", "task_id": "pyvul-a2d122cb9e3a61ddca7a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-a2d122cb9e3a61ddca7a"}
|
| 127 |
+
{"backend": "codeql", "cve_id": "CVE-2020-35653", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-a44d900bae2c75f9ea8d", "group": "CodeQL python", "language": "python", "project_id": "pyvul__python-pillow__pillow", "task_id": "pyvul-a44d900bae2c75f9ea8d", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-a44d900bae2c75f9ea8d"}
|
| 128 |
+
{"backend": "codeql", "cve_id": "CVE-2021-34363", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nvbn__thefuck", "task_id": "pyvul-b10e0389c54d164db5b4", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-b10e0389c54d164db5b4"}
|
| 129 |
+
{"backend": "codeql", "cve_id": "CVE-2014-1938", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-b5417e7c5b6909a4c5f9", "group": "CodeQL python", "language": "python", "project_id": "pyvul__alex__rply", "task_id": "pyvul-b5417e7c5b6909a4c5f9", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-b5417e7c5b6909a4c5f9"}
|
| 130 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21360", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-bae2a9b05bba64edb040", "group": "CodeQL python", "language": "python", "project_id": "pyvul__zopefoundation__products.genericsetup", "task_id": "pyvul-bae2a9b05bba64edb040", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-bae2a9b05bba64edb040"}
|
| 131 |
+
{"backend": "codeql", "cve_id": "CVE-2022-24302", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-bf4aded7c76d99f9ef84", "group": "CodeQL python", "language": "python", "project_id": "pyvul__paramiko__paramiko", "task_id": "pyvul-bf4aded7c76d99f9ef84", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-bf4aded7c76d99f9ef84"}
|
| 132 |
+
{"backend": "codeql", "cve_id": "CVE-2021-43854", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-c4ca067f7fd871d25376", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nltk__nltk", "task_id": "pyvul-c4ca067f7fd871d25376", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-c4ca067f7fd871d25376"}
|
| 133 |
+
{"backend": "codeql", "cve_id": "CVE-2023-2800", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-c52f0447bb0aa65cf9a4", "group": "CodeQL python", "language": "python", "project_id": "pyvul__huggingface__transformers", "task_id": "pyvul-c52f0447bb0aa65cf9a4", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-c52f0447bb0aa65cf9a4"}
|
| 134 |
+
{"backend": "codeql", "cve_id": "CVE-2022-4724", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-cb3f3f84ff4550031205", "group": "CodeQL python", "language": "python", "project_id": "pyvul__ikus060__rdiffweb", "task_id": "pyvul-cb3f3f84ff4550031205", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-cb3f3f84ff4550031205"}
|
| 135 |
+
{"backend": "codeql", "cve_id": "CVE-2023-49080", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-d005a7cf5935ac7e7aae", "group": "CodeQL python", "language": "python", "project_id": "pyvul__jupyter-server__jupyter_server", "task_id": "pyvul-d005a7cf5935ac7e7aae", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-d005a7cf5935ac7e7aae"}
|
| 136 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21386", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-d38a3c1956e86350a0c7", "group": "CodeQL python", "language": "python", "project_id": "pyvul__dwisiswant0__apkleaks", "task_id": "pyvul-d38a3c1956e86350a0c7", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-d38a3c1956e86350a0c7"}
|
| 137 |
+
{"backend": "codeql", "cve_id": "CVE-2023-5002", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-dbcc9a178b256c49887e", "group": "CodeQL python", "language": "python", "project_id": "pyvul__pgadmin-org__pgadmin4", "task_id": "pyvul-dbcc9a178b256c49887e", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-dbcc9a178b256c49887e"}
|
| 138 |
+
{"backend": "codeql", "cve_id": "CVE-2023-38201", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-e305522c703de57f9ede", "group": "CodeQL python", "language": "python", "project_id": "pyvul__keylime__keylime", "task_id": "pyvul-e305522c703de57f9ede", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-e305522c703de57f9ede"}
|
| 139 |
+
{"backend": "codeql", "cve_id": "CVE-2023-45139", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-e73df8c8998a1ddc180a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__fonttools__fonttools", "task_id": "pyvul-e73df8c8998a1ddc180a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-e73df8c8998a1ddc180a"}
|
| 140 |
+
{"backend": "codeql", "cve_id": "CVE-2021-39229", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-f55f7c013a9f5bd1eb0d", "group": "CodeQL python", "language": "python", "project_id": "pyvul__caronc__apprise", "task_id": "pyvul-f55f7c013a9f5bd1eb0d", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-f55f7c013a9f5bd1eb0d"}
|
| 141 |
+
{"backend": "codeql", "cve_id": "CVE-2023-45813", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-ff1e02f88768f34e43fb", "group": "CodeQL python", "language": "python", "project_id": "pyvul__dedsecinside__torbot", "task_id": "pyvul-ff1e02f88768f34e43fb", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-ff1e02f88768f34e43fb"}
|
| 142 |
+
{"backend": "csa", "cve_id": "CVE-2014-0749", "dataset": "csa159", "environment_id": "csa159/pair_134585", "group": "CSA", "language": "c/c++", "project_id": "adaptivecomputing_torque", "task_id": "pair_134585", "task_path": "csa159/tasks/pair_134585"}
|
| 143 |
+
{"backend": "csa", "cve_id": "CVE-2017-8911", "dataset": "csa159", "environment_id": "csa159/pair_135745", "group": "CSA", "language": "c/c++", "project_id": "verdammelt_tnef", "task_id": "pair_135745", "task_path": "csa159/tasks/pair_135745"}
|
| 144 |
+
{"backend": "csa", "cve_id": "CVE-2014-8127", "dataset": "csa159", "environment_id": "csa159/pair_136342", "group": "CSA", "language": "c/c++", "project_id": "vadz_libtiff", "task_id": "pair_136342", "task_path": "csa159/tasks/pair_136342"}
|
| 145 |
+
{"backend": "csa", "cve_id": "CVE-2019-9893", "dataset": "csa159", "environment_id": "csa159/pair_137674", "group": "CSA", "language": "c/c++", "project_id": "seccomp_libseccomp", "task_id": "pair_137674", "task_path": "csa159/tasks/pair_137674"}
|
| 146 |
+
{"backend": "csa", "cve_id": "CVE-2014-5388", "dataset": "csa159", "environment_id": "csa159/pair_137782", "group": "CSA", "language": "c/c++", "project_id": "qemu_qemu", "task_id": "pair_137782", "task_path": "csa159/tasks/pair_137782"}
|
| 147 |
+
{"backend": "csa", "cve_id": "CVE-2026-9501", "dataset": "csa159", "environment_id": "csa159/pair_138263", "group": "CSA", "language": "c/c++", "project_id": "LibreDWG_libredwg", "task_id": "pair_138263", "task_path": "csa159/tasks/pair_138263"}
|
| 148 |
+
{"backend": "csa", "cve_id": "CVE-2019-20022", "dataset": "csa159", "environment_id": "csa159/pair_138473", "group": "CSA", "language": "c/c++", "project_id": "saitoha_libsixel", "task_id": "pair_138473", "task_path": "csa159/tasks/pair_138473"}
|
| 149 |
+
{"backend": "csa", "cve_id": "CVE-2026-33165", "dataset": "csa159", "environment_id": "csa159/pair_138511", "group": "CSA", "language": "c/c++", "project_id": "strukturag_libde265", "task_id": "pair_138511", "task_path": "csa159/tasks/pair_138511"}
|
| 150 |
+
{"backend": "csa", "cve_id": "CVE-2025-48367", "dataset": "csa159", "environment_id": "csa159/pair_138570", "group": "CSA", "language": "c/c++", "project_id": "redis_redis", "task_id": "pair_138570", "task_path": "csa159/tasks/pair_138570"}
|
| 151 |
+
{"backend": "csa", "cve_id": "CVE-2024-25269", "dataset": "csa159", "environment_id": "csa159/pair_138644", "group": "CSA", "language": "c/c++", "project_id": "strukturag_libheif", "task_id": "pair_138644", "task_path": "csa159/tasks/pair_138644"}
|
| 152 |
+
{"backend": "csa", "cve_id": "CVE-2025-62171", "dataset": "csa159", "environment_id": "csa159/pair_138710", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick", "task_id": "pair_138710", "task_path": "csa159/tasks/pair_138710"}
|
| 153 |
+
{"backend": "csa", "cve_id": "CVE-2022-48923", "dataset": "csa159", "environment_id": "csa159/pair_139922", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_139922", "task_path": "csa159/tasks/pair_139922"}
|
| 154 |
+
{"backend": "csa", "cve_id": "CVE-2022-49375", "dataset": "csa159", "environment_id": "csa159/pair_140347", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_140347", "task_path": "csa159/tasks/pair_140347"}
|
| 155 |
+
{"backend": "csa", "cve_id": "CVE-2022-50419", "dataset": "csa159", "environment_id": "csa159/pair_141329", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141329", "task_path": "csa159/tasks/pair_141329"}
|
| 156 |
+
{"backend": "csa", "cve_id": "CVE-2023-53148", "dataset": "csa159", "environment_id": "csa159/pair_142288", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_142288", "task_path": "csa159/tasks/pair_142288"}
|
| 157 |
+
{"backend": "csa", "cve_id": "CVE-2023-53532", "dataset": "csa159", "environment_id": "csa159/pair_142647", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_142647", "task_path": "csa159/tasks/pair_142647"}
|
| 158 |
+
{"backend": "csa", "cve_id": "CVE-2025-38226", "dataset": "csa159", "environment_id": "csa159/pair_147034", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147034", "task_path": "csa159/tasks/pair_147034"}
|
| 159 |
+
{"backend": "csa", "cve_id": "CVE-2025-39773", "dataset": "csa159", "environment_id": "csa159/pair_147640", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147640", "task_path": "csa159/tasks/pair_147640"}
|
| 160 |
+
{"backend": "csa", "cve_id": "CVE-2025-39810", "dataset": "csa159", "environment_id": "csa159/pair_147676", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147676", "task_path": "csa159/tasks/pair_147676"}
|
| 161 |
+
{"backend": "csa", "cve_id": "CVE-2025-71146", "dataset": "csa159", "environment_id": "csa159/pair_148601", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_148601", "task_path": "csa159/tasks/pair_148601"}
|
| 162 |
+
{"backend": "csa", "cve_id": "CVE-2026-23111", "dataset": "csa159", "environment_id": "csa159/pair_148834", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_148834", "task_path": "csa159/tasks/pair_148834"}
|
| 163 |
+
{"backend": "csa", "cve_id": "CVE-2026-31747", "dataset": "csa159", "environment_id": "csa159/pair_149548", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149548", "task_path": "csa159/tasks/pair_149548"}
|
| 164 |
+
{"backend": "csa", "cve_id": "CVE-2026-43054", "dataset": "csa159", "environment_id": "csa159/pair_149640", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149640", "task_path": "csa159/tasks/pair_149640"}
|
| 165 |
+
{"backend": "csa", "cve_id": "CVE-2026-43166", "dataset": "csa159", "environment_id": "csa159/pair_149751", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149751", "task_path": "csa159/tasks/pair_149751"}
|
| 166 |
+
{"backend": "csa", "cve_id": "CVE-2026-43185", "dataset": "csa159", "environment_id": "csa159/pair_149770", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149770", "task_path": "csa159/tasks/pair_149770"}
|
| 167 |
+
{"backend": "csa", "cve_id": "CVE-2026-45863", "dataset": "csa159", "environment_id": "csa159/pair_150111", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150111", "task_path": "csa159/tasks/pair_150111"}
|
| 168 |
+
{"backend": "csa", "cve_id": "CVE-2026-46001", "dataset": "csa159", "environment_id": "csa159/pair_150247", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150247", "task_path": "csa159/tasks/pair_150247"}
|
| 169 |
+
{"backend": "csa", "cve_id": "CVE-2026-46180", "dataset": "csa159", "environment_id": "csa159/pair_150426", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150426", "task_path": "csa159/tasks/pair_150426"}
|
| 170 |
+
{"backend": "csa", "cve_id": "CVE-2022-48730", "dataset": "csa159", "environment_id": "csa159/pair_156745", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156745", "task_path": "csa159/tasks/pair_156745"}
|
| 171 |
+
{"backend": "csa", "cve_id": "CVE-2021-42252", "dataset": "csa159", "environment_id": "csa159/pair_157090", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_157090", "task_path": "csa159/tasks/pair_157090"}
|
| 172 |
+
{"backend": "csa", "cve_id": "CVE-2022-50010", "dataset": "csa159", "environment_id": "csa159/pair_157305", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_157305", "task_path": "csa159/tasks/pair_157305"}
|
| 173 |
+
{"backend": "csa", "cve_id": "CVE-2025-38692", "dataset": "csa159", "environment_id": "csa159/pair_157307", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_157307", "task_path": "csa159/tasks/pair_157307"}
|
| 174 |
+
{"backend": "csa", "cve_id": "CVE-2022-48634", "dataset": "csa159", "environment_id": "csa159/pair_158826", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158826", "task_path": "csa159/tasks/pair_158826"}
|
| 175 |
+
{"backend": "csa", "cve_id": "CVE-2021-47437", "dataset": "csa159", "environment_id": "csa159/pair_159680", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_159680", "task_path": "csa159/tasks/pair_159680"}
|
| 176 |
+
{"backend": "csa", "cve_id": "CVE-2024-26811", "dataset": "csa159", "environment_id": "csa159/pair_161551", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161551", "task_path": "csa159/tasks/pair_161551"}
|
| 177 |
+
{"backend": "csa", "cve_id": "CVE-2026-23299", "dataset": "csa159", "environment_id": "csa159/pair_161587", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161587", "task_path": "csa159/tasks/pair_161587"}
|
| 178 |
+
{"backend": "csa", "cve_id": "CVE-2020-28374", "dataset": "csa159", "environment_id": "csa159/pair_162518", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162518", "task_path": "csa159/tasks/pair_162518"}
|
| 179 |
+
{"backend": "csa", "cve_id": "CVE-2024-26954", "dataset": "csa159", "environment_id": "csa159/pair_162526", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162526", "task_path": "csa159/tasks/pair_162526"}
|
| 180 |
+
{"backend": "csa", "cve_id": "CVE-2023-53166", "dataset": "csa159", "environment_id": "csa159/pair_162993", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162993", "task_path": "csa159/tasks/pair_162993"}
|
| 181 |
+
{"backend": "csa", "cve_id": "CVE-2022-49639", "dataset": "csa159", "environment_id": "csa159/pair_163682", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163682", "task_path": "csa159/tasks/pair_163682"}
|
| 182 |
+
{"backend": "csa", "cve_id": "CVE-2024-38384", "dataset": "csa159", "environment_id": "csa159/pair_164279", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164279", "task_path": "csa159/tasks/pair_164279"}
|
| 183 |
+
{"backend": "csa", "cve_id": "CVE-2025-21719", "dataset": "csa159", "environment_id": "csa159/pair_164760", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164760", "task_path": "csa159/tasks/pair_164760"}
|
| 184 |
+
{"backend": "csa", "cve_id": "CVE-2025-37780", "dataset": "csa159", "environment_id": "csa159/pair_165550", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_165550", "task_path": "csa159/tasks/pair_165550"}
|
| 185 |
+
{"backend": "csa", "cve_id": "CVE-2019-11338", "dataset": "csa159", "environment_id": "csa159/pair_17613", "group": "CSA", "language": "c/c++", "project_id": "FFmpeg_FFmpeg", "task_id": "pair_17613", "task_path": "csa159/tasks/pair_17613"}
|
| 186 |
+
{"backend": "csa", "cve_id": "CVE-2023-39562", "dataset": "csa159", "environment_id": "csa159/pair_4253", "group": "CSA", "language": "c/c++", "project_id": "gpac_gpac", "task_id": "pair_4253", "task_path": "csa159/tasks/pair_4253"}
|
| 187 |
+
{"backend": "csa", "cve_id": "CVE-2017-7866", "dataset": "csa159", "environment_id": "csa159/pair_4869", "group": "CSA", "language": "c/c++", "project_id": "FFmpeg_FFmpeg", "task_id": "pair_4869", "task_path": "csa159/tasks/pair_4869"}
|
| 188 |
+
{"backend": "csa", "cve_id": "CVE-2020-9365", "dataset": "csa159", "environment_id": "csa159/pair_134943", "group": "CSA", "language": "c/c++", "project_id": "jedisct1_pure-ftpd", "task_id": "pair_134943", "task_path": "csa159/tasks/pair_134943"}
|
| 189 |
+
{"backend": "csa", "cve_id": "CVE-2016-5824", "dataset": "csa159", "environment_id": "csa159/pair_135175", "group": "CSA", "language": "c/c++", "project_id": "libical_libical", "task_id": "pair_135175", "task_path": "csa159/tasks/pair_135175"}
|
| 190 |
+
{"backend": "csa", "cve_id": "CVE-2020-26148", "dataset": "csa159", "environment_id": "csa159/pair_135384", "group": "CSA", "language": "c/c++", "project_id": "mity_md4c", "task_id": "pair_135384", "task_path": "csa159/tasks/pair_135384"}
|
| 191 |
+
{"backend": "csa", "cve_id": "CVE-2018-1000091", "dataset": "csa159", "environment_id": "csa159/pair_135405", "group": "CSA", "language": "c/c++", "project_id": "mwarning_KadNode", "task_id": "pair_135405", "task_path": "csa159/tasks/pair_135405"}
|
| 192 |
+
{"backend": "csa", "cve_id": "CVE-2021-33930", "dataset": "csa159", "environment_id": "csa159/pair_135446", "group": "CSA", "language": "c/c++", "project_id": "openSUSE_libsolv", "task_id": "pair_135446", "task_path": "csa159/tasks/pair_135446"}
|
| 193 |
+
{"backend": "csa", "cve_id": "CVE-2018-19826", "dataset": "csa159", "environment_id": "csa159/pair_135624", "group": "CSA", "language": "c/c++", "project_id": "sass_libsass", "task_id": "pair_135624", "task_path": "csa159/tasks/pair_135624"}
|
| 194 |
+
{"backend": "csa", "cve_id": "CVE-2017-6309", "dataset": "csa159", "environment_id": "csa159/pair_135749", "group": "CSA", "language": "c/c++", "project_id": "verdammelt_tnef", "task_id": "pair_135749", "task_path": "csa159/tasks/pair_135749"}
|
| 195 |
+
{"backend": "csa", "cve_id": "CVE-2020-11764", "dataset": "csa159", "environment_id": "csa159/pair_136251", "group": "CSA", "language": "c/c++", "project_id": "openexr_openexr", "task_id": "pair_136251", "task_path": "csa159/tasks/pair_136251"}
|
| 196 |
+
{"backend": "csa", "cve_id": "CVE-2020-11764", "dataset": "csa159", "environment_id": "csa159/pair_136252", "group": "CSA", "language": "c/c++", "project_id": "openexr_openexr", "task_id": "pair_136252", "task_path": "csa159/tasks/pair_136252"}
|
| 197 |
+
{"backend": "csa", "cve_id": "CVE-2023-3745", "dataset": "csa159", "environment_id": "csa159/pair_136864", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick6", "task_id": "pair_136864", "task_path": "csa159/tasks/pair_136864"}
|
| 198 |
+
{"backend": "csa", "cve_id": "CVE-2017-5627", "dataset": "csa159", "environment_id": "csa159/pair_137200", "group": "CSA", "language": "c/c++", "project_id": "ccxvii_mujs", "task_id": "pair_137200", "task_path": "csa159/tasks/pair_137200"}
|
| 199 |
+
{"backend": "csa", "cve_id": "CVE-2020-23306", "dataset": "csa159", "environment_id": "csa159/pair_137357", "group": "CSA", "language": "c/c++", "project_id": "jerryscript-project_jerryscript", "task_id": "pair_137357", "task_path": "csa159/tasks/pair_137357"}
|
| 200 |
+
{"backend": "csa", "cve_id": "CVE-2021-46349", "dataset": "csa159", "environment_id": "csa159/pair_137374", "group": "CSA", "language": "c/c++", "project_id": "jerryscript-project_jerryscript", "task_id": "pair_137374", "task_path": "csa159/tasks/pair_137374"}
|
| 201 |
+
{"backend": "csa", "cve_id": "CVE-2020-23312", "dataset": "csa159", "environment_id": "csa159/pair_137377", "group": "CSA", "language": "c/c++", "project_id": "jerryscript-project_jerryscript", "task_id": "pair_137377", "task_path": "csa159/tasks/pair_137377"}
|
| 202 |
+
{"backend": "csa", "cve_id": "CVE-2021-46350", "dataset": "csa159", "environment_id": "csa159/pair_137389", "group": "CSA", "language": "c/c++", "project_id": "jerryscript-project_jerryscript", "task_id": "pair_137389", "task_path": "csa159/tasks/pair_137389"}
|
| 203 |
+
{"backend": "csa", "cve_id": "CVE-2019-19795", "dataset": "csa159", "environment_id": "csa159/pair_137518", "group": "CSA", "language": "c/c++", "project_id": "michaelforney_samurai", "task_id": "pair_137518", "task_path": "csa159/tasks/pair_137518"}
|
| 204 |
+
{"backend": "csa", "cve_id": "CVE-2014-0146", "dataset": "csa159", "environment_id": "csa159/pair_137750", "group": "CSA", "language": "c/c++", "project_id": "qemu_qemu", "task_id": "pair_137750", "task_path": "csa159/tasks/pair_137750"}
|
| 205 |
+
{"backend": "csa", "cve_id": "CVE-2018-16847", "dataset": "csa159", "environment_id": "csa159/pair_137751", "group": "CSA", "language": "c/c++", "project_id": "qemu_qemu", "task_id": "pair_137751", "task_path": "csa159/tasks/pair_137751"}
|
| 206 |
+
{"backend": "csa", "cve_id": "CVE-2018-17963", "dataset": "csa159", "environment_id": "csa159/pair_137769", "group": "CSA", "language": "c/c++", "project_id": "qemu_qemu", "task_id": "pair_137769", "task_path": "csa159/tasks/pair_137769"}
|
| 207 |
+
{"backend": "csa", "cve_id": "CVE-2019-20396", "dataset": "csa159", "environment_id": "csa159/pair_138126", "group": "CSA", "language": "c/c++", "project_id": "CESNET_libyang", "task_id": "pair_138126", "task_path": "csa159/tasks/pair_138126"}
|
| 208 |
+
{"backend": "csa", "cve_id": "CVE-2026-32854", "dataset": "csa159", "environment_id": "csa159/pair_138203", "group": "CSA", "language": "c/c++", "project_id": "LibVNC_libvncserver", "task_id": "pair_138203", "task_path": "csa159/tasks/pair_138203"}
|
| 209 |
+
{"backend": "csa", "cve_id": "CVE-2020-6611", "dataset": "csa159", "environment_id": "csa159/pair_138249", "group": "CSA", "language": "c/c++", "project_id": "LibreDWG_libredwg", "task_id": "pair_138249", "task_path": "csa159/tasks/pair_138249"}
|
| 210 |
+
{"backend": "csa", "cve_id": "CVE-2021-36080", "dataset": "csa159", "environment_id": "csa159/pair_138280", "group": "CSA", "language": "c/c++", "project_id": "LibreDWG_libredwg", "task_id": "pair_138280", "task_path": "csa159/tasks/pair_138280"}
|
| 211 |
+
{"backend": "csa", "cve_id": "CVE-2019-13115", "dataset": "csa159", "environment_id": "csa159/pair_138328", "group": "CSA", "language": "c/c++", "project_id": "libssh2_libssh2", "task_id": "pair_138328", "task_path": "csa159/tasks/pair_138328"}
|
| 212 |
+
{"backend": "csa", "cve_id": "CVE-2024-28319", "dataset": "csa159", "environment_id": "csa159/pair_138462", "group": "CSA", "language": "c/c++", "project_id": "gpac_gpac", "task_id": "pair_138462", "task_path": "csa159/tasks/pair_138462"}
|
| 213 |
+
{"backend": "csa", "cve_id": "CVE-2018-21232", "dataset": "csa159", "environment_id": "csa159/pair_138485", "group": "CSA", "language": "c/c++", "project_id": "skvadrik_re2c", "task_id": "pair_138485", "task_path": "csa159/tasks/pair_138485"}
|
| 214 |
+
{"backend": "csa", "cve_id": "CVE-2016-1924", "dataset": "csa159", "environment_id": "csa159/pair_138650", "group": "CSA", "language": "c/c++", "project_id": "uclouvain_openjpeg", "task_id": "pair_138650", "task_path": "csa159/tasks/pair_138650"}
|
| 215 |
+
{"backend": "csa", "cve_id": "CVE-2026-40169", "dataset": "csa159", "environment_id": "csa159/pair_138728", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick", "task_id": "pair_138728", "task_path": "csa159/tasks/pair_138728"}
|
| 216 |
+
{"backend": "csa", "cve_id": "CVE-2025-46393", "dataset": "csa159", "environment_id": "csa159/pair_138746", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick", "task_id": "pair_138746", "task_path": "csa159/tasks/pair_138746"}
|
| 217 |
+
{"backend": "csa", "cve_id": "CVE-2026-33905", "dataset": "csa159", "environment_id": "csa159/pair_138756", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick", "task_id": "pair_138756", "task_path": "csa159/tasks/pair_138756"}
|
| 218 |
+
{"backend": "csa", "cve_id": "CVE-2011-2161", "dataset": "csa159", "environment_id": "csa159/pair_138800", "group": "CSA", "language": "c/c++", "project_id": "FFmpeg_FFmpeg", "task_id": "pair_138800", "task_path": "csa159/tasks/pair_138800"}
|
| 219 |
+
{"backend": "csa", "cve_id": "CVE-2021-47583", "dataset": "csa159", "environment_id": "csa159/pair_139579", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_139579", "task_path": "csa159/tasks/pair_139579"}
|
| 220 |
+
{"backend": "csa", "cve_id": "CVE-2022-49563", "dataset": "csa159", "environment_id": "csa159/pair_140531", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_140531", "task_path": "csa159/tasks/pair_140531"}
|
| 221 |
+
{"backend": "csa", "cve_id": "CVE-2022-49727", "dataset": "csa159", "environment_id": "csa159/pair_140691", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_140691", "task_path": "csa159/tasks/pair_140691"}
|
| 222 |
+
{"backend": "csa", "cve_id": "CVE-2022-50138", "dataset": "csa159", "environment_id": "csa159/pair_141072", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141072", "task_path": "csa159/tasks/pair_141072"}
|
| 223 |
+
{"backend": "csa", "cve_id": "CVE-2022-50374", "dataset": "csa159", "environment_id": "csa159/pair_141289", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141289", "task_path": "csa159/tasks/pair_141289"}
|
| 224 |
+
{"backend": "csa", "cve_id": "CVE-2022-50459", "dataset": "csa159", "environment_id": "csa159/pair_141364", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141364", "task_path": "csa159/tasks/pair_141364"}
|
| 225 |
+
{"backend": "csa", "cve_id": "CVE-2023-52471", "dataset": "csa159", "environment_id": "csa159/pair_141754", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141754", "task_path": "csa159/tasks/pair_141754"}
|
| 226 |
+
{"backend": "csa", "cve_id": "CVE-2023-52609", "dataset": "csa159", "environment_id": "csa159/pair_141857", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141857", "task_path": "csa159/tasks/pair_141857"}
|
| 227 |
+
{"backend": "csa", "cve_id": "CVE-2023-53250", "dataset": "csa159", "environment_id": "csa159/pair_142376", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_142376", "task_path": "csa159/tasks/pair_142376"}
|
| 228 |
+
{"backend": "csa", "cve_id": "CVE-2023-53679", "dataset": "csa159", "environment_id": "csa159/pair_142793", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_142793", "task_path": "csa159/tasks/pair_142793"}
|
| 229 |
+
{"backend": "csa", "cve_id": "CVE-2024-26927", "dataset": "csa159", "environment_id": "csa159/pair_143586", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_143586", "task_path": "csa159/tasks/pair_143586"}
|
| 230 |
+
{"backend": "csa", "cve_id": "CVE-2024-38628", "dataset": "csa159", "environment_id": "csa159/pair_144169", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_144169", "task_path": "csa159/tasks/pair_144169"}
|
| 231 |
+
{"backend": "csa", "cve_id": "CVE-2024-53117", "dataset": "csa159", "environment_id": "csa159/pair_145442", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145442", "task_path": "csa159/tasks/pair_145442"}
|
| 232 |
+
{"backend": "csa", "cve_id": "CVE-2024-53203", "dataset": "csa159", "environment_id": "csa159/pair_145527", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145527", "task_path": "csa159/tasks/pair_145527"}
|
| 233 |
+
{"backend": "csa", "cve_id": "CVE-2024-56605", "dataset": "csa159", "environment_id": "csa159/pair_145663", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145663", "task_path": "csa159/tasks/pair_145663"}
|
| 234 |
+
{"backend": "csa", "cve_id": "CVE-2024-57953", "dataset": "csa159", "environment_id": "csa159/pair_145933", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145933", "task_path": "csa159/tasks/pair_145933"}
|
| 235 |
+
{"backend": "csa", "cve_id": "CVE-2024-57996", "dataset": "csa159", "environment_id": "csa159/pair_145957", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145957", "task_path": "csa159/tasks/pair_145957"}
|
| 236 |
+
{"backend": "csa", "cve_id": "CVE-2024-58065", "dataset": "csa159", "environment_id": "csa159/pair_146000", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_146000", "task_path": "csa159/tasks/pair_146000"}
|
| 237 |
+
{"backend": "csa", "cve_id": "CVE-2025-21986", "dataset": "csa159", "environment_id": "csa159/pair_146389", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_146389", "task_path": "csa159/tasks/pair_146389"}
|
| 238 |
+
{"backend": "csa", "cve_id": "CVE-2025-38415", "dataset": "csa159", "environment_id": "csa159/pair_147222", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147222", "task_path": "csa159/tasks/pair_147222"}
|
| 239 |
+
{"backend": "csa", "cve_id": "CVE-2025-38459", "dataset": "csa159", "environment_id": "csa159/pair_147266", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147266", "task_path": "csa159/tasks/pair_147266"}
|
| 240 |
+
{"backend": "csa", "cve_id": "CVE-2025-40313", "dataset": "csa159", "environment_id": "csa159/pair_148175", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_148175", "task_path": "csa159/tasks/pair_148175"}
|
| 241 |
+
{"backend": "csa", "cve_id": "CVE-2026-43160", "dataset": "csa159", "environment_id": "csa159/pair_149745", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149745", "task_path": "csa159/tasks/pair_149745"}
|
| 242 |
+
{"backend": "csa", "cve_id": "CVE-2026-43249", "dataset": "csa159", "environment_id": "csa159/pair_149834", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149834", "task_path": "csa159/tasks/pair_149834"}
|
| 243 |
+
{"backend": "csa", "cve_id": "CVE-2026-43376", "dataset": "csa159", "environment_id": "csa159/pair_149959", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149959", "task_path": "csa159/tasks/pair_149959"}
|
| 244 |
+
{"backend": "csa", "cve_id": "CVE-2026-46045", "dataset": "csa159", "environment_id": "csa159/pair_150291", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150291", "task_path": "csa159/tasks/pair_150291"}
|
| 245 |
+
{"backend": "csa", "cve_id": "CVE-2026-46090", "dataset": "csa159", "environment_id": "csa159/pair_150336", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150336", "task_path": "csa159/tasks/pair_150336"}
|
| 246 |
+
{"backend": "csa", "cve_id": "CVE-2022-49007", "dataset": "csa159", "environment_id": "csa159/pair_156097", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156097", "task_path": "csa159/tasks/pair_156097"}
|
| 247 |
+
{"backend": "csa", "cve_id": "CVE-2024-42272", "dataset": "csa159", "environment_id": "csa159/pair_156217", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156217", "task_path": "csa159/tasks/pair_156217"}
|
| 248 |
+
{"backend": "csa", "cve_id": "CVE-2023-52505", "dataset": "csa159", "environment_id": "csa159/pair_156267", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156267", "task_path": "csa159/tasks/pair_156267"}
|
| 249 |
+
{"backend": "csa", "cve_id": "CVE-2024-26664", "dataset": "csa159", "environment_id": "csa159/pair_156473", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156473", "task_path": "csa159/tasks/pair_156473"}
|
| 250 |
+
{"backend": "csa", "cve_id": "CVE-2025-38568", "dataset": "csa159", "environment_id": "csa159/pair_156640", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156640", "task_path": "csa159/tasks/pair_156640"}
|
| 251 |
+
{"backend": "csa", "cve_id": "CVE-2023-53057", "dataset": "csa159", "environment_id": "csa159/pair_156704", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156704", "task_path": "csa159/tasks/pair_156704"}
|
| 252 |
+
{"backend": "csa", "cve_id": "CVE-2023-52865", "dataset": "csa159", "environment_id": "csa159/pair_156860", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156860", "task_path": "csa159/tasks/pair_156860"}
|
| 253 |
+
{"backend": "csa", "cve_id": "CVE-2022-48818", "dataset": "csa159", "environment_id": "csa159/pair_156981", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156981", "task_path": "csa159/tasks/pair_156981"}
|
| 254 |
+
{"backend": "csa", "cve_id": "CVE-2022-49519", "dataset": "csa159", "environment_id": "csa159/pair_157153", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_157153", "task_path": "csa159/tasks/pair_157153"}
|
| 255 |
+
{"backend": "csa", "cve_id": "CVE-2022-48665", "dataset": "csa159", "environment_id": "csa159/pair_158138", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158138", "task_path": "csa159/tasks/pair_158138"}
|
| 256 |
+
{"backend": "csa", "cve_id": "CVE-2026-53322", "dataset": "csa159", "environment_id": "csa159/pair_158217", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158217", "task_path": "csa159/tasks/pair_158217"}
|
| 257 |
+
{"backend": "csa", "cve_id": "CVE-2022-50131", "dataset": "csa159", "environment_id": "csa159/pair_158385", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158385", "task_path": "csa159/tasks/pair_158385"}
|
| 258 |
+
{"backend": "csa", "cve_id": "CVE-2023-1078", "dataset": "csa159", "environment_id": "csa159/pair_158831", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158831", "task_path": "csa159/tasks/pair_158831"}
|
| 259 |
+
{"backend": "csa", "cve_id": "CVE-2022-49208", "dataset": "csa159", "environment_id": "csa159/pair_159264", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_159264", "task_path": "csa159/tasks/pair_159264"}
|
| 260 |
+
{"backend": "csa", "cve_id": "CVE-2024-36899", "dataset": "csa159", "environment_id": "csa159/pair_159377", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_159377", "task_path": "csa159/tasks/pair_159377"}
|
| 261 |
+
{"backend": "csa", "cve_id": "CVE-2025-37812", "dataset": "csa159", "environment_id": "csa159/pair_160021", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160021", "task_path": "csa159/tasks/pair_160021"}
|
| 262 |
+
{"backend": "csa", "cve_id": "CVE-2023-52569", "dataset": "csa159", "environment_id": "csa159/pair_160187", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160187", "task_path": "csa159/tasks/pair_160187"}
|
| 263 |
+
{"backend": "csa", "cve_id": "CVE-2023-52603", "dataset": "csa159", "environment_id": "csa159/pair_160364", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160364", "task_path": "csa159/tasks/pair_160364"}
|
| 264 |
+
{"backend": "csa", "cve_id": "CVE-2023-28464", "dataset": "csa159", "environment_id": "csa159/pair_160434", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160434", "task_path": "csa159/tasks/pair_160434"}
|
| 265 |
+
{"backend": "csa", "cve_id": "CVE-2025-38129", "dataset": "csa159", "environment_id": "csa159/pair_160451", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160451", "task_path": "csa159/tasks/pair_160451"}
|
| 266 |
+
{"backend": "csa", "cve_id": "CVE-2024-45017", "dataset": "csa159", "environment_id": "csa159/pair_160603", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160603", "task_path": "csa159/tasks/pair_160603"}
|
| 267 |
+
{"backend": "csa", "cve_id": "CVE-2022-49123", "dataset": "csa159", "environment_id": "csa159/pair_160628", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160628", "task_path": "csa159/tasks/pair_160628"}
|
| 268 |
+
{"backend": "csa", "cve_id": "CVE-2024-41059", "dataset": "csa159", "environment_id": "csa159/pair_160904", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160904", "task_path": "csa159/tasks/pair_160904"}
|
| 269 |
+
{"backend": "csa", "cve_id": "CVE-2024-42242", "dataset": "csa159", "environment_id": "csa159/pair_160912", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160912", "task_path": "csa159/tasks/pair_160912"}
|
| 270 |
+
{"backend": "csa", "cve_id": "CVE-2024-26585", "dataset": "csa159", "environment_id": "csa159/pair_161027", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161027", "task_path": "csa159/tasks/pair_161027"}
|
| 271 |
+
{"backend": "csa", "cve_id": "CVE-2024-38593", "dataset": "csa159", "environment_id": "csa159/pair_161598", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161598", "task_path": "csa159/tasks/pair_161598"}
|
| 272 |
+
{"backend": "csa", "cve_id": "CVE-2024-26583", "dataset": "csa159", "environment_id": "csa159/pair_161667", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161667", "task_path": "csa159/tasks/pair_161667"}
|
| 273 |
+
{"backend": "csa", "cve_id": "CVE-2025-21811", "dataset": "csa159", "environment_id": "csa159/pair_161782", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161782", "task_path": "csa159/tasks/pair_161782"}
|
| 274 |
+
{"backend": "csa", "cve_id": "CVE-2023-52843", "dataset": "csa159", "environment_id": "csa159/pair_161997", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161997", "task_path": "csa159/tasks/pair_161997"}
|
| 275 |
+
{"backend": "csa", "cve_id": "CVE-2023-53827", "dataset": "csa159", "environment_id": "csa159/pair_162003", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162003", "task_path": "csa159/tasks/pair_162003"}
|
| 276 |
+
{"backend": "csa", "cve_id": "CVE-2022-4095", "dataset": "csa159", "environment_id": "csa159/pair_162331", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162331", "task_path": "csa159/tasks/pair_162331"}
|
| 277 |
+
{"backend": "csa", "cve_id": "CVE-2022-48735", "dataset": "csa159", "environment_id": "csa159/pair_162535", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162535", "task_path": "csa159/tasks/pair_162535"}
|
| 278 |
+
{"backend": "csa", "cve_id": "CVE-2021-47032", "dataset": "csa159", "environment_id": "csa159/pair_162672", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162672", "task_path": "csa159/tasks/pair_162672"}
|
| 279 |
+
{"backend": "csa", "cve_id": "CVE-2024-36016", "dataset": "csa159", "environment_id": "csa159/pair_162700", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162700", "task_path": "csa159/tasks/pair_162700"}
|
| 280 |
+
{"backend": "csa", "cve_id": "CVE-2024-39509", "dataset": "csa159", "environment_id": "csa159/pair_163294", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163294", "task_path": "csa159/tasks/pair_163294"}
|
| 281 |
+
{"backend": "csa", "cve_id": "CVE-2025-38150", "dataset": "csa159", "environment_id": "csa159/pair_163698", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163698", "task_path": "csa159/tasks/pair_163698"}
|
| 282 |
+
{"backend": "csa", "cve_id": "CVE-2024-36484", "dataset": "csa159", "environment_id": "csa159/pair_163737", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163737", "task_path": "csa159/tasks/pair_163737"}
|
| 283 |
+
{"backend": "csa", "cve_id": "CVE-2023-39194", "dataset": "csa159", "environment_id": "csa159/pair_163761", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163761", "task_path": "csa159/tasks/pair_163761"}
|
| 284 |
+
{"backend": "csa", "cve_id": "CVE-2025-68337", "dataset": "csa159", "environment_id": "csa159/pair_163824", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163824", "task_path": "csa159/tasks/pair_163824"}
|
| 285 |
+
{"backend": "csa", "cve_id": "CVE-2024-56584", "dataset": "csa159", "environment_id": "csa159/pair_163861", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163861", "task_path": "csa159/tasks/pair_163861"}
|
| 286 |
+
{"backend": "csa", "cve_id": "CVE-2023-45863", "dataset": "csa159", "environment_id": "csa159/pair_163978", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163978", "task_path": "csa159/tasks/pair_163978"}
|
| 287 |
+
{"backend": "csa", "cve_id": "CVE-2023-52435", "dataset": "csa159", "environment_id": "csa159/pair_164140", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164140", "task_path": "csa159/tasks/pair_164140"}
|
| 288 |
+
{"backend": "csa", "cve_id": "CVE-2022-48893", "dataset": "csa159", "environment_id": "csa159/pair_164624", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164624", "task_path": "csa159/tasks/pair_164624"}
|
| 289 |
+
{"backend": "csa", "cve_id": "CVE-2021-47109", "dataset": "csa159", "environment_id": "csa159/pair_164920", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164920", "task_path": "csa159/tasks/pair_164920"}
|
| 290 |
+
{"backend": "csa", "cve_id": "CVE-2023-52623", "dataset": "csa159", "environment_id": "csa159/pair_164974", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164974", "task_path": "csa159/tasks/pair_164974"}
|
| 291 |
+
{"backend": "csa", "cve_id": "CVE-2022-28796", "dataset": "csa159", "environment_id": "csa159/pair_165542", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_165542", "task_path": "csa159/tasks/pair_165542"}
|
| 292 |
+
{"backend": "csa", "cve_id": "CVE-2022-49580", "dataset": "csa159", "environment_id": "csa159/pair_165655", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_165655", "task_path": "csa159/tasks/pair_165655"}
|
| 293 |
+
{"backend": "csa", "cve_id": "CVE-2023-45863", "dataset": "csa159", "environment_id": "csa159/pair_165738", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_165738", "task_path": "csa159/tasks/pair_165738"}
|
| 294 |
+
{"backend": "csa", "cve_id": "CVE-2021-40572", "dataset": "csa159", "environment_id": "csa159/pair_3538", "group": "CSA", "language": "c/c++", "project_id": "gpac_gpac", "task_id": "pair_3538", "task_path": "csa159/tasks/pair_3538"}
|
| 295 |
+
{"backend": "csa", "cve_id": "CVE-2020-36138", "dataset": "csa159", "environment_id": "csa159/pair_4701", "group": "CSA", "language": "c/c++", "project_id": "FFmpeg_FFmpeg", "task_id": "pair_4701", "task_path": "csa159/tasks/pair_4701"}
|
| 296 |
+
{"backend": "csa", "cve_id": "CVE-2020-11096", "dataset": "csa159", "environment_id": "csa159/pair_6060", "group": "CSA", "language": "c/c++", "project_id": "FreeRDP_FreeRDP", "task_id": "pair_6060", "task_path": "csa159/tasks/pair_6060"}
|
| 297 |
+
{"backend": "csa", "cve_id": "CVE-2018-8784", "dataset": "csa159", "environment_id": "csa159/pair_6105", "group": "CSA", "language": "c/c++", "project_id": "FreeRDP_FreeRDP", "task_id": "pair_6105", "task_path": "csa159/tasks/pair_6105"}
|
| 298 |
+
{"backend": "csa", "cve_id": "CVE-2020-11038", "dataset": "csa159", "environment_id": "csa159/pair_6132", "group": "CSA", "language": "c/c++", "project_id": "FreeRDP_FreeRDP", "task_id": "pair_6132", "task_path": "csa159/tasks/pair_6132"}
|
| 299 |
+
{"backend": "csa", "cve_id": "CVE-2016-5418", "dataset": "csa159", "environment_id": "csa159/pair_7278", "group": "CSA", "language": "c/c++", "project_id": "libarchive_libarchive", "task_id": "pair_7278", "task_path": "csa159/tasks/pair_7278"}
|
| 300 |
+
{"backend": "csa", "cve_id": "CVE-2013-0211", "dataset": "csa159", "environment_id": "csa159/pair_7287", "group": "CSA", "language": "c/c++", "project_id": "libarchive_libarchive", "task_id": "pair_7287", "task_path": "csa159/tasks/pair_7287"}
|
dataset/tasks.jsonl
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"backend": "codeql", "cve_id": "CVE-2022-4741", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78", "group": "CodeQL go", "language": "go", "project_id": "morefixes__sajari__docconv", "task_id": "morefixes-02cb4e0a6c5aaabd6a78", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-02cb4e0a6c5aaabd6a78"}
|
| 2 |
+
{"backend": "codeql", "cve_id": "CVE-2025-47281", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406", "group": "CodeQL go", "language": "go", "project_id": "morefixes__kyverno__kyverno", "task_id": "morefixes-08d699b1f7c72c366406", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-08d699b1f7c72c366406"}
|
| 3 |
+
{"backend": "codeql", "cve_id": "CVE-2020-29243", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb", "group": "CodeQL go", "language": "go", "project_id": "morefixes__dhowden__tag", "task_id": "morefixes-096cbfbd1d27f9ce86fb", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-096cbfbd1d27f9ce86fb"}
|
| 4 |
+
{"backend": "codeql", "cve_id": "CVE-2023-34236", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f", "group": "CodeQL go", "language": "go", "project_id": "morefixes__weaveworks__tf-controller", "task_id": "morefixes-0adb0a489b07a50d6b2f", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-0adb0a489b07a50d6b2f"}
|
| 5 |
+
{"backend": "codeql", "cve_id": "CVE-2022-41939", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28", "group": "CodeQL go", "language": "go", "project_id": "morefixes__knative__func", "task_id": "morefixes-110ab7950a2c0b2c6f28", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-110ab7950a2c0b2c6f28"}
|
| 6 |
+
{"backend": "codeql", "cve_id": "CVE-2023-27582", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555", "group": "CodeQL go", "language": "go", "project_id": "morefixes__foxcpp__maddy", "task_id": "morefixes-1218ce956f8120d59555", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-1218ce956f8120d59555"}
|
| 7 |
+
{"backend": "codeql", "cve_id": "CVE-2024-39315", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-14446e68cdc53bc98807", "group": "CodeQL go", "language": "go", "project_id": "morefixes__pomerium__pomerium", "task_id": "morefixes-14446e68cdc53bc98807", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-14446e68cdc53bc98807"}
|
| 8 |
+
{"backend": "codeql", "cve_id": "CVE-2022-2582", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-1d20aba9f4be2de73db5", "group": "CodeQL go", "language": "go", "project_id": "morefixes__aws__aws-sdk-go", "task_id": "morefixes-1d20aba9f4be2de73db5", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-1d20aba9f4be2de73db5"}
|
| 9 |
+
{"backend": "codeql", "cve_id": "CVE-2025-66626", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-2331a664751876781460", "group": "CodeQL go", "language": "go", "project_id": "morefixes__argoproj__argo-workflows", "task_id": "morefixes-2331a664751876781460", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-2331a664751876781460"}
|
| 10 |
+
{"backend": "codeql", "cve_id": "CVE-2019-12496", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-2cc25dee5f2a118bcb26", "group": "CodeQL go", "language": "go", "project_id": "morefixes__hybridgroup__gobot", "task_id": "morefixes-2cc25dee5f2a118bcb26", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-2cc25dee5f2a118bcb26"}
|
| 11 |
+
{"backend": "codeql", "cve_id": "CVE-2026-40890", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-30e495de2402bd4bed4b", "group": "CodeQL go", "language": "go", "project_id": "morefixes__gomarkdown__markdown", "task_id": "morefixes-30e495de2402bd4bed4b", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-30e495de2402bd4bed4b"}
|
| 12 |
+
{"backend": "codeql", "cve_id": "CVE-2024-7773", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-32ed35a8bd8aba7b47ad", "group": "CodeQL go", "language": "go", "project_id": "morefixes__ollama__ollama", "task_id": "morefixes-32ed35a8bd8aba7b47ad", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-32ed35a8bd8aba7b47ad"}
|
| 13 |
+
{"backend": "codeql", "cve_id": "CVE-2023-40586", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-398ac78e3981b77e4ee2", "group": "CodeQL go", "language": "go", "project_id": "morefixes__corazawaf__coraza", "task_id": "morefixes-398ac78e3981b77e4ee2", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-398ac78e3981b77e4ee2"}
|
| 14 |
+
{"backend": "codeql", "cve_id": "CVE-2022-41920", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-461c7bace102119cf443", "group": "CodeQL go", "language": "go", "project_id": "morefixes__duke-git__lancet", "task_id": "morefixes-461c7bace102119cf443", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-461c7bace102119cf443"}
|
| 15 |
+
{"backend": "codeql", "cve_id": "CVE-2026-10722", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-50b28fbf07dd2d79022e", "group": "CodeQL go", "language": "go", "project_id": "morefixes__cilium__ebpf", "task_id": "morefixes-50b28fbf07dd2d79022e", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-50b28fbf07dd2d79022e"}
|
| 16 |
+
{"backend": "codeql", "cve_id": "CVE-2023-47105", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-5ad30634efaa1d03593c", "group": "CodeQL go", "language": "go", "project_id": "morefixes__chaosblade-io__chaosblade", "task_id": "morefixes-5ad30634efaa1d03593c", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-5ad30634efaa1d03593c"}
|
| 17 |
+
{"backend": "codeql", "cve_id": "CVE-2024-23840", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-5c2773bb1de86a62a247", "group": "CodeQL go", "language": "go", "project_id": "morefixes__goreleaser__goreleaser", "task_id": "morefixes-5c2773bb1de86a62a247", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-5c2773bb1de86a62a247"}
|
| 18 |
+
{"backend": "codeql", "cve_id": "CVE-2022-30428", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-5cfa41b8575717ecee17", "group": "CodeQL go", "language": "go", "project_id": "morefixes__gphper__ginadmin", "task_id": "morefixes-5cfa41b8575717ecee17", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-5cfa41b8575717ecee17"}
|
| 19 |
+
{"backend": "codeql", "cve_id": "CVE-2020-36568", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-6e40429ff01c5ab8b71b", "group": "CodeQL go", "language": "go", "project_id": "morefixes__revel__revel", "task_id": "morefixes-6e40429ff01c5ab8b71b", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-6e40429ff01c5ab8b71b"}
|
| 20 |
+
{"backend": "codeql", "cve_id": "CVE-2023-33965", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-7c57d35438d22210ced2", "group": "CodeQL go", "language": "go", "project_id": "morefixes__txthinking__brook", "task_id": "morefixes-7c57d35438d22210ced2", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-7c57d35438d22210ced2"}
|
| 21 |
+
{"backend": "codeql", "cve_id": "CVE-2026-8275", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-7e2af82757795db7f69a", "group": "CodeQL go", "language": "go", "project_id": "morefixes__bettercap__bettercap", "task_id": "morefixes-7e2af82757795db7f69a", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-7e2af82757795db7f69a"}
|
| 22 |
+
{"backend": "codeql", "cve_id": "CVE-2024-41270", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-9fbea0e4da10bfc882d4", "group": "CodeQL go", "language": "go", "project_id": "morefixes__appleboy__gorush", "task_id": "morefixes-9fbea0e4da10bfc882d4", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-9fbea0e4da10bfc882d4"}
|
| 23 |
+
{"backend": "codeql", "cve_id": "CVE-2023-46132", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-a469597c1a5d38baeb5d", "group": "CodeQL go", "language": "go", "project_id": "morefixes__hyperledger__fabric", "task_id": "morefixes-a469597c1a5d38baeb5d", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-a469597c1a5d38baeb5d"}
|
| 24 |
+
{"backend": "codeql", "cve_id": "CVE-2023-34105", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-a9ee7c2085f2981a7be1", "group": "CodeQL go", "language": "go", "project_id": "morefixes__ossrs__srs", "task_id": "morefixes-a9ee7c2085f2981a7be1", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-a9ee7c2085f2981a7be1"}
|
| 25 |
+
{"backend": "codeql", "cve_id": "CVE-2018-1002207", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-c254bd7b8a82b4ef45c1", "group": "CodeQL go", "language": "go", "project_id": "morefixes__mholt__archiver", "task_id": "morefixes-c254bd7b8a82b4ef45c1", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-c254bd7b8a82b4ef45c1"}
|
| 26 |
+
{"backend": "codeql", "cve_id": "CVE-2017-1000070", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-cd95b2e4d63395291cd3", "group": "CodeQL go", "language": "go", "project_id": "morefixes__bitly__oauth2_proxy", "task_id": "morefixes-cd95b2e4d63395291cd3", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-cd95b2e4d63395291cd3"}
|
| 27 |
+
{"backend": "codeql", "cve_id": "CVE-2025-67499", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-d3400ed5292d19661685", "group": "CodeQL go", "language": "go", "project_id": "morefixes__containernetworking__plugins", "task_id": "morefixes-d3400ed5292d19661685", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-d3400ed5292d19661685"}
|
| 28 |
+
{"backend": "codeql", "cve_id": "CVE-2022-21698", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-e3f3ac87786e2080b81f", "group": "CodeQL go", "language": "go", "project_id": "morefixes__prometheus__client_golang", "task_id": "morefixes-e3f3ac87786e2080b81f", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-e3f3ac87786e2080b81f"}
|
| 29 |
+
{"backend": "codeql", "cve_id": "CVE-2021-3538", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-f0d857f4ad82fae5a3a9", "group": "CodeQL go", "language": "go", "project_id": "morefixes__satori__go.uuid", "task_id": "morefixes-f0d857f4ad82fae5a3a9", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-f0d857f4ad82fae5a3a9"}
|
| 30 |
+
{"backend": "codeql", "cve_id": "CVE-2025-32445", "dataset": "codeql_go_benchmark_top30_v1", "environment_id": "codeql_go_benchmark_top30_v1/morefixes-fb75b5c545e3cb24f7ae", "group": "CodeQL go", "language": "go", "project_id": "morefixes__argoproj__argo-events", "task_id": "morefixes-fb75b5c545e3cb24f7ae", "task_path": "codeql_go_benchmark_top30_v1/tasks/morefixes-fb75b5c545e3cb24f7ae"}
|
| 31 |
+
{"backend": "codeql", "cve_id": "CVE-2023-2196", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-02f75a63a6f0b8d6c6c7", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__codedx-plugin", "task_id": "morefixes-02f75a63a6f0b8d6c6c7", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-02f75a63a6f0b8d6c6c7"}
|
| 32 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21656", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-04bdb708bf23aabdc444", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__xcode-plugin", "task_id": "morefixes-04bdb708bf23aabdc444", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-04bdb708bf23aabdc444"}
|
| 33 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21632", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-05d6240fd5a9017a44ec", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__dependency-track-plugin", "task_id": "morefixes-05d6240fd5a9017a44ec", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-05d6240fd5a9017a44ec"}
|
| 34 |
+
{"backend": "codeql", "cve_id": "CVE-2020-2132", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-0608482232bb0119b561", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__environment-manager-tools-plugin", "task_id": "morefixes-0608482232bb0119b561", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-0608482232bb0119b561"}
|
| 35 |
+
{"backend": "codeql", "cve_id": "CVE-2020-2311", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-0709c903a0f96b124bd5", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jenkinsci__aws-global-configuration-plugin", "task_id": "morefixes-0709c903a0f96b124bd5", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-0709c903a0f96b124bd5"}
|
| 36 |
+
{"backend": "codeql", "cve_id": "CVE-2020-14297", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-09002f4d38e9ecf8238a", "group": "CodeQL java", "language": "java", "project_id": "morefixes__wildfly__jboss-ejb-client", "task_id": "morefixes-09002f4d38e9ecf8238a", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-09002f4d38e9ecf8238a"}
|
| 37 |
+
{"backend": "codeql", "cve_id": "CVE-2020-25023", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-13b1b3610eb300ab9704", "group": "CodeQL java", "language": "java", "project_id": "morefixes__rweather__noise-java", "task_id": "morefixes-13b1b3610eb300ab9704", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-13b1b3610eb300ab9704"}
|
| 38 |
+
{"backend": "codeql", "cve_id": "CVE-2023-25141", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-149c5507d76b198944c3", "group": "CodeQL java", "language": "java", "project_id": "morefixes__apache__sling-org-apache-sling-jcr-base", "task_id": "morefixes-149c5507d76b198944c3", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-149c5507d76b198944c3"}
|
| 39 |
+
{"backend": "codeql", "cve_id": "CVE-2022-43183", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-19d7bda86b839e7fc493", "group": "CodeQL java", "language": "java", "project_id": "morefixes__xuxueli__xxl-job", "task_id": "morefixes-19d7bda86b839e7fc493", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-19d7bda86b839e7fc493"}
|
| 40 |
+
{"backend": "codeql", "cve_id": "CVE-2025-29908", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-1f67e1cf382f2e332752", "group": "CodeQL java", "language": "java", "project_id": "morefixes__netty__netty-incubator-codec-quic", "task_id": "morefixes-1f67e1cf382f2e332752", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-1f67e1cf382f2e332752"}
|
| 41 |
+
{"backend": "codeql", "cve_id": "CVE-2020-25022", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-21b89e6983680bd0068c", "group": "CodeQL java", "language": "java", "project_id": "morefixes__rweather__noise-java", "task_id": "morefixes-21b89e6983680bd0068c", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-21b89e6983680bd0068c"}
|
| 42 |
+
{"backend": "codeql", "cve_id": "CVE-2021-22573", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-23c03b1bf7a3c44f444b", "group": "CodeQL java", "language": "java", "project_id": "morefixes__googleapis__google-oauth-java-client", "task_id": "morefixes-23c03b1bf7a3c44f444b", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-23c03b1bf7a3c44f444b"}
|
| 43 |
+
{"backend": "codeql", "cve_id": "CVE-2021-39196", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-2b14860afe0d3bf8094a", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jdhwpgmbca__pcapture", "task_id": "morefixes-2b14860afe0d3bf8094a", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-2b14860afe0d3bf8094a"}
|
| 44 |
+
{"backend": "codeql", "cve_id": "CVE-2022-4641", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-35510b21cf51a9acf072", "group": "CodeQL java", "language": "java", "project_id": "morefixes__tdunning__pig-vector", "task_id": "morefixes-35510b21cf51a9acf072", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-35510b21cf51a9acf072"}
|
| 45 |
+
{"backend": "codeql", "cve_id": "CVE-2025-67030", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-378f408f498b20422fe9", "group": "CodeQL java", "language": "java", "project_id": "morefixes__codehaus-plexus__plexus-utils", "task_id": "morefixes-378f408f498b20422fe9", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-378f408f498b20422fe9"}
|
| 46 |
+
{"backend": "codeql", "cve_id": "CVE-2024-39118", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-3cc69a690ef991c8bd71", "group": "CodeQL java", "language": "java", "project_id": "morefixes__mommyheather__advancedbackups", "task_id": "morefixes-3cc69a690ef991c8bd71", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-3cc69a690ef991c8bd71"}
|
| 47 |
+
{"backend": "codeql", "cve_id": "CVE-2024-36114", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-462566b2f857f458bf20", "group": "CodeQL java", "language": "java", "project_id": "morefixes__airlift__aircompressor", "task_id": "morefixes-462566b2f857f458bf20", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-462566b2f857f458bf20"}
|
| 48 |
+
{"backend": "codeql", "cve_id": "CVE-2020-36640", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-4a0720656247f4fdd55d", "group": "CodeQL java", "language": "java", "project_id": "morefixes__bonitasoft__bonita-connector-webservice", "task_id": "morefixes-4a0720656247f4fdd55d", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-4a0720656247f4fdd55d"}
|
| 49 |
+
{"backend": "codeql", "cve_id": "CVE-2023-48299", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-623c5f3c0558ba463c5a", "group": "CodeQL java", "language": "java", "project_id": "morefixes__pytorch__serve", "task_id": "morefixes-623c5f3c0558ba463c5a", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-623c5f3c0558ba463c5a"}
|
| 50 |
+
{"backend": "codeql", "cve_id": "CVE-2024-1102", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-6c80dd14ea98e73d8b2e", "group": "CodeQL java", "language": "java", "project_id": "morefixes__jberet__jsr352", "task_id": "morefixes-6c80dd14ea98e73d8b2e", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-6c80dd14ea98e73d8b2e"}
|
| 51 |
+
{"backend": "codeql", "cve_id": "CVE-2022-41967", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-76076416f1349da24444", "group": "CodeQL java", "language": "java", "project_id": "morefixes__hyperadev__dragonfly", "task_id": "morefixes-76076416f1349da24444", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-76076416f1349da24444"}
|
| 52 |
+
{"backend": "codeql", "cve_id": "CVE-2025-4641", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-80a186235f1faf976a71", "group": "CodeQL java", "language": "java", "project_id": "morefixes__bonigarcia__webdrivermanager", "task_id": "morefixes-80a186235f1faf976a71", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-80a186235f1faf976a71"}
|
| 53 |
+
{"backend": "codeql", "cve_id": "CVE-2020-1729", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-8641a4da2de2d0610576", "group": "CodeQL java", "language": "java", "project_id": "morefixes__smallrye__smallrye-config", "task_id": "morefixes-8641a4da2de2d0610576", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-8641a4da2de2d0610576"}
|
| 54 |
+
{"backend": "codeql", "cve_id": "CVE-2022-29631", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-8e4d1bd2b930ae852ae1", "group": "CodeQL java", "language": "java", "project_id": "morefixes__oblac__jodd-http", "task_id": "morefixes-8e4d1bd2b930ae852ae1", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-8e4d1bd2b930ae852ae1"}
|
| 55 |
+
{"backend": "codeql", "cve_id": "CVE-2020-17534", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-9db4a0f5f07f59debbce", "group": "CodeQL java", "language": "java", "project_id": "morefixes__apache__netbeans-html4j", "task_id": "morefixes-9db4a0f5f07f59debbce", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-9db4a0f5f07f59debbce"}
|
| 56 |
+
{"backend": "codeql", "cve_id": "CVE-2025-67721", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-a624a25672727b30851a", "group": "CodeQL java", "language": "java", "project_id": "morefixes__airlift__aircompressor", "task_id": "morefixes-a624a25672727b30851a", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-a624a25672727b30851a"}
|
| 57 |
+
{"backend": "codeql", "cve_id": "CVE-2022-24913", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-ab625a5d0d2a27547494", "group": "CodeQL java", "language": "java", "project_id": "morefixes__cowtowncoder__java-merge-sort", "task_id": "morefixes-ab625a5d0d2a27547494", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-ab625a5d0d2a27547494"}
|
| 58 |
+
{"backend": "codeql", "cve_id": "CVE-2024-57699", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-ac88413b62ef5803c04f", "group": "CodeQL java", "language": "java", "project_id": "morefixes__netplex__json-smart-v2", "task_id": "morefixes-ac88413b62ef5803c04f", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-ac88413b62ef5803c04f"}
|
| 59 |
+
{"backend": "codeql", "cve_id": "CVE-2025-67721", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-cf8752e9dc2f57b1d5c8", "group": "CodeQL java", "language": "java", "project_id": "morefixes__airlift__aircompressor", "task_id": "morefixes-cf8752e9dc2f57b1d5c8", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-cf8752e9dc2f57b1d5c8"}
|
| 60 |
+
{"backend": "codeql", "cve_id": "CVE-2022-4494", "dataset": "codeql_java_benchmark_top30_v2", "environment_id": "codeql_java_benchmark_top30_v2/morefixes-f298b6158c5168025365", "group": "CodeQL java", "language": "java", "project_id": "morefixes__bspkrs__mcpmappingviewer", "task_id": "morefixes-f298b6158c5168025365", "task_path": "codeql_java_benchmark_top30_v2/tasks/morefixes-f298b6158c5168025365"}
|
| 61 |
+
{"backend": "codeql", "cve_id": "CVE-2023-33194", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-040d724ca8211a3aaf1d", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__craftcms__cms", "task_id": "morefixes-040d724ca8211a3aaf1d", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-040d724ca8211a3aaf1d"}
|
| 62 |
+
{"backend": "codeql", "cve_id": "CVE-2026-25642", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-04314885419e817d3b17", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__hedgedoc__hedgedoc", "task_id": "morefixes-04314885419e817d3b17", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-04314885419e817d3b17"}
|
| 63 |
+
{"backend": "codeql", "cve_id": "CVE-2025-59526", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-08f7e6287de57ef9a5c8", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__eladnava__mailgen", "task_id": "morefixes-08f7e6287de57ef9a5c8", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-08f7e6287de57ef9a5c8"}
|
| 64 |
+
{"backend": "codeql", "cve_id": "CVE-2018-3758", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-0e82cb4ad70fc2c896ef", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__mrvautin__expresscart", "task_id": "morefixes-0e82cb4ad70fc2c896ef", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-0e82cb4ad70fc2c896ef"}
|
| 65 |
+
{"backend": "codeql", "cve_id": "CVE-2026-45787", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-0e8f49f3d1cc46668f9b", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__electerm__electerm", "task_id": "morefixes-0e8f49f3d1cc46668f9b", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-0e8f49f3d1cc46668f9b"}
|
| 66 |
+
{"backend": "codeql", "cve_id": "CVE-2021-3801", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-0ea8f5f13e7432539721", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__prismjs__prism", "task_id": "morefixes-0ea8f5f13e7432539721", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-0ea8f5f13e7432539721"}
|
| 67 |
+
{"backend": "codeql", "cve_id": "CVE-2025-49590", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-0f4271d4851600835c47", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__cryptpad__cryptpad", "task_id": "morefixes-0f4271d4851600835c47", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-0f4271d4851600835c47"}
|
| 68 |
+
{"backend": "codeql", "cve_id": "CVE-2024-25981", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-135296414af3a0faf089", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__moodle__moodle", "task_id": "morefixes-135296414af3a0faf089", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-135296414af3a0faf089"}
|
| 69 |
+
{"backend": "codeql", "cve_id": "CVE-2014-5273", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-16768fdfa00c963539dc", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__phpmyadmin__phpmyadmin", "task_id": "morefixes-16768fdfa00c963539dc", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-16768fdfa00c963539dc"}
|
| 70 |
+
{"backend": "codeql", "cve_id": "CVE-2024-40761", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-17d21311a4f5af9bbc4f", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__apache__incubator-answer", "task_id": "morefixes-17d21311a4f5af9bbc4f", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-17d21311a4f5af9bbc4f"}
|
| 71 |
+
{"backend": "codeql", "cve_id": "CVE-2025-46344", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-1cf55be2336b09a515a6", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__auth0__nextjs-auth0", "task_id": "morefixes-1cf55be2336b09a515a6", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-1cf55be2336b09a515a6"}
|
| 72 |
+
{"backend": "codeql", "cve_id": "CVE-2026-22819", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-312479357bdfa998bf6e", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__outray-tunnel__outray", "task_id": "morefixes-312479357bdfa998bf6e", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-312479357bdfa998bf6e"}
|
| 73 |
+
{"backend": "codeql", "cve_id": "CVE-2025-10044", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-374e3093d6d5875aa960", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__keycloak__keycloak", "task_id": "morefixes-374e3093d6d5875aa960", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-374e3093d6d5875aa960"}
|
| 74 |
+
{"backend": "codeql", "cve_id": "CVE-2021-4124", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-4b95de19a5da1e74a747", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__meetecho__janus-gateway", "task_id": "morefixes-4b95de19a5da1e74a747", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-4b95de19a5da1e74a747"}
|
| 75 |
+
{"backend": "codeql", "cve_id": "CVE-2021-25990", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-4ffaae63e8f8c0012a0f", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__ifmeorg__ifme", "task_id": "morefixes-4ffaae63e8f8c0012a0f", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-4ffaae63e8f8c0012a0f"}
|
| 76 |
+
{"backend": "codeql", "cve_id": "CVE-2023-47635", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-516c6c53716bba29b7f0", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__decidim__decidim", "task_id": "morefixes-516c6c53716bba29b7f0", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-516c6c53716bba29b7f0"}
|
| 77 |
+
{"backend": "codeql", "cve_id": "CVE-2010-2273", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-550b9b77dc4d0c01e1fe", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__dojo__dojo", "task_id": "morefixes-550b9b77dc4d0c01e1fe", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-550b9b77dc4d0c01e1fe"}
|
| 78 |
+
{"backend": "codeql", "cve_id": "CVE-2024-22411", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-58be9c1811ee7367cce5", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__avo-hq__avo", "task_id": "morefixes-58be9c1811ee7367cce5", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-58be9c1811ee7367cce5"}
|
| 79 |
+
{"backend": "codeql", "cve_id": "CVE-2020-11611", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-60205e347d7f83ebc999", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__ofirdagan__cross-domain-local-storage", "task_id": "morefixes-60205e347d7f83ebc999", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-60205e347d7f83ebc999"}
|
| 80 |
+
{"backend": "codeql", "cve_id": "CVE-2017-1000189", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-633246d79fea5271cdce", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__mde__ejs", "task_id": "morefixes-633246d79fea5271cdce", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-633246d79fea5271cdce"}
|
| 81 |
+
{"backend": "codeql", "cve_id": "CVE-2018-11798", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-88a92b26b3a23d01f412", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__apache__thrift", "task_id": "morefixes-88a92b26b3a23d01f412", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-88a92b26b3a23d01f412"}
|
| 82 |
+
{"backend": "codeql", "cve_id": "CVE-2024-28176", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-941abf85c9b7d820de47", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__panva__jose", "task_id": "morefixes-941abf85c9b7d820de47", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-941abf85c9b7d820de47"}
|
| 83 |
+
{"backend": "codeql", "cve_id": "CVE-2026-39941", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-99aea6539029d3ab985e", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__churchcrm__crm", "task_id": "morefixes-99aea6539029d3ab985e", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-99aea6539029d3ab985e"}
|
| 84 |
+
{"backend": "codeql", "cve_id": "CVE-2024-45312", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-9f8a2d1b597df98c6680", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__overleaf__overleaf", "task_id": "morefixes-9f8a2d1b597df98c6680", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-9f8a2d1b597df98c6680"}
|
| 85 |
+
{"backend": "codeql", "cve_id": "CVE-2025-11222", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-b475f3a535ea41bec3ff", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__line__centraldogma", "task_id": "morefixes-b475f3a535ea41bec3ff", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-b475f3a535ea41bec3ff"}
|
| 86 |
+
{"backend": "codeql", "cve_id": "CVE-2026-10269", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-b61b3848e076036c7b06", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__decolua__9router", "task_id": "morefixes-b61b3848e076036c7b06", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-b61b3848e076036c7b06"}
|
| 87 |
+
{"backend": "codeql", "cve_id": "CVE-2022-39267", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-bd56f8e5b73f132cd962", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__brokercap__bifrost", "task_id": "morefixes-bd56f8e5b73f132cd962", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-bd56f8e5b73f132cd962"}
|
| 88 |
+
{"backend": "codeql", "cve_id": "CVE-2020-7729", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-bd86b40955cabdb21c65", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__gruntjs__grunt", "task_id": "morefixes-bd86b40955cabdb21c65", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-bd86b40955cabdb21c65"}
|
| 89 |
+
{"backend": "codeql", "cve_id": "CVE-2023-37259", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-f1044573e0d15a82a1d0", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__matrix-org__matrix-react-sdk", "task_id": "morefixes-f1044573e0d15a82a1d0", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-f1044573e0d15a82a1d0"}
|
| 90 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21679", "dataset": "codeql_javascript_benchmark_top30_v1", "environment_id": "codeql_javascript_benchmark_top30_v1/morefixes-f37103ca8d19c93116f8", "group": "CodeQL javascript", "language": "javascript", "project_id": "morefixes__jenkinsci__azure-ad-plugin", "task_id": "morefixes-f37103ca8d19c93116f8", "task_path": "codeql_javascript_benchmark_top30_v1/tasks/morefixes-f37103ca8d19c93116f8"}
|
| 91 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21371", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-03252773bde39ba37465", "group": "CodeQL python", "language": "python", "project_id": "pyvul__tenable__integration-jira-cloud", "task_id": "pyvul-03252773bde39ba37465", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-03252773bde39ba37465"}
|
| 92 |
+
{"backend": "codeql", "cve_id": "CVE-2023-6977", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-07332271886167133edf", "group": "CodeQL python", "language": "python", "project_id": "pyvul__mlflow__mlflow", "task_id": "pyvul-07332271886167133edf", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-07332271886167133edf"}
|
| 93 |
+
{"backend": "codeql", "cve_id": "CVE-2020-12889", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-0e38a9079f90a5ac566e", "group": "CodeQL python", "language": "python", "project_id": "pyvul__misp__misp-maltego", "task_id": "pyvul-0e38a9079f90a5ac566e", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-0e38a9079f90a5ac566e"}
|
| 94 |
+
{"backend": "codeql", "cve_id": "CVE-2023-30629", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-10fb77265dc23f305315", "group": "CodeQL python", "language": "python", "project_id": "pyvul__vyperlang__vyper", "task_id": "pyvul-10fb77265dc23f305315", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-10fb77265dc23f305315"}
|
| 95 |
+
{"backend": "codeql", "cve_id": "CVE-2019-3830", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-135c7fcada946877931a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__openstack__ceilometer", "task_id": "pyvul-135c7fcada946877931a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-135c7fcada946877931a"}
|
| 96 |
+
{"backend": "codeql", "cve_id": "CVE-2020-10799", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-15c0ad3037992bda1b19", "group": "CodeQL python", "language": "python", "project_id": "pyvul__deeplook__svglib", "task_id": "pyvul-15c0ad3037992bda1b19", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-15c0ad3037992bda1b19"}
|
| 97 |
+
{"backend": "codeql", "cve_id": "CVE-2022-0736", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-1a630dd8f83b2e29740d", "group": "CodeQL python", "language": "python", "project_id": "pyvul__mlflow__mlflow", "task_id": "pyvul-1a630dd8f83b2e29740d", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-1a630dd8f83b2e29740d"}
|
| 98 |
+
{"backend": "codeql", "cve_id": "CVE-2022-42965", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-1f5068a3fe5ca0192a07", "group": "CodeQL python", "language": "python", "project_id": "pyvul__snowflakedb__snowflake-connector-python", "task_id": "pyvul-1f5068a3fe5ca0192a07", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-1f5068a3fe5ca0192a07"}
|
| 99 |
+
{"backend": "codeql", "cve_id": "CVE-2021-46898", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-2ab65d62986b80922362", "group": "CodeQL python", "language": "python", "project_id": "pyvul__sehmaschine__django-grappelli", "task_id": "pyvul-2ab65d62986b80922362", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-2ab65d62986b80922362"}
|
| 100 |
+
{"backend": "codeql", "cve_id": "CVE-2023-48224", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-3062589ff0b3b95c2ed7", "group": "CodeQL python", "language": "python", "project_id": "pyvul__ethyca__fides", "task_id": "pyvul-3062589ff0b3b95c2ed7", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-3062589ff0b3b95c2ed7"}
|
| 101 |
+
{"backend": "codeql", "cve_id": "CVE-2020-19001", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-3187445bcbbf39128a26", "group": "CodeQL python", "language": "python", "project_id": "pyvul__tankywoo__simiki", "task_id": "pyvul-3187445bcbbf39128a26", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-3187445bcbbf39128a26"}
|
| 102 |
+
{"backend": "codeql", "cve_id": "CVE-2022-0845", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-36a40541d7c74a9a7777", "group": "CodeQL python", "language": "python", "project_id": "pyvul__pytorchlightning__pytorch-lightning", "task_id": "pyvul-36a40541d7c74a9a7777", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-36a40541d7c74a9a7777"}
|
| 103 |
+
{"backend": "codeql", "cve_id": "CVE-2023-6395", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-3819b1a7530257524a75", "group": "CodeQL python", "language": "python", "project_id": "pyvul__xsuchy__templated-dictionary", "task_id": "pyvul-3819b1a7530257524a75", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-3819b1a7530257524a75"}
|
| 104 |
+
{"backend": "codeql", "cve_id": "CVE-2020-29128", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-394adf7b067d96b356ca", "group": "CodeQL python", "language": "python", "project_id": "pyvul__petl-developers__petl", "task_id": "pyvul-394adf7b067d96b356ca", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-394adf7b067d96b356ca"}
|
| 105 |
+
{"backend": "codeql", "cve_id": "CVE-2021-41127", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-3994e3622b21c396ef8a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__rasahq__rasa", "task_id": "pyvul-3994e3622b21c396ef8a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-3994e3622b21c396ef8a"}
|
| 106 |
+
{"backend": "codeql", "cve_id": "CVE-2014-1932", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-4954e5890cce23c8b03d", "group": "CodeQL python", "language": "python", "project_id": "pyvul__python-imaging__pillow", "task_id": "pyvul-4954e5890cce23c8b03d", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-4954e5890cce23c8b03d"}
|
| 107 |
+
{"backend": "codeql", "cve_id": "CVE-2023-48700", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-4ac3440b9023e6511a91", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nautobot__nautobot-plugin-device-onboarding", "task_id": "pyvul-4ac3440b9023e6511a91", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-4ac3440b9023e6511a91"}
|
| 108 |
+
{"backend": "codeql", "cve_id": "CVE-2021-4315", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-4e31b8fba29687b8d792", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nyuccl__psiturk", "task_id": "pyvul-4e31b8fba29687b8d792", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-4e31b8fba29687b8d792"}
|
| 109 |
+
{"backend": "codeql", "cve_id": "CVE-2021-32839", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-509b1de3e2277ac89469", "group": "CodeQL python", "language": "python", "project_id": "pyvul__andialbrecht__sqlparse", "task_id": "pyvul-509b1de3e2277ac89469", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-509b1de3e2277ac89469"}
|
| 110 |
+
{"backend": "codeql", "cve_id": "CVE-2022-23530", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-533cc1a8c090c7529184", "group": "CodeQL python", "language": "python", "project_id": "pyvul__datadog__guarddog", "task_id": "pyvul-533cc1a8c090c7529184", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-533cc1a8c090c7529184"}
|
| 111 |
+
{"backend": "codeql", "cve_id": "CVE-2023-34540", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-5cffd45f7550a060e2cf", "group": "CodeQL python", "language": "python", "project_id": "pyvul__langchain-ai__langchain", "task_id": "pyvul-5cffd45f7550a060e2cf", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-5cffd45f7550a060e2cf"}
|
| 112 |
+
{"backend": "codeql", "cve_id": "CVE-2022-0315", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-6b5cf1b92b87b04c09cd", "group": "CodeQL python", "language": "python", "project_id": "pyvul__horovod__horovod", "task_id": "pyvul-6b5cf1b92b87b04c09cd", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-6b5cf1b92b87b04c09cd"}
|
| 113 |
+
{"backend": "codeql", "cve_id": "CVE-2021-23393", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-796a152aa965ce44a6db", "group": "CodeQL python", "language": "python", "project_id": "pyvul__briancappello__flask-unchained", "task_id": "pyvul-796a152aa965ce44a6db", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-796a152aa965ce44a6db"}
|
| 114 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21274", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-7c3c693e688548564c9a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__matrix-org__synapse", "task_id": "pyvul-7c3c693e688548564c9a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-7c3c693e688548564c9a"}
|
| 115 |
+
{"backend": "codeql", "cve_id": "CVE-2017-16616", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-7c7eaf17f0df49603ae4", "group": "CodeQL python", "language": "python", "project_id": "pyvul__stranger6667__pyanyapi", "task_id": "pyvul-7c7eaf17f0df49603ae4", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-7c7eaf17f0df49603ae4"}
|
| 116 |
+
{"backend": "codeql", "cve_id": "CVE-2018-25082", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-810ace2bf3e4aa0f04a1", "group": "CodeQL python", "language": "python", "project_id": "pyvul__zwczou__weixin-python", "task_id": "pyvul-810ace2bf3e4aa0f04a1", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-810ace2bf3e4aa0f04a1"}
|
| 117 |
+
{"backend": "codeql", "cve_id": "CVE-2022-31605", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-812f35b535c5e549929b", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nvidia__nvflare", "task_id": "pyvul-812f35b535c5e549929b", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-812f35b535c5e549929b"}
|
| 118 |
+
{"backend": "codeql", "cve_id": "CVE-2013-4260", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-8297e406660c92268ba5", "group": "CodeQL python", "language": "python", "project_id": "pyvul__ansible__ansible", "task_id": "pyvul-8297e406660c92268ba5", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-8297e406660c92268ba5"}
|
| 119 |
+
{"backend": "codeql", "cve_id": "CVE-2022-36082", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-89a9ff0f9cf4f2f4cc91", "group": "CodeQL python", "language": "python", "project_id": "pyvul__mansuf__mangadex-downloader", "task_id": "pyvul-89a9ff0f9cf4f2f4cc91", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-89a9ff0f9cf4f2f4cc91"}
|
| 120 |
+
{"backend": "codeql", "cve_id": "CVE-2020-15239", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-8e39d07d2ff863a3f19e", "group": "CodeQL python", "language": "python", "project_id": "pyvul__horazont__xmpp-http-upload", "task_id": "pyvul-8e39d07d2ff863a3f19e", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-8e39d07d2ff863a3f19e"}
|
| 121 |
+
{"backend": "codeql", "cve_id": "CVE-2023-29159", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-8f3613497f18d5cf2684", "group": "CodeQL python", "language": "python", "project_id": "pyvul__encode__starlette", "task_id": "pyvul-8f3613497f18d5cf2684", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-8f3613497f18d5cf2684"}
|
| 122 |
+
{"backend": "codeql", "cve_id": "CVE-2019-11340", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-98fc634e79976d5b5241", "group": "CodeQL python", "language": "python", "project_id": "pyvul__matrix-org__sydent", "task_id": "pyvul-98fc634e79976d5b5241", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-98fc634e79976d5b5241"}
|
| 123 |
+
{"backend": "codeql", "cve_id": "CVE-2019-14806", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-9ba7c665889bf20611cb", "group": "CodeQL python", "language": "python", "project_id": "pyvul__pallets__werkzeug", "task_id": "pyvul-9ba7c665889bf20611cb", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-9ba7c665889bf20611cb"}
|
| 124 |
+
{"backend": "codeql", "cve_id": "CVE-2023-49277", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-9c089aba2c203455d420", "group": "CodeQL python", "language": "python", "project_id": "pyvul__darrenofficial__dpaste", "task_id": "pyvul-9c089aba2c203455d420", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-9c089aba2c203455d420"}
|
| 125 |
+
{"backend": "codeql", "cve_id": "CVE-2020-15120", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-9dcb85347ac437354c6f", "group": "CodeQL python", "language": "python", "project_id": "pyvul__spiral-project__ihatemoney", "task_id": "pyvul-9dcb85347ac437354c6f", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-9dcb85347ac437354c6f"}
|
| 126 |
+
{"backend": "codeql", "cve_id": "CVE-2022-3301", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-a2d122cb9e3a61ddca7a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__ikus060__rdiffweb", "task_id": "pyvul-a2d122cb9e3a61ddca7a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-a2d122cb9e3a61ddca7a"}
|
| 127 |
+
{"backend": "codeql", "cve_id": "CVE-2020-35653", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-a44d900bae2c75f9ea8d", "group": "CodeQL python", "language": "python", "project_id": "pyvul__python-pillow__pillow", "task_id": "pyvul-a44d900bae2c75f9ea8d", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-a44d900bae2c75f9ea8d"}
|
| 128 |
+
{"backend": "codeql", "cve_id": "CVE-2021-34363", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-b10e0389c54d164db5b4", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nvbn__thefuck", "task_id": "pyvul-b10e0389c54d164db5b4", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-b10e0389c54d164db5b4"}
|
| 129 |
+
{"backend": "codeql", "cve_id": "CVE-2014-1938", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-b5417e7c5b6909a4c5f9", "group": "CodeQL python", "language": "python", "project_id": "pyvul__alex__rply", "task_id": "pyvul-b5417e7c5b6909a4c5f9", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-b5417e7c5b6909a4c5f9"}
|
| 130 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21360", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-bae2a9b05bba64edb040", "group": "CodeQL python", "language": "python", "project_id": "pyvul__zopefoundation__products.genericsetup", "task_id": "pyvul-bae2a9b05bba64edb040", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-bae2a9b05bba64edb040"}
|
| 131 |
+
{"backend": "codeql", "cve_id": "CVE-2022-24302", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-bf4aded7c76d99f9ef84", "group": "CodeQL python", "language": "python", "project_id": "pyvul__paramiko__paramiko", "task_id": "pyvul-bf4aded7c76d99f9ef84", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-bf4aded7c76d99f9ef84"}
|
| 132 |
+
{"backend": "codeql", "cve_id": "CVE-2021-43854", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-c4ca067f7fd871d25376", "group": "CodeQL python", "language": "python", "project_id": "pyvul__nltk__nltk", "task_id": "pyvul-c4ca067f7fd871d25376", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-c4ca067f7fd871d25376"}
|
| 133 |
+
{"backend": "codeql", "cve_id": "CVE-2023-2800", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-c52f0447bb0aa65cf9a4", "group": "CodeQL python", "language": "python", "project_id": "pyvul__huggingface__transformers", "task_id": "pyvul-c52f0447bb0aa65cf9a4", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-c52f0447bb0aa65cf9a4"}
|
| 134 |
+
{"backend": "codeql", "cve_id": "CVE-2022-4724", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-cb3f3f84ff4550031205", "group": "CodeQL python", "language": "python", "project_id": "pyvul__ikus060__rdiffweb", "task_id": "pyvul-cb3f3f84ff4550031205", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-cb3f3f84ff4550031205"}
|
| 135 |
+
{"backend": "codeql", "cve_id": "CVE-2023-49080", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-d005a7cf5935ac7e7aae", "group": "CodeQL python", "language": "python", "project_id": "pyvul__jupyter-server__jupyter_server", "task_id": "pyvul-d005a7cf5935ac7e7aae", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-d005a7cf5935ac7e7aae"}
|
| 136 |
+
{"backend": "codeql", "cve_id": "CVE-2021-21386", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-d38a3c1956e86350a0c7", "group": "CodeQL python", "language": "python", "project_id": "pyvul__dwisiswant0__apkleaks", "task_id": "pyvul-d38a3c1956e86350a0c7", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-d38a3c1956e86350a0c7"}
|
| 137 |
+
{"backend": "codeql", "cve_id": "CVE-2023-5002", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-dbcc9a178b256c49887e", "group": "CodeQL python", "language": "python", "project_id": "pyvul__pgadmin-org__pgadmin4", "task_id": "pyvul-dbcc9a178b256c49887e", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-dbcc9a178b256c49887e"}
|
| 138 |
+
{"backend": "codeql", "cve_id": "CVE-2023-38201", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-e305522c703de57f9ede", "group": "CodeQL python", "language": "python", "project_id": "pyvul__keylime__keylime", "task_id": "pyvul-e305522c703de57f9ede", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-e305522c703de57f9ede"}
|
| 139 |
+
{"backend": "codeql", "cve_id": "CVE-2023-45139", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-e73df8c8998a1ddc180a", "group": "CodeQL python", "language": "python", "project_id": "pyvul__fonttools__fonttools", "task_id": "pyvul-e73df8c8998a1ddc180a", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-e73df8c8998a1ddc180a"}
|
| 140 |
+
{"backend": "codeql", "cve_id": "CVE-2021-39229", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-f55f7c013a9f5bd1eb0d", "group": "CodeQL python", "language": "python", "project_id": "pyvul__caronc__apprise", "task_id": "pyvul-f55f7c013a9f5bd1eb0d", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-f55f7c013a9f5bd1eb0d"}
|
| 141 |
+
{"backend": "codeql", "cve_id": "CVE-2023-45813", "dataset": "codeql_python_benchmark51_v2", "environment_id": "codeql_python_benchmark51_v2/pyvul-ff1e02f88768f34e43fb", "group": "CodeQL python", "language": "python", "project_id": "pyvul__dedsecinside__torbot", "task_id": "pyvul-ff1e02f88768f34e43fb", "task_path": "codeql_python_benchmark51_v2/tasks/pyvul-ff1e02f88768f34e43fb"}
|
| 142 |
+
{"backend": "csa", "cve_id": "CVE-2014-0749", "dataset": "csa159", "environment_id": "csa159/pair_134585", "group": "CSA", "language": "c/c++", "project_id": "adaptivecomputing_torque", "task_id": "pair_134585", "task_path": "csa159/tasks/pair_134585"}
|
| 143 |
+
{"backend": "csa", "cve_id": "CVE-2017-8911", "dataset": "csa159", "environment_id": "csa159/pair_135745", "group": "CSA", "language": "c/c++", "project_id": "verdammelt_tnef", "task_id": "pair_135745", "task_path": "csa159/tasks/pair_135745"}
|
| 144 |
+
{"backend": "csa", "cve_id": "CVE-2014-8127", "dataset": "csa159", "environment_id": "csa159/pair_136342", "group": "CSA", "language": "c/c++", "project_id": "vadz_libtiff", "task_id": "pair_136342", "task_path": "csa159/tasks/pair_136342"}
|
| 145 |
+
{"backend": "csa", "cve_id": "CVE-2019-9893", "dataset": "csa159", "environment_id": "csa159/pair_137674", "group": "CSA", "language": "c/c++", "project_id": "seccomp_libseccomp", "task_id": "pair_137674", "task_path": "csa159/tasks/pair_137674"}
|
| 146 |
+
{"backend": "csa", "cve_id": "CVE-2014-5388", "dataset": "csa159", "environment_id": "csa159/pair_137782", "group": "CSA", "language": "c/c++", "project_id": "qemu_qemu", "task_id": "pair_137782", "task_path": "csa159/tasks/pair_137782"}
|
| 147 |
+
{"backend": "csa", "cve_id": "CVE-2026-9501", "dataset": "csa159", "environment_id": "csa159/pair_138263", "group": "CSA", "language": "c/c++", "project_id": "LibreDWG_libredwg", "task_id": "pair_138263", "task_path": "csa159/tasks/pair_138263"}
|
| 148 |
+
{"backend": "csa", "cve_id": "CVE-2019-20022", "dataset": "csa159", "environment_id": "csa159/pair_138473", "group": "CSA", "language": "c/c++", "project_id": "saitoha_libsixel", "task_id": "pair_138473", "task_path": "csa159/tasks/pair_138473"}
|
| 149 |
+
{"backend": "csa", "cve_id": "CVE-2026-33165", "dataset": "csa159", "environment_id": "csa159/pair_138511", "group": "CSA", "language": "c/c++", "project_id": "strukturag_libde265", "task_id": "pair_138511", "task_path": "csa159/tasks/pair_138511"}
|
| 150 |
+
{"backend": "csa", "cve_id": "CVE-2025-48367", "dataset": "csa159", "environment_id": "csa159/pair_138570", "group": "CSA", "language": "c/c++", "project_id": "redis_redis", "task_id": "pair_138570", "task_path": "csa159/tasks/pair_138570"}
|
| 151 |
+
{"backend": "csa", "cve_id": "CVE-2024-25269", "dataset": "csa159", "environment_id": "csa159/pair_138644", "group": "CSA", "language": "c/c++", "project_id": "strukturag_libheif", "task_id": "pair_138644", "task_path": "csa159/tasks/pair_138644"}
|
| 152 |
+
{"backend": "csa", "cve_id": "CVE-2025-62171", "dataset": "csa159", "environment_id": "csa159/pair_138710", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick", "task_id": "pair_138710", "task_path": "csa159/tasks/pair_138710"}
|
| 153 |
+
{"backend": "csa", "cve_id": "CVE-2022-48923", "dataset": "csa159", "environment_id": "csa159/pair_139922", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_139922", "task_path": "csa159/tasks/pair_139922"}
|
| 154 |
+
{"backend": "csa", "cve_id": "CVE-2022-49375", "dataset": "csa159", "environment_id": "csa159/pair_140347", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_140347", "task_path": "csa159/tasks/pair_140347"}
|
| 155 |
+
{"backend": "csa", "cve_id": "CVE-2022-50419", "dataset": "csa159", "environment_id": "csa159/pair_141329", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141329", "task_path": "csa159/tasks/pair_141329"}
|
| 156 |
+
{"backend": "csa", "cve_id": "CVE-2023-53148", "dataset": "csa159", "environment_id": "csa159/pair_142288", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_142288", "task_path": "csa159/tasks/pair_142288"}
|
| 157 |
+
{"backend": "csa", "cve_id": "CVE-2023-53532", "dataset": "csa159", "environment_id": "csa159/pair_142647", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_142647", "task_path": "csa159/tasks/pair_142647"}
|
| 158 |
+
{"backend": "csa", "cve_id": "CVE-2025-38226", "dataset": "csa159", "environment_id": "csa159/pair_147034", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147034", "task_path": "csa159/tasks/pair_147034"}
|
| 159 |
+
{"backend": "csa", "cve_id": "CVE-2025-39773", "dataset": "csa159", "environment_id": "csa159/pair_147640", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147640", "task_path": "csa159/tasks/pair_147640"}
|
| 160 |
+
{"backend": "csa", "cve_id": "CVE-2025-39810", "dataset": "csa159", "environment_id": "csa159/pair_147676", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147676", "task_path": "csa159/tasks/pair_147676"}
|
| 161 |
+
{"backend": "csa", "cve_id": "CVE-2025-71146", "dataset": "csa159", "environment_id": "csa159/pair_148601", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_148601", "task_path": "csa159/tasks/pair_148601"}
|
| 162 |
+
{"backend": "csa", "cve_id": "CVE-2026-23111", "dataset": "csa159", "environment_id": "csa159/pair_148834", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_148834", "task_path": "csa159/tasks/pair_148834"}
|
| 163 |
+
{"backend": "csa", "cve_id": "CVE-2026-31747", "dataset": "csa159", "environment_id": "csa159/pair_149548", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149548", "task_path": "csa159/tasks/pair_149548"}
|
| 164 |
+
{"backend": "csa", "cve_id": "CVE-2026-43054", "dataset": "csa159", "environment_id": "csa159/pair_149640", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149640", "task_path": "csa159/tasks/pair_149640"}
|
| 165 |
+
{"backend": "csa", "cve_id": "CVE-2026-43166", "dataset": "csa159", "environment_id": "csa159/pair_149751", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149751", "task_path": "csa159/tasks/pair_149751"}
|
| 166 |
+
{"backend": "csa", "cve_id": "CVE-2026-43185", "dataset": "csa159", "environment_id": "csa159/pair_149770", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149770", "task_path": "csa159/tasks/pair_149770"}
|
| 167 |
+
{"backend": "csa", "cve_id": "CVE-2026-45863", "dataset": "csa159", "environment_id": "csa159/pair_150111", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150111", "task_path": "csa159/tasks/pair_150111"}
|
| 168 |
+
{"backend": "csa", "cve_id": "CVE-2026-46001", "dataset": "csa159", "environment_id": "csa159/pair_150247", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150247", "task_path": "csa159/tasks/pair_150247"}
|
| 169 |
+
{"backend": "csa", "cve_id": "CVE-2026-46180", "dataset": "csa159", "environment_id": "csa159/pair_150426", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150426", "task_path": "csa159/tasks/pair_150426"}
|
| 170 |
+
{"backend": "csa", "cve_id": "CVE-2022-48730", "dataset": "csa159", "environment_id": "csa159/pair_156745", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156745", "task_path": "csa159/tasks/pair_156745"}
|
| 171 |
+
{"backend": "csa", "cve_id": "CVE-2021-42252", "dataset": "csa159", "environment_id": "csa159/pair_157090", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_157090", "task_path": "csa159/tasks/pair_157090"}
|
| 172 |
+
{"backend": "csa", "cve_id": "CVE-2022-50010", "dataset": "csa159", "environment_id": "csa159/pair_157305", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_157305", "task_path": "csa159/tasks/pair_157305"}
|
| 173 |
+
{"backend": "csa", "cve_id": "CVE-2025-38692", "dataset": "csa159", "environment_id": "csa159/pair_157307", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_157307", "task_path": "csa159/tasks/pair_157307"}
|
| 174 |
+
{"backend": "csa", "cve_id": "CVE-2022-48634", "dataset": "csa159", "environment_id": "csa159/pair_158826", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158826", "task_path": "csa159/tasks/pair_158826"}
|
| 175 |
+
{"backend": "csa", "cve_id": "CVE-2021-47437", "dataset": "csa159", "environment_id": "csa159/pair_159680", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_159680", "task_path": "csa159/tasks/pair_159680"}
|
| 176 |
+
{"backend": "csa", "cve_id": "CVE-2024-26811", "dataset": "csa159", "environment_id": "csa159/pair_161551", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161551", "task_path": "csa159/tasks/pair_161551"}
|
| 177 |
+
{"backend": "csa", "cve_id": "CVE-2026-23299", "dataset": "csa159", "environment_id": "csa159/pair_161587", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161587", "task_path": "csa159/tasks/pair_161587"}
|
| 178 |
+
{"backend": "csa", "cve_id": "CVE-2020-28374", "dataset": "csa159", "environment_id": "csa159/pair_162518", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162518", "task_path": "csa159/tasks/pair_162518"}
|
| 179 |
+
{"backend": "csa", "cve_id": "CVE-2024-26954", "dataset": "csa159", "environment_id": "csa159/pair_162526", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162526", "task_path": "csa159/tasks/pair_162526"}
|
| 180 |
+
{"backend": "csa", "cve_id": "CVE-2023-53166", "dataset": "csa159", "environment_id": "csa159/pair_162993", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162993", "task_path": "csa159/tasks/pair_162993"}
|
| 181 |
+
{"backend": "csa", "cve_id": "CVE-2022-49639", "dataset": "csa159", "environment_id": "csa159/pair_163682", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163682", "task_path": "csa159/tasks/pair_163682"}
|
| 182 |
+
{"backend": "csa", "cve_id": "CVE-2024-38384", "dataset": "csa159", "environment_id": "csa159/pair_164279", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164279", "task_path": "csa159/tasks/pair_164279"}
|
| 183 |
+
{"backend": "csa", "cve_id": "CVE-2025-21719", "dataset": "csa159", "environment_id": "csa159/pair_164760", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164760", "task_path": "csa159/tasks/pair_164760"}
|
| 184 |
+
{"backend": "csa", "cve_id": "CVE-2025-37780", "dataset": "csa159", "environment_id": "csa159/pair_165550", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_165550", "task_path": "csa159/tasks/pair_165550"}
|
| 185 |
+
{"backend": "csa", "cve_id": "CVE-2019-11338", "dataset": "csa159", "environment_id": "csa159/pair_17613", "group": "CSA", "language": "c/c++", "project_id": "FFmpeg_FFmpeg", "task_id": "pair_17613", "task_path": "csa159/tasks/pair_17613"}
|
| 186 |
+
{"backend": "csa", "cve_id": "CVE-2023-39562", "dataset": "csa159", "environment_id": "csa159/pair_4253", "group": "CSA", "language": "c/c++", "project_id": "gpac_gpac", "task_id": "pair_4253", "task_path": "csa159/tasks/pair_4253"}
|
| 187 |
+
{"backend": "csa", "cve_id": "CVE-2017-7866", "dataset": "csa159", "environment_id": "csa159/pair_4869", "group": "CSA", "language": "c/c++", "project_id": "FFmpeg_FFmpeg", "task_id": "pair_4869", "task_path": "csa159/tasks/pair_4869"}
|
| 188 |
+
{"backend": "csa", "cve_id": "CVE-2020-9365", "dataset": "csa159", "environment_id": "csa159/pair_134943", "group": "CSA", "language": "c/c++", "project_id": "jedisct1_pure-ftpd", "task_id": "pair_134943", "task_path": "csa159/tasks/pair_134943"}
|
| 189 |
+
{"backend": "csa", "cve_id": "CVE-2016-5824", "dataset": "csa159", "environment_id": "csa159/pair_135175", "group": "CSA", "language": "c/c++", "project_id": "libical_libical", "task_id": "pair_135175", "task_path": "csa159/tasks/pair_135175"}
|
| 190 |
+
{"backend": "csa", "cve_id": "CVE-2020-26148", "dataset": "csa159", "environment_id": "csa159/pair_135384", "group": "CSA", "language": "c/c++", "project_id": "mity_md4c", "task_id": "pair_135384", "task_path": "csa159/tasks/pair_135384"}
|
| 191 |
+
{"backend": "csa", "cve_id": "CVE-2018-1000091", "dataset": "csa159", "environment_id": "csa159/pair_135405", "group": "CSA", "language": "c/c++", "project_id": "mwarning_KadNode", "task_id": "pair_135405", "task_path": "csa159/tasks/pair_135405"}
|
| 192 |
+
{"backend": "csa", "cve_id": "CVE-2021-33930", "dataset": "csa159", "environment_id": "csa159/pair_135446", "group": "CSA", "language": "c/c++", "project_id": "openSUSE_libsolv", "task_id": "pair_135446", "task_path": "csa159/tasks/pair_135446"}
|
| 193 |
+
{"backend": "csa", "cve_id": "CVE-2018-19826", "dataset": "csa159", "environment_id": "csa159/pair_135624", "group": "CSA", "language": "c/c++", "project_id": "sass_libsass", "task_id": "pair_135624", "task_path": "csa159/tasks/pair_135624"}
|
| 194 |
+
{"backend": "csa", "cve_id": "CVE-2017-6309", "dataset": "csa159", "environment_id": "csa159/pair_135749", "group": "CSA", "language": "c/c++", "project_id": "verdammelt_tnef", "task_id": "pair_135749", "task_path": "csa159/tasks/pair_135749"}
|
| 195 |
+
{"backend": "csa", "cve_id": "CVE-2020-11764", "dataset": "csa159", "environment_id": "csa159/pair_136251", "group": "CSA", "language": "c/c++", "project_id": "openexr_openexr", "task_id": "pair_136251", "task_path": "csa159/tasks/pair_136251"}
|
| 196 |
+
{"backend": "csa", "cve_id": "CVE-2020-11764", "dataset": "csa159", "environment_id": "csa159/pair_136252", "group": "CSA", "language": "c/c++", "project_id": "openexr_openexr", "task_id": "pair_136252", "task_path": "csa159/tasks/pair_136252"}
|
| 197 |
+
{"backend": "csa", "cve_id": "CVE-2023-3745", "dataset": "csa159", "environment_id": "csa159/pair_136864", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick6", "task_id": "pair_136864", "task_path": "csa159/tasks/pair_136864"}
|
| 198 |
+
{"backend": "csa", "cve_id": "CVE-2017-5627", "dataset": "csa159", "environment_id": "csa159/pair_137200", "group": "CSA", "language": "c/c++", "project_id": "ccxvii_mujs", "task_id": "pair_137200", "task_path": "csa159/tasks/pair_137200"}
|
| 199 |
+
{"backend": "csa", "cve_id": "CVE-2020-23306", "dataset": "csa159", "environment_id": "csa159/pair_137357", "group": "CSA", "language": "c/c++", "project_id": "jerryscript-project_jerryscript", "task_id": "pair_137357", "task_path": "csa159/tasks/pair_137357"}
|
| 200 |
+
{"backend": "csa", "cve_id": "CVE-2021-46349", "dataset": "csa159", "environment_id": "csa159/pair_137374", "group": "CSA", "language": "c/c++", "project_id": "jerryscript-project_jerryscript", "task_id": "pair_137374", "task_path": "csa159/tasks/pair_137374"}
|
| 201 |
+
{"backend": "csa", "cve_id": "CVE-2020-23312", "dataset": "csa159", "environment_id": "csa159/pair_137377", "group": "CSA", "language": "c/c++", "project_id": "jerryscript-project_jerryscript", "task_id": "pair_137377", "task_path": "csa159/tasks/pair_137377"}
|
| 202 |
+
{"backend": "csa", "cve_id": "CVE-2021-46350", "dataset": "csa159", "environment_id": "csa159/pair_137389", "group": "CSA", "language": "c/c++", "project_id": "jerryscript-project_jerryscript", "task_id": "pair_137389", "task_path": "csa159/tasks/pair_137389"}
|
| 203 |
+
{"backend": "csa", "cve_id": "CVE-2019-19795", "dataset": "csa159", "environment_id": "csa159/pair_137518", "group": "CSA", "language": "c/c++", "project_id": "michaelforney_samurai", "task_id": "pair_137518", "task_path": "csa159/tasks/pair_137518"}
|
| 204 |
+
{"backend": "csa", "cve_id": "CVE-2014-0146", "dataset": "csa159", "environment_id": "csa159/pair_137750", "group": "CSA", "language": "c/c++", "project_id": "qemu_qemu", "task_id": "pair_137750", "task_path": "csa159/tasks/pair_137750"}
|
| 205 |
+
{"backend": "csa", "cve_id": "CVE-2018-16847", "dataset": "csa159", "environment_id": "csa159/pair_137751", "group": "CSA", "language": "c/c++", "project_id": "qemu_qemu", "task_id": "pair_137751", "task_path": "csa159/tasks/pair_137751"}
|
| 206 |
+
{"backend": "csa", "cve_id": "CVE-2018-17963", "dataset": "csa159", "environment_id": "csa159/pair_137769", "group": "CSA", "language": "c/c++", "project_id": "qemu_qemu", "task_id": "pair_137769", "task_path": "csa159/tasks/pair_137769"}
|
| 207 |
+
{"backend": "csa", "cve_id": "CVE-2019-20396", "dataset": "csa159", "environment_id": "csa159/pair_138126", "group": "CSA", "language": "c/c++", "project_id": "CESNET_libyang", "task_id": "pair_138126", "task_path": "csa159/tasks/pair_138126"}
|
| 208 |
+
{"backend": "csa", "cve_id": "CVE-2026-32854", "dataset": "csa159", "environment_id": "csa159/pair_138203", "group": "CSA", "language": "c/c++", "project_id": "LibVNC_libvncserver", "task_id": "pair_138203", "task_path": "csa159/tasks/pair_138203"}
|
| 209 |
+
{"backend": "csa", "cve_id": "CVE-2020-6611", "dataset": "csa159", "environment_id": "csa159/pair_138249", "group": "CSA", "language": "c/c++", "project_id": "LibreDWG_libredwg", "task_id": "pair_138249", "task_path": "csa159/tasks/pair_138249"}
|
| 210 |
+
{"backend": "csa", "cve_id": "CVE-2021-36080", "dataset": "csa159", "environment_id": "csa159/pair_138280", "group": "CSA", "language": "c/c++", "project_id": "LibreDWG_libredwg", "task_id": "pair_138280", "task_path": "csa159/tasks/pair_138280"}
|
| 211 |
+
{"backend": "csa", "cve_id": "CVE-2019-13115", "dataset": "csa159", "environment_id": "csa159/pair_138328", "group": "CSA", "language": "c/c++", "project_id": "libssh2_libssh2", "task_id": "pair_138328", "task_path": "csa159/tasks/pair_138328"}
|
| 212 |
+
{"backend": "csa", "cve_id": "CVE-2024-28319", "dataset": "csa159", "environment_id": "csa159/pair_138462", "group": "CSA", "language": "c/c++", "project_id": "gpac_gpac", "task_id": "pair_138462", "task_path": "csa159/tasks/pair_138462"}
|
| 213 |
+
{"backend": "csa", "cve_id": "CVE-2018-21232", "dataset": "csa159", "environment_id": "csa159/pair_138485", "group": "CSA", "language": "c/c++", "project_id": "skvadrik_re2c", "task_id": "pair_138485", "task_path": "csa159/tasks/pair_138485"}
|
| 214 |
+
{"backend": "csa", "cve_id": "CVE-2016-1924", "dataset": "csa159", "environment_id": "csa159/pair_138650", "group": "CSA", "language": "c/c++", "project_id": "uclouvain_openjpeg", "task_id": "pair_138650", "task_path": "csa159/tasks/pair_138650"}
|
| 215 |
+
{"backend": "csa", "cve_id": "CVE-2026-40169", "dataset": "csa159", "environment_id": "csa159/pair_138728", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick", "task_id": "pair_138728", "task_path": "csa159/tasks/pair_138728"}
|
| 216 |
+
{"backend": "csa", "cve_id": "CVE-2025-46393", "dataset": "csa159", "environment_id": "csa159/pair_138746", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick", "task_id": "pair_138746", "task_path": "csa159/tasks/pair_138746"}
|
| 217 |
+
{"backend": "csa", "cve_id": "CVE-2026-33905", "dataset": "csa159", "environment_id": "csa159/pair_138756", "group": "CSA", "language": "c/c++", "project_id": "ImageMagick_ImageMagick", "task_id": "pair_138756", "task_path": "csa159/tasks/pair_138756"}
|
| 218 |
+
{"backend": "csa", "cve_id": "CVE-2011-2161", "dataset": "csa159", "environment_id": "csa159/pair_138800", "group": "CSA", "language": "c/c++", "project_id": "FFmpeg_FFmpeg", "task_id": "pair_138800", "task_path": "csa159/tasks/pair_138800"}
|
| 219 |
+
{"backend": "csa", "cve_id": "CVE-2021-47583", "dataset": "csa159", "environment_id": "csa159/pair_139579", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_139579", "task_path": "csa159/tasks/pair_139579"}
|
| 220 |
+
{"backend": "csa", "cve_id": "CVE-2022-49563", "dataset": "csa159", "environment_id": "csa159/pair_140531", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_140531", "task_path": "csa159/tasks/pair_140531"}
|
| 221 |
+
{"backend": "csa", "cve_id": "CVE-2022-49727", "dataset": "csa159", "environment_id": "csa159/pair_140691", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_140691", "task_path": "csa159/tasks/pair_140691"}
|
| 222 |
+
{"backend": "csa", "cve_id": "CVE-2022-50138", "dataset": "csa159", "environment_id": "csa159/pair_141072", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141072", "task_path": "csa159/tasks/pair_141072"}
|
| 223 |
+
{"backend": "csa", "cve_id": "CVE-2022-50374", "dataset": "csa159", "environment_id": "csa159/pair_141289", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141289", "task_path": "csa159/tasks/pair_141289"}
|
| 224 |
+
{"backend": "csa", "cve_id": "CVE-2022-50459", "dataset": "csa159", "environment_id": "csa159/pair_141364", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141364", "task_path": "csa159/tasks/pair_141364"}
|
| 225 |
+
{"backend": "csa", "cve_id": "CVE-2023-52471", "dataset": "csa159", "environment_id": "csa159/pair_141754", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141754", "task_path": "csa159/tasks/pair_141754"}
|
| 226 |
+
{"backend": "csa", "cve_id": "CVE-2023-52609", "dataset": "csa159", "environment_id": "csa159/pair_141857", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_141857", "task_path": "csa159/tasks/pair_141857"}
|
| 227 |
+
{"backend": "csa", "cve_id": "CVE-2023-53250", "dataset": "csa159", "environment_id": "csa159/pair_142376", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_142376", "task_path": "csa159/tasks/pair_142376"}
|
| 228 |
+
{"backend": "csa", "cve_id": "CVE-2023-53679", "dataset": "csa159", "environment_id": "csa159/pair_142793", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_142793", "task_path": "csa159/tasks/pair_142793"}
|
| 229 |
+
{"backend": "csa", "cve_id": "CVE-2024-26927", "dataset": "csa159", "environment_id": "csa159/pair_143586", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_143586", "task_path": "csa159/tasks/pair_143586"}
|
| 230 |
+
{"backend": "csa", "cve_id": "CVE-2024-38628", "dataset": "csa159", "environment_id": "csa159/pair_144169", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_144169", "task_path": "csa159/tasks/pair_144169"}
|
| 231 |
+
{"backend": "csa", "cve_id": "CVE-2024-53117", "dataset": "csa159", "environment_id": "csa159/pair_145442", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145442", "task_path": "csa159/tasks/pair_145442"}
|
| 232 |
+
{"backend": "csa", "cve_id": "CVE-2024-53203", "dataset": "csa159", "environment_id": "csa159/pair_145527", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145527", "task_path": "csa159/tasks/pair_145527"}
|
| 233 |
+
{"backend": "csa", "cve_id": "CVE-2024-56605", "dataset": "csa159", "environment_id": "csa159/pair_145663", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145663", "task_path": "csa159/tasks/pair_145663"}
|
| 234 |
+
{"backend": "csa", "cve_id": "CVE-2024-57953", "dataset": "csa159", "environment_id": "csa159/pair_145933", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145933", "task_path": "csa159/tasks/pair_145933"}
|
| 235 |
+
{"backend": "csa", "cve_id": "CVE-2024-57996", "dataset": "csa159", "environment_id": "csa159/pair_145957", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_145957", "task_path": "csa159/tasks/pair_145957"}
|
| 236 |
+
{"backend": "csa", "cve_id": "CVE-2024-58065", "dataset": "csa159", "environment_id": "csa159/pair_146000", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_146000", "task_path": "csa159/tasks/pair_146000"}
|
| 237 |
+
{"backend": "csa", "cve_id": "CVE-2025-21986", "dataset": "csa159", "environment_id": "csa159/pair_146389", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_146389", "task_path": "csa159/tasks/pair_146389"}
|
| 238 |
+
{"backend": "csa", "cve_id": "CVE-2025-38415", "dataset": "csa159", "environment_id": "csa159/pair_147222", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147222", "task_path": "csa159/tasks/pair_147222"}
|
| 239 |
+
{"backend": "csa", "cve_id": "CVE-2025-38459", "dataset": "csa159", "environment_id": "csa159/pair_147266", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_147266", "task_path": "csa159/tasks/pair_147266"}
|
| 240 |
+
{"backend": "csa", "cve_id": "CVE-2025-40313", "dataset": "csa159", "environment_id": "csa159/pair_148175", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_148175", "task_path": "csa159/tasks/pair_148175"}
|
| 241 |
+
{"backend": "csa", "cve_id": "CVE-2026-43160", "dataset": "csa159", "environment_id": "csa159/pair_149745", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149745", "task_path": "csa159/tasks/pair_149745"}
|
| 242 |
+
{"backend": "csa", "cve_id": "CVE-2026-43249", "dataset": "csa159", "environment_id": "csa159/pair_149834", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149834", "task_path": "csa159/tasks/pair_149834"}
|
| 243 |
+
{"backend": "csa", "cve_id": "CVE-2026-43376", "dataset": "csa159", "environment_id": "csa159/pair_149959", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_149959", "task_path": "csa159/tasks/pair_149959"}
|
| 244 |
+
{"backend": "csa", "cve_id": "CVE-2026-46045", "dataset": "csa159", "environment_id": "csa159/pair_150291", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150291", "task_path": "csa159/tasks/pair_150291"}
|
| 245 |
+
{"backend": "csa", "cve_id": "CVE-2026-46090", "dataset": "csa159", "environment_id": "csa159/pair_150336", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_150336", "task_path": "csa159/tasks/pair_150336"}
|
| 246 |
+
{"backend": "csa", "cve_id": "CVE-2022-49007", "dataset": "csa159", "environment_id": "csa159/pair_156097", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156097", "task_path": "csa159/tasks/pair_156097"}
|
| 247 |
+
{"backend": "csa", "cve_id": "CVE-2024-42272", "dataset": "csa159", "environment_id": "csa159/pair_156217", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156217", "task_path": "csa159/tasks/pair_156217"}
|
| 248 |
+
{"backend": "csa", "cve_id": "CVE-2023-52505", "dataset": "csa159", "environment_id": "csa159/pair_156267", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156267", "task_path": "csa159/tasks/pair_156267"}
|
| 249 |
+
{"backend": "csa", "cve_id": "CVE-2024-26664", "dataset": "csa159", "environment_id": "csa159/pair_156473", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156473", "task_path": "csa159/tasks/pair_156473"}
|
| 250 |
+
{"backend": "csa", "cve_id": "CVE-2025-38568", "dataset": "csa159", "environment_id": "csa159/pair_156640", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156640", "task_path": "csa159/tasks/pair_156640"}
|
| 251 |
+
{"backend": "csa", "cve_id": "CVE-2023-53057", "dataset": "csa159", "environment_id": "csa159/pair_156704", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156704", "task_path": "csa159/tasks/pair_156704"}
|
| 252 |
+
{"backend": "csa", "cve_id": "CVE-2023-52865", "dataset": "csa159", "environment_id": "csa159/pair_156860", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156860", "task_path": "csa159/tasks/pair_156860"}
|
| 253 |
+
{"backend": "csa", "cve_id": "CVE-2022-48818", "dataset": "csa159", "environment_id": "csa159/pair_156981", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_156981", "task_path": "csa159/tasks/pair_156981"}
|
| 254 |
+
{"backend": "csa", "cve_id": "CVE-2022-49519", "dataset": "csa159", "environment_id": "csa159/pair_157153", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_157153", "task_path": "csa159/tasks/pair_157153"}
|
| 255 |
+
{"backend": "csa", "cve_id": "CVE-2022-48665", "dataset": "csa159", "environment_id": "csa159/pair_158138", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158138", "task_path": "csa159/tasks/pair_158138"}
|
| 256 |
+
{"backend": "csa", "cve_id": "CVE-2026-53322", "dataset": "csa159", "environment_id": "csa159/pair_158217", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158217", "task_path": "csa159/tasks/pair_158217"}
|
| 257 |
+
{"backend": "csa", "cve_id": "CVE-2022-50131", "dataset": "csa159", "environment_id": "csa159/pair_158385", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158385", "task_path": "csa159/tasks/pair_158385"}
|
| 258 |
+
{"backend": "csa", "cve_id": "CVE-2023-1078", "dataset": "csa159", "environment_id": "csa159/pair_158831", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_158831", "task_path": "csa159/tasks/pair_158831"}
|
| 259 |
+
{"backend": "csa", "cve_id": "CVE-2022-49208", "dataset": "csa159", "environment_id": "csa159/pair_159264", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_159264", "task_path": "csa159/tasks/pair_159264"}
|
| 260 |
+
{"backend": "csa", "cve_id": "CVE-2024-36899", "dataset": "csa159", "environment_id": "csa159/pair_159377", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_159377", "task_path": "csa159/tasks/pair_159377"}
|
| 261 |
+
{"backend": "csa", "cve_id": "CVE-2025-37812", "dataset": "csa159", "environment_id": "csa159/pair_160021", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160021", "task_path": "csa159/tasks/pair_160021"}
|
| 262 |
+
{"backend": "csa", "cve_id": "CVE-2023-52569", "dataset": "csa159", "environment_id": "csa159/pair_160187", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160187", "task_path": "csa159/tasks/pair_160187"}
|
| 263 |
+
{"backend": "csa", "cve_id": "CVE-2023-52603", "dataset": "csa159", "environment_id": "csa159/pair_160364", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160364", "task_path": "csa159/tasks/pair_160364"}
|
| 264 |
+
{"backend": "csa", "cve_id": "CVE-2023-28464", "dataset": "csa159", "environment_id": "csa159/pair_160434", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160434", "task_path": "csa159/tasks/pair_160434"}
|
| 265 |
+
{"backend": "csa", "cve_id": "CVE-2025-38129", "dataset": "csa159", "environment_id": "csa159/pair_160451", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160451", "task_path": "csa159/tasks/pair_160451"}
|
| 266 |
+
{"backend": "csa", "cve_id": "CVE-2024-45017", "dataset": "csa159", "environment_id": "csa159/pair_160603", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160603", "task_path": "csa159/tasks/pair_160603"}
|
| 267 |
+
{"backend": "csa", "cve_id": "CVE-2022-49123", "dataset": "csa159", "environment_id": "csa159/pair_160628", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160628", "task_path": "csa159/tasks/pair_160628"}
|
| 268 |
+
{"backend": "csa", "cve_id": "CVE-2024-41059", "dataset": "csa159", "environment_id": "csa159/pair_160904", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160904", "task_path": "csa159/tasks/pair_160904"}
|
| 269 |
+
{"backend": "csa", "cve_id": "CVE-2024-42242", "dataset": "csa159", "environment_id": "csa159/pair_160912", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_160912", "task_path": "csa159/tasks/pair_160912"}
|
| 270 |
+
{"backend": "csa", "cve_id": "CVE-2024-26585", "dataset": "csa159", "environment_id": "csa159/pair_161027", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161027", "task_path": "csa159/tasks/pair_161027"}
|
| 271 |
+
{"backend": "csa", "cve_id": "CVE-2024-38593", "dataset": "csa159", "environment_id": "csa159/pair_161598", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161598", "task_path": "csa159/tasks/pair_161598"}
|
| 272 |
+
{"backend": "csa", "cve_id": "CVE-2024-26583", "dataset": "csa159", "environment_id": "csa159/pair_161667", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161667", "task_path": "csa159/tasks/pair_161667"}
|
| 273 |
+
{"backend": "csa", "cve_id": "CVE-2025-21811", "dataset": "csa159", "environment_id": "csa159/pair_161782", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161782", "task_path": "csa159/tasks/pair_161782"}
|
| 274 |
+
{"backend": "csa", "cve_id": "CVE-2023-52843", "dataset": "csa159", "environment_id": "csa159/pair_161997", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_161997", "task_path": "csa159/tasks/pair_161997"}
|
| 275 |
+
{"backend": "csa", "cve_id": "CVE-2023-53827", "dataset": "csa159", "environment_id": "csa159/pair_162003", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162003", "task_path": "csa159/tasks/pair_162003"}
|
| 276 |
+
{"backend": "csa", "cve_id": "CVE-2022-4095", "dataset": "csa159", "environment_id": "csa159/pair_162331", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162331", "task_path": "csa159/tasks/pair_162331"}
|
| 277 |
+
{"backend": "csa", "cve_id": "CVE-2022-48735", "dataset": "csa159", "environment_id": "csa159/pair_162535", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162535", "task_path": "csa159/tasks/pair_162535"}
|
| 278 |
+
{"backend": "csa", "cve_id": "CVE-2021-47032", "dataset": "csa159", "environment_id": "csa159/pair_162672", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162672", "task_path": "csa159/tasks/pair_162672"}
|
| 279 |
+
{"backend": "csa", "cve_id": "CVE-2024-36016", "dataset": "csa159", "environment_id": "csa159/pair_162700", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_162700", "task_path": "csa159/tasks/pair_162700"}
|
| 280 |
+
{"backend": "csa", "cve_id": "CVE-2024-39509", "dataset": "csa159", "environment_id": "csa159/pair_163294", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163294", "task_path": "csa159/tasks/pair_163294"}
|
| 281 |
+
{"backend": "csa", "cve_id": "CVE-2025-38150", "dataset": "csa159", "environment_id": "csa159/pair_163698", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163698", "task_path": "csa159/tasks/pair_163698"}
|
| 282 |
+
{"backend": "csa", "cve_id": "CVE-2024-36484", "dataset": "csa159", "environment_id": "csa159/pair_163737", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163737", "task_path": "csa159/tasks/pair_163737"}
|
| 283 |
+
{"backend": "csa", "cve_id": "CVE-2023-39194", "dataset": "csa159", "environment_id": "csa159/pair_163761", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163761", "task_path": "csa159/tasks/pair_163761"}
|
| 284 |
+
{"backend": "csa", "cve_id": "CVE-2025-68337", "dataset": "csa159", "environment_id": "csa159/pair_163824", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163824", "task_path": "csa159/tasks/pair_163824"}
|
| 285 |
+
{"backend": "csa", "cve_id": "CVE-2024-56584", "dataset": "csa159", "environment_id": "csa159/pair_163861", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163861", "task_path": "csa159/tasks/pair_163861"}
|
| 286 |
+
{"backend": "csa", "cve_id": "CVE-2023-45863", "dataset": "csa159", "environment_id": "csa159/pair_163978", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_163978", "task_path": "csa159/tasks/pair_163978"}
|
| 287 |
+
{"backend": "csa", "cve_id": "CVE-2023-52435", "dataset": "csa159", "environment_id": "csa159/pair_164140", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164140", "task_path": "csa159/tasks/pair_164140"}
|
| 288 |
+
{"backend": "csa", "cve_id": "CVE-2022-48893", "dataset": "csa159", "environment_id": "csa159/pair_164624", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164624", "task_path": "csa159/tasks/pair_164624"}
|
| 289 |
+
{"backend": "csa", "cve_id": "CVE-2021-47109", "dataset": "csa159", "environment_id": "csa159/pair_164920", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164920", "task_path": "csa159/tasks/pair_164920"}
|
| 290 |
+
{"backend": "csa", "cve_id": "CVE-2023-52623", "dataset": "csa159", "environment_id": "csa159/pair_164974", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_164974", "task_path": "csa159/tasks/pair_164974"}
|
| 291 |
+
{"backend": "csa", "cve_id": "CVE-2022-28796", "dataset": "csa159", "environment_id": "csa159/pair_165542", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_165542", "task_path": "csa159/tasks/pair_165542"}
|
| 292 |
+
{"backend": "csa", "cve_id": "CVE-2022-49580", "dataset": "csa159", "environment_id": "csa159/pair_165655", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_165655", "task_path": "csa159/tasks/pair_165655"}
|
| 293 |
+
{"backend": "csa", "cve_id": "CVE-2023-45863", "dataset": "csa159", "environment_id": "csa159/pair_165738", "group": "CSA", "language": "c/c++", "project_id": "torvalds_linux", "task_id": "pair_165738", "task_path": "csa159/tasks/pair_165738"}
|
| 294 |
+
{"backend": "csa", "cve_id": "CVE-2021-40572", "dataset": "csa159", "environment_id": "csa159/pair_3538", "group": "CSA", "language": "c/c++", "project_id": "gpac_gpac", "task_id": "pair_3538", "task_path": "csa159/tasks/pair_3538"}
|
| 295 |
+
{"backend": "csa", "cve_id": "CVE-2020-36138", "dataset": "csa159", "environment_id": "csa159/pair_4701", "group": "CSA", "language": "c/c++", "project_id": "FFmpeg_FFmpeg", "task_id": "pair_4701", "task_path": "csa159/tasks/pair_4701"}
|
| 296 |
+
{"backend": "csa", "cve_id": "CVE-2020-11096", "dataset": "csa159", "environment_id": "csa159/pair_6060", "group": "CSA", "language": "c/c++", "project_id": "FreeRDP_FreeRDP", "task_id": "pair_6060", "task_path": "csa159/tasks/pair_6060"}
|
| 297 |
+
{"backend": "csa", "cve_id": "CVE-2018-8784", "dataset": "csa159", "environment_id": "csa159/pair_6105", "group": "CSA", "language": "c/c++", "project_id": "FreeRDP_FreeRDP", "task_id": "pair_6105", "task_path": "csa159/tasks/pair_6105"}
|
| 298 |
+
{"backend": "csa", "cve_id": "CVE-2020-11038", "dataset": "csa159", "environment_id": "csa159/pair_6132", "group": "CSA", "language": "c/c++", "project_id": "FreeRDP_FreeRDP", "task_id": "pair_6132", "task_path": "csa159/tasks/pair_6132"}
|
| 299 |
+
{"backend": "csa", "cve_id": "CVE-2016-5418", "dataset": "csa159", "environment_id": "csa159/pair_7278", "group": "CSA", "language": "c/c++", "project_id": "libarchive_libarchive", "task_id": "pair_7278", "task_path": "csa159/tasks/pair_7278"}
|
| 300 |
+
{"backend": "csa", "cve_id": "CVE-2013-0211", "dataset": "csa159", "environment_id": "csa159/pair_7287", "group": "CSA", "language": "c/c++", "project_id": "libarchive_libarchive", "task_id": "pair_7287", "task_path": "csa159/tasks/pair_7287"}
|
docs/environment.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Runtime environment
|
| 2 |
+
|
| 3 |
+
The release contains **300 tasks: CSA 159 and CodeQL 141**. All provided archives use neutral names and reproducible file metadata.
|
| 4 |
+
|
| 5 |
+
## Toolchain
|
| 6 |
+
|
| 7 |
+
Import the provided Docker archive with `scripts/restore.py --load-image`. The image is tagged `checkerbench-runtime:review-v1` and targets Linux amd64. Toolchain versions are listed in `environment/versions.json`.
|
| 8 |
+
|
| 9 |
+
The image contains LLVM/Clang, CodeQL, language dependencies, the Python environment, and the MCP adapter needed for task preparation and scanning. Model-service credentials are supplied separately by the operator.
|
| 10 |
+
|
| 11 |
+
## Task preparation
|
| 12 |
+
|
| 13 |
+
`scripts/prepare.py` accepts only tasks in the release roster. It creates writable workspaces from the bundled task inputs and captured runtime assets. It rewrites the scan paths for the requested workspace and applies the source-evidenced compiler compatibility adjustments recorded in `runtime-adjustments.json`.
|
| 14 |
+
|
| 15 |
+
CSA workspaces share immutable Git objects with the extracted dataset. Keep `/data` mounted at the same path when reopening them. CodeQL copies its before, after, and refinement databases into the writable output directory.
|
| 16 |
+
|
| 17 |
+
## Refinement assets
|
| 18 |
+
|
| 19 |
+
CSA source snapshots, refinement overlays, compilation databases, and restoration scripts are included. Full refinement restoration is available through:
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
python /data/csa159/scripts/rehydrate_benchmark_env.py \
|
| 23 |
+
--pair-id 134943 --output-workdir /work/refinement-example
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
Some captured refinement assets use absolute symbolic links or generated build files. Their original source-relative mappings must be preserved when restoring those environments. Before/after workspace checks and full refinement replay have separate validation scopes; `reports/validation.json` identifies the checks actually performed.
|
| 27 |
+
|
| 28 |
+
## Integrity
|
| 29 |
+
|
| 30 |
+
Each dataset archive contains `integrity.json`, which hashes regular files and records symbolic-link targets. `release-manifest.json` additionally records complete archive and split-part SHA-256 checksums.
|
| 31 |
+
|
| 32 |
+
The reviewer distribution retains task inputs, executable runtime assets, reference implementations, and evaluation evidence. Operator run logs, account configurations, and trajectory administration records are omitted. Upstream project source files and licenses retain their original content.
|
environment/versions.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"platform": "linux/amd64",
|
| 3 |
+
"image": "checkerbench-runtime:review-v1",
|
| 4 |
+
"ubuntu": "24.04",
|
| 5 |
+
"llvm": "18.1.8",
|
| 6 |
+
"codeql": "2.26.4",
|
| 7 |
+
"jdk": "17",
|
| 8 |
+
"gcc": "11",
|
| 9 |
+
"node": "22.23.1",
|
| 10 |
+
"python": "3.12"
|
| 11 |
+
}
|
release-manifest.json
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 1,
|
| 3 |
+
"tag": "checkerbench-300-v1",
|
| 4 |
+
"task_count": 300,
|
| 5 |
+
"packages": [
|
| 6 |
+
{
|
| 7 |
+
"key": "codeql_go_benchmark_top30_v1",
|
| 8 |
+
"kind": "dataset",
|
| 9 |
+
"archive": "codeql_go_benchmark_top30_v1.tar.gz",
|
| 10 |
+
"bytes": 1255620410,
|
| 11 |
+
"sha256": "f1c061beb65d425414f8d20938b8918e521c6c908a706cbcdab2db568e269bd2",
|
| 12 |
+
"parts": [
|
| 13 |
+
{
|
| 14 |
+
"name": "codeql_go_benchmark_top30_v1.tar.gz",
|
| 15 |
+
"bytes": 1255620410,
|
| 16 |
+
"sha256": "f1c061beb65d425414f8d20938b8918e521c6c908a706cbcdab2db568e269bd2"
|
| 17 |
+
}
|
| 18 |
+
],
|
| 19 |
+
"root": "codeql_go_benchmark_top30_v1",
|
| 20 |
+
"task_count": 30
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"key": "codeql_java_benchmark_top30_v2",
|
| 24 |
+
"kind": "dataset",
|
| 25 |
+
"archive": "codeql_java_benchmark_top30_v2.tar.gz",
|
| 26 |
+
"bytes": 258511734,
|
| 27 |
+
"sha256": "94584869e15e944bdf4b48df044debff02a4607a60ba360ccc9db554037595bb",
|
| 28 |
+
"parts": [
|
| 29 |
+
{
|
| 30 |
+
"name": "codeql_java_benchmark_top30_v2.tar.gz",
|
| 31 |
+
"bytes": 258511734,
|
| 32 |
+
"sha256": "94584869e15e944bdf4b48df044debff02a4607a60ba360ccc9db554037595bb"
|
| 33 |
+
}
|
| 34 |
+
],
|
| 35 |
+
"root": "codeql_java_benchmark_top30_v2",
|
| 36 |
+
"task_count": 30
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"key": "codeql_javascript_benchmark_top30_v1",
|
| 40 |
+
"kind": "dataset",
|
| 41 |
+
"archive": "codeql_javascript_benchmark_top30_v1.tar.gz",
|
| 42 |
+
"bytes": 2879812908,
|
| 43 |
+
"sha256": "57bacbb732adfd1afc499afb561604afbffbd54f6b74c0fe7ec49c3432652292",
|
| 44 |
+
"parts": [
|
| 45 |
+
{
|
| 46 |
+
"name": "codeql_javascript_benchmark_top30_v1.tar.gz.part000",
|
| 47 |
+
"bytes": 1572864000,
|
| 48 |
+
"sha256": "229fcbf134d2df605599a341245bef39dbce57d44b3e15a612bedb2e2fc21607"
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"name": "codeql_javascript_benchmark_top30_v1.tar.gz.part001",
|
| 52 |
+
"bytes": 1306948908,
|
| 53 |
+
"sha256": "f47cfe368d0f645445f5abc4b35c900640f0e97f5303a3e4704dce2178421183"
|
| 54 |
+
}
|
| 55 |
+
],
|
| 56 |
+
"root": "codeql_javascript_benchmark_top30_v1",
|
| 57 |
+
"task_count": 30
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"key": "codeql_python_benchmark51_v2",
|
| 61 |
+
"kind": "dataset",
|
| 62 |
+
"archive": "codeql_python_benchmark51_v2.tar.gz",
|
| 63 |
+
"bytes": 1652172553,
|
| 64 |
+
"sha256": "167a9b7225a969fe5a053a7bdbda59765bc97beaf6ec8fef09ba7257fbd2c4c6",
|
| 65 |
+
"parts": [
|
| 66 |
+
{
|
| 67 |
+
"name": "codeql_python_benchmark51_v2.tar.gz.part000",
|
| 68 |
+
"bytes": 1572864000,
|
| 69 |
+
"sha256": "c19e99879456b637ded3ad3b8b524f0d7cf29d81af261fdb5d1086e57d7ae78c"
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"name": "codeql_python_benchmark51_v2.tar.gz.part001",
|
| 73 |
+
"bytes": 79308553,
|
| 74 |
+
"sha256": "37c12d1e099d89f65fdcb69677adca1e9f94e35f7372fb89ae92ea6dcee72d42"
|
| 75 |
+
}
|
| 76 |
+
],
|
| 77 |
+
"root": "codeql_python_benchmark51_v2",
|
| 78 |
+
"task_count": 51
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"key": "csa159",
|
| 82 |
+
"kind": "dataset",
|
| 83 |
+
"archive": "checkerbench-csa159.tar.gz",
|
| 84 |
+
"bytes": 5195950032,
|
| 85 |
+
"sha256": "9700929add77ea04bd171fb0946ae9910e6d1a14067199ce7e10d232d647366f",
|
| 86 |
+
"parts": [
|
| 87 |
+
{
|
| 88 |
+
"name": "checkerbench-csa159.tar.gz.part000",
|
| 89 |
+
"bytes": 1572864000,
|
| 90 |
+
"sha256": "7fddb3afd80e67d8eec2694e9704e24e65ce318dfb5d1260b8058dbc84c23830"
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"name": "checkerbench-csa159.tar.gz.part001",
|
| 94 |
+
"bytes": 1572864000,
|
| 95 |
+
"sha256": "0615ba64af1cb7e526c741eca523c1dd2a98ef9214b4834e229c92f7d6113706"
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"name": "checkerbench-csa159.tar.gz.part002",
|
| 99 |
+
"bytes": 1572864000,
|
| 100 |
+
"sha256": "54d83cf819a8d0777f1bcded9848cfe96605a7201878cbc563205880ab5ae85a"
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"name": "checkerbench-csa159.tar.gz.part003",
|
| 104 |
+
"bytes": 477358032,
|
| 105 |
+
"sha256": "b483ff23fcb3a303032ce2f7956e3e5280849491d917d8e565333077b818ba43"
|
| 106 |
+
}
|
| 107 |
+
],
|
| 108 |
+
"root": "csa159",
|
| 109 |
+
"task_count": 159
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"key": "environment",
|
| 113 |
+
"kind": "docker-image",
|
| 114 |
+
"archive": "checkerbench-environment-linux-amd64.tar.gz",
|
| 115 |
+
"bytes": 2046492607,
|
| 116 |
+
"sha256": "1c7778d6e92e5acd97469d644ff81c4bf4cb8819205794c6c98111c38c0c63f7",
|
| 117 |
+
"parts": [
|
| 118 |
+
{
|
| 119 |
+
"name": "checkerbench-environment-linux-amd64.tar.gz.part000",
|
| 120 |
+
"bytes": 1572864000,
|
| 121 |
+
"sha256": "6dcc402d563e599525e9fb748244d754a983a48318ec6c871a85cfa18c854976"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"name": "checkerbench-environment-linux-amd64.tar.gz.part001",
|
| 125 |
+
"bytes": 473628607,
|
| 126 |
+
"sha256": "976c8e16a733cd76540f5374756c155a122edef44585b0eea12589d6f0ac09b9"
|
| 127 |
+
}
|
| 128 |
+
],
|
| 129 |
+
"image": "checkerbench-runtime:review-v1",
|
| 130 |
+
"image_id": "sha256:6b6aff6ee4502aac70a6d518965fa63a8953483ff506a5cbd8d7b06faa18f9b6",
|
| 131 |
+
"platform": "linux/amd64"
|
| 132 |
+
}
|
| 133 |
+
]
|
| 134 |
+
}
|
reports/archive-validation.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"task_count": 300,
|
| 3 |
+
"packages": [
|
| 4 |
+
{
|
| 5 |
+
"package": "codeql_go_benchmark_top30_v1",
|
| 6 |
+
"task_count": 30,
|
| 7 |
+
"regular_files": 30505,
|
| 8 |
+
"logical_bytes": 2962723420,
|
| 9 |
+
"file_checksums_verified": true,
|
| 10 |
+
"fixture_task": "morefixes-02cb4e0a6c5aaabd6a78"
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"package": "codeql_java_benchmark_top30_v2",
|
| 14 |
+
"task_count": 30,
|
| 15 |
+
"regular_files": 42278,
|
| 16 |
+
"logical_bytes": 957672106,
|
| 17 |
+
"file_checksums_verified": true,
|
| 18 |
+
"fixture_task": "morefixes-02f75a63a6f0b8d6c6c7"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"package": "codeql_javascript_benchmark_top30_v1",
|
| 22 |
+
"task_count": 30,
|
| 23 |
+
"regular_files": 48500,
|
| 24 |
+
"logical_bytes": 6232335624,
|
| 25 |
+
"file_checksums_verified": true,
|
| 26 |
+
"fixture_task": "morefixes-040d724ca8211a3aaf1d"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"package": "codeql_python_benchmark51_v2",
|
| 30 |
+
"task_count": 51,
|
| 31 |
+
"regular_files": 69002,
|
| 32 |
+
"logical_bytes": 5307115528,
|
| 33 |
+
"file_checksums_verified": true,
|
| 34 |
+
"fixture_task": "pyvul-03252773bde39ba37465"
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"package": "csa159",
|
| 38 |
+
"task_count": 159,
|
| 39 |
+
"regular_files": 185075,
|
| 40 |
+
"logical_bytes": 12551690467,
|
| 41 |
+
"file_checksums_verified": true,
|
| 42 |
+
"fixture_task": "pair_134943"
|
| 43 |
+
}
|
| 44 |
+
]
|
| 45 |
+
}
|
reports/huggingface-validation.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"task_count": 300,
|
| 3 |
+
"backend_counts": {
|
| 4 |
+
"codeql": 141,
|
| 5 |
+
"csa": 159
|
| 6 |
+
},
|
| 7 |
+
"language_counts": {
|
| 8 |
+
"go": 30,
|
| 9 |
+
"java": 30,
|
| 10 |
+
"javascript": 30,
|
| 11 |
+
"python": 51,
|
| 12 |
+
"c/c++": 159
|
| 13 |
+
},
|
| 14 |
+
"parquet_roundtrip": "All fields in all 300 rows match the browsable task inputs",
|
| 15 |
+
"table_columns": [
|
| 16 |
+
"backend",
|
| 17 |
+
"cve_id",
|
| 18 |
+
"dataset",
|
| 19 |
+
"environment_id",
|
| 20 |
+
"group",
|
| 21 |
+
"language",
|
| 22 |
+
"project_id",
|
| 23 |
+
"task_id",
|
| 24 |
+
"task_path",
|
| 25 |
+
"task_prompt",
|
| 26 |
+
"patch",
|
| 27 |
+
"before_context",
|
| 28 |
+
"after_context",
|
| 29 |
+
"task_metadata_json",
|
| 30 |
+
"checker_template"
|
| 31 |
+
],
|
| 32 |
+
"table_sha256": "cf6583507a74e33e53515bfdfd3bfb00acd4878f8e9e3772972e549f4fdfdf4e"
|
| 33 |
+
}
|
reports/privacy-check.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"operator_identity_matches": [],
|
| 3 |
+
"task_count": 300,
|
| 4 |
+
"git_history": "Single neutral-author commit",
|
| 5 |
+
"archive_headers": "Neutral uid/gid and fixed mtimes",
|
| 6 |
+
"operator_logs_and_account_configuration": "omitted",
|
| 7 |
+
"upstream_source_and_license_notices": "preserved"
|
| 8 |
+
}
|
reports/validation.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"task_count": 300,
|
| 3 |
+
"backend_counts": {
|
| 4 |
+
"csa": 159,
|
| 5 |
+
"codeql": 141
|
| 6 |
+
},
|
| 7 |
+
"archive_regular_files_verified": 375360,
|
| 8 |
+
"validation_scope": {
|
| 9 |
+
"archive_integrity": "All regular archived files checked against per-file SHA-256 manifests",
|
| 10 |
+
"task_roster": "All 300 task directories checked against the release roster",
|
| 11 |
+
"restoration": "Complete Java archive restored with scripts/restore.py",
|
| 12 |
+
"download": "Java release asset downloaded again and its SHA-256 verified",
|
| 13 |
+
"runtime": "One reference task per backend/language; compilation and before/after scans in the distributed environment"
|
| 14 |
+
},
|
| 15 |
+
"smoke_results": [
|
| 16 |
+
{
|
| 17 |
+
"backend": "codeql",
|
| 18 |
+
"language": "go",
|
| 19 |
+
"task_id": "morefixes-02cb4e0a6c5aaabd6a78",
|
| 20 |
+
"exit_code": 0,
|
| 21 |
+
"passed": true,
|
| 22 |
+
"seconds": 49.1
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"backend": "codeql",
|
| 26 |
+
"language": "java",
|
| 27 |
+
"task_id": "morefixes-02f75a63a6f0b8d6c6c7",
|
| 28 |
+
"exit_code": 0,
|
| 29 |
+
"passed": true,
|
| 30 |
+
"seconds": 34.6
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"backend": "codeql",
|
| 34 |
+
"language": "javascript",
|
| 35 |
+
"task_id": "morefixes-040d724ca8211a3aaf1d",
|
| 36 |
+
"exit_code": 0,
|
| 37 |
+
"passed": true,
|
| 38 |
+
"seconds": 114.0
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"backend": "codeql",
|
| 42 |
+
"language": "python",
|
| 43 |
+
"task_id": "pyvul-03252773bde39ba37465",
|
| 44 |
+
"exit_code": 0,
|
| 45 |
+
"passed": true,
|
| 46 |
+
"seconds": 36.9
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"backend": "csa",
|
| 50 |
+
"language": "c/c++",
|
| 51 |
+
"task_id": "pair_134943",
|
| 52 |
+
"passed": true,
|
| 53 |
+
"exit_code": 0,
|
| 54 |
+
"seconds": 8.0,
|
| 55 |
+
"checker": "security.PureMemcmpOobRead"
|
| 56 |
+
}
|
| 57 |
+
],
|
| 58 |
+
"limitations": [
|
| 59 |
+
"Runtime smoke checks cover 5 representative tasks, not a new complete 300-task score evaluation.",
|
| 60 |
+
"Full CSA refinement replay is not covered by these before/after smoke checks."
|
| 61 |
+
]
|
| 62 |
+
}
|
scripts/download.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Download verified CheckerBench archives from the Hugging Face dataset repository."""
|
| 3 |
+
import argparse
|
| 4 |
+
import hashlib
|
| 5 |
+
import json
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
from huggingface_hub import hf_hub_download
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def valid(path, entry):
|
| 12 |
+
if not path.is_file() or path.stat().st_size != entry["bytes"]:
|
| 13 |
+
return False
|
| 14 |
+
digest = hashlib.sha256()
|
| 15 |
+
with path.open("rb") as stream:
|
| 16 |
+
for block in iter(lambda: stream.read(8 * 1024**2), b""):
|
| 17 |
+
digest.update(block)
|
| 18 |
+
return digest.hexdigest() == entry["sha256"]
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def main():
|
| 22 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 23 |
+
parser.add_argument("--repo", default="Benchanything/checkerbench")
|
| 24 |
+
parser.add_argument("--revision", default="main")
|
| 25 |
+
parser.add_argument("--output", type=Path, default=Path("assets"))
|
| 26 |
+
parser.add_argument("--manifest", type=Path, default=Path(__file__).resolve().parents[1] / "release-manifest.json")
|
| 27 |
+
parser.add_argument("--kind", choices=["all", "dataset", "docker-image"], default="all")
|
| 28 |
+
args = parser.parse_args()
|
| 29 |
+
manifest = json.loads(args.manifest.read_text())
|
| 30 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 31 |
+
for package in manifest["packages"]:
|
| 32 |
+
if args.kind != "all" and package["kind"] != args.kind:
|
| 33 |
+
continue
|
| 34 |
+
for part in package["parts"]:
|
| 35 |
+
target = args.output / part["name"]
|
| 36 |
+
if not valid(target, part):
|
| 37 |
+
downloaded = Path(hf_hub_download(
|
| 38 |
+
repo_id=args.repo,
|
| 39 |
+
repo_type="dataset",
|
| 40 |
+
revision=args.revision,
|
| 41 |
+
filename="assets/" + part["name"],
|
| 42 |
+
local_dir=args.output / ".hub-download",
|
| 43 |
+
))
|
| 44 |
+
if not valid(downloaded, part):
|
| 45 |
+
raise SystemExit("Checksum mismatch: " + part["name"])
|
| 46 |
+
downloaded.replace(target)
|
| 47 |
+
print("verified " + part["name"], flush=True)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
if __name__ == "__main__":
|
| 51 |
+
main()
|
scripts/prepare.py
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Create a writable checker workspace from the immutable benchmark export."""
|
| 3 |
+
import argparse
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import re
|
| 7 |
+
import hashlib
|
| 8 |
+
import shlex
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
import shutil
|
| 11 |
+
import subprocess
|
| 12 |
+
|
| 13 |
+
ROOT = Path(os.environ.get('CHECKERBENCH_DATA_ROOT', '/data'))
|
| 14 |
+
CSA = ROOT / 'csa159'
|
| 15 |
+
CODEQL = os.environ.get('CODEQL_BIN', '/opt/checkerbench/codeql-2.26.4/codeql')
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def restore_rv_monitor_config(worktree):
|
| 19 |
+
"""Restore a missing generated integer from this tree's config evidence."""
|
| 20 |
+
header = worktree/'include/generated/autoconf.h'
|
| 21 |
+
kconfig = worktree/'kernel/trace/rv/Kconfig'
|
| 22 |
+
if not header.is_file() or not kconfig.is_file():
|
| 23 |
+
return None
|
| 24 |
+
text = header.read_text()
|
| 25 |
+
symbol = 'CONFIG_RV_PER_TASK_MONITORS'
|
| 26 |
+
if not re.search(r'^#define CONFIG_RV 1$', text, re.M) or re.search(r'^#define '+symbol+r'\b', text, re.M):
|
| 27 |
+
return None
|
| 28 |
+
source = kconfig.read_text()
|
| 29 |
+
block = re.search(r'(?ms)^config RV_PER_TASK_MONITORS\n(.*?)(?=^(?:config|menuconfig|source|endif|endmenu)\b|\Z)', source)
|
| 30 |
+
if not block or not re.search(r'^[ \t]+depends on RV[ \t]*$', block[1], re.M):
|
| 31 |
+
return None
|
| 32 |
+
bounds = re.findall(r'^[ \t]+range ([0-9]+) ([0-9]+)[ \t]*$', block[1], re.M)
|
| 33 |
+
if not re.search(r'^[ \t]+int(?:[ \t]|$)', block[1], re.M) or len(bounds) != 1:
|
| 34 |
+
return None
|
| 35 |
+
config_path = worktree/'.config'
|
| 36 |
+
config = config_path.read_text() if config_path.is_file() else ''
|
| 37 |
+
explicit = re.search(r'^'+symbol+r'=([^\n]+)$', config, re.M)
|
| 38 |
+
if explicit:
|
| 39 |
+
value_text = explicit[1].strip()
|
| 40 |
+
origin = '.config'
|
| 41 |
+
else:
|
| 42 |
+
defaults = re.findall(r'^[ \t]+default ([^\n]+)$', block[1], re.M)
|
| 43 |
+
if len(defaults) != 1:
|
| 44 |
+
return None
|
| 45 |
+
value_text = defaults[0].strip()
|
| 46 |
+
origin = 'kernel/trace/rv/Kconfig unconditional default'
|
| 47 |
+
if not re.fullmatch(r'[0-9]+', value_text):
|
| 48 |
+
return None
|
| 49 |
+
value = int(value_text)
|
| 50 |
+
if not int(bounds[0][0]) <= value <= int(bounds[0][1]):
|
| 51 |
+
raise RuntimeError('RV monitor configuration outside source Kconfig range')
|
| 52 |
+
updated = text + '\n/* checkerbench replay: restored from this source tree configuration. */\n#define '+symbol+' '+str(value)+'\n'
|
| 53 |
+
header.write_text(updated)
|
| 54 |
+
return dict(kind='restore_rv_monitor_config', worktree=worktree.name, symbol=symbol,
|
| 55 |
+
value=value, value_origin=origin, original_sha256=hashlib.sha256(text.encode()).hexdigest(),
|
| 56 |
+
repaired_sha256=hashlib.sha256(updated.encode()).hexdigest(),
|
| 57 |
+
kconfig_sha256=hashlib.sha256(source.encode()).hexdigest(),
|
| 58 |
+
config_sha256=hashlib.sha256(config.encode()).hexdigest())
|
| 59 |
+
|
| 60 |
+
def restore_linux_anonymous_struct_flags(output):
|
| 61 |
+
"""Restore the required C extension for captured tagged anonymous structs."""
|
| 62 |
+
env_path = output/'scan/envs.json'
|
| 63 |
+
if not env_path.is_file():
|
| 64 |
+
return []
|
| 65 |
+
original_env = env_path.read_text()
|
| 66 |
+
envs = json.loads(original_env)
|
| 67 |
+
required = {}
|
| 68 |
+
for entries in envs.values():
|
| 69 |
+
for entry in entries.values():
|
| 70 |
+
name = Path(entry.get('worktree_path') or entry.get('work_dir') or '').name
|
| 71 |
+
wt = output/'scan/tmp'/name
|
| 72 |
+
makefile = wt/'Makefile'
|
| 73 |
+
header = wt/'include/linux/ns/ns_common_types.h'
|
| 74 |
+
if not makefile.is_file() or not header.is_file():
|
| 75 |
+
continue
|
| 76 |
+
make_text, header_text = makefile.read_text(), header.read_text()
|
| 77 |
+
if (re.search(r'^KBUILD_CFLAGS[ \t]*\+=[ \t]*-fms-extensions[ \t]*$', make_text, re.M)
|
| 78 |
+
and re.search(r'^[ \t]*struct ns_tree;[ \t]*$', header_text, re.M)):
|
| 79 |
+
required[name] = dict(worktree=name, makefile_sha256=hashlib.sha256(make_text.encode()).hexdigest(),
|
| 80 |
+
header_sha256=hashlib.sha256(header_text.encode()).hexdigest())
|
| 81 |
+
if not required:
|
| 82 |
+
return []
|
| 83 |
+
changes = {}
|
| 84 |
+
env_changed = False
|
| 85 |
+
for entries in envs.values():
|
| 86 |
+
for entry in entries.values():
|
| 87 |
+
name = Path(entry.get('worktree_path') or entry.get('work_dir') or '').name
|
| 88 |
+
if name in required and '-fms-extensions' not in shlex.split(entry['compile_flags']):
|
| 89 |
+
entry['compile_flags'] = '-fms-extensions ' + entry['compile_flags']
|
| 90 |
+
env_changed = True
|
| 91 |
+
if env_changed:
|
| 92 |
+
changes[env_path] = (original_env, json.dumps(envs, indent=2)+'\n')
|
| 93 |
+
for path in (output/'scan').glob('*.sh'):
|
| 94 |
+
old = path.read_text()
|
| 95 |
+
lines = []
|
| 96 |
+
for line in old.splitlines(keepends=True):
|
| 97 |
+
if any(name in line for name in required) and '/opt/llvm/bin/clang --analyze' in line and '-fms-extensions' not in line:
|
| 98 |
+
line = line.replace('/opt/llvm/bin/clang --analyze', '/opt/llvm/bin/clang -fms-extensions --analyze')
|
| 99 |
+
lines.append(line)
|
| 100 |
+
new = ''.join(lines)
|
| 101 |
+
if old != new:
|
| 102 |
+
changes[path] = (old, new)
|
| 103 |
+
for path in (output/'scan').glob('flags_*.txt'):
|
| 104 |
+
old = path.read_text()
|
| 105 |
+
if any(name in old for name in required) and '-fms-extensions' not in shlex.split(old):
|
| 106 |
+
changes[path] = (old, '-fms-extensions '+old)
|
| 107 |
+
if not changes:
|
| 108 |
+
return []
|
| 109 |
+
files = []
|
| 110 |
+
for path, (old, new) in changes.items():
|
| 111 |
+
backup = output/'runtime-originals/required-linux-build-flags'/path.name
|
| 112 |
+
backup.parent.mkdir(parents=True, exist_ok=True)
|
| 113 |
+
if not backup.exists():
|
| 114 |
+
backup.write_text(old)
|
| 115 |
+
path.write_text(new)
|
| 116 |
+
files.append(dict(path=str(path.relative_to(output)), original_sha256=hashlib.sha256(old.encode()).hexdigest(),
|
| 117 |
+
repaired_sha256=hashlib.sha256(new.encode()).hexdigest(), backup=str(backup.relative_to(output))))
|
| 118 |
+
return [dict(kind='restore_required_linux_build_flag', flag='-fms-extensions',
|
| 119 |
+
reason='Source Makefile requires this flag for tagged anonymous structs used in ns_common.',
|
| 120 |
+
source_evidence=list(required.values()), files=files)]
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
def repair_csa_runtime(output, project_id):
|
| 124 |
+
"""Apply evidenced compatibility fixes only to writable replay assets."""
|
| 125 |
+
adjustments = []
|
| 126 |
+
if project_id == 'openexr_openexr':
|
| 127 |
+
gcc_dir = '/usr/lib/gcc/x86_64-linux-gnu/11'
|
| 128 |
+
if not Path(gcc_dir).is_dir(): raise RuntimeError('GCC 11 development headers are required for OpenEXR replay')
|
| 129 |
+
for p in (output/'scan').glob('scan_*.sh'):
|
| 130 |
+
text = p.read_text()
|
| 131 |
+
updated = text.replace('/opt/llvm/bin/clang --analyze', f'/opt/llvm/bin/clang --gcc-install-dir={gcc_dir} --analyze')
|
| 132 |
+
if updated != text: p.write_text(updated)
|
| 133 |
+
adjustments.append({'kind':'gcc_header_version','project':project_id,'gcc_install_dir':gcc_dir,'reason':'Old OpenEXR source requires the original GCC 11 C++ header transitive includes.'})
|
| 134 |
+
for wt in (output/'scan/tmp').glob('wt_*'):
|
| 135 |
+
kconfig = wt/'init/Kconfig'
|
| 136 |
+
header = wt/'include/generated/autoconf.h'
|
| 137 |
+
if not kconfig.is_file() or not header.is_file(): continue
|
| 138 |
+
block = re.search(r'(?ms)^config MEMCG\n(.*?)(?=^(?:config|menuconfig|endmenu|endif)\b|\Z)', kconfig.read_text())
|
| 139 |
+
text = header.read_text()
|
| 140 |
+
if block and re.search(r'^\s+select SLAB_OBJ_EXT\s*$', block[1], re.M) and '#define CONFIG_MEMCG 1' in text and not re.search(r'^#define CONFIG_SLAB_OBJ_EXT\b',text,re.M):
|
| 141 |
+
updated = text + '\n/* checkerbench replay: selected by MEMCG in this source tree Kconfig. */\n#define CONFIG_SLAB_OBJ_EXT 1\n'
|
| 142 |
+
header.write_text(updated)
|
| 143 |
+
adjustments.append({'kind':'restore_selected_kconfig_symbol','worktree':wt.name,'symbol':'CONFIG_SLAB_OBJ_EXT','value':1,'reason':'Source init/Kconfig: MEMCG selects SLAB_OBJ_EXT; exported autoconf omitted this required symbol.','original_sha256':hashlib.sha256(text.encode()).hexdigest(),'repaired_sha256':hashlib.sha256(updated.encode()).hexdigest()})
|
| 144 |
+
rv_adjustment = restore_rv_monitor_config(wt)
|
| 145 |
+
if rv_adjustment:
|
| 146 |
+
adjustments.append(rv_adjustment)
|
| 147 |
+
if project_id == 'torvalds_linux':
|
| 148 |
+
adjustments.extend(restore_linux_anonymous_struct_flags(output))
|
| 149 |
+
(output/'runtime-adjustments.json').write_text(json.dumps(adjustments,indent=2))
|
| 150 |
+
return adjustments
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
def prepare_csa(task_id, output, reference=False):
|
| 154 |
+
pair_id = int(task_id.removeprefix('pair_'))
|
| 155 |
+
task_id = f'pair_{pair_id}'
|
| 156 |
+
index = json.loads((CSA / 'runtime/index.json').read_text())
|
| 157 |
+
info = index['pairs'][str(pair_id)]
|
| 158 |
+
selected = next(json.loads(line) for line in (CSA/'selected_results.jsonl').read_text().splitlines() if json.loads(line)['pair_id'] == pair_id)
|
| 159 |
+
task_result = json.loads((CSA/'references'/task_id/'task_result.json').read_text())
|
| 160 |
+
subprocess.run(['python3', str(CSA/'scripts/rehydrate_scan_env.py'), '--pair-id', str(pair_id), '--output-workdir', str(output)], check=True)
|
| 161 |
+
replacements = {task_result['success_workdir']: str(output)}
|
| 162 |
+
for side, side_info in info['sides'].items():
|
| 163 |
+
wt = output/'scan/tmp'/side_info['worktree_basename']
|
| 164 |
+
snap = output/'.benchmark-runtime/snapshots'/side_info['snapshot_key']
|
| 165 |
+
replacements[side_info['original_worktree_path']] = str(wt)
|
| 166 |
+
replacements[side_info['original_snapshot_path']] = str(snap)
|
| 167 |
+
files = list((output/'scan').glob('*.sh')) + list((output/'scan').glob('*.txt')) + [output/'scan/envs.json', output/'config.json']
|
| 168 |
+
files += list((output/'.benchmark-runtime/snapshots').glob('*/compile_commands.json'))
|
| 169 |
+
for path in files:
|
| 170 |
+
if not path.is_file(): continue
|
| 171 |
+
text = path.read_text(errors='replace')
|
| 172 |
+
for old, new in sorted(replacements.items(), key=lambda item: -len(item[0])):
|
| 173 |
+
text = text.replace(old, new)
|
| 174 |
+
path.write_text(text)
|
| 175 |
+
config_path = output/'config.json'
|
| 176 |
+
config = json.loads(config_path.read_text())
|
| 177 |
+
config['repo_path'] = str(output/'scan/tmp'/info['sides']['before']['worktree_basename'])
|
| 178 |
+
config['llvm_build_dir'] = '/opt/llvm'
|
| 179 |
+
config_path.write_text(json.dumps(config, indent=2, ensure_ascii=False))
|
| 180 |
+
repair_csa_runtime(output, config['project_id'])
|
| 181 |
+
(output/'.mcp.json').write_text(json.dumps({'mcpServers': {'csa-tools': {'type':'stdio', 'command':'/opt/checkerbench/venv/bin/python', 'args':['/opt/checkerbench/mcp-server.py'], 'env':{'LLVM_BUILD_DIR':'/opt/llvm','CHECKERBENCH_WORK_ROOT':str(output)}}}}, indent=2))
|
| 182 |
+
if reference:
|
| 183 |
+
shutil.copy2(CSA/selected['reference_success_workdir']/'checker.cpp', output/'checker.cpp')
|
| 184 |
+
(output/'checkerbench-workspace.json').write_text(json.dumps({'backend':'csa','task_id':task_id,'reference_loaded':reference,'llvm_version':'18.1.8'}, indent=2))
|
| 185 |
+
return output
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def prepare_codeql(language, task_id, output, reference=False):
|
| 189 |
+
roots = [p for p in ROOT.glob(f'codeql_{language}_*') if p.is_dir()]
|
| 190 |
+
if len(roots) != 1: raise RuntimeError(f'Expected one benchmark for {language}')
|
| 191 |
+
root = roots[0]
|
| 192 |
+
item = next(t for t in json.loads((root/'manifest.json').read_text())['tasks'] if t['dataset_item_id'] == task_id)
|
| 193 |
+
output.mkdir(parents=True, exist_ok=False)
|
| 194 |
+
task_dir = output/'tasks'/task_id
|
| 195 |
+
shutil.copytree(root/'tasks'/task_id, task_dir)
|
| 196 |
+
# Exported API-search helpers reference the original machine's bundle path.
|
| 197 |
+
for script in (task_dir/'scripts').glob('*.sh'):
|
| 198 |
+
text = script.read_text()
|
| 199 |
+
text = text.replace('/workspace/checkerGym/codeql-tools/codeql-bundle-v2.26.4', str(Path(CODEQL).parent))
|
| 200 |
+
script.write_text(text)
|
| 201 |
+
# Databases are copied: query caches must not modify the exported originals.
|
| 202 |
+
for asset in item['assets'].values():
|
| 203 |
+
relative = Path(asset['database'])
|
| 204 |
+
dest = output/relative
|
| 205 |
+
if not dest.exists():
|
| 206 |
+
dest.parent.mkdir(parents=True,exist_ok=True)
|
| 207 |
+
subprocess.run(['cp','-a','--reflink=auto',str(root/relative),str(dest)],check=True)
|
| 208 |
+
if reference:
|
| 209 |
+
shutil.copytree(root/item['reference']/'query', task_dir/'query', dirs_exist_ok=True)
|
| 210 |
+
(output/'env.sh').write_text(f'export CODEQL_BIN={CODEQL}\nexport LLVM_BUILD_DIR=/opt/llvm\n')
|
| 211 |
+
(output/'checkerbench-workspace.json').write_text(json.dumps({'backend':'codeql','language':language,'task_id':task_id,'reference_loaded':reference,'codeql_version':'2.26.4'},indent=2))
|
| 212 |
+
return task_dir
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def main():
|
| 216 |
+
global ROOT, CSA
|
| 217 |
+
parser=argparse.ArgumentParser(description=__doc__)
|
| 218 |
+
parser.add_argument('backend',choices=['csa','codeql'])
|
| 219 |
+
parser.add_argument('task_id')
|
| 220 |
+
parser.add_argument('--language',choices=['go','java','javascript','python'])
|
| 221 |
+
parser.add_argument('--output',type=Path,required=True)
|
| 222 |
+
parser.add_argument('--data-root', type=Path, default=ROOT)
|
| 223 |
+
parser.add_argument('--roster', type=Path, default=Path(__file__).resolve().parents[1]/'dataset/tasks.jsonl')
|
| 224 |
+
parser.add_argument('--reference',action='store_true',help='Maintainer validation only: copy the successful reference checker into the workspace.')
|
| 225 |
+
args=parser.parse_args();out=args.output.expanduser().resolve()
|
| 226 |
+
ROOT=args.data_root.expanduser().resolve();CSA=ROOT/'csa159'
|
| 227 |
+
rows=[json.loads(line) for line in args.roster.read_text().splitlines() if line.strip()]
|
| 228 |
+
matches=[r for r in rows if r['backend']==args.backend and r['task_id']==args.task_id
|
| 229 |
+
and (args.backend=='csa' or r['language']==args.language)]
|
| 230 |
+
if len(matches)!=1:parser.error('Task is not in the fixed 300-task roster')
|
| 231 |
+
if out.exists():parser.error(f'Output already exists: {out}')
|
| 232 |
+
if args.backend=='codeql' and not args.language:parser.error('--language is required for codeql')
|
| 233 |
+
out.parent.mkdir(parents=True,exist_ok=True)
|
| 234 |
+
if args.backend=='csa':dest=prepare_csa(args.task_id,out,args.reference)
|
| 235 |
+
else:dest=prepare_codeql(args.language,args.task_id,out,args.reference)
|
| 236 |
+
print(f'WORKSPACE={dest}')
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
if __name__=='__main__':main()
|
scripts/restore.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Verify split archives, extract datasets, and optionally import the Docker image."""
|
| 3 |
+
import argparse
|
| 4 |
+
import hashlib
|
| 5 |
+
import io
|
| 6 |
+
import json
|
| 7 |
+
import os
|
| 8 |
+
from pathlib import Path, PurePosixPath
|
| 9 |
+
import shutil
|
| 10 |
+
import subprocess
|
| 11 |
+
import tarfile
|
| 12 |
+
|
| 13 |
+
from download import valid
|
| 14 |
+
|
| 15 |
+
class Parts(io.RawIOBase):
|
| 16 |
+
def __init__(self,paths):
|
| 17 |
+
self.paths=iter(paths);self.current=None
|
| 18 |
+
def readable(self):return True
|
| 19 |
+
def readinto(self,b):
|
| 20 |
+
while True:
|
| 21 |
+
if self.current is None:
|
| 22 |
+
try:self.current=next(self.paths).open('rb')
|
| 23 |
+
except StopIteration:return 0
|
| 24 |
+
n=self.current.readinto(b)
|
| 25 |
+
if n:return n
|
| 26 |
+
self.current.close();self.current=None
|
| 27 |
+
def close(self):
|
| 28 |
+
if self.current:self.current.close()
|
| 29 |
+
super().close()
|
| 30 |
+
|
| 31 |
+
def path_within(base,name,root):
|
| 32 |
+
name=PurePosixPath(name)
|
| 33 |
+
if name.is_absolute() or '..' in name.parts or not name.parts or name.parts[0]!=root:
|
| 34 |
+
raise ValueError('Unexpected archive path: '+str(name))
|
| 35 |
+
path=base/str(name)
|
| 36 |
+
if not path.parent.resolve().is_relative_to(base.resolve()):raise ValueError('External archive parent')
|
| 37 |
+
return path
|
| 38 |
+
|
| 39 |
+
def extract(stream,base,root):
|
| 40 |
+
links=[];directories=[]
|
| 41 |
+
with tarfile.open(fileobj=stream,mode='r|gz') as tar:
|
| 42 |
+
for member in tar:
|
| 43 |
+
target=path_within(base,member.name,root)
|
| 44 |
+
target.parent.mkdir(parents=True,exist_ok=True)
|
| 45 |
+
if member.issym() or member.islnk():links.append(member);continue
|
| 46 |
+
if member.isdir():target.mkdir(exist_ok=True);directories.append((target,member.mode));continue
|
| 47 |
+
if not member.isfile():raise ValueError('Special file in archive: '+member.name)
|
| 48 |
+
with tar.extractfile(member) as src,target.open('xb') as dst:shutil.copyfileobj(src,dst,8*1024**2)
|
| 49 |
+
target.chmod(member.mode & 0o777)
|
| 50 |
+
# Historical absolute symlinks are preserved as data, after all file writes.
|
| 51 |
+
for member in links:
|
| 52 |
+
target=path_within(base,member.name,root)
|
| 53 |
+
if member.issym():target.symlink_to(member.linkname)
|
| 54 |
+
else:
|
| 55 |
+
source=path_within(base,member.linkname,root)
|
| 56 |
+
if source.is_symlink() or not source.is_file():raise ValueError('Invalid hard link')
|
| 57 |
+
os.link(source,target)
|
| 58 |
+
for target,mode in reversed(directories):target.chmod(mode & 0o777)
|
| 59 |
+
|
| 60 |
+
def main():
|
| 61 |
+
p=argparse.ArgumentParser(description=__doc__)
|
| 62 |
+
p.add_argument('--assets',type=Path,default=Path('downloads'))
|
| 63 |
+
p.add_argument('--data',type=Path,default=Path('data'))
|
| 64 |
+
p.add_argument('--manifest',type=Path,default=Path(__file__).resolve().parents[1]/'release-manifest.json')
|
| 65 |
+
p.add_argument('--load-image',action='store_true')
|
| 66 |
+
p.add_argument('--image-only',action='store_true')
|
| 67 |
+
a=p.parse_args();manifest=json.loads(a.manifest.read_text());a.data.mkdir(parents=True,exist_ok=True)
|
| 68 |
+
for package in manifest['packages']:
|
| 69 |
+
if package['kind']=='docker-image' and not (a.load_image or a.image_only):continue
|
| 70 |
+
if package['kind']=='dataset' and a.image_only:continue
|
| 71 |
+
paths=[a.assets/x['name'] for x in package['parts']]
|
| 72 |
+
full=hashlib.sha256()
|
| 73 |
+
for path,part in zip(paths,package['parts']):
|
| 74 |
+
if not valid(path,part):raise SystemExit('Missing or corrupt asset: '+str(path))
|
| 75 |
+
with path.open('rb') as f:
|
| 76 |
+
for b in iter(lambda:f.read(8*1024**2),b''):full.update(b)
|
| 77 |
+
if full.hexdigest()!=package['sha256']:raise SystemExit('Archive checksum mismatch: '+package['archive'])
|
| 78 |
+
with io.BufferedReader(Parts(paths),buffer_size=8*1024**2) as stream:
|
| 79 |
+
if package['kind']=='docker-image':
|
| 80 |
+
process=subprocess.Popen(['docker','load'],stdin=subprocess.PIPE)
|
| 81 |
+
shutil.copyfileobj(stream,process.stdin,8*1024**2);process.stdin.close()
|
| 82 |
+
if process.wait():raise SystemExit('docker load failed')
|
| 83 |
+
else:
|
| 84 |
+
receipt=a.data/(package['root']+'.restored.json')
|
| 85 |
+
if receipt.exists() and json.loads(receipt.read_text())['sha256']==package['sha256']:
|
| 86 |
+
print('already restored '+package['root']);continue
|
| 87 |
+
if (a.data/package['root']).exists():raise SystemExit('Use a fresh data directory or move incomplete extraction: '+package['root'])
|
| 88 |
+
extract(stream,a.data,package['root'])
|
| 89 |
+
receipt.write_text(json.dumps(dict(sha256=package['sha256'],task_count=package['task_count']))+'\n')
|
| 90 |
+
print('restored '+package['key'],flush=True)
|
| 91 |
+
|
| 92 |
+
if __name__=='__main__':main()
|
tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/patch.diff
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/docx.go b/docx.go
|
| 2 |
+
index 0b3c2e6..f9f276a 100644
|
| 3 |
+
--- a/docx.go
|
| 4 |
+
+++ b/docx.go
|
| 5 |
+
@@ -40,7 +40,7 @@ func ConvertDocx(r io.Reader) (string, map[string]string, error) {
|
| 6 |
+
size = si.Size()
|
| 7 |
+
ra = f
|
| 8 |
+
} else {
|
| 9 |
+
- b, err := ioutil.ReadAll(r)
|
| 10 |
+
+ b, err := ioutil.ReadAll(io.LimitReader(r, maxBytes))
|
| 11 |
+
if err != nil {
|
| 12 |
+
return "", nil, nil
|
| 13 |
+
}
|
| 14 |
+
diff --git a/limit.go b/limit.go
|
| 15 |
+
new file mode 100644
|
| 16 |
+
index 0000000..8ef2940
|
| 17 |
+
--- /dev/null
|
| 18 |
+
+++ b/limit.go
|
| 19 |
+
@@ -0,0 +1,3 @@
|
| 20 |
+
+package docconv
|
| 21 |
+
+
|
| 22 |
+
+const maxBytes = 20 << 20 // 20MB
|
| 23 |
+
diff --git a/odt.go b/odt.go
|
| 24 |
+
index 68dd968..ad93d07 100644
|
| 25 |
+
--- a/odt.go
|
| 26 |
+
+++ b/odt.go
|
| 27 |
+
@@ -14,7 +14,7 @@ func ConvertODT(r io.Reader) (string, map[string]string, error) {
|
| 28 |
+
meta := make(map[string]string)
|
| 29 |
+
var textBody string
|
| 30 |
+
|
| 31 |
+
- b, err := ioutil.ReadAll(r)
|
| 32 |
+
+ b, err := ioutil.ReadAll(io.LimitReader(r, maxBytes))
|
| 33 |
+
if err != nil {
|
| 34 |
+
return "", nil, err
|
| 35 |
+
}
|
| 36 |
+
diff --git a/pages.go b/pages.go
|
| 37 |
+
index 5325ecf..54a2b03 100644
|
| 38 |
+
--- a/pages.go
|
| 39 |
+
+++ b/pages.go
|
| 40 |
+
@@ -21,7 +21,7 @@ func ConvertPages(r io.Reader) (string, map[string]string, error) {
|
| 41 |
+
meta := make(map[string]string)
|
| 42 |
+
var textBody string
|
| 43 |
+
|
| 44 |
+
- b, err := ioutil.ReadAll(r)
|
| 45 |
+
+ b, err := ioutil.ReadAll(io.LimitReader(r, maxBytes))
|
| 46 |
+
if err != nil {
|
| 47 |
+
return "", nil, fmt.Errorf("error reading data: %v", err)
|
| 48 |
+
}
|
| 49 |
+
diff --git a/xml.go b/xml.go
|
| 50 |
+
index 8f422a3..28da02e 100644
|
| 51 |
+
--- a/xml.go
|
| 52 |
+
+++ b/xml.go
|
| 53 |
+
@@ -25,7 +25,7 @@ func ConvertXML(r io.Reader) (string, map[string]string, error) {
|
| 54 |
+
func XMLToText(r io.Reader, breaks []string, skip []string, strict bool) (string, error) {
|
| 55 |
+
var result string
|
| 56 |
+
|
| 57 |
+
- dec := xml.NewDecoder(r)
|
| 58 |
+
+ dec := xml.NewDecoder(io.LimitReader(r, maxBytes))
|
| 59 |
+
dec.Strict = strict
|
| 60 |
+
for {
|
| 61 |
+
t, err := dec.Token()
|
| 62 |
+
@@ -76,7 +76,7 @@ func XMLToText(r io.Reader, breaks []string, skip []string, strict bool) (string
|
| 63 |
+
// XMLToMap converts XML to a nested string map.
|
| 64 |
+
func XMLToMap(r io.Reader) (map[string]string, error) {
|
| 65 |
+
m := make(map[string]string)
|
| 66 |
+
- dec := xml.NewDecoder(r)
|
| 67 |
+
+ dec := xml.NewDecoder(io.LimitReader(r, maxBytes))
|
| 68 |
+
var tagName string
|
| 69 |
+
for {
|
| 70 |
+
t, err := dec.Token()
|
tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/post_context.md
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context after the fix
|
| 2 |
+
|
| 3 |
+
## `docx.go` (changed lines (43,))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package docconv
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"archive/zip"
|
| 10 |
+
"bytes"
|
| 11 |
+
"encoding/xml"
|
| 12 |
+
"fmt"
|
| 13 |
+
"io"
|
| 14 |
+
"io/ioutil"
|
| 15 |
+
"os"
|
| 16 |
+
"time"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
type typeOverride struct {
|
| 20 |
+
XMLName xml.Name `xml:"Override"`
|
| 21 |
+
ContentType string `xml:"ContentType,attr"`
|
| 22 |
+
PartName string `xml:"PartName,attr"`
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
type contentTypeDefinition struct {
|
| 26 |
+
XMLName xml.Name `xml:"Types"`
|
| 27 |
+
Overrides []typeOverride `xml:"Override"`
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// ConvertDocx converts an MS Word docx file to text.
|
| 31 |
+
func ConvertDocx(r io.Reader) (string, map[string]string, error) {
|
| 32 |
+
var size int64
|
| 33 |
+
|
| 34 |
+
// Common case: if the reader is a file (or trivial wrapper), avoid
|
| 35 |
+
// loading it all into memory.
|
| 36 |
+
var ra io.ReaderAt
|
| 37 |
+
if f, ok := r.(interface {
|
| 38 |
+
io.ReaderAt
|
| 39 |
+
Stat() (os.FileInfo, error)
|
| 40 |
+
}); ok {
|
| 41 |
+
si, err := f.Stat()
|
| 42 |
+
if err != nil {
|
| 43 |
+
return "", nil, err
|
| 44 |
+
}
|
| 45 |
+
size = si.Size()
|
| 46 |
+
ra = f
|
| 47 |
+
} else {
|
| 48 |
+
b, err := ioutil.ReadAll(io.LimitReader(r, maxBytes))
|
| 49 |
+
if err != nil {
|
| 50 |
+
return "", nil, nil
|
| 51 |
+
}
|
| 52 |
+
size = int64(len(b))
|
| 53 |
+
ra = bytes.NewReader(b)
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
zr, err := zip.NewReader(ra, size)
|
| 57 |
+
if err != nil {
|
| 58 |
+
return "", nil, fmt.Errorf("error unzipping data: %v", err)
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
zipFiles := mapZipFiles(zr.File)
|
| 62 |
+
|
| 63 |
+
contentTypeDefinition, err := getContentTypeDefinition(zipFiles["[Content_Types].xml"])
|
| 64 |
+
if err != nil {
|
| 65 |
+
return "", nil, err
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
meta := make(map[string]string)
|
| 69 |
+
var textHeader, textBody, textFooter string
|
| 70 |
+
for _, override := range contentTypeDefinition.Overrides {
|
| 71 |
+
f := zipFiles[override.PartName]
|
| 72 |
+
|
| 73 |
+
switch {
|
| 74 |
+
case override.ContentType == "application/vnd.openxmlformats-package.core-properties+xml":
|
| 75 |
+
rc, err := f.Open()
|
| 76 |
+
if err != nil {
|
| 77 |
+
return "", nil, fmt.Errorf("error opening '%v' from archive: %v", f.Name, err)
|
| 78 |
+
}
|
| 79 |
+
defer rc.Close()
|
| 80 |
+
|
| 81 |
+
meta, err = XMLToMap(rc)
|
| 82 |
+
if err != nil {
|
| 83 |
+
return "", nil, fmt.Errorf("error parsing '%v': %v", f.Name, err)
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
if tmp, ok := meta["modified"]; ok {
|
| 87 |
+
if t, err := time.Parse(time.RFC3339, tmp); err == nil {
|
| 88 |
+
meta["ModifiedDate"] = fmt.Sprintf("%d", t.Unix())
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
if tmp, ok := meta["created"]; ok {
|
| 92 |
+
if t, err := time.Parse(time.RFC3339, tmp); err == nil {
|
| 93 |
+
meta["CreatedDate"] = fmt.Sprintf("%d", t.Unix())
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
case override.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":
|
| 97 |
+
body, err := parseDocxText(f)
|
| 98 |
+
if err != nil {
|
| 99 |
+
return "", nil, err
|
| 100 |
+
}
|
| 101 |
+
textBody += body + "\n"
|
| 102 |
+
case override.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":
|
| 103 |
+
footer, err := parseDocxText(f)
|
| 104 |
+
if err != nil {
|
| 105 |
+
return "", nil, err
|
| 106 |
+
}
|
| 107 |
+
textFooter += footer + "\n"
|
| 108 |
+
case override.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml":
|
| 109 |
+
header, err := parseDocxText(f)
|
| 110 |
+
if err != nil {
|
| 111 |
+
return "", nil, err
|
| 112 |
+
}
|
| 113 |
+
textHeader += header + "\n"
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
}
|
| 117 |
+
return textHeader + "\n" + textBody + "\n" + textFooter, meta, nil
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
func getContentTypeDefinition(zf *zip.File) (*contentTypeDefinition, error) {
|
| 121 |
+
f, err := zf.Open()
|
| 122 |
+
if err != nil {
|
| 123 |
+
return nil, err
|
| 124 |
+
}
|
| 125 |
+
defer f.Close()
|
| 126 |
+
|
| 127 |
+
x := &contentTypeDefinition{}
|
| 128 |
+
if err := xml.NewDecoder(f).Decode(x); err != nil {
|
| 129 |
+
return nil, err
|
| 130 |
+
}
|
| 131 |
+
return x, nil
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
func mapZipFiles(files []*zip.File) map[string]*zip.File {
|
| 135 |
+
filesMap := make(map[string]*zip.File, 2*len(files))
|
| 136 |
+
for _, f := range files {
|
| 137 |
+
filesMap[f.Name] = f
|
| 138 |
+
filesMap["/"+f.Name] = f
|
| 139 |
+
}
|
| 140 |
+
return filesMap
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
func parseDocxText(f *zip.File) (string, error) {
|
| 144 |
+
r, err := f.Open()
|
| 145 |
+
if err != nil {
|
| 146 |
+
return "", fmt.Errorf("error opening '%v' from archive: %v", f.Name, err)
|
| 147 |
+
}
|
| 148 |
+
defer r.Close()
|
| 149 |
+
|
| 150 |
+
text, err := DocxXMLToText(r)
|
| 151 |
+
if err != nil {
|
| 152 |
+
return "", fmt.Errorf("error parsing '%v': %v", f.Name, err)
|
| 153 |
+
}
|
| 154 |
+
return text, nil
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
// DocxXMLToText converts Docx XML into plain text.
|
| 158 |
+
func DocxXMLToText(r io.Reader) (string, error) {
|
| 159 |
+
return XMLToText(r, []string{"br", "p", "tab"}, []string{"instrText", "script"}, true)
|
| 160 |
+
}
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
## `limit.go` (changed lines (1, 2, 3))
|
| 164 |
+
|
| 165 |
+
```go
|
| 166 |
+
package docconv
|
| 167 |
+
|
| 168 |
+
const maxBytes = 20 << 20 // 20MB
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
## `odt.go` (changed lines (17,))
|
| 172 |
+
|
| 173 |
+
```go
|
| 174 |
+
package docconv
|
| 175 |
+
|
| 176 |
+
import (
|
| 177 |
+
"archive/zip"
|
| 178 |
+
"bytes"
|
| 179 |
+
"fmt"
|
| 180 |
+
"io"
|
| 181 |
+
"io/ioutil"
|
| 182 |
+
"time"
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
+
// ConvertODT converts a ODT file to text
|
| 186 |
+
func ConvertODT(r io.Reader) (string, map[string]string, error) {
|
| 187 |
+
meta := make(map[string]string)
|
| 188 |
+
var textBody string
|
| 189 |
+
|
| 190 |
+
b, err := ioutil.ReadAll(io.LimitReader(r, maxBytes))
|
| 191 |
+
if err != nil {
|
| 192 |
+
return "", nil, err
|
| 193 |
+
}
|
| 194 |
+
zr, err := zip.NewReader(bytes.NewReader(b), int64(len(b)))
|
| 195 |
+
if err != nil {
|
| 196 |
+
return "", nil, fmt.Errorf("error unzipping data: %v", err)
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
for _, f := range zr.File {
|
| 200 |
+
switch f.Name {
|
| 201 |
+
case "meta.xml":
|
| 202 |
+
rc, err := f.Open()
|
| 203 |
+
if err != nil {
|
| 204 |
+
return "", nil, fmt.Errorf("error extracting '%v' from archive: %v", f.Name, err)
|
| 205 |
+
}
|
| 206 |
+
defer rc.Close()
|
| 207 |
+
|
| 208 |
+
info, err := XMLToMap(rc)
|
| 209 |
+
if err != nil {
|
| 210 |
+
return "", nil, fmt.Errorf("error parsing '%v': %v", f.Name, err)
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
if tmp, ok := info["creator"]; ok {
|
| 214 |
+
meta["Author"] = tmp
|
| 215 |
+
}
|
| 216 |
+
if tmp, ok := info["date"]; ok {
|
| 217 |
+
if t, err := time.Parse("2006-01-02T15:04:05", tmp); err == nil {
|
| 218 |
+
meta["ModifiedDate"] = fmt.Sprintf("%d", t.Unix())
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
if tmp, ok := info["creation-date"]; ok {
|
| 222 |
+
if t, err := time.Parse("2006-01-02T15:04:05", tmp); err == nil {
|
| 223 |
+
meta["CreatedDate"] = fmt.Sprintf("%d", t.Unix())
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
case "content.xml":
|
| 228 |
+
rc, err := f.Open()
|
| 229 |
+
if err != nil {
|
| 230 |
+
return "", nil, fmt.Errorf("error extracting '%v' from archive: %v", f.Name, err)
|
| 231 |
+
}
|
| 232 |
+
defer rc.Close()
|
| 233 |
+
|
| 234 |
+
textBody, err = XMLToText(rc, []string{"br", "p", "tab"}, []string{}, true)
|
| 235 |
+
if err != nil {
|
| 236 |
+
return "", nil, fmt.Errorf("error parsing '%v': %v", f.Name, err)
|
| 237 |
+
}
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
return textBody, meta, nil
|
| 242 |
+
}
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
+
## `pages.go` (changed lines (24,))
|
| 246 |
+
|
| 247 |
+
```go
|
| 248 |
+
package docconv
|
| 249 |
+
|
| 250 |
+
import (
|
| 251 |
+
"archive/zip"
|
| 252 |
+
"bufio"
|
| 253 |
+
"bytes"
|
| 254 |
+
"encoding/binary"
|
| 255 |
+
"fmt"
|
| 256 |
+
"io"
|
| 257 |
+
"io/ioutil"
|
| 258 |
+
"strings"
|
| 259 |
+
|
| 260 |
+
"google.golang.org/protobuf/proto"
|
| 261 |
+
|
| 262 |
+
TSP "code.sajari.com/docconv/iWork"
|
| 263 |
+
"code.sajari.com/docconv/snappy"
|
| 264 |
+
)
|
| 265 |
+
|
| 266 |
+
// ConvertPages converts a Pages file to text.
|
| 267 |
+
func ConvertPages(r io.Reader) (string, map[string]string, error) {
|
| 268 |
+
meta := make(map[string]string)
|
| 269 |
+
var textBody string
|
| 270 |
+
|
| 271 |
+
b, err := ioutil.ReadAll(io.LimitReader(r, maxBytes))
|
| 272 |
+
if err != nil {
|
| 273 |
+
return "", nil, fmt.Errorf("error reading data: %v", err)
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
zr, err := zip.NewReader(bytes.NewReader(b), int64(len(b)))
|
| 277 |
+
if err != nil {
|
| 278 |
+
return "", nil, fmt.Errorf("error unzipping data: %v", err)
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
for _, f := range zr.File {
|
| 282 |
+
if strings.HasSuffix(f.Name, "Preview.pdf") {
|
| 283 |
+
// There is a preview PDF version we can use
|
| 284 |
+
if rc, err := f.Open(); err == nil {
|
| 285 |
+
return ConvertPDF(rc)
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
if f.Name == "index.xml" {
|
| 289 |
+
// There's an XML version we can use
|
| 290 |
+
if rc, err := f.Open(); err == nil {
|
| 291 |
+
return ConvertXML(rc)
|
| 292 |
+
}
|
| 293 |
+
}
|
| 294 |
+
if f.Name == "Index/Document.iwa" {
|
| 295 |
+
rc, _ := f.Open()
|
| 296 |
+
defer rc.Close()
|
| 297 |
+
bReader := bufio.NewReader(snappy.NewReader(io.MultiReader(strings.NewReader("\xff\x06\x00\x00sNaPpY"), rc)))
|
| 298 |
+
|
| 299 |
+
// Ignore error.
|
| 300 |
+
// NOTE: This error was unchecked. Need to revisit this to see if it
|
| 301 |
+
// should be acted on.
|
| 302 |
+
archiveLength, _ := binary.ReadVarint(bReader)
|
| 303 |
+
|
| 304 |
+
// Ignore error.
|
| 305 |
+
// NOTE: This error was unchecked. Need to revisit this to see if it
|
| 306 |
+
// should be acted on.
|
| 307 |
+
archiveInfoData, _ := ioutil.ReadAll(io.LimitReader(bReader, archiveLength))
|
| 308 |
+
|
| 309 |
+
archiveInfo := &TSP.ArchiveInfo{}
|
| 310 |
+
err = proto.Unmarshal(archiveInfoData, archiveInfo)
|
| 311 |
+
fmt.Println("archiveInfo:", archiveInfo, err)
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
return textBody, meta, nil
|
| 316 |
+
}
|
| 317 |
+
```
|
| 318 |
+
|
| 319 |
+
## `xml.go` (changed lines (28, 79))
|
| 320 |
+
|
| 321 |
+
```go
|
| 322 |
+
package docconv
|
| 323 |
+
|
| 324 |
+
import (
|
| 325 |
+
"bytes"
|
| 326 |
+
"encoding/xml"
|
| 327 |
+
"fmt"
|
| 328 |
+
"io"
|
| 329 |
+
)
|
| 330 |
+
|
| 331 |
+
// ConvertXML converts an XML file to text.
|
| 332 |
+
func ConvertXML(r io.Reader) (string, map[string]string, error) {
|
| 333 |
+
meta := make(map[string]string)
|
| 334 |
+
cleanXML, err := Tidy(r, true)
|
| 335 |
+
if err != nil {
|
| 336 |
+
return "", nil, fmt.Errorf("tidy error: %v", err)
|
| 337 |
+
}
|
| 338 |
+
result, err := XMLToText(bytes.NewReader(cleanXML), []string{}, []string{}, true)
|
| 339 |
+
if err != nil {
|
| 340 |
+
return "", nil, fmt.Errorf("error from XMLToText: %v", err)
|
| 341 |
+
}
|
| 342 |
+
return result, meta, nil
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// XMLToText converts XML to plain text given how to treat elements.
|
| 346 |
+
func XMLToText(r io.Reader, breaks []string, skip []string, strict bool) (string, error) {
|
| 347 |
+
var result string
|
| 348 |
+
|
| 349 |
+
dec := xml.NewDecoder(io.LimitReader(r, maxBytes))
|
| 350 |
+
dec.Strict = strict
|
| 351 |
+
for {
|
| 352 |
+
t, err := dec.Token()
|
| 353 |
+
if err != nil {
|
| 354 |
+
if err == io.EOF {
|
| 355 |
+
break
|
| 356 |
+
}
|
| 357 |
+
return "", err
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
switch v := t.(type) {
|
| 361 |
+
case xml.CharData:
|
| 362 |
+
result += string(v)
|
| 363 |
+
case xml.StartElement:
|
| 364 |
+
for _, breakElement := range breaks {
|
| 365 |
+
if v.Name.Local == breakElement {
|
| 366 |
+
result += "\n"
|
| 367 |
+
}
|
| 368 |
+
}
|
| 369 |
+
for _, skipElement := range skip {
|
| 370 |
+
if v.Name.Local == skipElement {
|
| 371 |
+
depth := 1
|
| 372 |
+
for {
|
| 373 |
+
t, err := dec.Token()
|
| 374 |
+
if err != nil {
|
| 375 |
+
// An io.EOF here is actually an error.
|
| 376 |
+
return "", err
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
switch t.(type) {
|
| 380 |
+
case xml.StartElement:
|
| 381 |
+
depth++
|
| 382 |
+
case xml.EndElement:
|
| 383 |
+
depth--
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
if depth == 0 {
|
| 387 |
+
break
|
| 388 |
+
}
|
| 389 |
+
}
|
| 390 |
+
}
|
| 391 |
+
}
|
| 392 |
+
}
|
| 393 |
+
}
|
| 394 |
+
return result, nil
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
// XMLToMap converts XML to a nested string map.
|
| 398 |
+
func XMLToMap(r io.Reader) (map[string]string, error) {
|
| 399 |
+
m := make(map[string]string)
|
| 400 |
+
dec := xml.NewDecoder(io.LimitReader(r, maxBytes))
|
| 401 |
+
var tagName string
|
| 402 |
+
for {
|
| 403 |
+
t, err := dec.Token()
|
| 404 |
+
if err != nil {
|
| 405 |
+
if err == io.EOF {
|
| 406 |
+
break
|
| 407 |
+
}
|
| 408 |
+
return nil, err
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
switch v := t.(type) {
|
| 412 |
+
case xml.StartElement:
|
| 413 |
+
tagName = string(v.Name.Local)
|
| 414 |
+
case xml.CharData:
|
| 415 |
+
m[tagName] = string(v)
|
| 416 |
+
}
|
| 417 |
+
}
|
| 418 |
+
return m, nil
|
| 419 |
+
}
|
| 420 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/pre_context.md
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context before the fix
|
| 2 |
+
|
| 3 |
+
## `docx.go` (changed lines (43, 44))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package docconv
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"archive/zip"
|
| 10 |
+
"bytes"
|
| 11 |
+
"encoding/xml"
|
| 12 |
+
"fmt"
|
| 13 |
+
"io"
|
| 14 |
+
"io/ioutil"
|
| 15 |
+
"os"
|
| 16 |
+
"time"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
type typeOverride struct {
|
| 20 |
+
XMLName xml.Name `xml:"Override"`
|
| 21 |
+
ContentType string `xml:"ContentType,attr"`
|
| 22 |
+
PartName string `xml:"PartName,attr"`
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
type contentTypeDefinition struct {
|
| 26 |
+
XMLName xml.Name `xml:"Types"`
|
| 27 |
+
Overrides []typeOverride `xml:"Override"`
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// ConvertDocx converts an MS Word docx file to text.
|
| 31 |
+
func ConvertDocx(r io.Reader) (string, map[string]string, error) {
|
| 32 |
+
var size int64
|
| 33 |
+
|
| 34 |
+
// Common case: if the reader is a file (or trivial wrapper), avoid
|
| 35 |
+
// loading it all into memory.
|
| 36 |
+
var ra io.ReaderAt
|
| 37 |
+
if f, ok := r.(interface {
|
| 38 |
+
io.ReaderAt
|
| 39 |
+
Stat() (os.FileInfo, error)
|
| 40 |
+
}); ok {
|
| 41 |
+
si, err := f.Stat()
|
| 42 |
+
if err != nil {
|
| 43 |
+
return "", nil, err
|
| 44 |
+
}
|
| 45 |
+
size = si.Size()
|
| 46 |
+
ra = f
|
| 47 |
+
} else {
|
| 48 |
+
b, err := ioutil.ReadAll(r)
|
| 49 |
+
if err != nil {
|
| 50 |
+
return "", nil, nil
|
| 51 |
+
}
|
| 52 |
+
size = int64(len(b))
|
| 53 |
+
ra = bytes.NewReader(b)
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
zr, err := zip.NewReader(ra, size)
|
| 57 |
+
if err != nil {
|
| 58 |
+
return "", nil, fmt.Errorf("error unzipping data: %v", err)
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
zipFiles := mapZipFiles(zr.File)
|
| 62 |
+
|
| 63 |
+
contentTypeDefinition, err := getContentTypeDefinition(zipFiles["[Content_Types].xml"])
|
| 64 |
+
if err != nil {
|
| 65 |
+
return "", nil, err
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
meta := make(map[string]string)
|
| 69 |
+
var textHeader, textBody, textFooter string
|
| 70 |
+
for _, override := range contentTypeDefinition.Overrides {
|
| 71 |
+
f := zipFiles[override.PartName]
|
| 72 |
+
|
| 73 |
+
switch {
|
| 74 |
+
case override.ContentType == "application/vnd.openxmlformats-package.core-properties+xml":
|
| 75 |
+
rc, err := f.Open()
|
| 76 |
+
if err != nil {
|
| 77 |
+
return "", nil, fmt.Errorf("error opening '%v' from archive: %v", f.Name, err)
|
| 78 |
+
}
|
| 79 |
+
defer rc.Close()
|
| 80 |
+
|
| 81 |
+
meta, err = XMLToMap(rc)
|
| 82 |
+
if err != nil {
|
| 83 |
+
return "", nil, fmt.Errorf("error parsing '%v': %v", f.Name, err)
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
if tmp, ok := meta["modified"]; ok {
|
| 87 |
+
if t, err := time.Parse(time.RFC3339, tmp); err == nil {
|
| 88 |
+
meta["ModifiedDate"] = fmt.Sprintf("%d", t.Unix())
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
if tmp, ok := meta["created"]; ok {
|
| 92 |
+
if t, err := time.Parse(time.RFC3339, tmp); err == nil {
|
| 93 |
+
meta["CreatedDate"] = fmt.Sprintf("%d", t.Unix())
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
case override.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":
|
| 97 |
+
body, err := parseDocxText(f)
|
| 98 |
+
if err != nil {
|
| 99 |
+
return "", nil, err
|
| 100 |
+
}
|
| 101 |
+
textBody += body + "\n"
|
| 102 |
+
case override.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":
|
| 103 |
+
footer, err := parseDocxText(f)
|
| 104 |
+
if err != nil {
|
| 105 |
+
return "", nil, err
|
| 106 |
+
}
|
| 107 |
+
textFooter += footer + "\n"
|
| 108 |
+
case override.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml":
|
| 109 |
+
header, err := parseDocxText(f)
|
| 110 |
+
if err != nil {
|
| 111 |
+
return "", nil, err
|
| 112 |
+
}
|
| 113 |
+
textHeader += header + "\n"
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
}
|
| 117 |
+
return textHeader + "\n" + textBody + "\n" + textFooter, meta, nil
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
func getContentTypeDefinition(zf *zip.File) (*contentTypeDefinition, error) {
|
| 121 |
+
f, err := zf.Open()
|
| 122 |
+
if err != nil {
|
| 123 |
+
return nil, err
|
| 124 |
+
}
|
| 125 |
+
defer f.Close()
|
| 126 |
+
|
| 127 |
+
x := &contentTypeDefinition{}
|
| 128 |
+
if err := xml.NewDecoder(f).Decode(x); err != nil {
|
| 129 |
+
return nil, err
|
| 130 |
+
}
|
| 131 |
+
return x, nil
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
func mapZipFiles(files []*zip.File) map[string]*zip.File {
|
| 135 |
+
filesMap := make(map[string]*zip.File, 2*len(files))
|
| 136 |
+
for _, f := range files {
|
| 137 |
+
filesMap[f.Name] = f
|
| 138 |
+
filesMap["/"+f.Name] = f
|
| 139 |
+
}
|
| 140 |
+
return filesMap
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
func parseDocxText(f *zip.File) (string, error) {
|
| 144 |
+
r, err := f.Open()
|
| 145 |
+
if err != nil {
|
| 146 |
+
return "", fmt.Errorf("error opening '%v' from archive: %v", f.Name, err)
|
| 147 |
+
}
|
| 148 |
+
defer r.Close()
|
| 149 |
+
|
| 150 |
+
text, err := DocxXMLToText(r)
|
| 151 |
+
if err != nil {
|
| 152 |
+
return "", fmt.Errorf("error parsing '%v': %v", f.Name, err)
|
| 153 |
+
}
|
| 154 |
+
return text, nil
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
// DocxXMLToText converts Docx XML into plain text.
|
| 158 |
+
func DocxXMLToText(r io.Reader) (string, error) {
|
| 159 |
+
return XMLToText(r, []string{"br", "p", "tab"}, []string{"instrText", "script"}, true)
|
| 160 |
+
}
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
## `odt.go` (changed lines (17, 18))
|
| 164 |
+
|
| 165 |
+
```go
|
| 166 |
+
package docconv
|
| 167 |
+
|
| 168 |
+
import (
|
| 169 |
+
"archive/zip"
|
| 170 |
+
"bytes"
|
| 171 |
+
"fmt"
|
| 172 |
+
"io"
|
| 173 |
+
"io/ioutil"
|
| 174 |
+
"time"
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
// ConvertODT converts a ODT file to text
|
| 178 |
+
func ConvertODT(r io.Reader) (string, map[string]string, error) {
|
| 179 |
+
meta := make(map[string]string)
|
| 180 |
+
var textBody string
|
| 181 |
+
|
| 182 |
+
b, err := ioutil.ReadAll(r)
|
| 183 |
+
if err != nil {
|
| 184 |
+
return "", nil, err
|
| 185 |
+
}
|
| 186 |
+
zr, err := zip.NewReader(bytes.NewReader(b), int64(len(b)))
|
| 187 |
+
if err != nil {
|
| 188 |
+
return "", nil, fmt.Errorf("error unzipping data: %v", err)
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
for _, f := range zr.File {
|
| 192 |
+
switch f.Name {
|
| 193 |
+
case "meta.xml":
|
| 194 |
+
rc, err := f.Open()
|
| 195 |
+
if err != nil {
|
| 196 |
+
return "", nil, fmt.Errorf("error extracting '%v' from archive: %v", f.Name, err)
|
| 197 |
+
}
|
| 198 |
+
defer rc.Close()
|
| 199 |
+
|
| 200 |
+
info, err := XMLToMap(rc)
|
| 201 |
+
if err != nil {
|
| 202 |
+
return "", nil, fmt.Errorf("error parsing '%v': %v", f.Name, err)
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
if tmp, ok := info["creator"]; ok {
|
| 206 |
+
meta["Author"] = tmp
|
| 207 |
+
}
|
| 208 |
+
if tmp, ok := info["date"]; ok {
|
| 209 |
+
if t, err := time.Parse("2006-01-02T15:04:05", tmp); err == nil {
|
| 210 |
+
meta["ModifiedDate"] = fmt.Sprintf("%d", t.Unix())
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
if tmp, ok := info["creation-date"]; ok {
|
| 214 |
+
if t, err := time.Parse("2006-01-02T15:04:05", tmp); err == nil {
|
| 215 |
+
meta["CreatedDate"] = fmt.Sprintf("%d", t.Unix())
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
case "content.xml":
|
| 220 |
+
rc, err := f.Open()
|
| 221 |
+
if err != nil {
|
| 222 |
+
return "", nil, fmt.Errorf("error extracting '%v' from archive: %v", f.Name, err)
|
| 223 |
+
}
|
| 224 |
+
defer rc.Close()
|
| 225 |
+
|
| 226 |
+
textBody, err = XMLToText(rc, []string{"br", "p", "tab"}, []string{}, true)
|
| 227 |
+
if err != nil {
|
| 228 |
+
return "", nil, fmt.Errorf("error parsing '%v': %v", f.Name, err)
|
| 229 |
+
}
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
return textBody, meta, nil
|
| 234 |
+
}
|
| 235 |
+
```
|
| 236 |
+
|
| 237 |
+
## `pages.go` (changed lines (24, 25))
|
| 238 |
+
|
| 239 |
+
```go
|
| 240 |
+
package docconv
|
| 241 |
+
|
| 242 |
+
import (
|
| 243 |
+
"archive/zip"
|
| 244 |
+
"bufio"
|
| 245 |
+
"bytes"
|
| 246 |
+
"encoding/binary"
|
| 247 |
+
"fmt"
|
| 248 |
+
"io"
|
| 249 |
+
"io/ioutil"
|
| 250 |
+
"strings"
|
| 251 |
+
|
| 252 |
+
"google.golang.org/protobuf/proto"
|
| 253 |
+
|
| 254 |
+
TSP "code.sajari.com/docconv/iWork"
|
| 255 |
+
"code.sajari.com/docconv/snappy"
|
| 256 |
+
)
|
| 257 |
+
|
| 258 |
+
// ConvertPages converts a Pages file to text.
|
| 259 |
+
func ConvertPages(r io.Reader) (string, map[string]string, error) {
|
| 260 |
+
meta := make(map[string]string)
|
| 261 |
+
var textBody string
|
| 262 |
+
|
| 263 |
+
b, err := ioutil.ReadAll(r)
|
| 264 |
+
if err != nil {
|
| 265 |
+
return "", nil, fmt.Errorf("error reading data: %v", err)
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
zr, err := zip.NewReader(bytes.NewReader(b), int64(len(b)))
|
| 269 |
+
if err != nil {
|
| 270 |
+
return "", nil, fmt.Errorf("error unzipping data: %v", err)
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
for _, f := range zr.File {
|
| 274 |
+
if strings.HasSuffix(f.Name, "Preview.pdf") {
|
| 275 |
+
// There is a preview PDF version we can use
|
| 276 |
+
if rc, err := f.Open(); err == nil {
|
| 277 |
+
return ConvertPDF(rc)
|
| 278 |
+
}
|
| 279 |
+
}
|
| 280 |
+
if f.Name == "index.xml" {
|
| 281 |
+
// There's an XML version we can use
|
| 282 |
+
if rc, err := f.Open(); err == nil {
|
| 283 |
+
return ConvertXML(rc)
|
| 284 |
+
}
|
| 285 |
+
}
|
| 286 |
+
if f.Name == "Index/Document.iwa" {
|
| 287 |
+
rc, _ := f.Open()
|
| 288 |
+
defer rc.Close()
|
| 289 |
+
bReader := bufio.NewReader(snappy.NewReader(io.MultiReader(strings.NewReader("\xff\x06\x00\x00sNaPpY"), rc)))
|
| 290 |
+
|
| 291 |
+
// Ignore error.
|
| 292 |
+
// NOTE: This error was unchecked. Need to revisit this to see if it
|
| 293 |
+
// should be acted on.
|
| 294 |
+
archiveLength, _ := binary.ReadVarint(bReader)
|
| 295 |
+
|
| 296 |
+
// Ignore error.
|
| 297 |
+
// NOTE: This error was unchecked. Need to revisit this to see if it
|
| 298 |
+
// should be acted on.
|
| 299 |
+
archiveInfoData, _ := ioutil.ReadAll(io.LimitReader(bReader, archiveLength))
|
| 300 |
+
|
| 301 |
+
archiveInfo := &TSP.ArchiveInfo{}
|
| 302 |
+
err = proto.Unmarshal(archiveInfoData, archiveInfo)
|
| 303 |
+
fmt.Println("archiveInfo:", archiveInfo, err)
|
| 304 |
+
}
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
return textBody, meta, nil
|
| 308 |
+
}
|
| 309 |
+
```
|
| 310 |
+
|
| 311 |
+
## `xml.go` (changed lines (28, 29, 79, 80))
|
| 312 |
+
|
| 313 |
+
```go
|
| 314 |
+
package docconv
|
| 315 |
+
|
| 316 |
+
import (
|
| 317 |
+
"bytes"
|
| 318 |
+
"encoding/xml"
|
| 319 |
+
"fmt"
|
| 320 |
+
"io"
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
+
// ConvertXML converts an XML file to text.
|
| 324 |
+
func ConvertXML(r io.Reader) (string, map[string]string, error) {
|
| 325 |
+
meta := make(map[string]string)
|
| 326 |
+
cleanXML, err := Tidy(r, true)
|
| 327 |
+
if err != nil {
|
| 328 |
+
return "", nil, fmt.Errorf("tidy error: %v", err)
|
| 329 |
+
}
|
| 330 |
+
result, err := XMLToText(bytes.NewReader(cleanXML), []string{}, []string{}, true)
|
| 331 |
+
if err != nil {
|
| 332 |
+
return "", nil, fmt.Errorf("error from XMLToText: %v", err)
|
| 333 |
+
}
|
| 334 |
+
return result, meta, nil
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
// XMLToText converts XML to plain text given how to treat elements.
|
| 338 |
+
func XMLToText(r io.Reader, breaks []string, skip []string, strict bool) (string, error) {
|
| 339 |
+
var result string
|
| 340 |
+
|
| 341 |
+
dec := xml.NewDecoder(r)
|
| 342 |
+
dec.Strict = strict
|
| 343 |
+
for {
|
| 344 |
+
t, err := dec.Token()
|
| 345 |
+
if err != nil {
|
| 346 |
+
if err == io.EOF {
|
| 347 |
+
break
|
| 348 |
+
}
|
| 349 |
+
return "", err
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
switch v := t.(type) {
|
| 353 |
+
case xml.CharData:
|
| 354 |
+
result += string(v)
|
| 355 |
+
case xml.StartElement:
|
| 356 |
+
for _, breakElement := range breaks {
|
| 357 |
+
if v.Name.Local == breakElement {
|
| 358 |
+
result += "\n"
|
| 359 |
+
}
|
| 360 |
+
}
|
| 361 |
+
for _, skipElement := range skip {
|
| 362 |
+
if v.Name.Local == skipElement {
|
| 363 |
+
depth := 1
|
| 364 |
+
for {
|
| 365 |
+
t, err := dec.Token()
|
| 366 |
+
if err != nil {
|
| 367 |
+
// An io.EOF here is actually an error.
|
| 368 |
+
return "", err
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
switch t.(type) {
|
| 372 |
+
case xml.StartElement:
|
| 373 |
+
depth++
|
| 374 |
+
case xml.EndElement:
|
| 375 |
+
depth--
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
if depth == 0 {
|
| 379 |
+
break
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
return result, nil
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
// XMLToMap converts XML to a nested string map.
|
| 390 |
+
func XMLToMap(r io.Reader) (map[string]string, error) {
|
| 391 |
+
m := make(map[string]string)
|
| 392 |
+
dec := xml.NewDecoder(r)
|
| 393 |
+
var tagName string
|
| 394 |
+
for {
|
| 395 |
+
t, err := dec.Token()
|
| 396 |
+
if err != nil {
|
| 397 |
+
if err == io.EOF {
|
| 398 |
+
break
|
| 399 |
+
}
|
| 400 |
+
return nil, err
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
switch v := t.(type) {
|
| 404 |
+
case xml.StartElement:
|
| 405 |
+
tagName = string(v.Name.Local)
|
| 406 |
+
case xml.CharData:
|
| 407 |
+
m[tagName] = string(v)
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
return m, nil
|
| 411 |
+
}
|
| 412 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/task.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "synthesis-task-v1",
|
| 3 |
+
"task": {
|
| 4 |
+
"pair_id": "morefixes-02cb4e0a6c5aaabd6a78",
|
| 5 |
+
"dataset_id": "morefixes",
|
| 6 |
+
"dataset_item_id": "morefixes-02cb4e0a6c5aaabd6a78",
|
| 7 |
+
"project_id": "morefixes__sajari__docconv",
|
| 8 |
+
"language": "go",
|
| 9 |
+
"backend": "codeql"
|
| 10 |
+
},
|
| 11 |
+
"changed_go_files": [
|
| 12 |
+
"docx.go",
|
| 13 |
+
"limit.go",
|
| 14 |
+
"odt.go",
|
| 15 |
+
"pages.go",
|
| 16 |
+
"xml.go"
|
| 17 |
+
],
|
| 18 |
+
"patch_units": {
|
| 19 |
+
"before": [
|
| 20 |
+
"docx.go",
|
| 21 |
+
"odt.go",
|
| 22 |
+
"pages.go",
|
| 23 |
+
"xml.go"
|
| 24 |
+
],
|
| 25 |
+
"after": [
|
| 26 |
+
"docx.go",
|
| 27 |
+
"limit.go",
|
| 28 |
+
"odt.go",
|
| 29 |
+
"pages.go",
|
| 30 |
+
"xml.go"
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
"runtime_assets": {
|
| 34 |
+
"before": {
|
| 35 |
+
"database": "assets/0f2dd7f22cb39edf425e31c73ad68abc097ae1a4227101bae0ef970834d7c195/database",
|
| 36 |
+
"cache_key": "0f2dd7f22cb39edf425e31c73ad68abc097ae1a4227101bae0ef970834d7c195",
|
| 37 |
+
"codeql_version": "2.26.4"
|
| 38 |
+
},
|
| 39 |
+
"after": {
|
| 40 |
+
"database": "assets/be9479e3777ab6ce5fb6fa038c81bdab6f5dfbef376d50e51366dfb28a5c116d/database",
|
| 41 |
+
"cache_key": "be9479e3777ab6ce5fb6fa038c81bdab6f5dfbef376d50e51366dfb28a5c116d",
|
| 42 |
+
"codeql_version": "2.26.4"
|
| 43 |
+
},
|
| 44 |
+
"refine": {
|
| 45 |
+
"database": "assets/d7101a87feb72cf67fc571c338a8eac59c3ad369e8babe871b5052fda7970114/database",
|
| 46 |
+
"cache_key": "d7101a87feb72cf67fc571c338a8eac59c3ad369e8babe871b5052fda7970114",
|
| 47 |
+
"codeql_version": "2.26.4"
|
| 48 |
+
}
|
| 49 |
+
},
|
| 50 |
+
"benchmark_contract": {
|
| 51 |
+
"agent_visible": true,
|
| 52 |
+
"reference_query_location": "references/morefixes-02cb4e0a6c5aaabd6a78/query/ (do not mount into agent)",
|
| 53 |
+
"evaluator_location": "evaluator/morefixes-02cb4e0a6c5aaabd6a78/ (do not mount into agent)"
|
| 54 |
+
}
|
| 55 |
+
}
|
tasks/codeql_go_benchmark_top30_v1/morefixes-02cb4e0a6c5aaabd6a78/task_prompt.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Go CodeQL detector synthesis
|
| 2 |
+
|
| 3 |
+
You are cc operating in `/work`. Starting only from the supplied patch,
|
| 4 |
+
before/after Go context, CodeQL references, and validation tools, synthesize a semantic CodeQL
|
| 5 |
+
detector for the vulnerability fixed by the patch. This is one fresh session. You may iterate inside
|
| 6 |
+
this session, but no later framework repair or resume will occur.
|
| 7 |
+
|
| 8 |
+
## Inputs and owned outputs
|
| 9 |
+
|
| 10 |
+
- Read `patch.diff`, `go_patch.diff`, `pre_context.md`, and `post_context.md`.
|
| 11 |
+
- Read `references/codeql/convergence_protocol.md` and
|
| 12 |
+
`references/codeql/go_api.md` before experimenting. Read the remaining
|
| 13 |
+
`references/codeql/` files for the selected mechanism.
|
| 14 |
+
- Use `scripts/search_codeql_api.sh` to inspect the pinned official libraries when an API detail is
|
| 15 |
+
uncertain. Do not guess predicate names or build a large family of inspection queries.
|
| 16 |
+
- Complete the design contract in `state.json` and `scope_statement.md` before final validation.
|
| 17 |
+
- Replace `query/vulnerability.ql`; add only genuinely shared `.qll` helpers when useful. Keep the
|
| 18 |
+
fixed offline dependency in `query/qlpack.yml`.
|
| 19 |
+
- Preserve the exact `expected_query_id` from `config.json` as the query's sole `@id`. This
|
| 20 |
+
task-unique metadata must never be used in a query predicate.
|
| 21 |
+
- Use `scripts/compile_query.sh`, `scripts/run_before.sh`, and `scripts/run_after.sh`.
|
| 22 |
+
- Finish by writing `summary.json` with `status`, `query_path`, `query_kind`, `build_passed`,
|
| 23 |
+
`before_findings`, `after_findings`, `validation_completed`, and a concise `notes` field.
|
| 24 |
+
|
| 25 |
+
## Required reasoning contract
|
| 26 |
+
|
| 27 |
+
Before coding, record this mapping in `state.json`:
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
vulnerable operation / trigger / patch safety condition
|
| 31 |
+
→ CodeQL-observable evidence
|
| 32 |
+
→ syntax, control-flow, local value-flow, global taint/value-flow, or interprocedural mechanism
|
| 33 |
+
→ source, sink/report site, guard/barrier and query predicates
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Choose the lowest mechanism that can actually prove the condition. Guard-sensitive patches require
|
| 37 |
+
real path/control-flow semantics; provenance-sensitive patches require value flow. Do not replace
|
| 38 |
+
either with source-text matching or with the mere presence of patch-added syntax.
|
| 39 |
+
|
| 40 |
+
## Mandatory convergence contract
|
| 41 |
+
|
| 42 |
+
The rollout has a 50-minute hard wall-clock ceiling and must be finalized by minute 43. Minutes
|
| 43 |
+
43–50 are an emergency shutdown buffer, not exploration time. A sophisticated unfinished query is
|
| 44 |
+
a failure; an early compilable semantic candidate can be improved. Follow the checkpoints in
|
| 45 |
+
`references/codeql/convergence_protocol.md`:
|
| 46 |
+
|
| 47 |
+
1. Record the mechanism contract, then replace the placeholder in `query/vulnerability.ql`
|
| 48 |
+
immediately. Do not wait until every CodeQL API detail is known.
|
| 49 |
+
2. Use at most three distinct scratch `.ql` files. Prefer repeatedly editing one
|
| 50 |
+
`query/scratch.ql`. After two failed variants of one API assumption, inspect the exact bundled
|
| 51 |
+
definition with `scripts/search_codeql_api.sh` or simplify the mechanism.
|
| 52 |
+
3. Obtain a compiling minimal main query before broadening it. Compile the main query after every
|
| 53 |
+
meaningful mechanism change.
|
| 54 |
+
4. Move in order from compile → relevant before finding → after elimination → final contract. Do
|
| 55 |
+
not continue API exploration after the intended before/after differential is established.
|
| 56 |
+
5. Run `scripts/check_progress.sh` at each checkpoint. It reports elapsed time, the minute-43
|
| 57 |
+
finalization deadline, and the minute-50 hard timeout. When it prints `finalize_now`, stop all
|
| 58 |
+
exploration, preserve the best compiling query, finish the contract files, and exit.
|
| 59 |
+
|
| 60 |
+
## Semantic and generalization rules
|
| 61 |
+
|
| 62 |
+
- Report at the vulnerable call, operator, access, or sink.
|
| 63 |
+
- Do not use a patch-local path, line, commit hash, label, or local variable name as the primary
|
| 64 |
+
matching condition. Stable library/framework APIs or public project APIs are allowed only when
|
| 65 |
+
`scope_statement.md` explains why they define the intended vulnerability family.
|
| 66 |
+
- The safety condition introduced by the patch must be represented by the query.
|
| 67 |
+
- A lower after warning count is not enough: inspect SARIF and ensure at least one intended before
|
| 68 |
+
finding is in a patch-overlapping semantic unit and the corresponding finding disappears after.
|
| 69 |
+
- Avoid broad proxy queries that report an enclosing function or unrelated API merely because it
|
| 70 |
+
changed in the patch.
|
| 71 |
+
|
| 72 |
+
## Final validation protocol
|
| 73 |
+
|
| 74 |
+
1. Compile the final query.
|
| 75 |
+
2. Run it on before and inspect `raw/before.sarif` for the intended report location.
|
| 76 |
+
3. Run the identical query on after and inspect `raw/after.sarif`.
|
| 77 |
+
4. Recheck query metadata, query kind/select signature, report locality, design-to-code consistency,
|
| 78 |
+
and absence of patch-local hardcoding.
|
| 79 |
+
5. Update `state.json`, `scope_statement.md`, and write valid `summary.json`.
|
| 80 |
+
|
| 81 |
+
Do not modify the runtime databases, references, patch, context, or validation scripts except for
|
| 82 |
+
normal CodeQL-generated database caches produced by the provided run scripts.
|
tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/patch.diff
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/pkg/engine/wildcards/wildcards.go b/pkg/engine/wildcards/wildcards.go
|
| 2 |
+
index 730d82529..a21ad08f9 100644
|
| 3 |
+
--- a/pkg/engine/wildcards/wildcards.go
|
| 4 |
+
+++ b/pkg/engine/wildcards/wildcards.go
|
| 5 |
+
@@ -135,7 +135,16 @@ func getValueAsStringMap(key string, data interface{}) (string, map[string]strin
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
for k, v := range valMap {
|
| 9 |
+
- result[k] = v.(string)
|
| 10 |
+
+ if v == nil {
|
| 11 |
+
+ continue
|
| 12 |
+
+ }
|
| 13 |
+
+
|
| 14 |
+
+ switch typedVal := v.(type) {
|
| 15 |
+
+ case string:
|
| 16 |
+
+ result[k] = typedVal
|
| 17 |
+
+ default:
|
| 18 |
+
+ continue
|
| 19 |
+
+ }
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
return patternKey, result
|
| 23 |
+
diff --git a/pkg/engine/wildcards/wildcards_test.go b/pkg/engine/wildcards/wildcards_test.go
|
| 24 |
+
index 52dcddc43..5c13f6cf9 100644
|
| 25 |
+
--- a/pkg/engine/wildcards/wildcards_test.go
|
| 26 |
+
+++ b/pkg/engine/wildcards/wildcards_test.go
|
| 27 |
+
@@ -3,6 +3,8 @@ package wildcards
|
| 28 |
+
import (
|
| 29 |
+
"reflect"
|
| 30 |
+
"testing"
|
| 31 |
+
+
|
| 32 |
+
+ "github.com/stretchr/testify/assert"
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
func TestExpandInMetadata(t *testing.T) {
|
| 36 |
+
@@ -25,3 +27,241 @@ func testExpand(t *testing.T, patternMap, resourceMap map[string]string, expecte
|
| 37 |
+
t.Errorf("expected %v but received %v", expectedMap, result)
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
+
|
| 41 |
+
+func TestGetValueAsStringMap_NilHandling(t *testing.T) {
|
| 42 |
+
+ tests := []struct {
|
| 43 |
+
+ name string
|
| 44 |
+
+ key string
|
| 45 |
+
+ data interface{}
|
| 46 |
+
+ expectedKey string
|
| 47 |
+
+ expectedResult map[string]string
|
| 48 |
+
+ }{
|
| 49 |
+
+ {
|
| 50 |
+
+ name: "nil data",
|
| 51 |
+
+ key: "test",
|
| 52 |
+
+ data: nil,
|
| 53 |
+
+ expectedKey: "",
|
| 54 |
+
+ expectedResult: nil,
|
| 55 |
+
+ },
|
| 56 |
+
+ {
|
| 57 |
+
+ name: "data is not a map",
|
| 58 |
+
+ key: "test",
|
| 59 |
+
+ data: "not a map",
|
| 60 |
+
+ expectedKey: "",
|
| 61 |
+
+ expectedResult: nil,
|
| 62 |
+
+ },
|
| 63 |
+
+ {
|
| 64 |
+
+ name: "key not found",
|
| 65 |
+
+ key: "nonexistent",
|
| 66 |
+
+ data: map[string]interface{}{"otherKey": "value"},
|
| 67 |
+
+ expectedKey: "",
|
| 68 |
+
+ expectedResult: nil,
|
| 69 |
+
+ },
|
| 70 |
+
+ {
|
| 71 |
+
+ name: "value is nil",
|
| 72 |
+
+ key: "test",
|
| 73 |
+
+ data: map[string]interface{}{"test": nil},
|
| 74 |
+
+ expectedKey: "",
|
| 75 |
+
+ expectedResult: nil,
|
| 76 |
+
+ },
|
| 77 |
+
+ {
|
| 78 |
+
+ name: "value is not a map",
|
| 79 |
+
+ key: "test",
|
| 80 |
+
+ data: map[string]interface{}{"test": "not a map"},
|
| 81 |
+
+ expectedKey: "",
|
| 82 |
+
+ expectedResult: nil,
|
| 83 |
+
+ },
|
| 84 |
+
+ {
|
| 85 |
+
+ name: "handles nil value in map",
|
| 86 |
+
+ key: "test",
|
| 87 |
+
+ data: map[string]interface{}{
|
| 88 |
+
+ "test": map[string]interface{}{
|
| 89 |
+
+ "key1": "value1",
|
| 90 |
+
+ "key2": nil,
|
| 91 |
+
+ "key3": "value3",
|
| 92 |
+
+ },
|
| 93 |
+
+ },
|
| 94 |
+
+ expectedKey: "test",
|
| 95 |
+
+ expectedResult: map[string]string{
|
| 96 |
+
+ "key1": "value1",
|
| 97 |
+
+ // key2 should be skipped
|
| 98 |
+
+ "key3": "value3",
|
| 99 |
+
+ },
|
| 100 |
+
+ },
|
| 101 |
+
+ {
|
| 102 |
+
+ name: "handles non-string value in map",
|
| 103 |
+
+ key: "test",
|
| 104 |
+
+ data: map[string]interface{}{
|
| 105 |
+
+ "test": map[string]interface{}{
|
| 106 |
+
+ "key1": "value1",
|
| 107 |
+
+ "key2": 123,
|
| 108 |
+
+ "key3": map[string]string{
|
| 109 |
+
+ "nested": "value",
|
| 110 |
+
+ },
|
| 111 |
+
+ "key4": "value4",
|
| 112 |
+
+ },
|
| 113 |
+
+ },
|
| 114 |
+
+ expectedKey: "test",
|
| 115 |
+
+ expectedResult: map[string]string{
|
| 116 |
+
+ "key1": "value1",
|
| 117 |
+
+ // key2 should be skipped (non-string)
|
| 118 |
+
+ // key3 should be skipped (complex)
|
| 119 |
+
+ "key4": "value4",
|
| 120 |
+
+ },
|
| 121 |
+
+ },
|
| 122 |
+
+ {
|
| 123 |
+
+ name: "normal case - all strings",
|
| 124 |
+
+ key: "test",
|
| 125 |
+
+ data: map[string]interface{}{
|
| 126 |
+
+ "test": map[string]interface{}{
|
| 127 |
+
+ "key1": "value1",
|
| 128 |
+
+ "key2": "value2",
|
| 129 |
+
+ },
|
| 130 |
+
+ },
|
| 131 |
+
+ expectedKey: "test",
|
| 132 |
+
+ expectedResult: map[string]string{
|
| 133 |
+
+ "key1": "value1",
|
| 134 |
+
+ "key2": "value2",
|
| 135 |
+
+ },
|
| 136 |
+
+ },
|
| 137 |
+
+ }
|
| 138 |
+
+
|
| 139 |
+
+ for _, test := range tests {
|
| 140 |
+
+ t.Run(test.name, func(t *testing.T) {
|
| 141 |
+
+ key, result := getValueAsStringMap(test.key, test.data)
|
| 142 |
+
+ assert.Equal(t, test.expectedKey, key)
|
| 143 |
+
+ assert.Equal(t, test.expectedResult, result)
|
| 144 |
+
+ })
|
| 145 |
+
+ }
|
| 146 |
+
+}
|
| 147 |
+
+
|
| 148 |
+
+func TestExpandInMetadata_NilSafety(t *testing.T) {
|
| 149 |
+
+ testCases := []struct {
|
| 150 |
+
+ name string
|
| 151 |
+
+ patternMap map[string]interface{}
|
| 152 |
+
+ resourceMap map[string]interface{}
|
| 153 |
+
+ shouldPanic bool
|
| 154 |
+
+ }{
|
| 155 |
+
+ {
|
| 156 |
+
+ name: "nil value in annotation should not panic",
|
| 157 |
+
+ patternMap: map[string]interface{}{
|
| 158 |
+
+ "metadata": map[string]interface{}{
|
| 159 |
+
+ "annotations": map[string]interface{}{
|
| 160 |
+
+ "some-key": nil,
|
| 161 |
+
+ },
|
| 162 |
+
+ },
|
| 163 |
+
+ },
|
| 164 |
+
+ resourceMap: map[string]interface{}{
|
| 165 |
+
+ "metadata": map[string]interface{}{
|
| 166 |
+
+ "annotations": map[string]interface{}{
|
| 167 |
+
+ "real-key": "real-value",
|
| 168 |
+
+ },
|
| 169 |
+
+ },
|
| 170 |
+
+ },
|
| 171 |
+
+ shouldPanic: false,
|
| 172 |
+
+ },
|
| 173 |
+
+ {
|
| 174 |
+
+ name: "complex value in annotation should not panic",
|
| 175 |
+
+ patternMap: map[string]interface{}{
|
| 176 |
+
+ "metadata": map[string]interface{}{
|
| 177 |
+
+ "annotations": map[string]interface{}{
|
| 178 |
+
+ "some-key": map[string]interface{}{
|
| 179 |
+
+ "nested": "value",
|
| 180 |
+
+ },
|
| 181 |
+
+ },
|
| 182 |
+
+ },
|
| 183 |
+
+ },
|
| 184 |
+
+ resourceMap: map[string]interface{}{
|
| 185 |
+
+ "metadata": map[string]interface{}{
|
| 186 |
+
+ "annotations": map[string]interface{}{
|
| 187 |
+
+ "real-key": "real-value",
|
| 188 |
+
+ },
|
| 189 |
+
+ },
|
| 190 |
+
+ },
|
| 191 |
+
+ shouldPanic: false,
|
| 192 |
+
+ },
|
| 193 |
+
+ {
|
| 194 |
+
+ name: "simulated jmespath nil result",
|
| 195 |
+
+ patternMap: map[string]interface{}{
|
| 196 |
+
+ "metadata": map[string]interface{}{
|
| 197 |
+
+ "annotations": map[string]interface{}{
|
| 198 |
+
+ "test": nil, // Simulating what happens when {{@ | foo}} evaluates with undefined 'foo'
|
| 199 |
+
+ },
|
| 200 |
+
+ },
|
| 201 |
+
+ },
|
| 202 |
+
+ resourceMap: map[string]interface{}{
|
| 203 |
+
+ "metadata": map[string]interface{}{
|
| 204 |
+
+ "annotations": map[string]interface{}{
|
| 205 |
+
+ "real-key": "real-value",
|
| 206 |
+
+ },
|
| 207 |
+
+ },
|
| 208 |
+
+ },
|
| 209 |
+
+ shouldPanic: false,
|
| 210 |
+
+ },
|
| 211 |
+
+ }
|
| 212 |
+
+
|
| 213 |
+
+ for _, tc := range testCases {
|
| 214 |
+
+ t.Run(tc.name, func(t *testing.T) {
|
| 215 |
+
+ defer func() {
|
| 216 |
+
+ r := recover()
|
| 217 |
+
+ if tc.shouldPanic {
|
| 218 |
+
+ assert.NotNil(t, r, "Expected function to panic, but it didn't")
|
| 219 |
+
+ } else {
|
| 220 |
+
+ assert.Nil(t, r, "Function panicked unexpectedly")
|
| 221 |
+
+ }
|
| 222 |
+
+ }()
|
| 223 |
+
+
|
| 224 |
+
+ ExpandInMetadata(tc.patternMap, tc.resourceMap)
|
| 225 |
+
+ })
|
| 226 |
+
+ }
|
| 227 |
+
+}
|
| 228 |
+
+
|
| 229 |
+
+func TestJMESPathNil(t *testing.T) {
|
| 230 |
+
+ // Create a pattern with a nil value in labels or annotations
|
| 231 |
+
+ // to simulate what happens after a JMESPath expression like {{@ | foo}}
|
| 232 |
+
+ // (where 'foo' is not a defined function) is evaluated and results in nil.
|
| 233 |
+
+ patternMap := map[string]interface{}{
|
| 234 |
+
+ "metadata": map[string]interface{}{
|
| 235 |
+
+ "labels": map[string]interface{}{
|
| 236 |
+
+ "normal": "value",
|
| 237 |
+
+ "nil-value": nil, // This represents the result of {{@ | foo}} substitution
|
| 238 |
+
+ },
|
| 239 |
+
+ "annotations": map[string]interface{}{
|
| 240 |
+
+ "another-normal": "value",
|
| 241 |
+
+ "complex-value": map[string]interface{}{ // And this represents a complex structure
|
| 242 |
+
+ "nested": "value",
|
| 243 |
+
+ },
|
| 244 |
+
+ },
|
| 245 |
+
+ },
|
| 246 |
+
+ }
|
| 247 |
+
+
|
| 248 |
+
+ resourceMap := map[string]interface{}{
|
| 249 |
+
+ "metadata": map[string]interface{}{
|
| 250 |
+
+ "labels": map[string]interface{}{
|
| 251 |
+
+ "app": "test",
|
| 252 |
+
+ },
|
| 253 |
+
+ "annotations": map[string]interface{}{
|
| 254 |
+
+ "test": "value",
|
| 255 |
+
+ },
|
| 256 |
+
+ },
|
| 257 |
+
+ }
|
| 258 |
+
+
|
| 259 |
+
+ defer func() {
|
| 260 |
+
+ r := recover()
|
| 261 |
+
+ assert.Nil(t, r, "ExpandInMetadata should not panic with nil values, but it did: %v", r)
|
| 262 |
+
+ }()
|
| 263 |
+
+
|
| 264 |
+
+ result := ExpandInMetadata(patternMap, resourceMap)
|
| 265 |
+
+
|
| 266 |
+
+ // Additional verification that the function works correctly
|
| 267 |
+
+ metadataResult := result["metadata"].(map[string]interface{})
|
| 268 |
+
+ labelsResult, ok := metadataResult["labels"].(map[string]interface{})
|
| 269 |
+
+
|
| 270 |
+
+ assert.True(t, ok, "Expected labels to be a map[string]interface{}")
|
| 271 |
+
+ assert.Contains(t, labelsResult, "normal")
|
| 272 |
+
+
|
| 273 |
+
+ // Annotations with complex values should also be handled properly
|
| 274 |
+
+ annotationsResult, ok := metadataResult["annotations"].(map[string]interface{})
|
| 275 |
+
+ assert.True(t, ok, "Expected annotations to be a map[string]interface{}")
|
| 276 |
+
+ assert.Contains(t, annotationsResult, "another-normal")
|
| 277 |
+
+}
|
tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/post_context.md
ADDED
|
@@ -0,0 +1,449 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context after the fix
|
| 2 |
+
|
| 3 |
+
## `pkg/engine/wildcards/wildcards.go` (changed lines (138, 139, 140, 141, 142, 143, 144, 145, 146, 147))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package wildcards
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"strings"
|
| 10 |
+
|
| 11 |
+
"github.com/kyverno/kyverno/ext/wildcard"
|
| 12 |
+
"github.com/kyverno/kyverno/pkg/engine/anchor"
|
| 13 |
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
// ReplaceInSelector replaces label selector keys and values containing
|
| 17 |
+
// wildcard characters with matching keys and values from the resource labels.
|
| 18 |
+
func ReplaceInSelector(labelSelector *metav1.LabelSelector, resourceLabels map[string]string) *metav1.LabelSelector {
|
| 19 |
+
labelSelector = labelSelector.DeepCopy()
|
| 20 |
+
result := replaceWildcardsInMapKeyValues(labelSelector.MatchLabels, resourceLabels)
|
| 21 |
+
labelSelector.MatchLabels = result
|
| 22 |
+
return labelSelector
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
// replaceWildcardsInMapKeyValues will expand the "key" and "value" and will replace wildcard characters
|
| 26 |
+
// It also does not handle anchors as these are not expected in selectors
|
| 27 |
+
func replaceWildcardsInMapKeyValues(patternMap map[string]string, resourceMap map[string]string) map[string]string {
|
| 28 |
+
result := map[string]string{}
|
| 29 |
+
for k, v := range patternMap {
|
| 30 |
+
if wildcard.ContainsWildcard(k) || wildcard.ContainsWildcard(v) {
|
| 31 |
+
matchK, matchV := expandWildcards(k, v, resourceMap, true, true)
|
| 32 |
+
result[matchK] = matchV
|
| 33 |
+
} else {
|
| 34 |
+
result[k] = v
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return result
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
func expandWildcards(k, v string, resourceMap map[string]string, matchValue, replace bool) (key string, val string) {
|
| 41 |
+
for k1, v1 := range resourceMap {
|
| 42 |
+
if wildcard.Match(k, k1) {
|
| 43 |
+
if !matchValue {
|
| 44 |
+
return k1, v1
|
| 45 |
+
} else if wildcard.Match(v, v1) {
|
| 46 |
+
return k1, v1
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
if replace {
|
| 51 |
+
k = replaceWildCardChars(k)
|
| 52 |
+
v = replaceWildCardChars(v)
|
| 53 |
+
}
|
| 54 |
+
return k, v
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
// replaceWildCardChars will replace '*' and '?' characters which are not
|
| 58 |
+
// supported by Kubernetes with a '0'.
|
| 59 |
+
func replaceWildCardChars(s string) string {
|
| 60 |
+
s = strings.ReplaceAll(s, "*", "0")
|
| 61 |
+
s = strings.ReplaceAll(s, "?", "0")
|
| 62 |
+
return s
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
// ExpandInMetadata substitutes wildcard characters in map keys for metadata.labels and
|
| 66 |
+
// metadata.annotations that are present in a validation pattern. Values are not substituted
|
| 67 |
+
// here, as they are evaluated separately while processing the validation pattern. Anchors
|
| 68 |
+
// on the tags (e.g. "=(kubernetes.io/*)" will be preserved when the values are expanded.
|
| 69 |
+
func ExpandInMetadata(patternMap, resourceMap map[string]interface{}) map[string]interface{} {
|
| 70 |
+
_, patternMetadata := getPatternValue("metadata", patternMap)
|
| 71 |
+
if patternMetadata == nil {
|
| 72 |
+
return patternMap
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
resourceMetadata := resourceMap["metadata"]
|
| 76 |
+
if resourceMetadata == nil {
|
| 77 |
+
return patternMap
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
metadata := patternMetadata.(map[string]interface{})
|
| 81 |
+
labelsKey, labels := expandWildcardsInTag("labels", patternMetadata, resourceMetadata)
|
| 82 |
+
if labels != nil {
|
| 83 |
+
metadata[labelsKey] = labels
|
| 84 |
+
}
|
| 85 |
+
annotationsKey, annotations := expandWildcardsInTag("annotations", patternMetadata, resourceMetadata)
|
| 86 |
+
if annotations != nil {
|
| 87 |
+
metadata[annotationsKey] = annotations
|
| 88 |
+
}
|
| 89 |
+
return patternMap
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
func getPatternValue(tag string, pattern map[string]interface{}) (string, interface{}) {
|
| 93 |
+
for k, v := range pattern {
|
| 94 |
+
if k == tag {
|
| 95 |
+
return k, v
|
| 96 |
+
}
|
| 97 |
+
if a := anchor.Parse(k); a != nil && a.Key() == tag {
|
| 98 |
+
return k, v
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
return "", nil
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
// expandWildcardsInTag
|
| 105 |
+
func expandWildcardsInTag(tag string, patternMetadata, resourceMetadata interface{}) (string, map[string]interface{}) {
|
| 106 |
+
patternKey, patternData := getValueAsStringMap(tag, patternMetadata)
|
| 107 |
+
if patternData == nil {
|
| 108 |
+
return "", nil
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
_, resourceData := getValueAsStringMap(tag, resourceMetadata)
|
| 112 |
+
if resourceData == nil {
|
| 113 |
+
return "", nil
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
results := replaceWildcardsInMapKeys(patternData, resourceData)
|
| 117 |
+
return patternKey, results
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
func getValueAsStringMap(key string, data interface{}) (string, map[string]string) {
|
| 121 |
+
if data == nil {
|
| 122 |
+
return "", nil
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
dataMap, ok := data.(map[string]interface{})
|
| 126 |
+
if !ok {
|
| 127 |
+
return "", nil
|
| 128 |
+
}
|
| 129 |
+
patternKey, val := getPatternValue(key, dataMap)
|
| 130 |
+
|
| 131 |
+
if val == nil {
|
| 132 |
+
return "", nil
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
result := map[string]string{}
|
| 136 |
+
|
| 137 |
+
valMap, ok := val.(map[string]interface{})
|
| 138 |
+
if !ok {
|
| 139 |
+
return "", nil
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
for k, v := range valMap {
|
| 143 |
+
if v == nil {
|
| 144 |
+
continue
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
switch typedVal := v.(type) {
|
| 148 |
+
case string:
|
| 149 |
+
result[k] = typedVal
|
| 150 |
+
default:
|
| 151 |
+
continue
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
return patternKey, result
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
// replaceWildcardsInMapKeys will expand only the "key" and not replace wildcard characters in the key or values
|
| 159 |
+
// It also preserves anchors in keys
|
| 160 |
+
func replaceWildcardsInMapKeys(patternData, resourceData map[string]string) map[string]interface{} {
|
| 161 |
+
results := map[string]interface{}{}
|
| 162 |
+
for k, v := range patternData {
|
| 163 |
+
if wildcard.ContainsWildcard(k) {
|
| 164 |
+
if a := anchor.Parse(k); a != nil {
|
| 165 |
+
matchK, _ := expandWildcards(a.Key(), v, resourceData, false, false)
|
| 166 |
+
results[anchor.String(a.Type(), matchK)] = v
|
| 167 |
+
} else {
|
| 168 |
+
matchK, _ := expandWildcards(k, v, resourceData, false, false)
|
| 169 |
+
results[matchK] = v
|
| 170 |
+
}
|
| 171 |
+
} else {
|
| 172 |
+
results[k] = v
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
return results
|
| 176 |
+
}
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
## `pkg/engine/wildcards/wildcards_test.go` (changed lines (6, 7, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267))
|
| 180 |
+
|
| 181 |
+
```go
|
| 182 |
+
package wildcards
|
| 183 |
+
|
| 184 |
+
import (
|
| 185 |
+
"reflect"
|
| 186 |
+
"testing"
|
| 187 |
+
|
| 188 |
+
"github.com/stretchr/testify/assert"
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
func TestExpandInMetadata(t *testing.T) {
|
| 192 |
+
// testExpand(t, map[string]string{"test/*": "*"}, map[string]string{},
|
| 193 |
+
// map[string]string{"test/0": "0"})
|
| 194 |
+
|
| 195 |
+
testExpand(t, map[string]string{"test/*": "*"}, map[string]string{"test/test": "test"},
|
| 196 |
+
map[string]interface{}{"test/test": "*"})
|
| 197 |
+
|
| 198 |
+
testExpand(t, map[string]string{"=(test/*)": "test"}, map[string]string{"test/test": "test"},
|
| 199 |
+
map[string]interface{}{"=(test/test)": "test"})
|
| 200 |
+
|
| 201 |
+
testExpand(t, map[string]string{"test/*": "*"}, map[string]string{"test/test1": "test1"},
|
| 202 |
+
map[string]interface{}{"test/test1": "*"})
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
func testExpand(t *testing.T, patternMap, resourceMap map[string]string, expectedMap map[string]interface{}) {
|
| 206 |
+
result := replaceWildcardsInMapKeys(patternMap, resourceMap)
|
| 207 |
+
if !reflect.DeepEqual(expectedMap, result) {
|
| 208 |
+
t.Errorf("expected %v but received %v", expectedMap, result)
|
| 209 |
+
}
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
func TestGetValueAsStringMap_NilHandling(t *testing.T) {
|
| 213 |
+
tests := []struct {
|
| 214 |
+
name string
|
| 215 |
+
key string
|
| 216 |
+
data interface{}
|
| 217 |
+
expectedKey string
|
| 218 |
+
expectedResult map[string]string
|
| 219 |
+
}{
|
| 220 |
+
{
|
| 221 |
+
name: "nil data",
|
| 222 |
+
key: "test",
|
| 223 |
+
data: nil,
|
| 224 |
+
expectedKey: "",
|
| 225 |
+
expectedResult: nil,
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
name: "data is not a map",
|
| 229 |
+
key: "test",
|
| 230 |
+
data: "not a map",
|
| 231 |
+
expectedKey: "",
|
| 232 |
+
expectedResult: nil,
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
name: "key not found",
|
| 236 |
+
key: "nonexistent",
|
| 237 |
+
data: map[string]interface{}{"otherKey": "value"},
|
| 238 |
+
expectedKey: "",
|
| 239 |
+
expectedResult: nil,
|
| 240 |
+
},
|
| 241 |
+
{
|
| 242 |
+
name: "value is nil",
|
| 243 |
+
key: "test",
|
| 244 |
+
data: map[string]interface{}{"test": nil},
|
| 245 |
+
expectedKey: "",
|
| 246 |
+
expectedResult: nil,
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
name: "value is not a map",
|
| 250 |
+
key: "test",
|
| 251 |
+
data: map[string]interface{}{"test": "not a map"},
|
| 252 |
+
expectedKey: "",
|
| 253 |
+
expectedResult: nil,
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
name: "handles nil value in map",
|
| 257 |
+
key: "test",
|
| 258 |
+
data: map[string]interface{}{
|
| 259 |
+
"test": map[string]interface{}{
|
| 260 |
+
"key1": "value1",
|
| 261 |
+
"key2": nil,
|
| 262 |
+
"key3": "value3",
|
| 263 |
+
},
|
| 264 |
+
},
|
| 265 |
+
expectedKey: "test",
|
| 266 |
+
expectedResult: map[string]string{
|
| 267 |
+
"key1": "value1",
|
| 268 |
+
// key2 should be skipped
|
| 269 |
+
"key3": "value3",
|
| 270 |
+
},
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
name: "handles non-string value in map",
|
| 274 |
+
key: "test",
|
| 275 |
+
data: map[string]interface{}{
|
| 276 |
+
"test": map[string]interface{}{
|
| 277 |
+
"key1": "value1",
|
| 278 |
+
"key2": 123,
|
| 279 |
+
"key3": map[string]string{
|
| 280 |
+
"nested": "value",
|
| 281 |
+
},
|
| 282 |
+
"key4": "value4",
|
| 283 |
+
},
|
| 284 |
+
},
|
| 285 |
+
expectedKey: "test",
|
| 286 |
+
expectedResult: map[string]string{
|
| 287 |
+
"key1": "value1",
|
| 288 |
+
// key2 should be skipped (non-string)
|
| 289 |
+
// key3 should be skipped (complex)
|
| 290 |
+
"key4": "value4",
|
| 291 |
+
},
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
name: "normal case - all strings",
|
| 295 |
+
key: "test",
|
| 296 |
+
data: map[string]interface{}{
|
| 297 |
+
"test": map[string]interface{}{
|
| 298 |
+
"key1": "value1",
|
| 299 |
+
"key2": "value2",
|
| 300 |
+
},
|
| 301 |
+
},
|
| 302 |
+
expectedKey: "test",
|
| 303 |
+
expectedResult: map[string]string{
|
| 304 |
+
"key1": "value1",
|
| 305 |
+
"key2": "value2",
|
| 306 |
+
},
|
| 307 |
+
},
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
for _, test := range tests {
|
| 311 |
+
t.Run(test.name, func(t *testing.T) {
|
| 312 |
+
key, result := getValueAsStringMap(test.key, test.data)
|
| 313 |
+
assert.Equal(t, test.expectedKey, key)
|
| 314 |
+
assert.Equal(t, test.expectedResult, result)
|
| 315 |
+
})
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
func TestExpandInMetadata_NilSafety(t *testing.T) {
|
| 320 |
+
testCases := []struct {
|
| 321 |
+
name string
|
| 322 |
+
patternMap map[string]interface{}
|
| 323 |
+
resourceMap map[string]interface{}
|
| 324 |
+
shouldPanic bool
|
| 325 |
+
}{
|
| 326 |
+
{
|
| 327 |
+
name: "nil value in annotation should not panic",
|
| 328 |
+
patternMap: map[string]interface{}{
|
| 329 |
+
"metadata": map[string]interface{}{
|
| 330 |
+
"annotations": map[string]interface{}{
|
| 331 |
+
"some-key": nil,
|
| 332 |
+
},
|
| 333 |
+
},
|
| 334 |
+
},
|
| 335 |
+
resourceMap: map[string]interface{}{
|
| 336 |
+
"metadata": map[string]interface{}{
|
| 337 |
+
"annotations": map[string]interface{}{
|
| 338 |
+
"real-key": "real-value",
|
| 339 |
+
},
|
| 340 |
+
},
|
| 341 |
+
},
|
| 342 |
+
shouldPanic: false,
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
name: "complex value in annotation should not panic",
|
| 346 |
+
patternMap: map[string]interface{}{
|
| 347 |
+
"metadata": map[string]interface{}{
|
| 348 |
+
"annotations": map[string]interface{}{
|
| 349 |
+
"some-key": map[string]interface{}{
|
| 350 |
+
"nested": "value",
|
| 351 |
+
},
|
| 352 |
+
},
|
| 353 |
+
},
|
| 354 |
+
},
|
| 355 |
+
resourceMap: map[string]interface{}{
|
| 356 |
+
"metadata": map[string]interface{}{
|
| 357 |
+
"annotations": map[string]interface{}{
|
| 358 |
+
"real-key": "real-value",
|
| 359 |
+
},
|
| 360 |
+
},
|
| 361 |
+
},
|
| 362 |
+
shouldPanic: false,
|
| 363 |
+
},
|
| 364 |
+
{
|
| 365 |
+
name: "simulated jmespath nil result",
|
| 366 |
+
patternMap: map[string]interface{}{
|
| 367 |
+
"metadata": map[string]interface{}{
|
| 368 |
+
"annotations": map[string]interface{}{
|
| 369 |
+
"test": nil, // Simulating what happens when {{@ | foo}} evaluates with undefined 'foo'
|
| 370 |
+
},
|
| 371 |
+
},
|
| 372 |
+
},
|
| 373 |
+
resourceMap: map[string]interface{}{
|
| 374 |
+
"metadata": map[string]interface{}{
|
| 375 |
+
"annotations": map[string]interface{}{
|
| 376 |
+
"real-key": "real-value",
|
| 377 |
+
},
|
| 378 |
+
},
|
| 379 |
+
},
|
| 380 |
+
shouldPanic: false,
|
| 381 |
+
},
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
for _, tc := range testCases {
|
| 385 |
+
t.Run(tc.name, func(t *testing.T) {
|
| 386 |
+
defer func() {
|
| 387 |
+
r := recover()
|
| 388 |
+
if tc.shouldPanic {
|
| 389 |
+
assert.NotNil(t, r, "Expected function to panic, but it didn't")
|
| 390 |
+
} else {
|
| 391 |
+
assert.Nil(t, r, "Function panicked unexpectedly")
|
| 392 |
+
}
|
| 393 |
+
}()
|
| 394 |
+
|
| 395 |
+
ExpandInMetadata(tc.patternMap, tc.resourceMap)
|
| 396 |
+
})
|
| 397 |
+
}
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
func TestJMESPathNil(t *testing.T) {
|
| 401 |
+
// Create a pattern with a nil value in labels or annotations
|
| 402 |
+
// to simulate what happens after a JMESPath expression like {{@ | foo}}
|
| 403 |
+
// (where 'foo' is not a defined function) is evaluated and results in nil.
|
| 404 |
+
patternMap := map[string]interface{}{
|
| 405 |
+
"metadata": map[string]interface{}{
|
| 406 |
+
"labels": map[string]interface{}{
|
| 407 |
+
"normal": "value",
|
| 408 |
+
"nil-value": nil, // This represents the result of {{@ | foo}} substitution
|
| 409 |
+
},
|
| 410 |
+
"annotations": map[string]interface{}{
|
| 411 |
+
"another-normal": "value",
|
| 412 |
+
"complex-value": map[string]interface{}{ // And this represents a complex structure
|
| 413 |
+
"nested": "value",
|
| 414 |
+
},
|
| 415 |
+
},
|
| 416 |
+
},
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
resourceMap := map[string]interface{}{
|
| 420 |
+
"metadata": map[string]interface{}{
|
| 421 |
+
"labels": map[string]interface{}{
|
| 422 |
+
"app": "test",
|
| 423 |
+
},
|
| 424 |
+
"annotations": map[string]interface{}{
|
| 425 |
+
"test": "value",
|
| 426 |
+
},
|
| 427 |
+
},
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
defer func() {
|
| 431 |
+
r := recover()
|
| 432 |
+
assert.Nil(t, r, "ExpandInMetadata should not panic with nil values, but it did: %v", r)
|
| 433 |
+
}()
|
| 434 |
+
|
| 435 |
+
result := ExpandInMetadata(patternMap, resourceMap)
|
| 436 |
+
|
| 437 |
+
// Additional verification that the function works correctly
|
| 438 |
+
metadataResult := result["metadata"].(map[string]interface{})
|
| 439 |
+
labelsResult, ok := metadataResult["labels"].(map[string]interface{})
|
| 440 |
+
|
| 441 |
+
assert.True(t, ok, "Expected labels to be a map[string]interface{}")
|
| 442 |
+
assert.Contains(t, labelsResult, "normal")
|
| 443 |
+
|
| 444 |
+
// Annotations with complex values should also be handled properly
|
| 445 |
+
annotationsResult, ok := metadataResult["annotations"].(map[string]interface{})
|
| 446 |
+
assert.True(t, ok, "Expected annotations to be a map[string]interface{}")
|
| 447 |
+
assert.Contains(t, annotationsResult, "another-normal")
|
| 448 |
+
}
|
| 449 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/pre_context.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context before the fix
|
| 2 |
+
|
| 3 |
+
## `pkg/engine/wildcards/wildcards.go` (changed lines (138, 139))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package wildcards
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"strings"
|
| 10 |
+
|
| 11 |
+
"github.com/kyverno/kyverno/ext/wildcard"
|
| 12 |
+
"github.com/kyverno/kyverno/pkg/engine/anchor"
|
| 13 |
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
// ReplaceInSelector replaces label selector keys and values containing
|
| 17 |
+
// wildcard characters with matching keys and values from the resource labels.
|
| 18 |
+
func ReplaceInSelector(labelSelector *metav1.LabelSelector, resourceLabels map[string]string) *metav1.LabelSelector {
|
| 19 |
+
labelSelector = labelSelector.DeepCopy()
|
| 20 |
+
result := replaceWildcardsInMapKeyValues(labelSelector.MatchLabels, resourceLabels)
|
| 21 |
+
labelSelector.MatchLabels = result
|
| 22 |
+
return labelSelector
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
// replaceWildcardsInMapKeyValues will expand the "key" and "value" and will replace wildcard characters
|
| 26 |
+
// It also does not handle anchors as these are not expected in selectors
|
| 27 |
+
func replaceWildcardsInMapKeyValues(patternMap map[string]string, resourceMap map[string]string) map[string]string {
|
| 28 |
+
result := map[string]string{}
|
| 29 |
+
for k, v := range patternMap {
|
| 30 |
+
if wildcard.ContainsWildcard(k) || wildcard.ContainsWildcard(v) {
|
| 31 |
+
matchK, matchV := expandWildcards(k, v, resourceMap, true, true)
|
| 32 |
+
result[matchK] = matchV
|
| 33 |
+
} else {
|
| 34 |
+
result[k] = v
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return result
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
func expandWildcards(k, v string, resourceMap map[string]string, matchValue, replace bool) (key string, val string) {
|
| 41 |
+
for k1, v1 := range resourceMap {
|
| 42 |
+
if wildcard.Match(k, k1) {
|
| 43 |
+
if !matchValue {
|
| 44 |
+
return k1, v1
|
| 45 |
+
} else if wildcard.Match(v, v1) {
|
| 46 |
+
return k1, v1
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
if replace {
|
| 51 |
+
k = replaceWildCardChars(k)
|
| 52 |
+
v = replaceWildCardChars(v)
|
| 53 |
+
}
|
| 54 |
+
return k, v
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
// replaceWildCardChars will replace '*' and '?' characters which are not
|
| 58 |
+
// supported by Kubernetes with a '0'.
|
| 59 |
+
func replaceWildCardChars(s string) string {
|
| 60 |
+
s = strings.ReplaceAll(s, "*", "0")
|
| 61 |
+
s = strings.ReplaceAll(s, "?", "0")
|
| 62 |
+
return s
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
// ExpandInMetadata substitutes wildcard characters in map keys for metadata.labels and
|
| 66 |
+
// metadata.annotations that are present in a validation pattern. Values are not substituted
|
| 67 |
+
// here, as they are evaluated separately while processing the validation pattern. Anchors
|
| 68 |
+
// on the tags (e.g. "=(kubernetes.io/*)" will be preserved when the values are expanded.
|
| 69 |
+
func ExpandInMetadata(patternMap, resourceMap map[string]interface{}) map[string]interface{} {
|
| 70 |
+
_, patternMetadata := getPatternValue("metadata", patternMap)
|
| 71 |
+
if patternMetadata == nil {
|
| 72 |
+
return patternMap
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
resourceMetadata := resourceMap["metadata"]
|
| 76 |
+
if resourceMetadata == nil {
|
| 77 |
+
return patternMap
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
metadata := patternMetadata.(map[string]interface{})
|
| 81 |
+
labelsKey, labels := expandWildcardsInTag("labels", patternMetadata, resourceMetadata)
|
| 82 |
+
if labels != nil {
|
| 83 |
+
metadata[labelsKey] = labels
|
| 84 |
+
}
|
| 85 |
+
annotationsKey, annotations := expandWildcardsInTag("annotations", patternMetadata, resourceMetadata)
|
| 86 |
+
if annotations != nil {
|
| 87 |
+
metadata[annotationsKey] = annotations
|
| 88 |
+
}
|
| 89 |
+
return patternMap
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
func getPatternValue(tag string, pattern map[string]interface{}) (string, interface{}) {
|
| 93 |
+
for k, v := range pattern {
|
| 94 |
+
if k == tag {
|
| 95 |
+
return k, v
|
| 96 |
+
}
|
| 97 |
+
if a := anchor.Parse(k); a != nil && a.Key() == tag {
|
| 98 |
+
return k, v
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
return "", nil
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
// expandWildcardsInTag
|
| 105 |
+
func expandWildcardsInTag(tag string, patternMetadata, resourceMetadata interface{}) (string, map[string]interface{}) {
|
| 106 |
+
patternKey, patternData := getValueAsStringMap(tag, patternMetadata)
|
| 107 |
+
if patternData == nil {
|
| 108 |
+
return "", nil
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
_, resourceData := getValueAsStringMap(tag, resourceMetadata)
|
| 112 |
+
if resourceData == nil {
|
| 113 |
+
return "", nil
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
results := replaceWildcardsInMapKeys(patternData, resourceData)
|
| 117 |
+
return patternKey, results
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
func getValueAsStringMap(key string, data interface{}) (string, map[string]string) {
|
| 121 |
+
if data == nil {
|
| 122 |
+
return "", nil
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
dataMap, ok := data.(map[string]interface{})
|
| 126 |
+
if !ok {
|
| 127 |
+
return "", nil
|
| 128 |
+
}
|
| 129 |
+
patternKey, val := getPatternValue(key, dataMap)
|
| 130 |
+
|
| 131 |
+
if val == nil {
|
| 132 |
+
return "", nil
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
result := map[string]string{}
|
| 136 |
+
|
| 137 |
+
valMap, ok := val.(map[string]interface{})
|
| 138 |
+
if !ok {
|
| 139 |
+
return "", nil
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
for k, v := range valMap {
|
| 143 |
+
result[k] = v.(string)
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
return patternKey, result
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
// replaceWildcardsInMapKeys will expand only the "key" and not replace wildcard characters in the key or values
|
| 150 |
+
// It also preserves anchors in keys
|
| 151 |
+
func replaceWildcardsInMapKeys(patternData, resourceData map[string]string) map[string]interface{} {
|
| 152 |
+
results := map[string]interface{}{}
|
| 153 |
+
for k, v := range patternData {
|
| 154 |
+
if wildcard.ContainsWildcard(k) {
|
| 155 |
+
if a := anchor.Parse(k); a != nil {
|
| 156 |
+
matchK, _ := expandWildcards(a.Key(), v, resourceData, false, false)
|
| 157 |
+
results[anchor.String(a.Type(), matchK)] = v
|
| 158 |
+
} else {
|
| 159 |
+
matchK, _ := expandWildcards(k, v, resourceData, false, false)
|
| 160 |
+
results[matchK] = v
|
| 161 |
+
}
|
| 162 |
+
} else {
|
| 163 |
+
results[k] = v
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
return results
|
| 167 |
+
}
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
## `pkg/engine/wildcards/wildcards_test.go` (changed lines (6, 28))
|
| 171 |
+
|
| 172 |
+
```go
|
| 173 |
+
package wildcards
|
| 174 |
+
|
| 175 |
+
import (
|
| 176 |
+
"reflect"
|
| 177 |
+
"testing"
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
func TestExpandInMetadata(t *testing.T) {
|
| 181 |
+
// testExpand(t, map[string]string{"test/*": "*"}, map[string]string{},
|
| 182 |
+
// map[string]string{"test/0": "0"})
|
| 183 |
+
|
| 184 |
+
testExpand(t, map[string]string{"test/*": "*"}, map[string]string{"test/test": "test"},
|
| 185 |
+
map[string]interface{}{"test/test": "*"})
|
| 186 |
+
|
| 187 |
+
testExpand(t, map[string]string{"=(test/*)": "test"}, map[string]string{"test/test": "test"},
|
| 188 |
+
map[string]interface{}{"=(test/test)": "test"})
|
| 189 |
+
|
| 190 |
+
testExpand(t, map[string]string{"test/*": "*"}, map[string]string{"test/test1": "test1"},
|
| 191 |
+
map[string]interface{}{"test/test1": "*"})
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
func testExpand(t *testing.T, patternMap, resourceMap map[string]string, expectedMap map[string]interface{}) {
|
| 195 |
+
result := replaceWildcardsInMapKeys(patternMap, resourceMap)
|
| 196 |
+
if !reflect.DeepEqual(expectedMap, result) {
|
| 197 |
+
t.Errorf("expected %v but received %v", expectedMap, result)
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/task.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "synthesis-task-v1",
|
| 3 |
+
"task": {
|
| 4 |
+
"pair_id": "morefixes-08d699b1f7c72c366406",
|
| 5 |
+
"dataset_id": "morefixes",
|
| 6 |
+
"dataset_item_id": "morefixes-08d699b1f7c72c366406",
|
| 7 |
+
"project_id": "morefixes__kyverno__kyverno",
|
| 8 |
+
"language": "go",
|
| 9 |
+
"backend": "codeql"
|
| 10 |
+
},
|
| 11 |
+
"changed_go_files": [
|
| 12 |
+
"pkg/engine/wildcards/wildcards.go",
|
| 13 |
+
"pkg/engine/wildcards/wildcards_test.go"
|
| 14 |
+
],
|
| 15 |
+
"patch_units": {
|
| 16 |
+
"before": [
|
| 17 |
+
"pkg/engine/wildcards/wildcards.go",
|
| 18 |
+
"pkg/engine/wildcards/wildcards_test.go"
|
| 19 |
+
],
|
| 20 |
+
"after": [
|
| 21 |
+
"pkg/engine/wildcards/wildcards.go",
|
| 22 |
+
"pkg/engine/wildcards/wildcards_test.go"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
"runtime_assets": {
|
| 26 |
+
"before": {
|
| 27 |
+
"database": "assets/83b670f1115034b4433e483663960bd3f562a7c09fe5cb6dcf140d5048a6ce8f/database",
|
| 28 |
+
"cache_key": "83b670f1115034b4433e483663960bd3f562a7c09fe5cb6dcf140d5048a6ce8f",
|
| 29 |
+
"codeql_version": "2.26.4"
|
| 30 |
+
},
|
| 31 |
+
"after": {
|
| 32 |
+
"database": "assets/c094a82c89630463a6d0fa86a16ba5c7492fab7051a11261cac1808586525ee0/database",
|
| 33 |
+
"cache_key": "c094a82c89630463a6d0fa86a16ba5c7492fab7051a11261cac1808586525ee0",
|
| 34 |
+
"codeql_version": "2.26.4"
|
| 35 |
+
},
|
| 36 |
+
"refine": {
|
| 37 |
+
"database": "assets/ca9672e6600175c72d388571605401118ec17d7e51613ef932b9e2ac55a0c8e9/database",
|
| 38 |
+
"cache_key": "ca9672e6600175c72d388571605401118ec17d7e51613ef932b9e2ac55a0c8e9",
|
| 39 |
+
"codeql_version": "2.26.4"
|
| 40 |
+
}
|
| 41 |
+
},
|
| 42 |
+
"benchmark_contract": {
|
| 43 |
+
"agent_visible": true,
|
| 44 |
+
"reference_query_location": "references/morefixes-08d699b1f7c72c366406/query/ (do not mount into agent)",
|
| 45 |
+
"evaluator_location": "evaluator/morefixes-08d699b1f7c72c366406/ (do not mount into agent)"
|
| 46 |
+
}
|
| 47 |
+
}
|
tasks/codeql_go_benchmark_top30_v1/morefixes-08d699b1f7c72c366406/task_prompt.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Go CodeQL detector synthesis
|
| 2 |
+
|
| 3 |
+
You are cc operating in `/work`. Starting only from the supplied patch,
|
| 4 |
+
before/after Go context, CodeQL references, and validation tools, synthesize a semantic CodeQL
|
| 5 |
+
detector for the vulnerability fixed by the patch. This is one fresh session. You may iterate inside
|
| 6 |
+
this session, but no later framework repair or resume will occur.
|
| 7 |
+
|
| 8 |
+
## Inputs and owned outputs
|
| 9 |
+
|
| 10 |
+
- Read `patch.diff`, `go_patch.diff`, `pre_context.md`, and `post_context.md`.
|
| 11 |
+
- Read `references/codeql/convergence_protocol.md` and
|
| 12 |
+
`references/codeql/go_api.md` before experimenting. Read the remaining
|
| 13 |
+
`references/codeql/` files for the selected mechanism.
|
| 14 |
+
- Use `scripts/search_codeql_api.sh` to inspect the pinned official libraries when an API detail is
|
| 15 |
+
uncertain. Do not guess predicate names or build a large family of inspection queries.
|
| 16 |
+
- Complete the design contract in `state.json` and `scope_statement.md` before final validation.
|
| 17 |
+
- Replace `query/vulnerability.ql`; add only genuinely shared `.qll` helpers when useful. Keep the
|
| 18 |
+
fixed offline dependency in `query/qlpack.yml`.
|
| 19 |
+
- Preserve the exact `expected_query_id` from `config.json` as the query's sole `@id`. This
|
| 20 |
+
task-unique metadata must never be used in a query predicate.
|
| 21 |
+
- Use `scripts/compile_query.sh`, `scripts/run_before.sh`, and `scripts/run_after.sh`.
|
| 22 |
+
- Finish by writing `summary.json` with `status`, `query_path`, `query_kind`, `build_passed`,
|
| 23 |
+
`before_findings`, `after_findings`, `validation_completed`, and a concise `notes` field.
|
| 24 |
+
|
| 25 |
+
## Required reasoning contract
|
| 26 |
+
|
| 27 |
+
Before coding, record this mapping in `state.json`:
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
vulnerable operation / trigger / patch safety condition
|
| 31 |
+
→ CodeQL-observable evidence
|
| 32 |
+
→ syntax, control-flow, local value-flow, global taint/value-flow, or interprocedural mechanism
|
| 33 |
+
→ source, sink/report site, guard/barrier and query predicates
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Choose the lowest mechanism that can actually prove the condition. Guard-sensitive patches require
|
| 37 |
+
real path/control-flow semantics; provenance-sensitive patches require value flow. Do not replace
|
| 38 |
+
either with source-text matching or with the mere presence of patch-added syntax.
|
| 39 |
+
|
| 40 |
+
## Mandatory convergence contract
|
| 41 |
+
|
| 42 |
+
The rollout has a 50-minute hard wall-clock ceiling and must be finalized by minute 43. Minutes
|
| 43 |
+
43–50 are an emergency shutdown buffer, not exploration time. A sophisticated unfinished query is
|
| 44 |
+
a failure; an early compilable semantic candidate can be improved. Follow the checkpoints in
|
| 45 |
+
`references/codeql/convergence_protocol.md`:
|
| 46 |
+
|
| 47 |
+
1. Record the mechanism contract, then replace the placeholder in `query/vulnerability.ql`
|
| 48 |
+
immediately. Do not wait until every CodeQL API detail is known.
|
| 49 |
+
2. Use at most three distinct scratch `.ql` files. Prefer repeatedly editing one
|
| 50 |
+
`query/scratch.ql`. After two failed variants of one API assumption, inspect the exact bundled
|
| 51 |
+
definition with `scripts/search_codeql_api.sh` or simplify the mechanism.
|
| 52 |
+
3. Obtain a compiling minimal main query before broadening it. Compile the main query after every
|
| 53 |
+
meaningful mechanism change.
|
| 54 |
+
4. Move in order from compile → relevant before finding → after elimination → final contract. Do
|
| 55 |
+
not continue API exploration after the intended before/after differential is established.
|
| 56 |
+
5. Run `scripts/check_progress.sh` at each checkpoint. It reports elapsed time, the minute-43
|
| 57 |
+
finalization deadline, and the minute-50 hard timeout. When it prints `finalize_now`, stop all
|
| 58 |
+
exploration, preserve the best compiling query, finish the contract files, and exit.
|
| 59 |
+
|
| 60 |
+
## Semantic and generalization rules
|
| 61 |
+
|
| 62 |
+
- Report at the vulnerable call, operator, access, or sink.
|
| 63 |
+
- Do not use a patch-local path, line, commit hash, label, or local variable name as the primary
|
| 64 |
+
matching condition. Stable library/framework APIs or public project APIs are allowed only when
|
| 65 |
+
`scope_statement.md` explains why they define the intended vulnerability family.
|
| 66 |
+
- The safety condition introduced by the patch must be represented by the query.
|
| 67 |
+
- A lower after warning count is not enough: inspect SARIF and ensure at least one intended before
|
| 68 |
+
finding is in a patch-overlapping semantic unit and the corresponding finding disappears after.
|
| 69 |
+
- Avoid broad proxy queries that report an enclosing function or unrelated API merely because it
|
| 70 |
+
changed in the patch.
|
| 71 |
+
|
| 72 |
+
## Final validation protocol
|
| 73 |
+
|
| 74 |
+
1. Compile the final query.
|
| 75 |
+
2. Run it on before and inspect `raw/before.sarif` for the intended report location.
|
| 76 |
+
3. Run the identical query on after and inspect `raw/after.sarif`.
|
| 77 |
+
4. Recheck query metadata, query kind/select signature, report locality, design-to-code consistency,
|
| 78 |
+
and absence of patch-local hardcoding.
|
| 79 |
+
5. Update `state.json`, `scope_statement.md`, and write valid `summary.json`.
|
| 80 |
+
|
| 81 |
+
Do not modify the runtime databases, references, patch, context, or validation scripts except for
|
| 82 |
+
normal CodeQL-generated database caches produced by the provided run scripts.
|
tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/patch.diff
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/mp4.go b/mp4.go
|
| 2 |
+
index bc0286b..6523397 100644
|
| 3 |
+
--- a/mp4.go
|
| 4 |
+
+++ b/mp4.go
|
| 5 |
+
@@ -149,8 +149,8 @@ func (m metadataMP4) readAtomData(r io.ReadSeeker, name string, size uint32, pro
|
| 6 |
+
// "data" + size (4 bytes each)
|
| 7 |
+
b = b[8:]
|
| 8 |
+
|
| 9 |
+
- if len(b) < 3 {
|
| 10 |
+
- return fmt.Errorf("invalid encoding: expected at least %d bytes, for class, got %d", 3, len(b))
|
| 11 |
+
+ if len(b) < 4 {
|
| 12 |
+
+ return fmt.Errorf("invalid encoding: expected at least %d bytes, for class, got %d", 4, len(b))
|
| 13 |
+
}
|
| 14 |
+
class := getInt(b[1:4])
|
| 15 |
+
var ok bool
|
tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/post_context.md
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context after the fix
|
| 2 |
+
|
| 3 |
+
## `mp4.go` (changed lines (152, 153))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
// Copyright 2015, David Howden
|
| 7 |
+
// Use of this source code is governed by a BSD-style
|
| 8 |
+
// license that can be found in the LICENSE file.
|
| 9 |
+
|
| 10 |
+
package tag
|
| 11 |
+
|
| 12 |
+
import (
|
| 13 |
+
"bytes"
|
| 14 |
+
"encoding/binary"
|
| 15 |
+
"errors"
|
| 16 |
+
"fmt"
|
| 17 |
+
"io"
|
| 18 |
+
"strconv"
|
| 19 |
+
"strings"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
var atomTypes = map[int]string{
|
| 23 |
+
0: "implicit", // automatic based on atom name
|
| 24 |
+
1: "text",
|
| 25 |
+
13: "jpeg",
|
| 26 |
+
14: "png",
|
| 27 |
+
21: "uint8",
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// NB: atoms does not include "----", this is handled separately
|
| 31 |
+
var atoms = atomNames(map[string]string{
|
| 32 |
+
"\xa9alb": "album",
|
| 33 |
+
"\xa9art": "artist",
|
| 34 |
+
"\xa9ART": "artist",
|
| 35 |
+
"aART": "album_artist",
|
| 36 |
+
"\xa9day": "year",
|
| 37 |
+
"\xa9nam": "title",
|
| 38 |
+
"\xa9gen": "genre",
|
| 39 |
+
"trkn": "track",
|
| 40 |
+
"\xa9wrt": "composer",
|
| 41 |
+
"\xa9too": "encoder",
|
| 42 |
+
"cprt": "copyright",
|
| 43 |
+
"covr": "picture",
|
| 44 |
+
"\xa9grp": "grouping",
|
| 45 |
+
"keyw": "keyword",
|
| 46 |
+
"\xa9lyr": "lyrics",
|
| 47 |
+
"\xa9cmt": "comment",
|
| 48 |
+
"tmpo": "tempo",
|
| 49 |
+
"cpil": "compilation",
|
| 50 |
+
"disk": "disc",
|
| 51 |
+
})
|
| 52 |
+
|
| 53 |
+
// Detect PNG image if "implicit" class is used
|
| 54 |
+
var pngHeader = []byte{137, 80, 78, 71, 13, 10, 26, 10}
|
| 55 |
+
|
| 56 |
+
type atomNames map[string]string
|
| 57 |
+
|
| 58 |
+
func (f atomNames) Name(n string) []string {
|
| 59 |
+
res := make([]string, 1)
|
| 60 |
+
for k, v := range f {
|
| 61 |
+
if v == n {
|
| 62 |
+
res = append(res, k)
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
return res
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
// metadataMP4 is the implementation of Metadata for MP4 tag (atom) data.
|
| 69 |
+
type metadataMP4 struct {
|
| 70 |
+
fileType FileType
|
| 71 |
+
data map[string]interface{}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
// ReadAtoms reads MP4 metadata atoms from the io.ReadSeeker into a Metadata, returning
|
| 75 |
+
// non-nil error if there was a problem.
|
| 76 |
+
func ReadAtoms(r io.ReadSeeker) (Metadata, error) {
|
| 77 |
+
m := metadataMP4{
|
| 78 |
+
data: make(map[string]interface{}),
|
| 79 |
+
fileType: UnknownFileType,
|
| 80 |
+
}
|
| 81 |
+
err := m.readAtoms(r)
|
| 82 |
+
return m, err
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
func (m metadataMP4) readAtoms(r io.ReadSeeker) error {
|
| 86 |
+
for {
|
| 87 |
+
name, size, err := readAtomHeader(r)
|
| 88 |
+
if err != nil {
|
| 89 |
+
if err == io.EOF {
|
| 90 |
+
return nil
|
| 91 |
+
}
|
| 92 |
+
return err
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
switch name {
|
| 96 |
+
case "meta":
|
| 97 |
+
// next_item_id (int32)
|
| 98 |
+
_, err := readBytes(r, 4)
|
| 99 |
+
if err != nil {
|
| 100 |
+
return err
|
| 101 |
+
}
|
| 102 |
+
fallthrough
|
| 103 |
+
|
| 104 |
+
case "moov", "udta", "ilst":
|
| 105 |
+
return m.readAtoms(r)
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
_, ok := atoms[name]
|
| 109 |
+
var data []string
|
| 110 |
+
if name == "----" {
|
| 111 |
+
name, data, err = readCustomAtom(r, size)
|
| 112 |
+
if err != nil {
|
| 113 |
+
return err
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
if name != "----" {
|
| 117 |
+
ok = true
|
| 118 |
+
size = 0 // already read data
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
if !ok {
|
| 123 |
+
_, err := r.Seek(int64(size-8), io.SeekCurrent)
|
| 124 |
+
if err != nil {
|
| 125 |
+
return err
|
| 126 |
+
}
|
| 127 |
+
continue
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
err = m.readAtomData(r, name, size-8, data)
|
| 131 |
+
if err != nil {
|
| 132 |
+
return err
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
func (m metadataMP4) readAtomData(r io.ReadSeeker, name string, size uint32, processedData []string) error {
|
| 138 |
+
var b []byte
|
| 139 |
+
var err error
|
| 140 |
+
var contentType string
|
| 141 |
+
if len(processedData) > 0 {
|
| 142 |
+
b = []byte(strings.Join(processedData, ";")) // add delimiter if multiple data fields
|
| 143 |
+
contentType = "text"
|
| 144 |
+
} else {
|
| 145 |
+
// read the data
|
| 146 |
+
b, err = readBytes(r, uint(size))
|
| 147 |
+
if err != nil {
|
| 148 |
+
return err
|
| 149 |
+
}
|
| 150 |
+
if len(b) < 8 {
|
| 151 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, got %d", 8, len(b))
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
// "data" + size (4 bytes each)
|
| 155 |
+
b = b[8:]
|
| 156 |
+
|
| 157 |
+
if len(b) < 4 {
|
| 158 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, for class, got %d", 4, len(b))
|
| 159 |
+
}
|
| 160 |
+
class := getInt(b[1:4])
|
| 161 |
+
var ok bool
|
| 162 |
+
contentType, ok = atomTypes[class]
|
| 163 |
+
if !ok {
|
| 164 |
+
return fmt.Errorf("invalid content type: %v (%x) (%x)", class, b[1:4], b)
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
// 4: atom version (1 byte) + atom flags (3 bytes)
|
| 168 |
+
// 4: NULL (usually locale indicator)
|
| 169 |
+
if len(b) < 8 {
|
| 170 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, for atom version and flags, got %d", 8, len(b))
|
| 171 |
+
}
|
| 172 |
+
b = b[8:]
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
if name == "trkn" || name == "disk" {
|
| 176 |
+
if len(b) < 6 {
|
| 177 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, for track and disk numbers, got %d", 6, len(b))
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
m.data[name] = int(b[3])
|
| 181 |
+
m.data[name+"_count"] = int(b[5])
|
| 182 |
+
return nil
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
if contentType == "implicit" {
|
| 186 |
+
if name == "covr" {
|
| 187 |
+
if bytes.HasPrefix(b, pngHeader) {
|
| 188 |
+
contentType = "png"
|
| 189 |
+
}
|
| 190 |
+
// TODO(dhowden): Detect JPEG formats too (harder).
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
var data interface{}
|
| 195 |
+
switch contentType {
|
| 196 |
+
case "implicit":
|
| 197 |
+
if _, ok := atoms[name]; ok {
|
| 198 |
+
return fmt.Errorf("unhandled implicit content type for required atom: %q", name)
|
| 199 |
+
}
|
| 200 |
+
return nil
|
| 201 |
+
|
| 202 |
+
case "text":
|
| 203 |
+
data = string(b)
|
| 204 |
+
|
| 205 |
+
case "uint8":
|
| 206 |
+
if len(b) < 1 {
|
| 207 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, for integer tag data, got %d", 1, len(b))
|
| 208 |
+
}
|
| 209 |
+
data = getInt(b[:1])
|
| 210 |
+
|
| 211 |
+
case "jpeg", "png":
|
| 212 |
+
data = &Picture{
|
| 213 |
+
Ext: contentType,
|
| 214 |
+
MIMEType: "image/" + contentType,
|
| 215 |
+
Data: b,
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
m.data[name] = data
|
| 219 |
+
|
| 220 |
+
return nil
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
func readAtomHeader(r io.ReadSeeker) (name string, size uint32, err error) {
|
| 224 |
+
err = binary.Read(r, binary.BigEndian, &size)
|
| 225 |
+
if err != nil {
|
| 226 |
+
return
|
| 227 |
+
}
|
| 228 |
+
name, err = readString(r, 4)
|
| 229 |
+
return
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
// Generic atom.
|
| 233 |
+
// Should have 3 sub atoms : mean, name and data.
|
| 234 |
+
// We check that mean is "com.apple.iTunes" and we use the subname as
|
| 235 |
+
// the name, and move to the data atom.
|
| 236 |
+
// Data atom could have multiple data values, each with a header.
|
| 237 |
+
// If anything goes wrong, we jump at the end of the "----" atom.
|
| 238 |
+
func readCustomAtom(r io.ReadSeeker, size uint32) (_ string, data []string, _ error) {
|
| 239 |
+
subNames := make(map[string]string)
|
| 240 |
+
|
| 241 |
+
for size > 8 {
|
| 242 |
+
subName, subSize, err := readAtomHeader(r)
|
| 243 |
+
if err != nil {
|
| 244 |
+
return "", nil, err
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
// Remove the size of the atom from the size counter
|
| 248 |
+
if size >= subSize {
|
| 249 |
+
size -= subSize
|
| 250 |
+
} else {
|
| 251 |
+
return "", nil, errors.New("--- invalid size")
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
b, err := readBytes(r, uint(subSize-8))
|
| 255 |
+
if err != nil {
|
| 256 |
+
return "", nil, err
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
if len(b) < 4 {
|
| 260 |
+
return "", nil, fmt.Errorf("invalid encoding: expected at least %d bytes, got %d", 4, len(b))
|
| 261 |
+
}
|
| 262 |
+
switch subName {
|
| 263 |
+
case "mean", "name":
|
| 264 |
+
subNames[subName] = string(b[4:])
|
| 265 |
+
case "data":
|
| 266 |
+
data = append(data, string(b[4:]))
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
// there should remain only the header size
|
| 271 |
+
if size != 8 {
|
| 272 |
+
err := errors.New("---- atom out of bounds")
|
| 273 |
+
return "", nil, err
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
if subNames["mean"] != "com.apple.iTunes" || subNames["name"] == "" || len(data) == 0 {
|
| 277 |
+
return "----", nil, nil
|
| 278 |
+
}
|
| 279 |
+
return subNames["name"], data, nil
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
func (metadataMP4) Format() Format { return MP4 }
|
| 283 |
+
func (m metadataMP4) FileType() FileType { return m.fileType }
|
| 284 |
+
|
| 285 |
+
func (m metadataMP4) Raw() map[string]interface{} { return m.data }
|
| 286 |
+
|
| 287 |
+
func (m metadataMP4) getString(n []string) string {
|
| 288 |
+
for _, k := range n {
|
| 289 |
+
if x, ok := m.data[k]; ok {
|
| 290 |
+
return x.(string)
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
return ""
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
func (m metadataMP4) getInt(n []string) int {
|
| 297 |
+
for _, k := range n {
|
| 298 |
+
if x, ok := m.data[k]; ok {
|
| 299 |
+
return x.(int)
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
+
return 0
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
func (m metadataMP4) Title() string {
|
| 306 |
+
return m.getString(atoms.Name("title"))
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
func (m metadataMP4) Artist() string {
|
| 310 |
+
return m.getString(atoms.Name("artist"))
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
func (m metadataMP4) Album() string {
|
| 314 |
+
return m.getString(atoms.Name("album"))
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
func (m metadataMP4) AlbumArtist() string {
|
| 318 |
+
return m.getString(atoms.Name("album_artist"))
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
func (m metadataMP4) Composer() string {
|
| 322 |
+
return m.getString(atoms.Name("composer"))
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
func (m metadataMP4) Genre() string {
|
| 326 |
+
return m.getString(atoms.Name("genre"))
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
func (m metadataMP4) Year() int {
|
| 330 |
+
date := m.getString(atoms.Name("year"))
|
| 331 |
+
if len(date) >= 4 {
|
| 332 |
+
year, _ := strconv.Atoi(date[:4])
|
| 333 |
+
return year
|
| 334 |
+
}
|
| 335 |
+
return 0
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
func (m metadataMP4) Track() (int, int) {
|
| 339 |
+
x := m.getInt([]string{"trkn"})
|
| 340 |
+
if n, ok := m.data["trkn_count"]; ok {
|
| 341 |
+
return x, n.(int)
|
| 342 |
+
}
|
| 343 |
+
return x, 0
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
func (m metadataMP4) Disc() (int, int) {
|
| 347 |
+
x := m.getInt([]string{"disk"})
|
| 348 |
+
if n, ok := m.data["disk_count"]; ok {
|
| 349 |
+
return x, n.(int)
|
| 350 |
+
}
|
| 351 |
+
return x, 0
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
func (m metadataMP4) Lyrics() string {
|
| 355 |
+
t, ok := m.data["\xa9lyr"]
|
| 356 |
+
if !ok {
|
| 357 |
+
return ""
|
| 358 |
+
}
|
| 359 |
+
return t.(string)
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
func (m metadataMP4) Comment() string {
|
| 363 |
+
t, ok := m.data["\xa9cmt"]
|
| 364 |
+
if !ok {
|
| 365 |
+
return ""
|
| 366 |
+
}
|
| 367 |
+
return t.(string)
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
func (m metadataMP4) Picture() *Picture {
|
| 371 |
+
v, ok := m.data["covr"]
|
| 372 |
+
if !ok {
|
| 373 |
+
return nil
|
| 374 |
+
}
|
| 375 |
+
p, _ := v.(*Picture)
|
| 376 |
+
return p
|
| 377 |
+
}
|
| 378 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/pre_context.md
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context before the fix
|
| 2 |
+
|
| 3 |
+
## `mp4.go` (changed lines (152, 153, 154))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
// Copyright 2015, David Howden
|
| 7 |
+
// Use of this source code is governed by a BSD-style
|
| 8 |
+
// license that can be found in the LICENSE file.
|
| 9 |
+
|
| 10 |
+
package tag
|
| 11 |
+
|
| 12 |
+
import (
|
| 13 |
+
"bytes"
|
| 14 |
+
"encoding/binary"
|
| 15 |
+
"errors"
|
| 16 |
+
"fmt"
|
| 17 |
+
"io"
|
| 18 |
+
"strconv"
|
| 19 |
+
"strings"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
var atomTypes = map[int]string{
|
| 23 |
+
0: "implicit", // automatic based on atom name
|
| 24 |
+
1: "text",
|
| 25 |
+
13: "jpeg",
|
| 26 |
+
14: "png",
|
| 27 |
+
21: "uint8",
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// NB: atoms does not include "----", this is handled separately
|
| 31 |
+
var atoms = atomNames(map[string]string{
|
| 32 |
+
"\xa9alb": "album",
|
| 33 |
+
"\xa9art": "artist",
|
| 34 |
+
"\xa9ART": "artist",
|
| 35 |
+
"aART": "album_artist",
|
| 36 |
+
"\xa9day": "year",
|
| 37 |
+
"\xa9nam": "title",
|
| 38 |
+
"\xa9gen": "genre",
|
| 39 |
+
"trkn": "track",
|
| 40 |
+
"\xa9wrt": "composer",
|
| 41 |
+
"\xa9too": "encoder",
|
| 42 |
+
"cprt": "copyright",
|
| 43 |
+
"covr": "picture",
|
| 44 |
+
"\xa9grp": "grouping",
|
| 45 |
+
"keyw": "keyword",
|
| 46 |
+
"\xa9lyr": "lyrics",
|
| 47 |
+
"\xa9cmt": "comment",
|
| 48 |
+
"tmpo": "tempo",
|
| 49 |
+
"cpil": "compilation",
|
| 50 |
+
"disk": "disc",
|
| 51 |
+
})
|
| 52 |
+
|
| 53 |
+
// Detect PNG image if "implicit" class is used
|
| 54 |
+
var pngHeader = []byte{137, 80, 78, 71, 13, 10, 26, 10}
|
| 55 |
+
|
| 56 |
+
type atomNames map[string]string
|
| 57 |
+
|
| 58 |
+
func (f atomNames) Name(n string) []string {
|
| 59 |
+
res := make([]string, 1)
|
| 60 |
+
for k, v := range f {
|
| 61 |
+
if v == n {
|
| 62 |
+
res = append(res, k)
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
return res
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
// metadataMP4 is the implementation of Metadata for MP4 tag (atom) data.
|
| 69 |
+
type metadataMP4 struct {
|
| 70 |
+
fileType FileType
|
| 71 |
+
data map[string]interface{}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
// ReadAtoms reads MP4 metadata atoms from the io.ReadSeeker into a Metadata, returning
|
| 75 |
+
// non-nil error if there was a problem.
|
| 76 |
+
func ReadAtoms(r io.ReadSeeker) (Metadata, error) {
|
| 77 |
+
m := metadataMP4{
|
| 78 |
+
data: make(map[string]interface{}),
|
| 79 |
+
fileType: UnknownFileType,
|
| 80 |
+
}
|
| 81 |
+
err := m.readAtoms(r)
|
| 82 |
+
return m, err
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
func (m metadataMP4) readAtoms(r io.ReadSeeker) error {
|
| 86 |
+
for {
|
| 87 |
+
name, size, err := readAtomHeader(r)
|
| 88 |
+
if err != nil {
|
| 89 |
+
if err == io.EOF {
|
| 90 |
+
return nil
|
| 91 |
+
}
|
| 92 |
+
return err
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
switch name {
|
| 96 |
+
case "meta":
|
| 97 |
+
// next_item_id (int32)
|
| 98 |
+
_, err := readBytes(r, 4)
|
| 99 |
+
if err != nil {
|
| 100 |
+
return err
|
| 101 |
+
}
|
| 102 |
+
fallthrough
|
| 103 |
+
|
| 104 |
+
case "moov", "udta", "ilst":
|
| 105 |
+
return m.readAtoms(r)
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
_, ok := atoms[name]
|
| 109 |
+
var data []string
|
| 110 |
+
if name == "----" {
|
| 111 |
+
name, data, err = readCustomAtom(r, size)
|
| 112 |
+
if err != nil {
|
| 113 |
+
return err
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
if name != "----" {
|
| 117 |
+
ok = true
|
| 118 |
+
size = 0 // already read data
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
if !ok {
|
| 123 |
+
_, err := r.Seek(int64(size-8), io.SeekCurrent)
|
| 124 |
+
if err != nil {
|
| 125 |
+
return err
|
| 126 |
+
}
|
| 127 |
+
continue
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
err = m.readAtomData(r, name, size-8, data)
|
| 131 |
+
if err != nil {
|
| 132 |
+
return err
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
func (m metadataMP4) readAtomData(r io.ReadSeeker, name string, size uint32, processedData []string) error {
|
| 138 |
+
var b []byte
|
| 139 |
+
var err error
|
| 140 |
+
var contentType string
|
| 141 |
+
if len(processedData) > 0 {
|
| 142 |
+
b = []byte(strings.Join(processedData, ";")) // add delimiter if multiple data fields
|
| 143 |
+
contentType = "text"
|
| 144 |
+
} else {
|
| 145 |
+
// read the data
|
| 146 |
+
b, err = readBytes(r, uint(size))
|
| 147 |
+
if err != nil {
|
| 148 |
+
return err
|
| 149 |
+
}
|
| 150 |
+
if len(b) < 8 {
|
| 151 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, got %d", 8, len(b))
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
// "data" + size (4 bytes each)
|
| 155 |
+
b = b[8:]
|
| 156 |
+
|
| 157 |
+
if len(b) < 3 {
|
| 158 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, for class, got %d", 3, len(b))
|
| 159 |
+
}
|
| 160 |
+
class := getInt(b[1:4])
|
| 161 |
+
var ok bool
|
| 162 |
+
contentType, ok = atomTypes[class]
|
| 163 |
+
if !ok {
|
| 164 |
+
return fmt.Errorf("invalid content type: %v (%x) (%x)", class, b[1:4], b)
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
// 4: atom version (1 byte) + atom flags (3 bytes)
|
| 168 |
+
// 4: NULL (usually locale indicator)
|
| 169 |
+
if len(b) < 8 {
|
| 170 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, for atom version and flags, got %d", 8, len(b))
|
| 171 |
+
}
|
| 172 |
+
b = b[8:]
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
if name == "trkn" || name == "disk" {
|
| 176 |
+
if len(b) < 6 {
|
| 177 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, for track and disk numbers, got %d", 6, len(b))
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
m.data[name] = int(b[3])
|
| 181 |
+
m.data[name+"_count"] = int(b[5])
|
| 182 |
+
return nil
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
if contentType == "implicit" {
|
| 186 |
+
if name == "covr" {
|
| 187 |
+
if bytes.HasPrefix(b, pngHeader) {
|
| 188 |
+
contentType = "png"
|
| 189 |
+
}
|
| 190 |
+
// TODO(dhowden): Detect JPEG formats too (harder).
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
var data interface{}
|
| 195 |
+
switch contentType {
|
| 196 |
+
case "implicit":
|
| 197 |
+
if _, ok := atoms[name]; ok {
|
| 198 |
+
return fmt.Errorf("unhandled implicit content type for required atom: %q", name)
|
| 199 |
+
}
|
| 200 |
+
return nil
|
| 201 |
+
|
| 202 |
+
case "text":
|
| 203 |
+
data = string(b)
|
| 204 |
+
|
| 205 |
+
case "uint8":
|
| 206 |
+
if len(b) < 1 {
|
| 207 |
+
return fmt.Errorf("invalid encoding: expected at least %d bytes, for integer tag data, got %d", 1, len(b))
|
| 208 |
+
}
|
| 209 |
+
data = getInt(b[:1])
|
| 210 |
+
|
| 211 |
+
case "jpeg", "png":
|
| 212 |
+
data = &Picture{
|
| 213 |
+
Ext: contentType,
|
| 214 |
+
MIMEType: "image/" + contentType,
|
| 215 |
+
Data: b,
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
m.data[name] = data
|
| 219 |
+
|
| 220 |
+
return nil
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
func readAtomHeader(r io.ReadSeeker) (name string, size uint32, err error) {
|
| 224 |
+
err = binary.Read(r, binary.BigEndian, &size)
|
| 225 |
+
if err != nil {
|
| 226 |
+
return
|
| 227 |
+
}
|
| 228 |
+
name, err = readString(r, 4)
|
| 229 |
+
return
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
// Generic atom.
|
| 233 |
+
// Should have 3 sub atoms : mean, name and data.
|
| 234 |
+
// We check that mean is "com.apple.iTunes" and we use the subname as
|
| 235 |
+
// the name, and move to the data atom.
|
| 236 |
+
// Data atom could have multiple data values, each with a header.
|
| 237 |
+
// If anything goes wrong, we jump at the end of the "----" atom.
|
| 238 |
+
func readCustomAtom(r io.ReadSeeker, size uint32) (_ string, data []string, _ error) {
|
| 239 |
+
subNames := make(map[string]string)
|
| 240 |
+
|
| 241 |
+
for size > 8 {
|
| 242 |
+
subName, subSize, err := readAtomHeader(r)
|
| 243 |
+
if err != nil {
|
| 244 |
+
return "", nil, err
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
// Remove the size of the atom from the size counter
|
| 248 |
+
if size >= subSize {
|
| 249 |
+
size -= subSize
|
| 250 |
+
} else {
|
| 251 |
+
return "", nil, errors.New("--- invalid size")
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
b, err := readBytes(r, uint(subSize-8))
|
| 255 |
+
if err != nil {
|
| 256 |
+
return "", nil, err
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
if len(b) < 4 {
|
| 260 |
+
return "", nil, fmt.Errorf("invalid encoding: expected at least %d bytes, got %d", 4, len(b))
|
| 261 |
+
}
|
| 262 |
+
switch subName {
|
| 263 |
+
case "mean", "name":
|
| 264 |
+
subNames[subName] = string(b[4:])
|
| 265 |
+
case "data":
|
| 266 |
+
data = append(data, string(b[4:]))
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
// there should remain only the header size
|
| 271 |
+
if size != 8 {
|
| 272 |
+
err := errors.New("---- atom out of bounds")
|
| 273 |
+
return "", nil, err
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
if subNames["mean"] != "com.apple.iTunes" || subNames["name"] == "" || len(data) == 0 {
|
| 277 |
+
return "----", nil, nil
|
| 278 |
+
}
|
| 279 |
+
return subNames["name"], data, nil
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
func (metadataMP4) Format() Format { return MP4 }
|
| 283 |
+
func (m metadataMP4) FileType() FileType { return m.fileType }
|
| 284 |
+
|
| 285 |
+
func (m metadataMP4) Raw() map[string]interface{} { return m.data }
|
| 286 |
+
|
| 287 |
+
func (m metadataMP4) getString(n []string) string {
|
| 288 |
+
for _, k := range n {
|
| 289 |
+
if x, ok := m.data[k]; ok {
|
| 290 |
+
return x.(string)
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
return ""
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
func (m metadataMP4) getInt(n []string) int {
|
| 297 |
+
for _, k := range n {
|
| 298 |
+
if x, ok := m.data[k]; ok {
|
| 299 |
+
return x.(int)
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
+
return 0
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
func (m metadataMP4) Title() string {
|
| 306 |
+
return m.getString(atoms.Name("title"))
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
func (m metadataMP4) Artist() string {
|
| 310 |
+
return m.getString(atoms.Name("artist"))
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
func (m metadataMP4) Album() string {
|
| 314 |
+
return m.getString(atoms.Name("album"))
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
func (m metadataMP4) AlbumArtist() string {
|
| 318 |
+
return m.getString(atoms.Name("album_artist"))
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
func (m metadataMP4) Composer() string {
|
| 322 |
+
return m.getString(atoms.Name("composer"))
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
func (m metadataMP4) Genre() string {
|
| 326 |
+
return m.getString(atoms.Name("genre"))
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
func (m metadataMP4) Year() int {
|
| 330 |
+
date := m.getString(atoms.Name("year"))
|
| 331 |
+
if len(date) >= 4 {
|
| 332 |
+
year, _ := strconv.Atoi(date[:4])
|
| 333 |
+
return year
|
| 334 |
+
}
|
| 335 |
+
return 0
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
func (m metadataMP4) Track() (int, int) {
|
| 339 |
+
x := m.getInt([]string{"trkn"})
|
| 340 |
+
if n, ok := m.data["trkn_count"]; ok {
|
| 341 |
+
return x, n.(int)
|
| 342 |
+
}
|
| 343 |
+
return x, 0
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
func (m metadataMP4) Disc() (int, int) {
|
| 347 |
+
x := m.getInt([]string{"disk"})
|
| 348 |
+
if n, ok := m.data["disk_count"]; ok {
|
| 349 |
+
return x, n.(int)
|
| 350 |
+
}
|
| 351 |
+
return x, 0
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
func (m metadataMP4) Lyrics() string {
|
| 355 |
+
t, ok := m.data["\xa9lyr"]
|
| 356 |
+
if !ok {
|
| 357 |
+
return ""
|
| 358 |
+
}
|
| 359 |
+
return t.(string)
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
func (m metadataMP4) Comment() string {
|
| 363 |
+
t, ok := m.data["\xa9cmt"]
|
| 364 |
+
if !ok {
|
| 365 |
+
return ""
|
| 366 |
+
}
|
| 367 |
+
return t.(string)
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
func (m metadataMP4) Picture() *Picture {
|
| 371 |
+
v, ok := m.data["covr"]
|
| 372 |
+
if !ok {
|
| 373 |
+
return nil
|
| 374 |
+
}
|
| 375 |
+
p, _ := v.(*Picture)
|
| 376 |
+
return p
|
| 377 |
+
}
|
| 378 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/task.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "synthesis-task-v1",
|
| 3 |
+
"task": {
|
| 4 |
+
"pair_id": "morefixes-096cbfbd1d27f9ce86fb",
|
| 5 |
+
"dataset_id": "morefixes",
|
| 6 |
+
"dataset_item_id": "morefixes-096cbfbd1d27f9ce86fb",
|
| 7 |
+
"project_id": "morefixes__dhowden__tag",
|
| 8 |
+
"language": "go",
|
| 9 |
+
"backend": "codeql"
|
| 10 |
+
},
|
| 11 |
+
"changed_go_files": [
|
| 12 |
+
"mp4.go"
|
| 13 |
+
],
|
| 14 |
+
"patch_units": {
|
| 15 |
+
"before": [
|
| 16 |
+
"mp4.go"
|
| 17 |
+
],
|
| 18 |
+
"after": [
|
| 19 |
+
"mp4.go"
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
+
"runtime_assets": {
|
| 23 |
+
"before": {
|
| 24 |
+
"database": "assets/391a1c81d692310e5ae3636a97b2879393733e65f81685f511f30da49159f9b9/database",
|
| 25 |
+
"cache_key": "391a1c81d692310e5ae3636a97b2879393733e65f81685f511f30da49159f9b9",
|
| 26 |
+
"codeql_version": "2.26.4"
|
| 27 |
+
},
|
| 28 |
+
"after": {
|
| 29 |
+
"database": "assets/fc2da4211ada3581bfb0f77ccd391196020c61b65d2c26538b9a6f38c2000f4d/database",
|
| 30 |
+
"cache_key": "fc2da4211ada3581bfb0f77ccd391196020c61b65d2c26538b9a6f38c2000f4d",
|
| 31 |
+
"codeql_version": "2.26.4"
|
| 32 |
+
},
|
| 33 |
+
"refine": {
|
| 34 |
+
"database": "assets/5034c6be0a7fca193c94d67f77de78677ea27023f2dc08ce50008c3e40174168/database",
|
| 35 |
+
"cache_key": "5034c6be0a7fca193c94d67f77de78677ea27023f2dc08ce50008c3e40174168",
|
| 36 |
+
"codeql_version": "2.26.4"
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
"benchmark_contract": {
|
| 40 |
+
"agent_visible": true,
|
| 41 |
+
"reference_query_location": "references/morefixes-096cbfbd1d27f9ce86fb/query/ (do not mount into agent)",
|
| 42 |
+
"evaluator_location": "evaluator/morefixes-096cbfbd1d27f9ce86fb/ (do not mount into agent)"
|
| 43 |
+
}
|
| 44 |
+
}
|
tasks/codeql_go_benchmark_top30_v1/morefixes-096cbfbd1d27f9ce86fb/task_prompt.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Go CodeQL detector synthesis
|
| 2 |
+
|
| 3 |
+
You are cc operating in `/work`. Starting only from the supplied patch,
|
| 4 |
+
before/after Go context, CodeQL references, and validation tools, synthesize a semantic CodeQL
|
| 5 |
+
detector for the vulnerability fixed by the patch. This is one fresh session. You may iterate inside
|
| 6 |
+
this session, but no later framework repair or resume will occur.
|
| 7 |
+
|
| 8 |
+
## Inputs and owned outputs
|
| 9 |
+
|
| 10 |
+
- Read `patch.diff`, `go_patch.diff`, `pre_context.md`, and `post_context.md`.
|
| 11 |
+
- Read `references/codeql/convergence_protocol.md` and
|
| 12 |
+
`references/codeql/go_api.md` before experimenting. Read the remaining
|
| 13 |
+
`references/codeql/` files for the selected mechanism.
|
| 14 |
+
- Use `scripts/search_codeql_api.sh` to inspect the pinned official libraries when an API detail is
|
| 15 |
+
uncertain. Do not guess predicate names or build a large family of inspection queries.
|
| 16 |
+
- Complete the design contract in `state.json` and `scope_statement.md` before final validation.
|
| 17 |
+
- Replace `query/vulnerability.ql`; add only genuinely shared `.qll` helpers when useful. Keep the
|
| 18 |
+
fixed offline dependency in `query/qlpack.yml`.
|
| 19 |
+
- Preserve the exact `expected_query_id` from `config.json` as the query's sole `@id`. This
|
| 20 |
+
task-unique metadata must never be used in a query predicate.
|
| 21 |
+
- Use `scripts/compile_query.sh`, `scripts/run_before.sh`, and `scripts/run_after.sh`.
|
| 22 |
+
- Finish by writing `summary.json` with `status`, `query_path`, `query_kind`, `build_passed`,
|
| 23 |
+
`before_findings`, `after_findings`, `validation_completed`, and a concise `notes` field.
|
| 24 |
+
|
| 25 |
+
## Required reasoning contract
|
| 26 |
+
|
| 27 |
+
Before coding, record this mapping in `state.json`:
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
vulnerable operation / trigger / patch safety condition
|
| 31 |
+
→ CodeQL-observable evidence
|
| 32 |
+
→ syntax, control-flow, local value-flow, global taint/value-flow, or interprocedural mechanism
|
| 33 |
+
→ source, sink/report site, guard/barrier and query predicates
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Choose the lowest mechanism that can actually prove the condition. Guard-sensitive patches require
|
| 37 |
+
real path/control-flow semantics; provenance-sensitive patches require value flow. Do not replace
|
| 38 |
+
either with source-text matching or with the mere presence of patch-added syntax.
|
| 39 |
+
|
| 40 |
+
## Mandatory convergence contract
|
| 41 |
+
|
| 42 |
+
The rollout has a 50-minute hard wall-clock ceiling and must be finalized by minute 43. Minutes
|
| 43 |
+
43–50 are an emergency shutdown buffer, not exploration time. A sophisticated unfinished query is
|
| 44 |
+
a failure; an early compilable semantic candidate can be improved. Follow the checkpoints in
|
| 45 |
+
`references/codeql/convergence_protocol.md`:
|
| 46 |
+
|
| 47 |
+
1. Record the mechanism contract, then replace the placeholder in `query/vulnerability.ql`
|
| 48 |
+
immediately. Do not wait until every CodeQL API detail is known.
|
| 49 |
+
2. Use at most three distinct scratch `.ql` files. Prefer repeatedly editing one
|
| 50 |
+
`query/scratch.ql`. After two failed variants of one API assumption, inspect the exact bundled
|
| 51 |
+
definition with `scripts/search_codeql_api.sh` or simplify the mechanism.
|
| 52 |
+
3. Obtain a compiling minimal main query before broadening it. Compile the main query after every
|
| 53 |
+
meaningful mechanism change.
|
| 54 |
+
4. Move in order from compile → relevant before finding → after elimination → final contract. Do
|
| 55 |
+
not continue API exploration after the intended before/after differential is established.
|
| 56 |
+
5. Run `scripts/check_progress.sh` at each checkpoint. It reports elapsed time, the minute-43
|
| 57 |
+
finalization deadline, and the minute-50 hard timeout. When it prints `finalize_now`, stop all
|
| 58 |
+
exploration, preserve the best compiling query, finish the contract files, and exit.
|
| 59 |
+
|
| 60 |
+
## Semantic and generalization rules
|
| 61 |
+
|
| 62 |
+
- Report at the vulnerable call, operator, access, or sink.
|
| 63 |
+
- Do not use a patch-local path, line, commit hash, label, or local variable name as the primary
|
| 64 |
+
matching condition. Stable library/framework APIs or public project APIs are allowed only when
|
| 65 |
+
`scope_statement.md` explains why they define the intended vulnerability family.
|
| 66 |
+
- The safety condition introduced by the patch must be represented by the query.
|
| 67 |
+
- A lower after warning count is not enough: inspect SARIF and ensure at least one intended before
|
| 68 |
+
finding is in a patch-overlapping semantic unit and the corresponding finding disappears after.
|
| 69 |
+
- Avoid broad proxy queries that report an enclosing function or unrelated API merely because it
|
| 70 |
+
changed in the patch.
|
| 71 |
+
|
| 72 |
+
## Final validation protocol
|
| 73 |
+
|
| 74 |
+
1. Compile the final query.
|
| 75 |
+
2. Run it on before and inspect `raw/before.sarif` for the intended report location.
|
| 76 |
+
3. Run the identical query on after and inspect `raw/after.sarif`.
|
| 77 |
+
4. Recheck query metadata, query kind/select signature, report locality, design-to-code consistency,
|
| 78 |
+
and absence of patch-local hardcoding.
|
| 79 |
+
5. Update `state.json`, `scope_statement.md`, and write valid `summary.json`.
|
| 80 |
+
|
| 81 |
+
Do not modify the runtime databases, references, patch, context, or validation scripts except for
|
| 82 |
+
normal CodeQL-generated database caches produced by the provided run scripts.
|
tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/patch.diff
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/runner/server.go b/runner/server.go
|
| 2 |
+
index 5a5db655..676ef756 100644
|
| 3 |
+
--- a/runner/server.go
|
| 4 |
+
+++ b/runner/server.go
|
| 5 |
+
@@ -170,6 +170,18 @@ func (r *TerraformRunnerServer) ProcessCliConfig(ctx context.Context, req *Proce
|
| 6 |
+
return &ProcessCliConfigReply{FilePath: tfrcFilepath}, nil
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
+// initLogger sets up the logger for the terraform runner
|
| 10 |
+
+func (r *TerraformRunnerServer) initLogger(log logr.Logger) {
|
| 11 |
+
+ disableTestLogging := os.Getenv("DISABLE_TF_LOGS") == "1"
|
| 12 |
+
+ if !disableTestLogging {
|
| 13 |
+
+ r.tf.SetStdout(os.Stdout)
|
| 14 |
+
+ r.tf.SetStderr(os.Stderr)
|
| 15 |
+
+ if os.Getenv("ENABLE_SENSITIVE_TF_LOGS") == "1" {
|
| 16 |
+
+ r.tf.SetLogger(&LocalPrintfer{logger: log})
|
| 17 |
+
+ }
|
| 18 |
+
+ }
|
| 19 |
+
+}
|
| 20 |
+
+
|
| 21 |
+
func (r *TerraformRunnerServer) NewTerraform(ctx context.Context, req *NewTerraformRequest) (*NewTerraformReply, error) {
|
| 22 |
+
r.InstanceID = req.GetInstanceID()
|
| 23 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 24 |
+
@@ -191,14 +203,8 @@ func (r *TerraformRunnerServer) NewTerraform(ctx context.Context, req *NewTerraf
|
| 25 |
+
// cache the Terraform resource when initializing
|
| 26 |
+
r.terraform = &terraform
|
| 27 |
+
|
| 28 |
+
- disableTestLogging := os.Getenv("DISABLE_TF_LOGS") == "1"
|
| 29 |
+
- if !disableTestLogging {
|
| 30 |
+
- r.tf.SetStdout(os.Stdout)
|
| 31 |
+
- r.tf.SetStderr(os.Stderr)
|
| 32 |
+
- if os.Getenv("ENABLE_SENSITIVE_TF_LOGS") == "1" {
|
| 33 |
+
- r.tf.SetLogger(&LocalPrintfer{logger: log})
|
| 34 |
+
- }
|
| 35 |
+
- }
|
| 36 |
+
+ // init default logger
|
| 37 |
+
+ r.initLogger(log)
|
| 38 |
+
|
| 39 |
+
return &NewTerraformReply{Id: r.InstanceID}, nil
|
| 40 |
+
}
|
| 41 |
+
diff --git a/runner/server_plan.go b/runner/server_plan.go
|
| 42 |
+
index 46e0e701..0012ecaa 100644
|
| 43 |
+
--- a/runner/server_plan.go
|
| 44 |
+
+++ b/runner/server_plan.go
|
| 45 |
+
@@ -4,12 +4,40 @@ import (
|
| 46 |
+
"context"
|
| 47 |
+
"errors"
|
| 48 |
+
"fmt"
|
| 49 |
+
+ "io"
|
| 50 |
+
+
|
| 51 |
+
"github.com/hashicorp/terraform-exec/tfexec"
|
| 52 |
+
+ tfjson "github.com/hashicorp/terraform-json"
|
| 53 |
+
"google.golang.org/grpc/codes"
|
| 54 |
+
"google.golang.org/grpc/status"
|
| 55 |
+
"sigs.k8s.io/controller-runtime"
|
| 56 |
+
+ ctrl "sigs.k8s.io/controller-runtime"
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
+func (r *TerraformRunnerServer) tfShowPlanFile(ctx context.Context, planPath string, opts ...tfexec.ShowOption) (*tfjson.Plan, error) {
|
| 60 |
+
+ log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 61 |
+
+
|
| 62 |
+
+ // This is the only place where we disable the logger
|
| 63 |
+
+ r.tf.SetStdout(io.Discard)
|
| 64 |
+
+ r.tf.SetStderr(io.Discard)
|
| 65 |
+
+
|
| 66 |
+
+ defer r.initLogger(log)
|
| 67 |
+
+
|
| 68 |
+
+ return r.tf.ShowPlanFile(ctx, planPath, opts...)
|
| 69 |
+
+}
|
| 70 |
+
+
|
| 71 |
+
+func (r *TerraformRunnerServer) tfShowPlanFileRaw(ctx context.Context, planPath string, opts ...tfexec.ShowOption) (string, error) {
|
| 72 |
+
+ log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 73 |
+
+
|
| 74 |
+
+ // This is the only place where we disable the logger
|
| 75 |
+
+ r.tf.SetStdout(io.Discard)
|
| 76 |
+
+ r.tf.SetStderr(io.Discard)
|
| 77 |
+
+
|
| 78 |
+
+ defer r.initLogger(log)
|
| 79 |
+
+
|
| 80 |
+
+ return r.tf.ShowPlanFileRaw(ctx, planPath, opts...)
|
| 81 |
+
+}
|
| 82 |
+
+
|
| 83 |
+
func (r *TerraformRunnerServer) Plan(ctx context.Context, req *PlanRequest) (*PlanReply, error) {
|
| 84 |
+
log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 85 |
+
log.Info("creating a plan")
|
| 86 |
+
@@ -68,7 +96,8 @@ func (r *TerraformRunnerServer) Plan(ctx context.Context, req *PlanRequest) (*Pl
|
| 87 |
+
planCreated := false
|
| 88 |
+
if req.Out != "" {
|
| 89 |
+
planCreated = true
|
| 90 |
+
- plan, err := r.tf.ShowPlanFile(ctx, req.Out)
|
| 91 |
+
+
|
| 92 |
+
+ plan, err := r.tfShowPlanFile(ctx, req.Out)
|
| 93 |
+
if err != nil {
|
| 94 |
+
return nil, err
|
| 95 |
+
}
|
| 96 |
+
@@ -81,6 +110,7 @@ func (r *TerraformRunnerServer) Plan(ctx context.Context, req *PlanRequest) (*Pl
|
| 97 |
+
plan.OutputChanges == nil {
|
| 98 |
+
planCreated = false
|
| 99 |
+
}
|
| 100 |
+
+
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
return &PlanReply{Message: "ok", Drifted: drifted, PlanCreated: planCreated}, nil
|
| 104 |
+
diff --git a/runner/server_save_tfplan.go b/runner/server_save_tfplan.go
|
| 105 |
+
index 3951596b..dfd95bbf 100644
|
| 106 |
+
--- a/runner/server_save_tfplan.go
|
| 107 |
+
+++ b/runner/server_save_tfplan.go
|
| 108 |
+
@@ -15,11 +15,11 @@ import (
|
| 109 |
+
"k8s.io/apimachinery/pkg/api/errors"
|
| 110 |
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 111 |
+
"k8s.io/apimachinery/pkg/types"
|
| 112 |
+
- "sigs.k8s.io/controller-runtime"
|
| 113 |
+
+ ctrl "sigs.k8s.io/controller-runtime"
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
func (r *TerraformRunnerServer) SaveTFPlan(ctx context.Context, req *SaveTFPlanRequest) (*SaveTFPlanReply, error) {
|
| 117 |
+
- log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 118 |
+
+ log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 119 |
+
log.Info("save the plan")
|
| 120 |
+
if req.TfInstance != r.InstanceID {
|
| 121 |
+
err := fmt.Errorf("no TF instance found")
|
| 122 |
+
@@ -47,7 +47,7 @@ func (r *TerraformRunnerServer) SaveTFPlan(ctx context.Context, req *SaveTFPlanR
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
if r.terraform.Spec.StoreReadablePlan == "json" {
|
| 126 |
+
- planObj, err := r.tf.ShowPlanFile(ctx, TFPlanName)
|
| 127 |
+
+ planObj, err := r.tfShowPlanFile(ctx, TFPlanName)
|
| 128 |
+
if err != nil {
|
| 129 |
+
log.Error(err, "unable to get the plan output for json")
|
| 130 |
+
return nil, err
|
| 131 |
+
@@ -63,7 +63,7 @@ func (r *TerraformRunnerServer) SaveTFPlan(ctx context.Context, req *SaveTFPlanR
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
} else if r.terraform.Spec.StoreReadablePlan == "human" {
|
| 135 |
+
- rawOutput, err := r.tf.ShowPlanFileRaw(ctx, TFPlanName)
|
| 136 |
+
+ rawOutput, err := r.tfShowPlanFileRaw(ctx, TFPlanName)
|
| 137 |
+
if err != nil {
|
| 138 |
+
log.Error(err, "unable to get the plan output for human")
|
| 139 |
+
return nil, err
|
| 140 |
+
diff --git a/runner/server_show_plan.go b/runner/server_show_plan.go
|
| 141 |
+
index b7d64fc8..532e3d95 100644
|
| 142 |
+
--- a/runner/server_show_plan.go
|
| 143 |
+
+++ b/runner/server_show_plan.go
|
| 144 |
+
@@ -16,7 +16,7 @@ func (r *TerraformRunnerServer) ShowPlanFileRaw(ctx context.Context, req *ShowPl
|
| 145 |
+
return nil, err
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
- rawOutput, err := r.tf.ShowPlanFileRaw(ctx, req.Filename)
|
| 149 |
+
+ rawOutput, err := r.tfShowPlanFileRaw(ctx, req.Filename)
|
| 150 |
+
if err != nil {
|
| 151 |
+
log.Error(err, "unable to get the raw plan output")
|
| 152 |
+
return nil, err
|
| 153 |
+
@@ -34,7 +34,7 @@ func (r *TerraformRunnerServer) ShowPlanFile(ctx context.Context, req *ShowPlanF
|
| 154 |
+
return nil, err
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
- plan, err := r.tf.ShowPlanFile(ctx, req.Filename)
|
| 158 |
+
+ plan, err := r.tfShowPlanFile(ctx, req.Filename)
|
| 159 |
+
if err != nil {
|
| 160 |
+
log.Error(err, "unable to get the json plan output")
|
| 161 |
+
return nil, err
|
tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/post_context.md
ADDED
|
@@ -0,0 +1,1034 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context after the fix
|
| 2 |
+
|
| 3 |
+
## `runner/server.go` (changed lines (173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 206, 207))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package runner
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"bytes"
|
| 10 |
+
"context"
|
| 11 |
+
"errors"
|
| 12 |
+
"fmt"
|
| 13 |
+
"io/ioutil"
|
| 14 |
+
"os"
|
| 15 |
+
"os/exec"
|
| 16 |
+
"path/filepath"
|
| 17 |
+
"strings"
|
| 18 |
+
|
| 19 |
+
securejoin "github.com/cyphar/filepath-securejoin"
|
| 20 |
+
"github.com/fluxcd/pkg/untar"
|
| 21 |
+
"github.com/go-logr/logr"
|
| 22 |
+
"github.com/hashicorp/terraform-exec/tfexec"
|
| 23 |
+
tfjson "github.com/hashicorp/terraform-json"
|
| 24 |
+
infrav1 "github.com/weaveworks/tf-controller/api/v1alpha2"
|
| 25 |
+
"github.com/weaveworks/tf-controller/utils"
|
| 26 |
+
"google.golang.org/grpc/codes"
|
| 27 |
+
"google.golang.org/grpc/status"
|
| 28 |
+
corev1 "k8s.io/api/core/v1"
|
| 29 |
+
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
| 30 |
+
"k8s.io/apimachinery/pkg/runtime"
|
| 31 |
+
"k8s.io/apimachinery/pkg/types"
|
| 32 |
+
ctrl "sigs.k8s.io/controller-runtime"
|
| 33 |
+
"sigs.k8s.io/controller-runtime/pkg/client"
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
const (
|
| 37 |
+
TFPlanName = "tfplan"
|
| 38 |
+
SavedPlanSecretAnnotation = "savedPlan"
|
| 39 |
+
runnerFileMappingLocationHome = "home"
|
| 40 |
+
runnerFileMappingLocationWorkspace = "workspace"
|
| 41 |
+
runnerFileMappingDirectoryPermissions = 0700
|
| 42 |
+
runnerFileMappingFilePermissions = 0600
|
| 43 |
+
HomePath = "/home/runner"
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
type LocalPrintfer struct {
|
| 47 |
+
logger logr.Logger
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
func (l LocalPrintfer) Printf(format string, v ...interface{}) {
|
| 51 |
+
l.logger.Info(fmt.Sprintf(format, v...))
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
type TerraformRunnerServer struct {
|
| 55 |
+
UnimplementedRunnerServer
|
| 56 |
+
tf *tfexec.Terraform
|
| 57 |
+
client.Client
|
| 58 |
+
Scheme *runtime.Scheme
|
| 59 |
+
Done chan os.Signal
|
| 60 |
+
terraform *infrav1.Terraform
|
| 61 |
+
InstanceID string
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
const loggerName = "runner.terraform"
|
| 65 |
+
|
| 66 |
+
func (r *TerraformRunnerServer) LookPath(ctx context.Context, req *LookPathRequest) (*LookPathReply, error) {
|
| 67 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 68 |
+
log.Info("looking for path", "file", req.File)
|
| 69 |
+
execPath, err := exec.LookPath(req.File)
|
| 70 |
+
if err != nil {
|
| 71 |
+
log.Error(err, "unable to look for path", "file", req.File)
|
| 72 |
+
return nil, err
|
| 73 |
+
}
|
| 74 |
+
return &LookPathReply{ExecPath: execPath}, nil
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
func (r *TerraformRunnerServer) UploadAndExtract(ctx context.Context, req *UploadAndExtractRequest) (*UploadAndExtractReply, error) {
|
| 78 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 79 |
+
log.Info("preparing for Upload and Extraction")
|
| 80 |
+
tmpDir, err := securejoin.SecureJoin(os.TempDir(), fmt.Sprintf("%s-%s", req.Namespace, req.Name))
|
| 81 |
+
if err != nil {
|
| 82 |
+
log.Error(err, "unable to join securely", "tmpDir", os.TempDir(), "namespace", req.Namespace, "name", req.Name)
|
| 83 |
+
return nil, err
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
buf := bytes.NewBuffer(req.TarGz)
|
| 87 |
+
if _, err = untar.Untar(buf, tmpDir); err != nil {
|
| 88 |
+
log.Error(err, "unable to extract tar file", "namespace", req.Namespace, "name", req.Name)
|
| 89 |
+
return nil, fmt.Errorf("failed to untar artifact, error: %w", err)
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
dirPath, err := securejoin.SecureJoin(tmpDir, req.Path)
|
| 93 |
+
if err != nil {
|
| 94 |
+
log.Error(err, "unable to join securely", "tmpDir", tmpDir, "path", req.Path)
|
| 95 |
+
return nil, err
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
if _, err := os.Stat(dirPath); err != nil {
|
| 99 |
+
log.Error(err, "path not found", "dirPath", dirPath)
|
| 100 |
+
err = fmt.Errorf("terraform path not found: %w", err)
|
| 101 |
+
return nil, err
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
return &UploadAndExtractReply{WorkingDir: dirPath, TmpDir: tmpDir}, nil
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
func (r *TerraformRunnerServer) CleanupDir(ctx context.Context, req *CleanupDirRequest) (*CleanupDirReply, error) {
|
| 108 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 109 |
+
log.Info("cleanup TmpDir", "tmpDir", req.TmpDir)
|
| 110 |
+
err := os.RemoveAll(req.TmpDir)
|
| 111 |
+
if err != nil {
|
| 112 |
+
log.Error(err, "error cleaning up TmpDir", "tmpDir", req.TmpDir)
|
| 113 |
+
return nil, err
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
return &CleanupDirReply{Message: "ok"}, nil
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
func (r *TerraformRunnerServer) WriteBackendConfig(ctx context.Context, req *WriteBackendConfigRequest) (*WriteBackendConfigReply, error) {
|
| 120 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 121 |
+
const backendConfigPath = "backend_override.tf"
|
| 122 |
+
log.Info("write backend config", "path", req.DirPath, "config", backendConfigPath)
|
| 123 |
+
filePath, err := securejoin.SecureJoin(req.DirPath, backendConfigPath)
|
| 124 |
+
if err != nil {
|
| 125 |
+
log.Error(err, "unable to join securely", "dirPath", req.DirPath, "config", backendConfigPath)
|
| 126 |
+
return nil, err
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
log.Info("write config to file", "filePath", filePath)
|
| 130 |
+
err = os.WriteFile(filePath, req.BackendConfig, 0644)
|
| 131 |
+
if err != nil {
|
| 132 |
+
log.Error(err, "unable to write file", "filePath", filePath)
|
| 133 |
+
return nil, err
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
return &WriteBackendConfigReply{Message: "ok"}, nil
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
func (r *TerraformRunnerServer) ProcessCliConfig(ctx context.Context, req *ProcessCliConfigRequest) (*ProcessCliConfigReply, error) {
|
| 140 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 141 |
+
log.Info("processing configuration", "namespace", req.Namespace, "name", req.Name)
|
| 142 |
+
cliConfigKey := types.NamespacedName{Namespace: req.Namespace, Name: req.Name}
|
| 143 |
+
var cliConfig corev1.Secret
|
| 144 |
+
if err := r.Get(ctx, cliConfigKey, &cliConfig); err != nil {
|
| 145 |
+
log.Error(err, "unable to get secret", "namespace", req.Namespace, "name", req.Name)
|
| 146 |
+
return nil, err
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
if len(cliConfig.Data) != 1 {
|
| 150 |
+
err := fmt.Errorf("expect the secret to contain 1 data")
|
| 151 |
+
log.Error(err, "secret missing data", "namespace", req.Namespace, "name", req.Name)
|
| 152 |
+
return nil, err
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
var tfrcFilepath string
|
| 156 |
+
for tfrcFilename, v := range cliConfig.Data {
|
| 157 |
+
if strings.HasSuffix(tfrcFilename, ".tfrc") {
|
| 158 |
+
var err error
|
| 159 |
+
tfrcFilepath, err = securejoin.SecureJoin(req.DirPath, tfrcFilename)
|
| 160 |
+
if err != nil {
|
| 161 |
+
log.Error(err, "secure join error", "dirPath", req.DirPath, "tfrcFilename", tfrcFilename)
|
| 162 |
+
return nil, err
|
| 163 |
+
}
|
| 164 |
+
err = os.WriteFile(tfrcFilepath, v, 0644)
|
| 165 |
+
if err != nil {
|
| 166 |
+
log.Error(err, "write file error", "tfrcFilename", tfrcFilename, "fileMode", "0644")
|
| 167 |
+
return nil, err
|
| 168 |
+
}
|
| 169 |
+
} else {
|
| 170 |
+
err := fmt.Errorf("expect the secret key to end with .tfrc")
|
| 171 |
+
log.Error(err, "file extension error", "tfrcFilename", tfrcFilename)
|
| 172 |
+
return nil, err
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
return &ProcessCliConfigReply{FilePath: tfrcFilepath}, nil
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
// initLogger sets up the logger for the terraform runner
|
| 179 |
+
func (r *TerraformRunnerServer) initLogger(log logr.Logger) {
|
| 180 |
+
disableTestLogging := os.Getenv("DISABLE_TF_LOGS") == "1"
|
| 181 |
+
if !disableTestLogging {
|
| 182 |
+
r.tf.SetStdout(os.Stdout)
|
| 183 |
+
r.tf.SetStderr(os.Stderr)
|
| 184 |
+
if os.Getenv("ENABLE_SENSITIVE_TF_LOGS") == "1" {
|
| 185 |
+
r.tf.SetLogger(&LocalPrintfer{logger: log})
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
func (r *TerraformRunnerServer) NewTerraform(ctx context.Context, req *NewTerraformRequest) (*NewTerraformReply, error) {
|
| 191 |
+
r.InstanceID = req.GetInstanceID()
|
| 192 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 193 |
+
log.Info("creating new terraform", "workingDir", req.WorkingDir, "execPath", req.ExecPath)
|
| 194 |
+
tf, err := tfexec.NewTerraform(req.WorkingDir, req.ExecPath)
|
| 195 |
+
if err != nil {
|
| 196 |
+
log.Error(err, "unable to create new terraform", "workingDir", req.WorkingDir, "execPath", req.ExecPath)
|
| 197 |
+
return nil, err
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
// hold only 1 instance
|
| 201 |
+
r.tf = tf
|
| 202 |
+
|
| 203 |
+
var terraform infrav1.Terraform
|
| 204 |
+
if err := terraform.FromBytes(req.Terraform, r.Scheme); err != nil {
|
| 205 |
+
log.Error(err, "there was a problem getting the terraform resource")
|
| 206 |
+
return nil, err
|
| 207 |
+
}
|
| 208 |
+
// cache the Terraform resource when initializing
|
| 209 |
+
r.terraform = &terraform
|
| 210 |
+
|
| 211 |
+
// init default logger
|
| 212 |
+
r.initLogger(log)
|
| 213 |
+
|
| 214 |
+
return &NewTerraformReply{Id: r.InstanceID}, nil
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
func (r *TerraformRunnerServer) SetEnv(ctx context.Context, req *SetEnvRequest) (*SetEnvReply, error) {
|
| 218 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 219 |
+
log.Info("setting envvars")
|
| 220 |
+
|
| 221 |
+
if req.TfInstance != r.InstanceID {
|
| 222 |
+
err := fmt.Errorf("no TF instance found")
|
| 223 |
+
log.Error(err, "no terraform")
|
| 224 |
+
return nil, err
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
log.Info("getting envvars from os environments")
|
| 228 |
+
envs := utils.EnvMap(os.Environ())
|
| 229 |
+
for k, v := range req.Envs {
|
| 230 |
+
envs[k] = v
|
| 231 |
+
}
|
| 232 |
+
err := r.tf.SetEnv(envs)
|
| 233 |
+
if err != nil {
|
| 234 |
+
log.Error(err, "unable to set envvars", "envvars", envs)
|
| 235 |
+
return nil, err
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
return &SetEnvReply{Message: "ok"}, nil
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
func (r *TerraformRunnerServer) CreateFileMappings(ctx context.Context, req *CreateFileMappingsRequest) (*CreateFileMappingsReply, error) {
|
| 242 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 243 |
+
log.Info("creating file mappings")
|
| 244 |
+
|
| 245 |
+
for _, fileMapping := range req.FileMappings {
|
| 246 |
+
var fileFullPath string
|
| 247 |
+
var err error
|
| 248 |
+
switch fileMapping.Location {
|
| 249 |
+
case runnerFileMappingLocationHome:
|
| 250 |
+
fileFullPath, err = securejoin.SecureJoin(HomePath, fileMapping.Path)
|
| 251 |
+
if err != nil {
|
| 252 |
+
log.Error(err, "insecure file path", "path", fileMapping.Path)
|
| 253 |
+
return nil, err
|
| 254 |
+
}
|
| 255 |
+
case runnerFileMappingLocationWorkspace:
|
| 256 |
+
fileFullPath, err = securejoin.SecureJoin(req.WorkingDir, fileMapping.Path)
|
| 257 |
+
if err != nil {
|
| 258 |
+
log.Error(err, "insecure file path", "path", fileMapping.Path)
|
| 259 |
+
return nil, err
|
| 260 |
+
}
|
| 261 |
+
default:
|
| 262 |
+
err := fmt.Errorf("unknown file mapping location")
|
| 263 |
+
log.Error(err, "unknown file mapping location", "location", fileMapping.Location)
|
| 264 |
+
return nil, err
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
log.Info("prepare to write file", "fileFullPath", fileFullPath)
|
| 268 |
+
dir := filepath.Dir(fileFullPath)
|
| 269 |
+
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
| 270 |
+
// create dir
|
| 271 |
+
err := os.MkdirAll(dir, runnerFileMappingDirectoryPermissions)
|
| 272 |
+
if err != nil {
|
| 273 |
+
log.Error(err, "unable to create dir", "dir", dir)
|
| 274 |
+
return nil, err
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
if err := os.WriteFile(fileFullPath, fileMapping.Content, runnerFileMappingFilePermissions); err != nil {
|
| 279 |
+
log.Error(err, "Unable to create file from file mapping", "file", fileFullPath)
|
| 280 |
+
return nil, err
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
return &CreateFileMappingsReply{Message: "ok"}, nil
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
func (r *TerraformRunnerServer) Init(ctx context.Context, req *InitRequest) (*InitReply, error) {
|
| 288 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 289 |
+
log.Info("initializing")
|
| 290 |
+
if req.TfInstance != r.InstanceID {
|
| 291 |
+
err := fmt.Errorf("no TF instance found")
|
| 292 |
+
log.Error(err, "no terraform")
|
| 293 |
+
return nil, err
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
terraform := r.terraform
|
| 297 |
+
|
| 298 |
+
log.Info("mapping the Spec.BackendConfigsFrom")
|
| 299 |
+
backendConfigsOpts := []tfexec.InitOption{}
|
| 300 |
+
for _, bf := range terraform.Spec.BackendConfigsFrom {
|
| 301 |
+
objectKey := types.NamespacedName{
|
| 302 |
+
Namespace: terraform.Namespace,
|
| 303 |
+
Name: bf.Name,
|
| 304 |
+
}
|
| 305 |
+
if bf.Kind == "Secret" {
|
| 306 |
+
var s corev1.Secret
|
| 307 |
+
err := r.Get(ctx, objectKey, &s)
|
| 308 |
+
if err != nil && bf.Optional == false {
|
| 309 |
+
log.Error(err, "unable to get object key", "objectKey", objectKey, "secret", s.ObjectMeta.Name)
|
| 310 |
+
return nil, err
|
| 311 |
+
}
|
| 312 |
+
// if VarsKeys is null, use all
|
| 313 |
+
if bf.Keys == nil {
|
| 314 |
+
for key, val := range s.Data {
|
| 315 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+string(val)))
|
| 316 |
+
}
|
| 317 |
+
} else {
|
| 318 |
+
for _, key := range bf.Keys {
|
| 319 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+string(s.Data[key])))
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
} else if bf.Kind == "ConfigMap" {
|
| 323 |
+
var cm corev1.ConfigMap
|
| 324 |
+
err := r.Get(ctx, objectKey, &cm)
|
| 325 |
+
if err != nil && bf.Optional == false {
|
| 326 |
+
log.Error(err, "unable to get object key", "objectKey", objectKey, "configmap", cm.ObjectMeta.Name)
|
| 327 |
+
return nil, err
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
// if Keys is null, use all
|
| 331 |
+
if bf.Keys == nil {
|
| 332 |
+
for key, val := range cm.Data {
|
| 333 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+val))
|
| 334 |
+
}
|
| 335 |
+
for key, val := range cm.BinaryData {
|
| 336 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+string(val)))
|
| 337 |
+
}
|
| 338 |
+
} else {
|
| 339 |
+
for _, key := range bf.Keys {
|
| 340 |
+
if val, ok := cm.Data[key]; ok {
|
| 341 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+val))
|
| 342 |
+
}
|
| 343 |
+
if val, ok := cm.BinaryData[key]; ok {
|
| 344 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+string(val)))
|
| 345 |
+
}
|
| 346 |
+
}
|
| 347 |
+
}
|
| 348 |
+
}
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
initOpts := []tfexec.InitOption{tfexec.Upgrade(req.Upgrade), tfexec.ForceCopy(req.ForceCopy)}
|
| 352 |
+
initOpts = append(initOpts, backendConfigsOpts...)
|
| 353 |
+
if err := r.tf.Init(ctx, initOpts...); err != nil {
|
| 354 |
+
st := status.New(codes.Internal, err.Error())
|
| 355 |
+
var stateErr *tfexec.ErrStateLocked
|
| 356 |
+
|
| 357 |
+
if errors.As(err, &stateErr) {
|
| 358 |
+
st, err = st.WithDetails(&InitReply{Message: "not ok", StateLockIdentifier: stateErr.ID})
|
| 359 |
+
|
| 360 |
+
if err != nil {
|
| 361 |
+
return nil, err
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
log.Error(err, "unable to initialize")
|
| 366 |
+
return nil, st.Err()
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
return &InitReply{Message: "ok"}, nil
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
func (r *TerraformRunnerServer) SelectWorkspace(ctx context.Context, req *WorkspaceRequest) (*WorkspaceReply, error) {
|
| 373 |
+
log := ctrl.LoggerFrom(ctx).WithName(loggerName)
|
| 374 |
+
log.Info("workspace select")
|
| 375 |
+
if req.TfInstance != r.InstanceID {
|
| 376 |
+
err := fmt.Errorf("no TF instance found")
|
| 377 |
+
log.Error(err, "no terraform")
|
| 378 |
+
return nil, err
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
terraform := r.terraform
|
| 382 |
+
|
| 383 |
+
if terraform.WorkspaceName() != infrav1.DefaultWorkspaceName {
|
| 384 |
+
wsOpts := []tfexec.WorkspaceNewCmdOption{}
|
| 385 |
+
ws := terraform.Spec.Workspace
|
| 386 |
+
if err := r.tf.WorkspaceNew(ctx, ws, wsOpts...); err != nil {
|
| 387 |
+
log.Info(fmt.Sprintf("workspace new:, %s", err.Error()))
|
| 388 |
+
}
|
| 389 |
+
if err := r.tf.WorkspaceSelect(ctx, ws); err != nil {
|
| 390 |
+
err := fmt.Errorf("failed to select workspace %s", ws)
|
| 391 |
+
log.Error(err, "workspace select error")
|
| 392 |
+
return nil, err
|
| 393 |
+
}
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
return &WorkspaceReply{Message: "ok"}, nil
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
func (r *TerraformRunnerServer) LoadTFPlan(ctx context.Context, req *LoadTFPlanRequest) (*LoadTFPlanReply, error) {
|
| 400 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 401 |
+
log.Info("loading plan from secret")
|
| 402 |
+
if req.TfInstance != r.InstanceID {
|
| 403 |
+
err := fmt.Errorf("no TF instance found")
|
| 404 |
+
log.Error(err, "no terraform")
|
| 405 |
+
return nil, err
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
tfplanSecretKey := types.NamespacedName{Namespace: req.Namespace, Name: "tfplan-" + r.terraform.WorkspaceName() + "-" + req.Name}
|
| 409 |
+
tfplanSecret := corev1.Secret{}
|
| 410 |
+
err := r.Get(ctx, tfplanSecretKey, &tfplanSecret)
|
| 411 |
+
if err != nil {
|
| 412 |
+
err = fmt.Errorf("error getting plan secret: %s", err)
|
| 413 |
+
log.Error(err, "unable to get secret")
|
| 414 |
+
return nil, err
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
if tfplanSecret.Annotations[SavedPlanSecretAnnotation] != req.PendingPlan {
|
| 418 |
+
err = fmt.Errorf("error pending plan and plan's name in the secret are not matched: %s != %s",
|
| 419 |
+
req.PendingPlan,
|
| 420 |
+
tfplanSecret.Annotations[SavedPlanSecretAnnotation])
|
| 421 |
+
log.Error(err, "plan name mismatch")
|
| 422 |
+
return nil, err
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
if req.BackendCompletelyDisable {
|
| 426 |
+
// do nothing
|
| 427 |
+
} else {
|
| 428 |
+
tfplan := tfplanSecret.Data[TFPlanName]
|
| 429 |
+
tfplan, err = utils.GzipDecode(tfplan)
|
| 430 |
+
if err != nil {
|
| 431 |
+
log.Error(err, "unable to decode the plan")
|
| 432 |
+
return nil, err
|
| 433 |
+
}
|
| 434 |
+
err = ioutil.WriteFile(filepath.Join(r.tf.WorkingDir(), TFPlanName), tfplan, 0644)
|
| 435 |
+
if err != nil {
|
| 436 |
+
err = fmt.Errorf("error saving plan file to disk: %s", err)
|
| 437 |
+
log.Error(err, "unable to write the plan to disk")
|
| 438 |
+
return nil, err
|
| 439 |
+
}
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
return &LoadTFPlanReply{Message: "ok"}, nil
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
func (r *TerraformRunnerServer) Destroy(ctx context.Context, req *DestroyRequest) (*DestroyReply, error) {
|
| 446 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 447 |
+
log.Info("running destroy")
|
| 448 |
+
ctx, cancel := context.WithCancel(ctx)
|
| 449 |
+
go func() {
|
| 450 |
+
select {
|
| 451 |
+
case <-r.Done:
|
| 452 |
+
cancel()
|
| 453 |
+
case <-ctx.Done():
|
| 454 |
+
}
|
| 455 |
+
}()
|
| 456 |
+
|
| 457 |
+
if req.TfInstance != r.InstanceID {
|
| 458 |
+
err := fmt.Errorf("no TF instance found")
|
| 459 |
+
log.Error(err, "no terraform")
|
| 460 |
+
return nil, err
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
var destroyOpt []tfexec.DestroyOption
|
| 464 |
+
for _, target := range req.Targets {
|
| 465 |
+
destroyOpt = append(destroyOpt, tfexec.Target(target))
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
if err := r.tf.Destroy(ctx, destroyOpt...); err != nil {
|
| 469 |
+
st := status.New(codes.Internal, err.Error())
|
| 470 |
+
var stateErr *tfexec.ErrStateLocked
|
| 471 |
+
|
| 472 |
+
if errors.As(err, &stateErr) {
|
| 473 |
+
st, err = st.WithDetails(&DestroyReply{Message: "not ok", StateLockIdentifier: stateErr.ID})
|
| 474 |
+
|
| 475 |
+
if err != nil {
|
| 476 |
+
return nil, err
|
| 477 |
+
}
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
log.Error(err, "unable to destroy")
|
| 481 |
+
return nil, st.Err()
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
return &DestroyReply{Message: "ok"}, nil
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
func (r *TerraformRunnerServer) Apply(ctx context.Context, req *ApplyRequest) (*ApplyReply, error) {
|
| 488 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 489 |
+
log.Info("running apply")
|
| 490 |
+
ctx, cancel := context.WithCancel(ctx)
|
| 491 |
+
go func() {
|
| 492 |
+
select {
|
| 493 |
+
case <-r.Done:
|
| 494 |
+
cancel()
|
| 495 |
+
case <-ctx.Done():
|
| 496 |
+
}
|
| 497 |
+
}()
|
| 498 |
+
|
| 499 |
+
if req.TfInstance != r.InstanceID {
|
| 500 |
+
err := fmt.Errorf("no TF instance found")
|
| 501 |
+
log.Error(err, "no terraform")
|
| 502 |
+
return nil, err
|
| 503 |
+
}
|
| 504 |
+
|
| 505 |
+
var applyOpt []tfexec.ApplyOption
|
| 506 |
+
if req.DirOrPlan != "" {
|
| 507 |
+
applyOpt = []tfexec.ApplyOption{tfexec.DirOrPlan(req.DirOrPlan)}
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
if req.RefreshBeforeApply {
|
| 511 |
+
applyOpt = []tfexec.ApplyOption{tfexec.Refresh(true)}
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
for _, target := range req.Targets {
|
| 515 |
+
applyOpt = append(applyOpt, tfexec.Target(target))
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
if req.Parallelism > 0 {
|
| 519 |
+
applyOpt = append(applyOpt, tfexec.Parallelism(int(req.Parallelism)))
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
if err := r.tf.Apply(ctx, applyOpt...); err != nil {
|
| 523 |
+
st := status.New(codes.Internal, err.Error())
|
| 524 |
+
var stateErr *tfexec.ErrStateLocked
|
| 525 |
+
|
| 526 |
+
if errors.As(err, &stateErr) {
|
| 527 |
+
st, err = st.WithDetails(&ApplyReply{Message: "not ok", StateLockIdentifier: stateErr.ID})
|
| 528 |
+
|
| 529 |
+
if err != nil {
|
| 530 |
+
return nil, err
|
| 531 |
+
}
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
log.Error(err, "unable to apply plan")
|
| 535 |
+
return nil, st.Err()
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
return &ApplyReply{Message: "ok"}, nil
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
func getInventoryFromTerraformModule(m *tfjson.StateModule) []*Inventory {
|
| 542 |
+
var result []*Inventory
|
| 543 |
+
for _, r := range m.Resources {
|
| 544 |
+
var id string
|
| 545 |
+
// TODO ARN is AWS-specific. Will need to support other cloud identifiers in the future.
|
| 546 |
+
if val, ok := r.AttributeValues["arn"]; ok {
|
| 547 |
+
id = val.(string)
|
| 548 |
+
} else if val, ok := r.AttributeValues["id"]; ok {
|
| 549 |
+
id = val.(string)
|
| 550 |
+
}
|
| 551 |
+
result = append(result, &Inventory{
|
| 552 |
+
Name: r.Name,
|
| 553 |
+
Type: r.Type,
|
| 554 |
+
Identifier: id,
|
| 555 |
+
})
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
// recursively get all resources from submodules
|
| 559 |
+
for _, childModule := range m.ChildModules {
|
| 560 |
+
childInventory := getInventoryFromTerraformModule(childModule)
|
| 561 |
+
result = append(result, childInventory...)
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
return result
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
func (r *TerraformRunnerServer) GetInventory(ctx context.Context, req *GetInventoryRequest) (*GetInventoryReply, error) {
|
| 568 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 569 |
+
log.Info("get inventory")
|
| 570 |
+
if req.TfInstance != r.InstanceID {
|
| 571 |
+
err := fmt.Errorf("no TF instance found")
|
| 572 |
+
log.Error(err, "get inventory: no terraform")
|
| 573 |
+
return nil, err
|
| 574 |
+
}
|
| 575 |
+
state, err := r.tf.Show(ctx)
|
| 576 |
+
if err != nil {
|
| 577 |
+
log.Error(err, "get inventory: unable to get state via show command")
|
| 578 |
+
return nil, err
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
// state contains no values after resource destruction for example
|
| 582 |
+
if state.Values == nil {
|
| 583 |
+
log.Info("get inventory: state values is nil")
|
| 584 |
+
return &GetInventoryReply{Inventories: []*Inventory{}}, nil
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
if state.Values.RootModule == nil {
|
| 588 |
+
log.Info("get inventory: root module is nil")
|
| 589 |
+
return &GetInventoryReply{Inventories: []*Inventory{}}, nil
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
return &GetInventoryReply{Inventories: getInventoryFromTerraformModule(state.Values.RootModule)}, nil
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
func (r *TerraformRunnerServer) FinalizeSecrets(ctx context.Context, req *FinalizeSecretsRequest) (*FinalizeSecretsReply, error) {
|
| 596 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 597 |
+
log.Info("finalize the output secrets")
|
| 598 |
+
// nil dereference bug here
|
| 599 |
+
planObjectKey := types.NamespacedName{Namespace: req.Namespace, Name: "tfplan-" + req.Workspace + "-" + req.Name}
|
| 600 |
+
var planSecret corev1.Secret
|
| 601 |
+
if err := r.Client.Get(ctx, planObjectKey, &planSecret); err == nil {
|
| 602 |
+
if err := r.Client.Delete(ctx, &planSecret); err != nil {
|
| 603 |
+
// transient failure
|
| 604 |
+
log.Error(err, "unable to delete the plan secret")
|
| 605 |
+
return nil, status.Error(codes.Internal, err.Error())
|
| 606 |
+
}
|
| 607 |
+
} else if apierrors.IsNotFound(err) {
|
| 608 |
+
log.Error(err, "plan secret not found")
|
| 609 |
+
return nil, status.Error(codes.NotFound, err.Error())
|
| 610 |
+
} else {
|
| 611 |
+
// transient failure
|
| 612 |
+
log.Error(err, "unable to get the plan secret")
|
| 613 |
+
return nil, status.Error(codes.Internal, err.Error())
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
if req.HasSpecifiedOutputSecret {
|
| 617 |
+
outputsObjectKey := types.NamespacedName{Namespace: req.Namespace, Name: req.OutputSecretName}
|
| 618 |
+
var outputsSecret corev1.Secret
|
| 619 |
+
if err := r.Client.Get(ctx, outputsObjectKey, &outputsSecret); err == nil {
|
| 620 |
+
if err := r.Client.Delete(ctx, &outputsSecret); err != nil {
|
| 621 |
+
// transient failure
|
| 622 |
+
log.Error(err, "unable to delete the output secret")
|
| 623 |
+
return nil, status.Error(codes.Internal, err.Error())
|
| 624 |
+
}
|
| 625 |
+
} else if apierrors.IsNotFound(err) {
|
| 626 |
+
log.Error(err, "output secret not found")
|
| 627 |
+
return nil, status.Error(codes.NotFound, err.Error())
|
| 628 |
+
} else {
|
| 629 |
+
// transient failure
|
| 630 |
+
log.Error(err, "unable to get the output secret")
|
| 631 |
+
return nil, status.Error(codes.Internal, err.Error())
|
| 632 |
+
}
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
return &FinalizeSecretsReply{Message: "ok"}, nil
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
func (r *TerraformRunnerServer) ForceUnlock(ctx context.Context, req *ForceUnlockRequest) (*ForceUnlockReply, error) {
|
| 639 |
+
reply := &ForceUnlockReply{
|
| 640 |
+
Success: true,
|
| 641 |
+
Message: fmt.Sprintf("Successfully unlocked state with lock identifier: %s", req.GetLockIdentifier()),
|
| 642 |
+
}
|
| 643 |
+
err := r.tf.ForceUnlock(ctx, req.LockIdentifier)
|
| 644 |
+
|
| 645 |
+
if err != nil {
|
| 646 |
+
reply.Success = false
|
| 647 |
+
reply.Message = fmt.Sprintf("Error unlocking the state: %s", err)
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
return reply, err
|
| 651 |
+
}
|
| 652 |
+
```
|
| 653 |
+
|
| 654 |
+
## `runner/server_plan.go` (changed lines (7, 8, 10, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 99, 100, 113))
|
| 655 |
+
|
| 656 |
+
```go
|
| 657 |
+
package runner
|
| 658 |
+
|
| 659 |
+
import (
|
| 660 |
+
"context"
|
| 661 |
+
"errors"
|
| 662 |
+
"fmt"
|
| 663 |
+
"io"
|
| 664 |
+
|
| 665 |
+
"github.com/hashicorp/terraform-exec/tfexec"
|
| 666 |
+
tfjson "github.com/hashicorp/terraform-json"
|
| 667 |
+
"google.golang.org/grpc/codes"
|
| 668 |
+
"google.golang.org/grpc/status"
|
| 669 |
+
"sigs.k8s.io/controller-runtime"
|
| 670 |
+
ctrl "sigs.k8s.io/controller-runtime"
|
| 671 |
+
)
|
| 672 |
+
|
| 673 |
+
func (r *TerraformRunnerServer) tfShowPlanFile(ctx context.Context, planPath string, opts ...tfexec.ShowOption) (*tfjson.Plan, error) {
|
| 674 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 675 |
+
|
| 676 |
+
// This is the only place where we disable the logger
|
| 677 |
+
r.tf.SetStdout(io.Discard)
|
| 678 |
+
r.tf.SetStderr(io.Discard)
|
| 679 |
+
|
| 680 |
+
defer r.initLogger(log)
|
| 681 |
+
|
| 682 |
+
return r.tf.ShowPlanFile(ctx, planPath, opts...)
|
| 683 |
+
}
|
| 684 |
+
|
| 685 |
+
func (r *TerraformRunnerServer) tfShowPlanFileRaw(ctx context.Context, planPath string, opts ...tfexec.ShowOption) (string, error) {
|
| 686 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 687 |
+
|
| 688 |
+
// This is the only place where we disable the logger
|
| 689 |
+
r.tf.SetStdout(io.Discard)
|
| 690 |
+
r.tf.SetStderr(io.Discard)
|
| 691 |
+
|
| 692 |
+
defer r.initLogger(log)
|
| 693 |
+
|
| 694 |
+
return r.tf.ShowPlanFileRaw(ctx, planPath, opts...)
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
func (r *TerraformRunnerServer) Plan(ctx context.Context, req *PlanRequest) (*PlanReply, error) {
|
| 698 |
+
log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 699 |
+
log.Info("creating a plan")
|
| 700 |
+
ctx, cancel := context.WithCancel(ctx)
|
| 701 |
+
go func() {
|
| 702 |
+
select {
|
| 703 |
+
case <-r.Done:
|
| 704 |
+
cancel()
|
| 705 |
+
case <-ctx.Done():
|
| 706 |
+
}
|
| 707 |
+
}()
|
| 708 |
+
|
| 709 |
+
if req.TfInstance != r.InstanceID {
|
| 710 |
+
err := fmt.Errorf("no TF instance found")
|
| 711 |
+
log.Error(err, "no terraform")
|
| 712 |
+
return nil, err
|
| 713 |
+
}
|
| 714 |
+
|
| 715 |
+
var planOpt []tfexec.PlanOption
|
| 716 |
+
if req.Out != "" {
|
| 717 |
+
planOpt = append(planOpt, tfexec.Out(req.Out))
|
| 718 |
+
} else {
|
| 719 |
+
// if backend is disabled completely, there will be no plan output file (req.Out = "")
|
| 720 |
+
log.Info("backend seems to be disabled completely, so there will be no plan output file")
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
if req.Refresh == false {
|
| 724 |
+
planOpt = append(planOpt, tfexec.Refresh(req.Refresh))
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
if req.Destroy {
|
| 728 |
+
planOpt = append(planOpt, tfexec.Destroy(req.Destroy))
|
| 729 |
+
}
|
| 730 |
+
|
| 731 |
+
for _, target := range req.Targets {
|
| 732 |
+
planOpt = append(planOpt, tfexec.Target(target))
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
drifted, err := r.tf.Plan(ctx, planOpt...)
|
| 736 |
+
if err != nil {
|
| 737 |
+
st := status.New(codes.Internal, err.Error())
|
| 738 |
+
var stateErr *tfexec.ErrStateLocked
|
| 739 |
+
|
| 740 |
+
if errors.As(err, &stateErr) {
|
| 741 |
+
st, err = st.WithDetails(&PlanReply{Message: "not ok", StateLockIdentifier: stateErr.ID})
|
| 742 |
+
|
| 743 |
+
if err != nil {
|
| 744 |
+
return nil, err
|
| 745 |
+
}
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
log.Error(err, "error creating the plan")
|
| 749 |
+
return nil, st.Err()
|
| 750 |
+
}
|
| 751 |
+
|
| 752 |
+
planCreated := false
|
| 753 |
+
if req.Out != "" {
|
| 754 |
+
planCreated = true
|
| 755 |
+
|
| 756 |
+
plan, err := r.tfShowPlanFile(ctx, req.Out)
|
| 757 |
+
if err != nil {
|
| 758 |
+
return nil, err
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
// This is the case when the plan is empty.
|
| 762 |
+
if plan.PlannedValues.Outputs == nil &&
|
| 763 |
+
plan.PlannedValues.RootModule.Resources == nil &&
|
| 764 |
+
plan.ResourceChanges == nil &&
|
| 765 |
+
plan.PriorState == nil &&
|
| 766 |
+
plan.OutputChanges == nil {
|
| 767 |
+
planCreated = false
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
}
|
| 771 |
+
|
| 772 |
+
return &PlanReply{Message: "ok", Drifted: drifted, PlanCreated: planCreated}, nil
|
| 773 |
+
}
|
| 774 |
+
```
|
| 775 |
+
|
| 776 |
+
## `runner/server_save_tfplan.go` (changed lines (18, 22, 50, 66))
|
| 777 |
+
|
| 778 |
+
```go
|
| 779 |
+
package runner
|
| 780 |
+
|
| 781 |
+
import (
|
| 782 |
+
"context"
|
| 783 |
+
"encoding/json"
|
| 784 |
+
"fmt"
|
| 785 |
+
"io/ioutil"
|
| 786 |
+
"path/filepath"
|
| 787 |
+
"strings"
|
| 788 |
+
|
| 789 |
+
"github.com/go-logr/logr"
|
| 790 |
+
infrav1 "github.com/weaveworks/tf-controller/api/v1alpha2"
|
| 791 |
+
"github.com/weaveworks/tf-controller/utils"
|
| 792 |
+
"k8s.io/api/core/v1"
|
| 793 |
+
"k8s.io/apimachinery/pkg/api/errors"
|
| 794 |
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 795 |
+
"k8s.io/apimachinery/pkg/types"
|
| 796 |
+
ctrl "sigs.k8s.io/controller-runtime"
|
| 797 |
+
)
|
| 798 |
+
|
| 799 |
+
func (r *TerraformRunnerServer) SaveTFPlan(ctx context.Context, req *SaveTFPlanRequest) (*SaveTFPlanReply, error) {
|
| 800 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 801 |
+
log.Info("save the plan")
|
| 802 |
+
if req.TfInstance != r.InstanceID {
|
| 803 |
+
err := fmt.Errorf("no TF instance found")
|
| 804 |
+
log.Error(err, "no terraform")
|
| 805 |
+
return nil, err
|
| 806 |
+
}
|
| 807 |
+
|
| 808 |
+
var tfplan []byte
|
| 809 |
+
if req.BackendCompletelyDisable {
|
| 810 |
+
tfplan = []byte("dummy plan")
|
| 811 |
+
} else {
|
| 812 |
+
var err error
|
| 813 |
+
tfplan, err = ioutil.ReadFile(filepath.Join(r.tf.WorkingDir(), TFPlanName))
|
| 814 |
+
if err != nil {
|
| 815 |
+
err = fmt.Errorf("error reading plan file: %s", err)
|
| 816 |
+
log.Error(err, "unable to complete SaveTFPlan function")
|
| 817 |
+
return nil, err
|
| 818 |
+
}
|
| 819 |
+
}
|
| 820 |
+
|
| 821 |
+
planRev := strings.Replace(req.Revision, "/", "-", 1)
|
| 822 |
+
planName := "plan-" + planRev
|
| 823 |
+
if err := r.writePlanAsSecret(ctx, req.Name, req.Namespace, log, planName, tfplan, "", req.Uuid); err != nil {
|
| 824 |
+
return nil, err
|
| 825 |
+
}
|
| 826 |
+
|
| 827 |
+
if r.terraform.Spec.StoreReadablePlan == "json" {
|
| 828 |
+
planObj, err := r.tfShowPlanFile(ctx, TFPlanName)
|
| 829 |
+
if err != nil {
|
| 830 |
+
log.Error(err, "unable to get the plan output for json")
|
| 831 |
+
return nil, err
|
| 832 |
+
}
|
| 833 |
+
jsonBytes, err := json.Marshal(planObj)
|
| 834 |
+
if err != nil {
|
| 835 |
+
log.Error(err, "unable to marshal the plan to json")
|
| 836 |
+
return nil, err
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
if err := r.writePlanAsSecret(ctx, req.Name, req.Namespace, log, planName, jsonBytes, ".json", req.Uuid); err != nil {
|
| 840 |
+
return nil, err
|
| 841 |
+
}
|
| 842 |
+
|
| 843 |
+
} else if r.terraform.Spec.StoreReadablePlan == "human" {
|
| 844 |
+
rawOutput, err := r.tfShowPlanFileRaw(ctx, TFPlanName)
|
| 845 |
+
if err != nil {
|
| 846 |
+
log.Error(err, "unable to get the plan output for human")
|
| 847 |
+
return nil, err
|
| 848 |
+
}
|
| 849 |
+
|
| 850 |
+
if err := r.writePlanAsConfigMap(ctx, req.Name, req.Namespace, log, planName, rawOutput, "", req.Uuid); err != nil {
|
| 851 |
+
return nil, err
|
| 852 |
+
}
|
| 853 |
+
}
|
| 854 |
+
|
| 855 |
+
return &SaveTFPlanReply{Message: "ok"}, nil
|
| 856 |
+
}
|
| 857 |
+
|
| 858 |
+
func (r *TerraformRunnerServer) writePlanAsSecret(ctx context.Context, name string, namespace string, log logr.Logger, planName string, tfplan []byte, suffix string, uuid string) error {
|
| 859 |
+
secretName := "tfplan-" + r.terraform.WorkspaceName() + "-" + name + suffix
|
| 860 |
+
tfplanObjectKey := types.NamespacedName{Name: secretName, Namespace: namespace}
|
| 861 |
+
var tfplanSecret v1.Secret
|
| 862 |
+
tfplanSecretExists := true
|
| 863 |
+
|
| 864 |
+
if err := r.Client.Get(ctx, tfplanObjectKey, &tfplanSecret); err != nil {
|
| 865 |
+
if errors.IsNotFound(err) {
|
| 866 |
+
tfplanSecretExists = false
|
| 867 |
+
} else {
|
| 868 |
+
err = fmt.Errorf("error getting tfplanSecret: %s", err)
|
| 869 |
+
log.Error(err, "unable to get the plan secret")
|
| 870 |
+
return err
|
| 871 |
+
}
|
| 872 |
+
}
|
| 873 |
+
|
| 874 |
+
if tfplanSecretExists {
|
| 875 |
+
if err := r.Client.Delete(ctx, &tfplanSecret); err != nil {
|
| 876 |
+
err = fmt.Errorf("error deleting tfplanSecret: %s", err)
|
| 877 |
+
log.Error(err, "unable to delete the plan secret")
|
| 878 |
+
return err
|
| 879 |
+
}
|
| 880 |
+
}
|
| 881 |
+
|
| 882 |
+
tfplan, err := utils.GzipEncode(tfplan)
|
| 883 |
+
if err != nil {
|
| 884 |
+
log.Error(err, "unable to encode the plan revision", "planName", planName)
|
| 885 |
+
return err
|
| 886 |
+
}
|
| 887 |
+
|
| 888 |
+
tfplanData := map[string][]byte{TFPlanName: tfplan}
|
| 889 |
+
tfplanSecret = v1.Secret{
|
| 890 |
+
TypeMeta: metav1.TypeMeta{
|
| 891 |
+
Kind: "Secret",
|
| 892 |
+
APIVersion: "v1",
|
| 893 |
+
},
|
| 894 |
+
ObjectMeta: metav1.ObjectMeta{
|
| 895 |
+
Name: secretName,
|
| 896 |
+
Namespace: namespace,
|
| 897 |
+
Annotations: map[string]string{
|
| 898 |
+
"encoding": "gzip",
|
| 899 |
+
SavedPlanSecretAnnotation: planName,
|
| 900 |
+
},
|
| 901 |
+
OwnerReferences: []metav1.OwnerReference{
|
| 902 |
+
{
|
| 903 |
+
APIVersion: infrav1.GroupVersion.Group + "/" + infrav1.GroupVersion.Version,
|
| 904 |
+
Kind: infrav1.TerraformKind,
|
| 905 |
+
Name: name,
|
| 906 |
+
UID: types.UID(uuid),
|
| 907 |
+
},
|
| 908 |
+
},
|
| 909 |
+
},
|
| 910 |
+
Type: v1.SecretTypeOpaque,
|
| 911 |
+
Data: tfplanData,
|
| 912 |
+
}
|
| 913 |
+
|
| 914 |
+
if err := r.Client.Create(ctx, &tfplanSecret); err != nil {
|
| 915 |
+
err = fmt.Errorf("error recording plan status: %s", err)
|
| 916 |
+
log.Error(err, "unable to create plan secret")
|
| 917 |
+
return err
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
return nil
|
| 921 |
+
}
|
| 922 |
+
|
| 923 |
+
func (r *TerraformRunnerServer) writePlanAsConfigMap(ctx context.Context, name string, namespace string, log logr.Logger, planName string, tfplan string, suffix string, uuid string) error {
|
| 924 |
+
configMapName := "tfplan-" + r.terraform.WorkspaceName() + "-" + name + suffix
|
| 925 |
+
tfplanObjectKey := types.NamespacedName{Name: configMapName, Namespace: namespace}
|
| 926 |
+
var tfplanCM v1.ConfigMap
|
| 927 |
+
tfplanCMExists := true
|
| 928 |
+
|
| 929 |
+
if err := r.Client.Get(ctx, tfplanObjectKey, &tfplanCM); err != nil {
|
| 930 |
+
if errors.IsNotFound(err) {
|
| 931 |
+
tfplanCMExists = false
|
| 932 |
+
} else {
|
| 933 |
+
err = fmt.Errorf("error getting tfplanSecret: %s", err)
|
| 934 |
+
log.Error(err, "unable to get the plan configmap")
|
| 935 |
+
return err
|
| 936 |
+
}
|
| 937 |
+
}
|
| 938 |
+
|
| 939 |
+
if tfplanCMExists {
|
| 940 |
+
if err := r.Client.Delete(ctx, &tfplanCM); err != nil {
|
| 941 |
+
err = fmt.Errorf("error deleting tfplanSecret: %s", err)
|
| 942 |
+
log.Error(err, "unable to delete the plan configmap")
|
| 943 |
+
return err
|
| 944 |
+
}
|
| 945 |
+
}
|
| 946 |
+
|
| 947 |
+
tfplanData := map[string]string{TFPlanName: tfplan}
|
| 948 |
+
tfplanCM = v1.ConfigMap{
|
| 949 |
+
TypeMeta: metav1.TypeMeta{
|
| 950 |
+
Kind: "ConfigMap",
|
| 951 |
+
APIVersion: "v1",
|
| 952 |
+
},
|
| 953 |
+
ObjectMeta: metav1.ObjectMeta{
|
| 954 |
+
Name: configMapName,
|
| 955 |
+
Namespace: namespace,
|
| 956 |
+
Annotations: map[string]string{
|
| 957 |
+
SavedPlanSecretAnnotation: planName,
|
| 958 |
+
},
|
| 959 |
+
OwnerReferences: []metav1.OwnerReference{
|
| 960 |
+
{
|
| 961 |
+
APIVersion: infrav1.GroupVersion.Group + "/" + infrav1.GroupVersion.Version,
|
| 962 |
+
Kind: infrav1.TerraformKind,
|
| 963 |
+
Name: name,
|
| 964 |
+
UID: types.UID(uuid),
|
| 965 |
+
},
|
| 966 |
+
},
|
| 967 |
+
},
|
| 968 |
+
Data: tfplanData,
|
| 969 |
+
}
|
| 970 |
+
|
| 971 |
+
if err := r.Client.Create(ctx, &tfplanCM); err != nil {
|
| 972 |
+
err = fmt.Errorf("error recording plan status: %s", err)
|
| 973 |
+
log.Error(err, "unable to create plan configmap")
|
| 974 |
+
return err
|
| 975 |
+
}
|
| 976 |
+
|
| 977 |
+
return nil
|
| 978 |
+
}
|
| 979 |
+
```
|
| 980 |
+
|
| 981 |
+
## `runner/server_show_plan.go` (changed lines (19, 37))
|
| 982 |
+
|
| 983 |
+
```go
|
| 984 |
+
package runner
|
| 985 |
+
|
| 986 |
+
import (
|
| 987 |
+
"context"
|
| 988 |
+
"encoding/json"
|
| 989 |
+
"fmt"
|
| 990 |
+
"sigs.k8s.io/controller-runtime"
|
| 991 |
+
)
|
| 992 |
+
|
| 993 |
+
func (r *TerraformRunnerServer) ShowPlanFileRaw(ctx context.Context, req *ShowPlanFileRawRequest) (*ShowPlanFileRawReply, error) {
|
| 994 |
+
log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 995 |
+
log.Info("show the raw plan file")
|
| 996 |
+
if req.TfInstance != r.InstanceID {
|
| 997 |
+
err := fmt.Errorf("no TF instance found")
|
| 998 |
+
log.Error(err, "no terraform")
|
| 999 |
+
return nil, err
|
| 1000 |
+
}
|
| 1001 |
+
|
| 1002 |
+
rawOutput, err := r.tfShowPlanFileRaw(ctx, req.Filename)
|
| 1003 |
+
if err != nil {
|
| 1004 |
+
log.Error(err, "unable to get the raw plan output")
|
| 1005 |
+
return nil, err
|
| 1006 |
+
}
|
| 1007 |
+
|
| 1008 |
+
return &ShowPlanFileRawReply{RawOutput: rawOutput}, nil
|
| 1009 |
+
}
|
| 1010 |
+
|
| 1011 |
+
func (r *TerraformRunnerServer) ShowPlanFile(ctx context.Context, req *ShowPlanFileRequest) (*ShowPlanFileReply, error) {
|
| 1012 |
+
log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 1013 |
+
log.Info("show the raw plan file")
|
| 1014 |
+
if req.TfInstance != r.InstanceID {
|
| 1015 |
+
err := fmt.Errorf("no TF instance found")
|
| 1016 |
+
log.Error(err, "no terraform")
|
| 1017 |
+
return nil, err
|
| 1018 |
+
}
|
| 1019 |
+
|
| 1020 |
+
plan, err := r.tfShowPlanFile(ctx, req.Filename)
|
| 1021 |
+
if err != nil {
|
| 1022 |
+
log.Error(err, "unable to get the json plan output")
|
| 1023 |
+
return nil, err
|
| 1024 |
+
}
|
| 1025 |
+
|
| 1026 |
+
jsonBytes, err := json.Marshal(plan)
|
| 1027 |
+
if err != nil {
|
| 1028 |
+
log.Error(err, "unable to marshal the plan to json")
|
| 1029 |
+
return nil, err
|
| 1030 |
+
}
|
| 1031 |
+
|
| 1032 |
+
return &ShowPlanFileReply{JsonOutput: jsonBytes}, nil
|
| 1033 |
+
}
|
| 1034 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/pre_context.md
ADDED
|
@@ -0,0 +1,998 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context before the fix
|
| 2 |
+
|
| 3 |
+
## `runner/server.go` (changed lines (173, 194, 195, 196, 197, 198, 199, 200, 201, 202))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package runner
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"bytes"
|
| 10 |
+
"context"
|
| 11 |
+
"errors"
|
| 12 |
+
"fmt"
|
| 13 |
+
"io/ioutil"
|
| 14 |
+
"os"
|
| 15 |
+
"os/exec"
|
| 16 |
+
"path/filepath"
|
| 17 |
+
"strings"
|
| 18 |
+
|
| 19 |
+
securejoin "github.com/cyphar/filepath-securejoin"
|
| 20 |
+
"github.com/fluxcd/pkg/untar"
|
| 21 |
+
"github.com/go-logr/logr"
|
| 22 |
+
"github.com/hashicorp/terraform-exec/tfexec"
|
| 23 |
+
tfjson "github.com/hashicorp/terraform-json"
|
| 24 |
+
infrav1 "github.com/weaveworks/tf-controller/api/v1alpha2"
|
| 25 |
+
"github.com/weaveworks/tf-controller/utils"
|
| 26 |
+
"google.golang.org/grpc/codes"
|
| 27 |
+
"google.golang.org/grpc/status"
|
| 28 |
+
corev1 "k8s.io/api/core/v1"
|
| 29 |
+
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
| 30 |
+
"k8s.io/apimachinery/pkg/runtime"
|
| 31 |
+
"k8s.io/apimachinery/pkg/types"
|
| 32 |
+
ctrl "sigs.k8s.io/controller-runtime"
|
| 33 |
+
"sigs.k8s.io/controller-runtime/pkg/client"
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
const (
|
| 37 |
+
TFPlanName = "tfplan"
|
| 38 |
+
SavedPlanSecretAnnotation = "savedPlan"
|
| 39 |
+
runnerFileMappingLocationHome = "home"
|
| 40 |
+
runnerFileMappingLocationWorkspace = "workspace"
|
| 41 |
+
runnerFileMappingDirectoryPermissions = 0700
|
| 42 |
+
runnerFileMappingFilePermissions = 0600
|
| 43 |
+
HomePath = "/home/runner"
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
type LocalPrintfer struct {
|
| 47 |
+
logger logr.Logger
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
func (l LocalPrintfer) Printf(format string, v ...interface{}) {
|
| 51 |
+
l.logger.Info(fmt.Sprintf(format, v...))
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
type TerraformRunnerServer struct {
|
| 55 |
+
UnimplementedRunnerServer
|
| 56 |
+
tf *tfexec.Terraform
|
| 57 |
+
client.Client
|
| 58 |
+
Scheme *runtime.Scheme
|
| 59 |
+
Done chan os.Signal
|
| 60 |
+
terraform *infrav1.Terraform
|
| 61 |
+
InstanceID string
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
const loggerName = "runner.terraform"
|
| 65 |
+
|
| 66 |
+
func (r *TerraformRunnerServer) LookPath(ctx context.Context, req *LookPathRequest) (*LookPathReply, error) {
|
| 67 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 68 |
+
log.Info("looking for path", "file", req.File)
|
| 69 |
+
execPath, err := exec.LookPath(req.File)
|
| 70 |
+
if err != nil {
|
| 71 |
+
log.Error(err, "unable to look for path", "file", req.File)
|
| 72 |
+
return nil, err
|
| 73 |
+
}
|
| 74 |
+
return &LookPathReply{ExecPath: execPath}, nil
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
func (r *TerraformRunnerServer) UploadAndExtract(ctx context.Context, req *UploadAndExtractRequest) (*UploadAndExtractReply, error) {
|
| 78 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 79 |
+
log.Info("preparing for Upload and Extraction")
|
| 80 |
+
tmpDir, err := securejoin.SecureJoin(os.TempDir(), fmt.Sprintf("%s-%s", req.Namespace, req.Name))
|
| 81 |
+
if err != nil {
|
| 82 |
+
log.Error(err, "unable to join securely", "tmpDir", os.TempDir(), "namespace", req.Namespace, "name", req.Name)
|
| 83 |
+
return nil, err
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
buf := bytes.NewBuffer(req.TarGz)
|
| 87 |
+
if _, err = untar.Untar(buf, tmpDir); err != nil {
|
| 88 |
+
log.Error(err, "unable to extract tar file", "namespace", req.Namespace, "name", req.Name)
|
| 89 |
+
return nil, fmt.Errorf("failed to untar artifact, error: %w", err)
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
dirPath, err := securejoin.SecureJoin(tmpDir, req.Path)
|
| 93 |
+
if err != nil {
|
| 94 |
+
log.Error(err, "unable to join securely", "tmpDir", tmpDir, "path", req.Path)
|
| 95 |
+
return nil, err
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
if _, err := os.Stat(dirPath); err != nil {
|
| 99 |
+
log.Error(err, "path not found", "dirPath", dirPath)
|
| 100 |
+
err = fmt.Errorf("terraform path not found: %w", err)
|
| 101 |
+
return nil, err
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
return &UploadAndExtractReply{WorkingDir: dirPath, TmpDir: tmpDir}, nil
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
func (r *TerraformRunnerServer) CleanupDir(ctx context.Context, req *CleanupDirRequest) (*CleanupDirReply, error) {
|
| 108 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 109 |
+
log.Info("cleanup TmpDir", "tmpDir", req.TmpDir)
|
| 110 |
+
err := os.RemoveAll(req.TmpDir)
|
| 111 |
+
if err != nil {
|
| 112 |
+
log.Error(err, "error cleaning up TmpDir", "tmpDir", req.TmpDir)
|
| 113 |
+
return nil, err
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
return &CleanupDirReply{Message: "ok"}, nil
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
func (r *TerraformRunnerServer) WriteBackendConfig(ctx context.Context, req *WriteBackendConfigRequest) (*WriteBackendConfigReply, error) {
|
| 120 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 121 |
+
const backendConfigPath = "backend_override.tf"
|
| 122 |
+
log.Info("write backend config", "path", req.DirPath, "config", backendConfigPath)
|
| 123 |
+
filePath, err := securejoin.SecureJoin(req.DirPath, backendConfigPath)
|
| 124 |
+
if err != nil {
|
| 125 |
+
log.Error(err, "unable to join securely", "dirPath", req.DirPath, "config", backendConfigPath)
|
| 126 |
+
return nil, err
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
log.Info("write config to file", "filePath", filePath)
|
| 130 |
+
err = os.WriteFile(filePath, req.BackendConfig, 0644)
|
| 131 |
+
if err != nil {
|
| 132 |
+
log.Error(err, "unable to write file", "filePath", filePath)
|
| 133 |
+
return nil, err
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
return &WriteBackendConfigReply{Message: "ok"}, nil
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
func (r *TerraformRunnerServer) ProcessCliConfig(ctx context.Context, req *ProcessCliConfigRequest) (*ProcessCliConfigReply, error) {
|
| 140 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 141 |
+
log.Info("processing configuration", "namespace", req.Namespace, "name", req.Name)
|
| 142 |
+
cliConfigKey := types.NamespacedName{Namespace: req.Namespace, Name: req.Name}
|
| 143 |
+
var cliConfig corev1.Secret
|
| 144 |
+
if err := r.Get(ctx, cliConfigKey, &cliConfig); err != nil {
|
| 145 |
+
log.Error(err, "unable to get secret", "namespace", req.Namespace, "name", req.Name)
|
| 146 |
+
return nil, err
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
if len(cliConfig.Data) != 1 {
|
| 150 |
+
err := fmt.Errorf("expect the secret to contain 1 data")
|
| 151 |
+
log.Error(err, "secret missing data", "namespace", req.Namespace, "name", req.Name)
|
| 152 |
+
return nil, err
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
var tfrcFilepath string
|
| 156 |
+
for tfrcFilename, v := range cliConfig.Data {
|
| 157 |
+
if strings.HasSuffix(tfrcFilename, ".tfrc") {
|
| 158 |
+
var err error
|
| 159 |
+
tfrcFilepath, err = securejoin.SecureJoin(req.DirPath, tfrcFilename)
|
| 160 |
+
if err != nil {
|
| 161 |
+
log.Error(err, "secure join error", "dirPath", req.DirPath, "tfrcFilename", tfrcFilename)
|
| 162 |
+
return nil, err
|
| 163 |
+
}
|
| 164 |
+
err = os.WriteFile(tfrcFilepath, v, 0644)
|
| 165 |
+
if err != nil {
|
| 166 |
+
log.Error(err, "write file error", "tfrcFilename", tfrcFilename, "fileMode", "0644")
|
| 167 |
+
return nil, err
|
| 168 |
+
}
|
| 169 |
+
} else {
|
| 170 |
+
err := fmt.Errorf("expect the secret key to end with .tfrc")
|
| 171 |
+
log.Error(err, "file extension error", "tfrcFilename", tfrcFilename)
|
| 172 |
+
return nil, err
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
return &ProcessCliConfigReply{FilePath: tfrcFilepath}, nil
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
func (r *TerraformRunnerServer) NewTerraform(ctx context.Context, req *NewTerraformRequest) (*NewTerraformReply, error) {
|
| 179 |
+
r.InstanceID = req.GetInstanceID()
|
| 180 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 181 |
+
log.Info("creating new terraform", "workingDir", req.WorkingDir, "execPath", req.ExecPath)
|
| 182 |
+
tf, err := tfexec.NewTerraform(req.WorkingDir, req.ExecPath)
|
| 183 |
+
if err != nil {
|
| 184 |
+
log.Error(err, "unable to create new terraform", "workingDir", req.WorkingDir, "execPath", req.ExecPath)
|
| 185 |
+
return nil, err
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
// hold only 1 instance
|
| 189 |
+
r.tf = tf
|
| 190 |
+
|
| 191 |
+
var terraform infrav1.Terraform
|
| 192 |
+
if err := terraform.FromBytes(req.Terraform, r.Scheme); err != nil {
|
| 193 |
+
log.Error(err, "there was a problem getting the terraform resource")
|
| 194 |
+
return nil, err
|
| 195 |
+
}
|
| 196 |
+
// cache the Terraform resource when initializing
|
| 197 |
+
r.terraform = &terraform
|
| 198 |
+
|
| 199 |
+
disableTestLogging := os.Getenv("DISABLE_TF_LOGS") == "1"
|
| 200 |
+
if !disableTestLogging {
|
| 201 |
+
r.tf.SetStdout(os.Stdout)
|
| 202 |
+
r.tf.SetStderr(os.Stderr)
|
| 203 |
+
if os.Getenv("ENABLE_SENSITIVE_TF_LOGS") == "1" {
|
| 204 |
+
r.tf.SetLogger(&LocalPrintfer{logger: log})
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
return &NewTerraformReply{Id: r.InstanceID}, nil
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
func (r *TerraformRunnerServer) SetEnv(ctx context.Context, req *SetEnvRequest) (*SetEnvReply, error) {
|
| 212 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 213 |
+
log.Info("setting envvars")
|
| 214 |
+
|
| 215 |
+
if req.TfInstance != r.InstanceID {
|
| 216 |
+
err := fmt.Errorf("no TF instance found")
|
| 217 |
+
log.Error(err, "no terraform")
|
| 218 |
+
return nil, err
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
log.Info("getting envvars from os environments")
|
| 222 |
+
envs := utils.EnvMap(os.Environ())
|
| 223 |
+
for k, v := range req.Envs {
|
| 224 |
+
envs[k] = v
|
| 225 |
+
}
|
| 226 |
+
err := r.tf.SetEnv(envs)
|
| 227 |
+
if err != nil {
|
| 228 |
+
log.Error(err, "unable to set envvars", "envvars", envs)
|
| 229 |
+
return nil, err
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
return &SetEnvReply{Message: "ok"}, nil
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
func (r *TerraformRunnerServer) CreateFileMappings(ctx context.Context, req *CreateFileMappingsRequest) (*CreateFileMappingsReply, error) {
|
| 236 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 237 |
+
log.Info("creating file mappings")
|
| 238 |
+
|
| 239 |
+
for _, fileMapping := range req.FileMappings {
|
| 240 |
+
var fileFullPath string
|
| 241 |
+
var err error
|
| 242 |
+
switch fileMapping.Location {
|
| 243 |
+
case runnerFileMappingLocationHome:
|
| 244 |
+
fileFullPath, err = securejoin.SecureJoin(HomePath, fileMapping.Path)
|
| 245 |
+
if err != nil {
|
| 246 |
+
log.Error(err, "insecure file path", "path", fileMapping.Path)
|
| 247 |
+
return nil, err
|
| 248 |
+
}
|
| 249 |
+
case runnerFileMappingLocationWorkspace:
|
| 250 |
+
fileFullPath, err = securejoin.SecureJoin(req.WorkingDir, fileMapping.Path)
|
| 251 |
+
if err != nil {
|
| 252 |
+
log.Error(err, "insecure file path", "path", fileMapping.Path)
|
| 253 |
+
return nil, err
|
| 254 |
+
}
|
| 255 |
+
default:
|
| 256 |
+
err := fmt.Errorf("unknown file mapping location")
|
| 257 |
+
log.Error(err, "unknown file mapping location", "location", fileMapping.Location)
|
| 258 |
+
return nil, err
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
log.Info("prepare to write file", "fileFullPath", fileFullPath)
|
| 262 |
+
dir := filepath.Dir(fileFullPath)
|
| 263 |
+
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
| 264 |
+
// create dir
|
| 265 |
+
err := os.MkdirAll(dir, runnerFileMappingDirectoryPermissions)
|
| 266 |
+
if err != nil {
|
| 267 |
+
log.Error(err, "unable to create dir", "dir", dir)
|
| 268 |
+
return nil, err
|
| 269 |
+
}
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
if err := os.WriteFile(fileFullPath, fileMapping.Content, runnerFileMappingFilePermissions); err != nil {
|
| 273 |
+
log.Error(err, "Unable to create file from file mapping", "file", fileFullPath)
|
| 274 |
+
return nil, err
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
return &CreateFileMappingsReply{Message: "ok"}, nil
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
func (r *TerraformRunnerServer) Init(ctx context.Context, req *InitRequest) (*InitReply, error) {
|
| 282 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 283 |
+
log.Info("initializing")
|
| 284 |
+
if req.TfInstance != r.InstanceID {
|
| 285 |
+
err := fmt.Errorf("no TF instance found")
|
| 286 |
+
log.Error(err, "no terraform")
|
| 287 |
+
return nil, err
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
terraform := r.terraform
|
| 291 |
+
|
| 292 |
+
log.Info("mapping the Spec.BackendConfigsFrom")
|
| 293 |
+
backendConfigsOpts := []tfexec.InitOption{}
|
| 294 |
+
for _, bf := range terraform.Spec.BackendConfigsFrom {
|
| 295 |
+
objectKey := types.NamespacedName{
|
| 296 |
+
Namespace: terraform.Namespace,
|
| 297 |
+
Name: bf.Name,
|
| 298 |
+
}
|
| 299 |
+
if bf.Kind == "Secret" {
|
| 300 |
+
var s corev1.Secret
|
| 301 |
+
err := r.Get(ctx, objectKey, &s)
|
| 302 |
+
if err != nil && bf.Optional == false {
|
| 303 |
+
log.Error(err, "unable to get object key", "objectKey", objectKey, "secret", s.ObjectMeta.Name)
|
| 304 |
+
return nil, err
|
| 305 |
+
}
|
| 306 |
+
// if VarsKeys is null, use all
|
| 307 |
+
if bf.Keys == nil {
|
| 308 |
+
for key, val := range s.Data {
|
| 309 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+string(val)))
|
| 310 |
+
}
|
| 311 |
+
} else {
|
| 312 |
+
for _, key := range bf.Keys {
|
| 313 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+string(s.Data[key])))
|
| 314 |
+
}
|
| 315 |
+
}
|
| 316 |
+
} else if bf.Kind == "ConfigMap" {
|
| 317 |
+
var cm corev1.ConfigMap
|
| 318 |
+
err := r.Get(ctx, objectKey, &cm)
|
| 319 |
+
if err != nil && bf.Optional == false {
|
| 320 |
+
log.Error(err, "unable to get object key", "objectKey", objectKey, "configmap", cm.ObjectMeta.Name)
|
| 321 |
+
return nil, err
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
// if Keys is null, use all
|
| 325 |
+
if bf.Keys == nil {
|
| 326 |
+
for key, val := range cm.Data {
|
| 327 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+val))
|
| 328 |
+
}
|
| 329 |
+
for key, val := range cm.BinaryData {
|
| 330 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+string(val)))
|
| 331 |
+
}
|
| 332 |
+
} else {
|
| 333 |
+
for _, key := range bf.Keys {
|
| 334 |
+
if val, ok := cm.Data[key]; ok {
|
| 335 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+val))
|
| 336 |
+
}
|
| 337 |
+
if val, ok := cm.BinaryData[key]; ok {
|
| 338 |
+
backendConfigsOpts = append(backendConfigsOpts, tfexec.BackendConfig(key+"="+string(val)))
|
| 339 |
+
}
|
| 340 |
+
}
|
| 341 |
+
}
|
| 342 |
+
}
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
initOpts := []tfexec.InitOption{tfexec.Upgrade(req.Upgrade), tfexec.ForceCopy(req.ForceCopy)}
|
| 346 |
+
initOpts = append(initOpts, backendConfigsOpts...)
|
| 347 |
+
if err := r.tf.Init(ctx, initOpts...); err != nil {
|
| 348 |
+
st := status.New(codes.Internal, err.Error())
|
| 349 |
+
var stateErr *tfexec.ErrStateLocked
|
| 350 |
+
|
| 351 |
+
if errors.As(err, &stateErr) {
|
| 352 |
+
st, err = st.WithDetails(&InitReply{Message: "not ok", StateLockIdentifier: stateErr.ID})
|
| 353 |
+
|
| 354 |
+
if err != nil {
|
| 355 |
+
return nil, err
|
| 356 |
+
}
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
log.Error(err, "unable to initialize")
|
| 360 |
+
return nil, st.Err()
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
return &InitReply{Message: "ok"}, nil
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
func (r *TerraformRunnerServer) SelectWorkspace(ctx context.Context, req *WorkspaceRequest) (*WorkspaceReply, error) {
|
| 367 |
+
log := ctrl.LoggerFrom(ctx).WithName(loggerName)
|
| 368 |
+
log.Info("workspace select")
|
| 369 |
+
if req.TfInstance != r.InstanceID {
|
| 370 |
+
err := fmt.Errorf("no TF instance found")
|
| 371 |
+
log.Error(err, "no terraform")
|
| 372 |
+
return nil, err
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
terraform := r.terraform
|
| 376 |
+
|
| 377 |
+
if terraform.WorkspaceName() != infrav1.DefaultWorkspaceName {
|
| 378 |
+
wsOpts := []tfexec.WorkspaceNewCmdOption{}
|
| 379 |
+
ws := terraform.Spec.Workspace
|
| 380 |
+
if err := r.tf.WorkspaceNew(ctx, ws, wsOpts...); err != nil {
|
| 381 |
+
log.Info(fmt.Sprintf("workspace new:, %s", err.Error()))
|
| 382 |
+
}
|
| 383 |
+
if err := r.tf.WorkspaceSelect(ctx, ws); err != nil {
|
| 384 |
+
err := fmt.Errorf("failed to select workspace %s", ws)
|
| 385 |
+
log.Error(err, "workspace select error")
|
| 386 |
+
return nil, err
|
| 387 |
+
}
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
return &WorkspaceReply{Message: "ok"}, nil
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
func (r *TerraformRunnerServer) LoadTFPlan(ctx context.Context, req *LoadTFPlanRequest) (*LoadTFPlanReply, error) {
|
| 394 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 395 |
+
log.Info("loading plan from secret")
|
| 396 |
+
if req.TfInstance != r.InstanceID {
|
| 397 |
+
err := fmt.Errorf("no TF instance found")
|
| 398 |
+
log.Error(err, "no terraform")
|
| 399 |
+
return nil, err
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
tfplanSecretKey := types.NamespacedName{Namespace: req.Namespace, Name: "tfplan-" + r.terraform.WorkspaceName() + "-" + req.Name}
|
| 403 |
+
tfplanSecret := corev1.Secret{}
|
| 404 |
+
err := r.Get(ctx, tfplanSecretKey, &tfplanSecret)
|
| 405 |
+
if err != nil {
|
| 406 |
+
err = fmt.Errorf("error getting plan secret: %s", err)
|
| 407 |
+
log.Error(err, "unable to get secret")
|
| 408 |
+
return nil, err
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
if tfplanSecret.Annotations[SavedPlanSecretAnnotation] != req.PendingPlan {
|
| 412 |
+
err = fmt.Errorf("error pending plan and plan's name in the secret are not matched: %s != %s",
|
| 413 |
+
req.PendingPlan,
|
| 414 |
+
tfplanSecret.Annotations[SavedPlanSecretAnnotation])
|
| 415 |
+
log.Error(err, "plan name mismatch")
|
| 416 |
+
return nil, err
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
if req.BackendCompletelyDisable {
|
| 420 |
+
// do nothing
|
| 421 |
+
} else {
|
| 422 |
+
tfplan := tfplanSecret.Data[TFPlanName]
|
| 423 |
+
tfplan, err = utils.GzipDecode(tfplan)
|
| 424 |
+
if err != nil {
|
| 425 |
+
log.Error(err, "unable to decode the plan")
|
| 426 |
+
return nil, err
|
| 427 |
+
}
|
| 428 |
+
err = ioutil.WriteFile(filepath.Join(r.tf.WorkingDir(), TFPlanName), tfplan, 0644)
|
| 429 |
+
if err != nil {
|
| 430 |
+
err = fmt.Errorf("error saving plan file to disk: %s", err)
|
| 431 |
+
log.Error(err, "unable to write the plan to disk")
|
| 432 |
+
return nil, err
|
| 433 |
+
}
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
return &LoadTFPlanReply{Message: "ok"}, nil
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
func (r *TerraformRunnerServer) Destroy(ctx context.Context, req *DestroyRequest) (*DestroyReply, error) {
|
| 440 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 441 |
+
log.Info("running destroy")
|
| 442 |
+
ctx, cancel := context.WithCancel(ctx)
|
| 443 |
+
go func() {
|
| 444 |
+
select {
|
| 445 |
+
case <-r.Done:
|
| 446 |
+
cancel()
|
| 447 |
+
case <-ctx.Done():
|
| 448 |
+
}
|
| 449 |
+
}()
|
| 450 |
+
|
| 451 |
+
if req.TfInstance != r.InstanceID {
|
| 452 |
+
err := fmt.Errorf("no TF instance found")
|
| 453 |
+
log.Error(err, "no terraform")
|
| 454 |
+
return nil, err
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
var destroyOpt []tfexec.DestroyOption
|
| 458 |
+
for _, target := range req.Targets {
|
| 459 |
+
destroyOpt = append(destroyOpt, tfexec.Target(target))
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
if err := r.tf.Destroy(ctx, destroyOpt...); err != nil {
|
| 463 |
+
st := status.New(codes.Internal, err.Error())
|
| 464 |
+
var stateErr *tfexec.ErrStateLocked
|
| 465 |
+
|
| 466 |
+
if errors.As(err, &stateErr) {
|
| 467 |
+
st, err = st.WithDetails(&DestroyReply{Message: "not ok", StateLockIdentifier: stateErr.ID})
|
| 468 |
+
|
| 469 |
+
if err != nil {
|
| 470 |
+
return nil, err
|
| 471 |
+
}
|
| 472 |
+
}
|
| 473 |
+
|
| 474 |
+
log.Error(err, "unable to destroy")
|
| 475 |
+
return nil, st.Err()
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
return &DestroyReply{Message: "ok"}, nil
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
func (r *TerraformRunnerServer) Apply(ctx context.Context, req *ApplyRequest) (*ApplyReply, error) {
|
| 482 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 483 |
+
log.Info("running apply")
|
| 484 |
+
ctx, cancel := context.WithCancel(ctx)
|
| 485 |
+
go func() {
|
| 486 |
+
select {
|
| 487 |
+
case <-r.Done:
|
| 488 |
+
cancel()
|
| 489 |
+
case <-ctx.Done():
|
| 490 |
+
}
|
| 491 |
+
}()
|
| 492 |
+
|
| 493 |
+
if req.TfInstance != r.InstanceID {
|
| 494 |
+
err := fmt.Errorf("no TF instance found")
|
| 495 |
+
log.Error(err, "no terraform")
|
| 496 |
+
return nil, err
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
var applyOpt []tfexec.ApplyOption
|
| 500 |
+
if req.DirOrPlan != "" {
|
| 501 |
+
applyOpt = []tfexec.ApplyOption{tfexec.DirOrPlan(req.DirOrPlan)}
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
if req.RefreshBeforeApply {
|
| 505 |
+
applyOpt = []tfexec.ApplyOption{tfexec.Refresh(true)}
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
for _, target := range req.Targets {
|
| 509 |
+
applyOpt = append(applyOpt, tfexec.Target(target))
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
if req.Parallelism > 0 {
|
| 513 |
+
applyOpt = append(applyOpt, tfexec.Parallelism(int(req.Parallelism)))
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
if err := r.tf.Apply(ctx, applyOpt...); err != nil {
|
| 517 |
+
st := status.New(codes.Internal, err.Error())
|
| 518 |
+
var stateErr *tfexec.ErrStateLocked
|
| 519 |
+
|
| 520 |
+
if errors.As(err, &stateErr) {
|
| 521 |
+
st, err = st.WithDetails(&ApplyReply{Message: "not ok", StateLockIdentifier: stateErr.ID})
|
| 522 |
+
|
| 523 |
+
if err != nil {
|
| 524 |
+
return nil, err
|
| 525 |
+
}
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
log.Error(err, "unable to apply plan")
|
| 529 |
+
return nil, st.Err()
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
return &ApplyReply{Message: "ok"}, nil
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
func getInventoryFromTerraformModule(m *tfjson.StateModule) []*Inventory {
|
| 536 |
+
var result []*Inventory
|
| 537 |
+
for _, r := range m.Resources {
|
| 538 |
+
var id string
|
| 539 |
+
// TODO ARN is AWS-specific. Will need to support other cloud identifiers in the future.
|
| 540 |
+
if val, ok := r.AttributeValues["arn"]; ok {
|
| 541 |
+
id = val.(string)
|
| 542 |
+
} else if val, ok := r.AttributeValues["id"]; ok {
|
| 543 |
+
id = val.(string)
|
| 544 |
+
}
|
| 545 |
+
result = append(result, &Inventory{
|
| 546 |
+
Name: r.Name,
|
| 547 |
+
Type: r.Type,
|
| 548 |
+
Identifier: id,
|
| 549 |
+
})
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
// recursively get all resources from submodules
|
| 553 |
+
for _, childModule := range m.ChildModules {
|
| 554 |
+
childInventory := getInventoryFromTerraformModule(childModule)
|
| 555 |
+
result = append(result, childInventory...)
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
return result
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
func (r *TerraformRunnerServer) GetInventory(ctx context.Context, req *GetInventoryRequest) (*GetInventoryReply, error) {
|
| 562 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 563 |
+
log.Info("get inventory")
|
| 564 |
+
if req.TfInstance != r.InstanceID {
|
| 565 |
+
err := fmt.Errorf("no TF instance found")
|
| 566 |
+
log.Error(err, "get inventory: no terraform")
|
| 567 |
+
return nil, err
|
| 568 |
+
}
|
| 569 |
+
state, err := r.tf.Show(ctx)
|
| 570 |
+
if err != nil {
|
| 571 |
+
log.Error(err, "get inventory: unable to get state via show command")
|
| 572 |
+
return nil, err
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
// state contains no values after resource destruction for example
|
| 576 |
+
if state.Values == nil {
|
| 577 |
+
log.Info("get inventory: state values is nil")
|
| 578 |
+
return &GetInventoryReply{Inventories: []*Inventory{}}, nil
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
if state.Values.RootModule == nil {
|
| 582 |
+
log.Info("get inventory: root module is nil")
|
| 583 |
+
return &GetInventoryReply{Inventories: []*Inventory{}}, nil
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
return &GetInventoryReply{Inventories: getInventoryFromTerraformModule(state.Values.RootModule)}, nil
|
| 587 |
+
}
|
| 588 |
+
|
| 589 |
+
func (r *TerraformRunnerServer) FinalizeSecrets(ctx context.Context, req *FinalizeSecretsRequest) (*FinalizeSecretsReply, error) {
|
| 590 |
+
log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 591 |
+
log.Info("finalize the output secrets")
|
| 592 |
+
// nil dereference bug here
|
| 593 |
+
planObjectKey := types.NamespacedName{Namespace: req.Namespace, Name: "tfplan-" + req.Workspace + "-" + req.Name}
|
| 594 |
+
var planSecret corev1.Secret
|
| 595 |
+
if err := r.Client.Get(ctx, planObjectKey, &planSecret); err == nil {
|
| 596 |
+
if err := r.Client.Delete(ctx, &planSecret); err != nil {
|
| 597 |
+
// transient failure
|
| 598 |
+
log.Error(err, "unable to delete the plan secret")
|
| 599 |
+
return nil, status.Error(codes.Internal, err.Error())
|
| 600 |
+
}
|
| 601 |
+
} else if apierrors.IsNotFound(err) {
|
| 602 |
+
log.Error(err, "plan secret not found")
|
| 603 |
+
return nil, status.Error(codes.NotFound, err.Error())
|
| 604 |
+
} else {
|
| 605 |
+
// transient failure
|
| 606 |
+
log.Error(err, "unable to get the plan secret")
|
| 607 |
+
return nil, status.Error(codes.Internal, err.Error())
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
if req.HasSpecifiedOutputSecret {
|
| 611 |
+
outputsObjectKey := types.NamespacedName{Namespace: req.Namespace, Name: req.OutputSecretName}
|
| 612 |
+
var outputsSecret corev1.Secret
|
| 613 |
+
if err := r.Client.Get(ctx, outputsObjectKey, &outputsSecret); err == nil {
|
| 614 |
+
if err := r.Client.Delete(ctx, &outputsSecret); err != nil {
|
| 615 |
+
// transient failure
|
| 616 |
+
log.Error(err, "unable to delete the output secret")
|
| 617 |
+
return nil, status.Error(codes.Internal, err.Error())
|
| 618 |
+
}
|
| 619 |
+
} else if apierrors.IsNotFound(err) {
|
| 620 |
+
log.Error(err, "output secret not found")
|
| 621 |
+
return nil, status.Error(codes.NotFound, err.Error())
|
| 622 |
+
} else {
|
| 623 |
+
// transient failure
|
| 624 |
+
log.Error(err, "unable to get the output secret")
|
| 625 |
+
return nil, status.Error(codes.Internal, err.Error())
|
| 626 |
+
}
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
return &FinalizeSecretsReply{Message: "ok"}, nil
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
func (r *TerraformRunnerServer) ForceUnlock(ctx context.Context, req *ForceUnlockRequest) (*ForceUnlockReply, error) {
|
| 633 |
+
reply := &ForceUnlockReply{
|
| 634 |
+
Success: true,
|
| 635 |
+
Message: fmt.Sprintf("Successfully unlocked state with lock identifier: %s", req.GetLockIdentifier()),
|
| 636 |
+
}
|
| 637 |
+
err := r.tf.ForceUnlock(ctx, req.LockIdentifier)
|
| 638 |
+
|
| 639 |
+
if err != nil {
|
| 640 |
+
reply.Success = false
|
| 641 |
+
reply.Message = fmt.Sprintf("Error unlocking the state: %s", err)
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
return reply, err
|
| 645 |
+
}
|
| 646 |
+
```
|
| 647 |
+
|
| 648 |
+
## `runner/server_plan.go` (changed lines (7, 8, 11, 13, 71, 72, 84))
|
| 649 |
+
|
| 650 |
+
```go
|
| 651 |
+
package runner
|
| 652 |
+
|
| 653 |
+
import (
|
| 654 |
+
"context"
|
| 655 |
+
"errors"
|
| 656 |
+
"fmt"
|
| 657 |
+
"github.com/hashicorp/terraform-exec/tfexec"
|
| 658 |
+
"google.golang.org/grpc/codes"
|
| 659 |
+
"google.golang.org/grpc/status"
|
| 660 |
+
"sigs.k8s.io/controller-runtime"
|
| 661 |
+
)
|
| 662 |
+
|
| 663 |
+
func (r *TerraformRunnerServer) Plan(ctx context.Context, req *PlanRequest) (*PlanReply, error) {
|
| 664 |
+
log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 665 |
+
log.Info("creating a plan")
|
| 666 |
+
ctx, cancel := context.WithCancel(ctx)
|
| 667 |
+
go func() {
|
| 668 |
+
select {
|
| 669 |
+
case <-r.Done:
|
| 670 |
+
cancel()
|
| 671 |
+
case <-ctx.Done():
|
| 672 |
+
}
|
| 673 |
+
}()
|
| 674 |
+
|
| 675 |
+
if req.TfInstance != r.InstanceID {
|
| 676 |
+
err := fmt.Errorf("no TF instance found")
|
| 677 |
+
log.Error(err, "no terraform")
|
| 678 |
+
return nil, err
|
| 679 |
+
}
|
| 680 |
+
|
| 681 |
+
var planOpt []tfexec.PlanOption
|
| 682 |
+
if req.Out != "" {
|
| 683 |
+
planOpt = append(planOpt, tfexec.Out(req.Out))
|
| 684 |
+
} else {
|
| 685 |
+
// if backend is disabled completely, there will be no plan output file (req.Out = "")
|
| 686 |
+
log.Info("backend seems to be disabled completely, so there will be no plan output file")
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
if req.Refresh == false {
|
| 690 |
+
planOpt = append(planOpt, tfexec.Refresh(req.Refresh))
|
| 691 |
+
}
|
| 692 |
+
|
| 693 |
+
if req.Destroy {
|
| 694 |
+
planOpt = append(planOpt, tfexec.Destroy(req.Destroy))
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
for _, target := range req.Targets {
|
| 698 |
+
planOpt = append(planOpt, tfexec.Target(target))
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
drifted, err := r.tf.Plan(ctx, planOpt...)
|
| 702 |
+
if err != nil {
|
| 703 |
+
st := status.New(codes.Internal, err.Error())
|
| 704 |
+
var stateErr *tfexec.ErrStateLocked
|
| 705 |
+
|
| 706 |
+
if errors.As(err, &stateErr) {
|
| 707 |
+
st, err = st.WithDetails(&PlanReply{Message: "not ok", StateLockIdentifier: stateErr.ID})
|
| 708 |
+
|
| 709 |
+
if err != nil {
|
| 710 |
+
return nil, err
|
| 711 |
+
}
|
| 712 |
+
}
|
| 713 |
+
|
| 714 |
+
log.Error(err, "error creating the plan")
|
| 715 |
+
return nil, st.Err()
|
| 716 |
+
}
|
| 717 |
+
|
| 718 |
+
planCreated := false
|
| 719 |
+
if req.Out != "" {
|
| 720 |
+
planCreated = true
|
| 721 |
+
plan, err := r.tf.ShowPlanFile(ctx, req.Out)
|
| 722 |
+
if err != nil {
|
| 723 |
+
return nil, err
|
| 724 |
+
}
|
| 725 |
+
|
| 726 |
+
// This is the case when the plan is empty.
|
| 727 |
+
if plan.PlannedValues.Outputs == nil &&
|
| 728 |
+
plan.PlannedValues.RootModule.Resources == nil &&
|
| 729 |
+
plan.ResourceChanges == nil &&
|
| 730 |
+
plan.PriorState == nil &&
|
| 731 |
+
plan.OutputChanges == nil {
|
| 732 |
+
planCreated = false
|
| 733 |
+
}
|
| 734 |
+
}
|
| 735 |
+
|
| 736 |
+
return &PlanReply{Message: "ok", Drifted: drifted, PlanCreated: planCreated}, nil
|
| 737 |
+
}
|
| 738 |
+
```
|
| 739 |
+
|
| 740 |
+
## `runner/server_save_tfplan.go` (changed lines (18, 19, 22, 23, 50, 51, 66, 67))
|
| 741 |
+
|
| 742 |
+
```go
|
| 743 |
+
package runner
|
| 744 |
+
|
| 745 |
+
import (
|
| 746 |
+
"context"
|
| 747 |
+
"encoding/json"
|
| 748 |
+
"fmt"
|
| 749 |
+
"io/ioutil"
|
| 750 |
+
"path/filepath"
|
| 751 |
+
"strings"
|
| 752 |
+
|
| 753 |
+
"github.com/go-logr/logr"
|
| 754 |
+
infrav1 "github.com/weaveworks/tf-controller/api/v1alpha2"
|
| 755 |
+
"github.com/weaveworks/tf-controller/utils"
|
| 756 |
+
"k8s.io/api/core/v1"
|
| 757 |
+
"k8s.io/apimachinery/pkg/api/errors"
|
| 758 |
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 759 |
+
"k8s.io/apimachinery/pkg/types"
|
| 760 |
+
"sigs.k8s.io/controller-runtime"
|
| 761 |
+
)
|
| 762 |
+
|
| 763 |
+
func (r *TerraformRunnerServer) SaveTFPlan(ctx context.Context, req *SaveTFPlanRequest) (*SaveTFPlanReply, error) {
|
| 764 |
+
log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 765 |
+
log.Info("save the plan")
|
| 766 |
+
if req.TfInstance != r.InstanceID {
|
| 767 |
+
err := fmt.Errorf("no TF instance found")
|
| 768 |
+
log.Error(err, "no terraform")
|
| 769 |
+
return nil, err
|
| 770 |
+
}
|
| 771 |
+
|
| 772 |
+
var tfplan []byte
|
| 773 |
+
if req.BackendCompletelyDisable {
|
| 774 |
+
tfplan = []byte("dummy plan")
|
| 775 |
+
} else {
|
| 776 |
+
var err error
|
| 777 |
+
tfplan, err = ioutil.ReadFile(filepath.Join(r.tf.WorkingDir(), TFPlanName))
|
| 778 |
+
if err != nil {
|
| 779 |
+
err = fmt.Errorf("error reading plan file: %s", err)
|
| 780 |
+
log.Error(err, "unable to complete SaveTFPlan function")
|
| 781 |
+
return nil, err
|
| 782 |
+
}
|
| 783 |
+
}
|
| 784 |
+
|
| 785 |
+
planRev := strings.Replace(req.Revision, "/", "-", 1)
|
| 786 |
+
planName := "plan-" + planRev
|
| 787 |
+
if err := r.writePlanAsSecret(ctx, req.Name, req.Namespace, log, planName, tfplan, "", req.Uuid); err != nil {
|
| 788 |
+
return nil, err
|
| 789 |
+
}
|
| 790 |
+
|
| 791 |
+
if r.terraform.Spec.StoreReadablePlan == "json" {
|
| 792 |
+
planObj, err := r.tf.ShowPlanFile(ctx, TFPlanName)
|
| 793 |
+
if err != nil {
|
| 794 |
+
log.Error(err, "unable to get the plan output for json")
|
| 795 |
+
return nil, err
|
| 796 |
+
}
|
| 797 |
+
jsonBytes, err := json.Marshal(planObj)
|
| 798 |
+
if err != nil {
|
| 799 |
+
log.Error(err, "unable to marshal the plan to json")
|
| 800 |
+
return nil, err
|
| 801 |
+
}
|
| 802 |
+
|
| 803 |
+
if err := r.writePlanAsSecret(ctx, req.Name, req.Namespace, log, planName, jsonBytes, ".json", req.Uuid); err != nil {
|
| 804 |
+
return nil, err
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
} else if r.terraform.Spec.StoreReadablePlan == "human" {
|
| 808 |
+
rawOutput, err := r.tf.ShowPlanFileRaw(ctx, TFPlanName)
|
| 809 |
+
if err != nil {
|
| 810 |
+
log.Error(err, "unable to get the plan output for human")
|
| 811 |
+
return nil, err
|
| 812 |
+
}
|
| 813 |
+
|
| 814 |
+
if err := r.writePlanAsConfigMap(ctx, req.Name, req.Namespace, log, planName, rawOutput, "", req.Uuid); err != nil {
|
| 815 |
+
return nil, err
|
| 816 |
+
}
|
| 817 |
+
}
|
| 818 |
+
|
| 819 |
+
return &SaveTFPlanReply{Message: "ok"}, nil
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
func (r *TerraformRunnerServer) writePlanAsSecret(ctx context.Context, name string, namespace string, log logr.Logger, planName string, tfplan []byte, suffix string, uuid string) error {
|
| 823 |
+
secretName := "tfplan-" + r.terraform.WorkspaceName() + "-" + name + suffix
|
| 824 |
+
tfplanObjectKey := types.NamespacedName{Name: secretName, Namespace: namespace}
|
| 825 |
+
var tfplanSecret v1.Secret
|
| 826 |
+
tfplanSecretExists := true
|
| 827 |
+
|
| 828 |
+
if err := r.Client.Get(ctx, tfplanObjectKey, &tfplanSecret); err != nil {
|
| 829 |
+
if errors.IsNotFound(err) {
|
| 830 |
+
tfplanSecretExists = false
|
| 831 |
+
} else {
|
| 832 |
+
err = fmt.Errorf("error getting tfplanSecret: %s", err)
|
| 833 |
+
log.Error(err, "unable to get the plan secret")
|
| 834 |
+
return err
|
| 835 |
+
}
|
| 836 |
+
}
|
| 837 |
+
|
| 838 |
+
if tfplanSecretExists {
|
| 839 |
+
if err := r.Client.Delete(ctx, &tfplanSecret); err != nil {
|
| 840 |
+
err = fmt.Errorf("error deleting tfplanSecret: %s", err)
|
| 841 |
+
log.Error(err, "unable to delete the plan secret")
|
| 842 |
+
return err
|
| 843 |
+
}
|
| 844 |
+
}
|
| 845 |
+
|
| 846 |
+
tfplan, err := utils.GzipEncode(tfplan)
|
| 847 |
+
if err != nil {
|
| 848 |
+
log.Error(err, "unable to encode the plan revision", "planName", planName)
|
| 849 |
+
return err
|
| 850 |
+
}
|
| 851 |
+
|
| 852 |
+
tfplanData := map[string][]byte{TFPlanName: tfplan}
|
| 853 |
+
tfplanSecret = v1.Secret{
|
| 854 |
+
TypeMeta: metav1.TypeMeta{
|
| 855 |
+
Kind: "Secret",
|
| 856 |
+
APIVersion: "v1",
|
| 857 |
+
},
|
| 858 |
+
ObjectMeta: metav1.ObjectMeta{
|
| 859 |
+
Name: secretName,
|
| 860 |
+
Namespace: namespace,
|
| 861 |
+
Annotations: map[string]string{
|
| 862 |
+
"encoding": "gzip",
|
| 863 |
+
SavedPlanSecretAnnotation: planName,
|
| 864 |
+
},
|
| 865 |
+
OwnerReferences: []metav1.OwnerReference{
|
| 866 |
+
{
|
| 867 |
+
APIVersion: infrav1.GroupVersion.Group + "/" + infrav1.GroupVersion.Version,
|
| 868 |
+
Kind: infrav1.TerraformKind,
|
| 869 |
+
Name: name,
|
| 870 |
+
UID: types.UID(uuid),
|
| 871 |
+
},
|
| 872 |
+
},
|
| 873 |
+
},
|
| 874 |
+
Type: v1.SecretTypeOpaque,
|
| 875 |
+
Data: tfplanData,
|
| 876 |
+
}
|
| 877 |
+
|
| 878 |
+
if err := r.Client.Create(ctx, &tfplanSecret); err != nil {
|
| 879 |
+
err = fmt.Errorf("error recording plan status: %s", err)
|
| 880 |
+
log.Error(err, "unable to create plan secret")
|
| 881 |
+
return err
|
| 882 |
+
}
|
| 883 |
+
|
| 884 |
+
return nil
|
| 885 |
+
}
|
| 886 |
+
|
| 887 |
+
func (r *TerraformRunnerServer) writePlanAsConfigMap(ctx context.Context, name string, namespace string, log logr.Logger, planName string, tfplan string, suffix string, uuid string) error {
|
| 888 |
+
configMapName := "tfplan-" + r.terraform.WorkspaceName() + "-" + name + suffix
|
| 889 |
+
tfplanObjectKey := types.NamespacedName{Name: configMapName, Namespace: namespace}
|
| 890 |
+
var tfplanCM v1.ConfigMap
|
| 891 |
+
tfplanCMExists := true
|
| 892 |
+
|
| 893 |
+
if err := r.Client.Get(ctx, tfplanObjectKey, &tfplanCM); err != nil {
|
| 894 |
+
if errors.IsNotFound(err) {
|
| 895 |
+
tfplanCMExists = false
|
| 896 |
+
} else {
|
| 897 |
+
err = fmt.Errorf("error getting tfplanSecret: %s", err)
|
| 898 |
+
log.Error(err, "unable to get the plan configmap")
|
| 899 |
+
return err
|
| 900 |
+
}
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
if tfplanCMExists {
|
| 904 |
+
if err := r.Client.Delete(ctx, &tfplanCM); err != nil {
|
| 905 |
+
err = fmt.Errorf("error deleting tfplanSecret: %s", err)
|
| 906 |
+
log.Error(err, "unable to delete the plan configmap")
|
| 907 |
+
return err
|
| 908 |
+
}
|
| 909 |
+
}
|
| 910 |
+
|
| 911 |
+
tfplanData := map[string]string{TFPlanName: tfplan}
|
| 912 |
+
tfplanCM = v1.ConfigMap{
|
| 913 |
+
TypeMeta: metav1.TypeMeta{
|
| 914 |
+
Kind: "ConfigMap",
|
| 915 |
+
APIVersion: "v1",
|
| 916 |
+
},
|
| 917 |
+
ObjectMeta: metav1.ObjectMeta{
|
| 918 |
+
Name: configMapName,
|
| 919 |
+
Namespace: namespace,
|
| 920 |
+
Annotations: map[string]string{
|
| 921 |
+
SavedPlanSecretAnnotation: planName,
|
| 922 |
+
},
|
| 923 |
+
OwnerReferences: []metav1.OwnerReference{
|
| 924 |
+
{
|
| 925 |
+
APIVersion: infrav1.GroupVersion.Group + "/" + infrav1.GroupVersion.Version,
|
| 926 |
+
Kind: infrav1.TerraformKind,
|
| 927 |
+
Name: name,
|
| 928 |
+
UID: types.UID(uuid),
|
| 929 |
+
},
|
| 930 |
+
},
|
| 931 |
+
},
|
| 932 |
+
Data: tfplanData,
|
| 933 |
+
}
|
| 934 |
+
|
| 935 |
+
if err := r.Client.Create(ctx, &tfplanCM); err != nil {
|
| 936 |
+
err = fmt.Errorf("error recording plan status: %s", err)
|
| 937 |
+
log.Error(err, "unable to create plan configmap")
|
| 938 |
+
return err
|
| 939 |
+
}
|
| 940 |
+
|
| 941 |
+
return nil
|
| 942 |
+
}
|
| 943 |
+
```
|
| 944 |
+
|
| 945 |
+
## `runner/server_show_plan.go` (changed lines (19, 20, 37, 38))
|
| 946 |
+
|
| 947 |
+
```go
|
| 948 |
+
package runner
|
| 949 |
+
|
| 950 |
+
import (
|
| 951 |
+
"context"
|
| 952 |
+
"encoding/json"
|
| 953 |
+
"fmt"
|
| 954 |
+
"sigs.k8s.io/controller-runtime"
|
| 955 |
+
)
|
| 956 |
+
|
| 957 |
+
func (r *TerraformRunnerServer) ShowPlanFileRaw(ctx context.Context, req *ShowPlanFileRawRequest) (*ShowPlanFileRawReply, error) {
|
| 958 |
+
log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 959 |
+
log.Info("show the raw plan file")
|
| 960 |
+
if req.TfInstance != r.InstanceID {
|
| 961 |
+
err := fmt.Errorf("no TF instance found")
|
| 962 |
+
log.Error(err, "no terraform")
|
| 963 |
+
return nil, err
|
| 964 |
+
}
|
| 965 |
+
|
| 966 |
+
rawOutput, err := r.tf.ShowPlanFileRaw(ctx, req.Filename)
|
| 967 |
+
if err != nil {
|
| 968 |
+
log.Error(err, "unable to get the raw plan output")
|
| 969 |
+
return nil, err
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
return &ShowPlanFileRawReply{RawOutput: rawOutput}, nil
|
| 973 |
+
}
|
| 974 |
+
|
| 975 |
+
func (r *TerraformRunnerServer) ShowPlanFile(ctx context.Context, req *ShowPlanFileRequest) (*ShowPlanFileReply, error) {
|
| 976 |
+
log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName)
|
| 977 |
+
log.Info("show the raw plan file")
|
| 978 |
+
if req.TfInstance != r.InstanceID {
|
| 979 |
+
err := fmt.Errorf("no TF instance found")
|
| 980 |
+
log.Error(err, "no terraform")
|
| 981 |
+
return nil, err
|
| 982 |
+
}
|
| 983 |
+
|
| 984 |
+
plan, err := r.tf.ShowPlanFile(ctx, req.Filename)
|
| 985 |
+
if err != nil {
|
| 986 |
+
log.Error(err, "unable to get the json plan output")
|
| 987 |
+
return nil, err
|
| 988 |
+
}
|
| 989 |
+
|
| 990 |
+
jsonBytes, err := json.Marshal(plan)
|
| 991 |
+
if err != nil {
|
| 992 |
+
log.Error(err, "unable to marshal the plan to json")
|
| 993 |
+
return nil, err
|
| 994 |
+
}
|
| 995 |
+
|
| 996 |
+
return &ShowPlanFileReply{JsonOutput: jsonBytes}, nil
|
| 997 |
+
}
|
| 998 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/task.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "synthesis-task-v1",
|
| 3 |
+
"task": {
|
| 4 |
+
"pair_id": "morefixes-0adb0a489b07a50d6b2f",
|
| 5 |
+
"dataset_id": "morefixes",
|
| 6 |
+
"dataset_item_id": "morefixes-0adb0a489b07a50d6b2f",
|
| 7 |
+
"project_id": "morefixes__weaveworks__tf-controller",
|
| 8 |
+
"language": "go",
|
| 9 |
+
"backend": "codeql"
|
| 10 |
+
},
|
| 11 |
+
"changed_go_files": [
|
| 12 |
+
"runner/server.go",
|
| 13 |
+
"runner/server_plan.go",
|
| 14 |
+
"runner/server_save_tfplan.go",
|
| 15 |
+
"runner/server_show_plan.go"
|
| 16 |
+
],
|
| 17 |
+
"patch_units": {
|
| 18 |
+
"before": [
|
| 19 |
+
"runner/server.go",
|
| 20 |
+
"runner/server_plan.go",
|
| 21 |
+
"runner/server_save_tfplan.go",
|
| 22 |
+
"runner/server_show_plan.go"
|
| 23 |
+
],
|
| 24 |
+
"after": [
|
| 25 |
+
"runner/server.go",
|
| 26 |
+
"runner/server_plan.go",
|
| 27 |
+
"runner/server_save_tfplan.go",
|
| 28 |
+
"runner/server_show_plan.go"
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
"runtime_assets": {
|
| 32 |
+
"before": {
|
| 33 |
+
"database": "assets/526bd22241fda08aa14f3aff637753e5a43fbb91c6797071cb3459ad1b5c5977/database",
|
| 34 |
+
"cache_key": "526bd22241fda08aa14f3aff637753e5a43fbb91c6797071cb3459ad1b5c5977",
|
| 35 |
+
"codeql_version": "2.26.4"
|
| 36 |
+
},
|
| 37 |
+
"after": {
|
| 38 |
+
"database": "assets/9ed4d3837482420c6ba2d63dce2e8616009a054f4fbc06d4e97455bd3bbebd32/database",
|
| 39 |
+
"cache_key": "9ed4d3837482420c6ba2d63dce2e8616009a054f4fbc06d4e97455bd3bbebd32",
|
| 40 |
+
"codeql_version": "2.26.4"
|
| 41 |
+
},
|
| 42 |
+
"refine": {
|
| 43 |
+
"database": "assets/ceaf049c8c906e9fc480038bd793145a9875fb9cfb427cf067b39438de42a041/database",
|
| 44 |
+
"cache_key": "ceaf049c8c906e9fc480038bd793145a9875fb9cfb427cf067b39438de42a041",
|
| 45 |
+
"codeql_version": "2.26.4"
|
| 46 |
+
}
|
| 47 |
+
},
|
| 48 |
+
"benchmark_contract": {
|
| 49 |
+
"agent_visible": true,
|
| 50 |
+
"reference_query_location": "references/morefixes-0adb0a489b07a50d6b2f/query/ (do not mount into agent)",
|
| 51 |
+
"evaluator_location": "evaluator/morefixes-0adb0a489b07a50d6b2f/ (do not mount into agent)"
|
| 52 |
+
}
|
| 53 |
+
}
|
tasks/codeql_go_benchmark_top30_v1/morefixes-0adb0a489b07a50d6b2f/task_prompt.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Go CodeQL detector synthesis
|
| 2 |
+
|
| 3 |
+
You are cc operating in `/work`. Starting only from the supplied patch,
|
| 4 |
+
before/after Go context, CodeQL references, and validation tools, synthesize a semantic CodeQL
|
| 5 |
+
detector for the vulnerability fixed by the patch. This is one fresh session. You may iterate inside
|
| 6 |
+
this session, but no later framework repair or resume will occur.
|
| 7 |
+
|
| 8 |
+
## Inputs and owned outputs
|
| 9 |
+
|
| 10 |
+
- Read `patch.diff`, `go_patch.diff`, `pre_context.md`, and `post_context.md`.
|
| 11 |
+
- Read `references/codeql/convergence_protocol.md` and
|
| 12 |
+
`references/codeql/go_api.md` before experimenting. Read the remaining
|
| 13 |
+
`references/codeql/` files for the selected mechanism.
|
| 14 |
+
- Use `scripts/search_codeql_api.sh` to inspect the pinned official libraries when an API detail is
|
| 15 |
+
uncertain. Do not guess predicate names or build a large family of inspection queries.
|
| 16 |
+
- Complete the design contract in `state.json` and `scope_statement.md` before final validation.
|
| 17 |
+
- Replace `query/vulnerability.ql`; add only genuinely shared `.qll` helpers when useful. Keep the
|
| 18 |
+
fixed offline dependency in `query/qlpack.yml`.
|
| 19 |
+
- Preserve the exact `expected_query_id` from `config.json` as the query's sole `@id`. This
|
| 20 |
+
task-unique metadata must never be used in a query predicate.
|
| 21 |
+
- Use `scripts/compile_query.sh`, `scripts/run_before.sh`, and `scripts/run_after.sh`.
|
| 22 |
+
- Finish by writing `summary.json` with `status`, `query_path`, `query_kind`, `build_passed`,
|
| 23 |
+
`before_findings`, `after_findings`, `validation_completed`, and a concise `notes` field.
|
| 24 |
+
|
| 25 |
+
## Required reasoning contract
|
| 26 |
+
|
| 27 |
+
Before coding, record this mapping in `state.json`:
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
vulnerable operation / trigger / patch safety condition
|
| 31 |
+
→ CodeQL-observable evidence
|
| 32 |
+
→ syntax, control-flow, local value-flow, global taint/value-flow, or interprocedural mechanism
|
| 33 |
+
→ source, sink/report site, guard/barrier and query predicates
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Choose the lowest mechanism that can actually prove the condition. Guard-sensitive patches require
|
| 37 |
+
real path/control-flow semantics; provenance-sensitive patches require value flow. Do not replace
|
| 38 |
+
either with source-text matching or with the mere presence of patch-added syntax.
|
| 39 |
+
|
| 40 |
+
## Mandatory convergence contract
|
| 41 |
+
|
| 42 |
+
The rollout has a 50-minute hard wall-clock ceiling and must be finalized by minute 43. Minutes
|
| 43 |
+
43–50 are an emergency shutdown buffer, not exploration time. A sophisticated unfinished query is
|
| 44 |
+
a failure; an early compilable semantic candidate can be improved. Follow the checkpoints in
|
| 45 |
+
`references/codeql/convergence_protocol.md`:
|
| 46 |
+
|
| 47 |
+
1. Record the mechanism contract, then replace the placeholder in `query/vulnerability.ql`
|
| 48 |
+
immediately. Do not wait until every CodeQL API detail is known.
|
| 49 |
+
2. Use at most three distinct scratch `.ql` files. Prefer repeatedly editing one
|
| 50 |
+
`query/scratch.ql`. After two failed variants of one API assumption, inspect the exact bundled
|
| 51 |
+
definition with `scripts/search_codeql_api.sh` or simplify the mechanism.
|
| 52 |
+
3. Obtain a compiling minimal main query before broadening it. Compile the main query after every
|
| 53 |
+
meaningful mechanism change.
|
| 54 |
+
4. Move in order from compile → relevant before finding → after elimination → final contract. Do
|
| 55 |
+
not continue API exploration after the intended before/after differential is established.
|
| 56 |
+
5. Run `scripts/check_progress.sh` at each checkpoint. It reports elapsed time, the minute-43
|
| 57 |
+
finalization deadline, and the minute-50 hard timeout. When it prints `finalize_now`, stop all
|
| 58 |
+
exploration, preserve the best compiling query, finish the contract files, and exit.
|
| 59 |
+
|
| 60 |
+
## Semantic and generalization rules
|
| 61 |
+
|
| 62 |
+
- Report at the vulnerable call, operator, access, or sink.
|
| 63 |
+
- Do not use a patch-local path, line, commit hash, label, or local variable name as the primary
|
| 64 |
+
matching condition. Stable library/framework APIs or public project APIs are allowed only when
|
| 65 |
+
`scope_statement.md` explains why they define the intended vulnerability family.
|
| 66 |
+
- The safety condition introduced by the patch must be represented by the query.
|
| 67 |
+
- A lower after warning count is not enough: inspect SARIF and ensure at least one intended before
|
| 68 |
+
finding is in a patch-overlapping semantic unit and the corresponding finding disappears after.
|
| 69 |
+
- Avoid broad proxy queries that report an enclosing function or unrelated API merely because it
|
| 70 |
+
changed in the patch.
|
| 71 |
+
|
| 72 |
+
## Final validation protocol
|
| 73 |
+
|
| 74 |
+
1. Compile the final query.
|
| 75 |
+
2. Run it on before and inspect `raw/before.sarif` for the intended report location.
|
| 76 |
+
3. Run the identical query on after and inspect `raw/after.sarif`.
|
| 77 |
+
4. Recheck query metadata, query kind/select signature, report locality, design-to-code consistency,
|
| 78 |
+
and absence of patch-local hardcoding.
|
| 79 |
+
5. Update `state.json`, `scope_statement.md`, and write valid `summary.json`.
|
| 80 |
+
|
| 81 |
+
Do not modify the runtime databases, references, patch, context, or validation scripts except for
|
| 82 |
+
normal CodeQL-generated database caches produced by the provided run scripts.
|
tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/patch.diff
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/cmd/root.go b/cmd/root.go
|
| 2 |
+
index 8fefcb37..b062eba2 100644
|
| 3 |
+
--- a/cmd/root.go
|
| 4 |
+
+++ b/cmd/root.go
|
| 5 |
+
@@ -9,6 +9,7 @@ import (
|
| 6 |
+
"time"
|
| 7 |
+
|
| 8 |
+
"knative.dev/func/cmd/templates"
|
| 9 |
+
+ "knative.dev/func/k8s"
|
| 10 |
+
|
| 11 |
+
"github.com/ory/viper"
|
| 12 |
+
"github.com/spf13/cobra"
|
| 13 |
+
@@ -361,7 +362,12 @@ func (v Version) StringVerbose() string {
|
| 14 |
+
if date == "" {
|
| 15 |
+
date = time.Now().Format(time.RFC3339)
|
| 16 |
+
}
|
| 17 |
+
- return fmt.Sprintf("%s-%s-%s", vers, hash, date)
|
| 18 |
+
+ funcVersion := fmt.Sprintf("%s-%s-%s", vers, hash, date)
|
| 19 |
+
+ return fmt.Sprintf("Version: %s\n"+
|
| 20 |
+
+ "SocatImage: %s\n"+
|
| 21 |
+
+ "TarImage: %s", funcVersion,
|
| 22 |
+
+ k8s.SocatImage,
|
| 23 |
+
+ k8s.TarImage)
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
// surveySelectDefault returns 'value' if defined and exists in 'options'.
|
| 27 |
+
diff --git a/cmd/root_test.go b/cmd/root_test.go
|
| 28 |
+
index 25f73c24..89569cfb 100644
|
| 29 |
+
--- a/cmd/root_test.go
|
| 30 |
+
+++ b/cmd/root_test.go
|
| 31 |
+
@@ -209,24 +209,28 @@ func TestRoot_CommandNameParameterized(t *testing.T) {
|
| 32 |
+
|
| 33 |
+
func TestVerbose(t *testing.T) {
|
| 34 |
+
tests := []struct {
|
| 35 |
+
- name string
|
| 36 |
+
- args []string
|
| 37 |
+
- want string
|
| 38 |
+
+ name string
|
| 39 |
+
+ args []string
|
| 40 |
+
+ want string
|
| 41 |
+
+ wantLF int
|
| 42 |
+
}{
|
| 43 |
+
{
|
| 44 |
+
- name: "verbose as version's flag",
|
| 45 |
+
- args: []string{"version", "-v"},
|
| 46 |
+
- want: "v0.42.0-cafe-1970-01-01\n",
|
| 47 |
+
+ name: "verbose as version's flag",
|
| 48 |
+
+ args: []string{"version", "-v"},
|
| 49 |
+
+ want: "Version: v0.42.0-cafe-1970-01-01",
|
| 50 |
+
+ wantLF: 3,
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
- name: "no verbose",
|
| 54 |
+
- args: []string{"version"},
|
| 55 |
+
- want: "v0.42.0\n",
|
| 56 |
+
+ name: "no verbose",
|
| 57 |
+
+ args: []string{"version"},
|
| 58 |
+
+ want: "v0.42.0",
|
| 59 |
+
+ wantLF: 1,
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
- name: "verbose as root's flag",
|
| 63 |
+
- args: []string{"--verbose", "version"},
|
| 64 |
+
- want: "v0.42.0-cafe-1970-01-01\n",
|
| 65 |
+
+ name: "verbose as root's flag",
|
| 66 |
+
+ args: []string{"--verbose", "version"},
|
| 67 |
+
+ want: "Version: v0.42.0-cafe-1970-01-01",
|
| 68 |
+
+ wantLF: 3,
|
| 69 |
+
},
|
| 70 |
+
}
|
| 71 |
+
for _, tt := range tests {
|
| 72 |
+
@@ -249,8 +253,12 @@ func TestVerbose(t *testing.T) {
|
| 73 |
+
t.Fatal(err)
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
- if out.String() != tt.want {
|
| 77 |
+
- t.Errorf("expected output: %q but got: %q", tt.want, out.String())
|
| 78 |
+
+ outLines := strings.Split(out.String(), "\n")
|
| 79 |
+
+ if len(outLines)-1 != tt.wantLF {
|
| 80 |
+
+ t.Errorf("expected output with %v line breaks but got %v:", tt.wantLF, len(outLines)-1)
|
| 81 |
+
+ }
|
| 82 |
+
+ if outLines[0] != tt.want {
|
| 83 |
+
+ t.Errorf("expected output: %q but got: %q", tt.want, outLines[0])
|
| 84 |
+
}
|
| 85 |
+
})
|
| 86 |
+
}
|
| 87 |
+
diff --git a/k8s/dialer.go b/k8s/dialer.go
|
| 88 |
+
index d11116d3..b2551837 100644
|
| 89 |
+
--- a/k8s/dialer.go
|
| 90 |
+
+++ b/k8s/dialer.go
|
| 91 |
+
@@ -7,7 +7,6 @@ import (
|
| 92 |
+
"fmt"
|
| 93 |
+
"io"
|
| 94 |
+
"net"
|
| 95 |
+
- "os"
|
| 96 |
+
"sync"
|
| 97 |
+
"time"
|
| 98 |
+
|
| 99 |
+
@@ -23,7 +22,7 @@ import (
|
| 100 |
+
"k8s.io/client-go/tools/remotecommand"
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
-var socatImage = "quay.io/boson/alpine-socat:1.7.4.3-r1-non-root"
|
| 104 |
+
+var SocatImage = "quay.io/boson/alpine-socat:1.7.4.3-r1-non-root"
|
| 105 |
+
|
| 106 |
+
// NewInClusterDialer creates context dialer that will dial TCP connections via POD running in k8s cluster.
|
| 107 |
+
// This is useful when accessing k8s services that are not exposed outside cluster (e.g. openshift image registry).
|
| 108 |
+
@@ -129,11 +128,6 @@ func (c *contextDialer) startDialerPod(ctx context.Context) (err error) {
|
| 109 |
+
}
|
| 110 |
+
}()
|
| 111 |
+
|
| 112 |
+
- img := socatImage
|
| 113 |
+
- if i, ok := os.LookupEnv("SOCAT_IMAGE"); ok {
|
| 114 |
+
- img = i
|
| 115 |
+
- }
|
| 116 |
+
-
|
| 117 |
+
pod := &coreV1.Pod{
|
| 118 |
+
ObjectMeta: metaV1.ObjectMeta{
|
| 119 |
+
Name: c.podName,
|
| 120 |
+
@@ -144,7 +138,7 @@ func (c *contextDialer) startDialerPod(ctx context.Context) (err error) {
|
| 121 |
+
Containers: []coreV1.Container{
|
| 122 |
+
{
|
| 123 |
+
Name: c.podName,
|
| 124 |
+
- Image: img,
|
| 125 |
+
+ Image: SocatImage,
|
| 126 |
+
Stdin: true,
|
| 127 |
+
StdinOnce: true,
|
| 128 |
+
Command: []string{"socat", "-u", "-", "OPEN:/dev/null"},
|
tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/post_context.md
ADDED
|
@@ -0,0 +1,1177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context after the fix
|
| 2 |
+
|
| 3 |
+
## `cmd/root.go` (changed lines (12, 365, 366, 367, 368, 369, 370))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package cmd
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"fmt"
|
| 10 |
+
"os"
|
| 11 |
+
"path/filepath"
|
| 12 |
+
"strings"
|
| 13 |
+
"text/template"
|
| 14 |
+
"time"
|
| 15 |
+
|
| 16 |
+
"knative.dev/func/cmd/templates"
|
| 17 |
+
"knative.dev/func/k8s"
|
| 18 |
+
|
| 19 |
+
"github.com/ory/viper"
|
| 20 |
+
"github.com/spf13/cobra"
|
| 21 |
+
"golang.org/x/term"
|
| 22 |
+
"k8s.io/apimachinery/pkg/util/sets"
|
| 23 |
+
"knative.dev/client/pkg/util"
|
| 24 |
+
fn "knative.dev/func"
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
type RootCommandConfig struct {
|
| 28 |
+
Name string // usually `func` or `kn func`
|
| 29 |
+
Version
|
| 30 |
+
NewClient ClientFactory
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
// NewRootCmd creates the root of the command tree defines the command name, description, globally
|
| 34 |
+
// available flags, etc. It has no action of its own, such that running the
|
| 35 |
+
// resultant binary with no arguments prints the help/usage text.
|
| 36 |
+
func NewRootCmd(config RootCommandConfig) *cobra.Command {
|
| 37 |
+
cmd := &cobra.Command{
|
| 38 |
+
// Use must be set to exactly config.Name, as this field is overloaded to
|
| 39 |
+
// be used in subcommand help text as the command with possible prefix:
|
| 40 |
+
Use: config.Name,
|
| 41 |
+
Short: "Serverless functions",
|
| 42 |
+
SilenceErrors: true, // we explicitly handle errors in Execute()
|
| 43 |
+
SilenceUsage: true, // no usage dump on error
|
| 44 |
+
Long: `Knative serverless functions
|
| 45 |
+
|
| 46 |
+
Create, build and deploy Knative functions
|
| 47 |
+
|
| 48 |
+
SYNOPSIS
|
| 49 |
+
{{.Use}} [-v|--verbose] <command> [args]
|
| 50 |
+
|
| 51 |
+
EXAMPLES
|
| 52 |
+
|
| 53 |
+
o Create a Node function in the current directory
|
| 54 |
+
$ {{.Use}} create --language node .
|
| 55 |
+
|
| 56 |
+
o Deploy the function defined in the current working directory to the
|
| 57 |
+
currently connected cluster, specifying a container registry in place of
|
| 58 |
+
quay.io/user for the function's container.
|
| 59 |
+
$ {{.Use}} deploy --registry quay.io.user
|
| 60 |
+
|
| 61 |
+
o Invoke the function defined in the current working directory with an example
|
| 62 |
+
request.
|
| 63 |
+
$ {{.Use}} invoke
|
| 64 |
+
|
| 65 |
+
For more examples, see '{{.Use}} [command] --help'.`,
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
// Environment Variables
|
| 69 |
+
// Evaluated first after static defaults, set all flags to be associated with
|
| 70 |
+
// a version prefixed by "FUNC_"
|
| 71 |
+
viper.AutomaticEnv() // read in environment variables for FUNC_<flag>
|
| 72 |
+
viper.SetEnvPrefix("func") // ensure that all have the prefix
|
| 73 |
+
|
| 74 |
+
// Flags
|
| 75 |
+
// persistent flags are available to all subcommands implicitly
|
| 76 |
+
// Note they are bound immediately here as opposed to other subcommands
|
| 77 |
+
// because this root command is not actually executed during tests, and
|
| 78 |
+
// therefore PreRunE and other event-based listeners are not invoked.
|
| 79 |
+
cmd.PersistentFlags().BoolP("verbose", "v", false, "Print verbose logs ($FUNC_VERBOSE)")
|
| 80 |
+
if err := viper.BindPFlag("verbose", cmd.PersistentFlags().Lookup("verbose")); err != nil {
|
| 81 |
+
fmt.Fprintf(os.Stderr, "error binding flag: %v\n", err)
|
| 82 |
+
}
|
| 83 |
+
cmd.PersistentFlags().StringP("namespace", "n", "", "The namespace on the cluster used for remote commands. By default, the namespace func.yaml is used or the currently active namespace if not set in the configuration. (Env: $FUNC_NAMESPACE)")
|
| 84 |
+
if err := viper.BindPFlag("namespace", cmd.PersistentFlags().Lookup("namespace")); err != nil {
|
| 85 |
+
fmt.Fprintf(os.Stderr, "error binding flag: %v\n", err)
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
// Version
|
| 89 |
+
cmd.Version = config.Version.String()
|
| 90 |
+
cmd.SetVersionTemplate(`{{printf "%s\n" .Version}}`)
|
| 91 |
+
|
| 92 |
+
// Client
|
| 93 |
+
// Use the provided ClientFactory or default to NewClient
|
| 94 |
+
newClient := config.NewClient
|
| 95 |
+
if newClient == nil {
|
| 96 |
+
newClient = NewClient
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
// Grouped commands
|
| 100 |
+
groups := templates.CommandGroups{
|
| 101 |
+
{
|
| 102 |
+
Header: "Main Commands:",
|
| 103 |
+
Commands: []*cobra.Command{
|
| 104 |
+
NewBuildCmd(newClient),
|
| 105 |
+
NewConfigCmd(defaultLoaderSaver),
|
| 106 |
+
NewCreateCmd(newClient),
|
| 107 |
+
NewDeleteCmd(newClient),
|
| 108 |
+
NewDeployCmd(newClient),
|
| 109 |
+
NewInfoCmd(newClient),
|
| 110 |
+
NewInvokeCmd(newClient),
|
| 111 |
+
NewLanguagesCmd(newClient),
|
| 112 |
+
NewListCmd(newClient),
|
| 113 |
+
NewRepositoryCmd(newClient),
|
| 114 |
+
NewRunCmd(newClient),
|
| 115 |
+
NewTemplatesCmd(newClient),
|
| 116 |
+
},
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
Header: "Other Commands:",
|
| 120 |
+
Commands: []*cobra.Command{
|
| 121 |
+
NewCompletionCmd(),
|
| 122 |
+
NewVersionCmd(config.Version),
|
| 123 |
+
},
|
| 124 |
+
},
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
// Add all commands to the root command, and initialize
|
| 128 |
+
groups.AddTo(cmd)
|
| 129 |
+
groups.SetRootUsage(cmd, nil)
|
| 130 |
+
|
| 131 |
+
return cmd
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
// Helpers
|
| 135 |
+
// ------------------------------------------
|
| 136 |
+
|
| 137 |
+
// interactiveTerminal returns whether or not the currently attached process
|
| 138 |
+
// terminal is interactive. Used for determining whether or not to
|
| 139 |
+
// interactively prompt the user to confirm default choices, etc.
|
| 140 |
+
func interactiveTerminal() bool {
|
| 141 |
+
return term.IsTerminal(int(os.Stdin.Fd()))
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
// bindFunc which conforms to the cobra PreRunE method signature
|
| 145 |
+
type bindFunc func(*cobra.Command, []string) error
|
| 146 |
+
|
| 147 |
+
// bindEnv returns a bindFunc that binds env vars to the named flags.
|
| 148 |
+
func bindEnv(flags ...string) bindFunc {
|
| 149 |
+
return func(cmd *cobra.Command, args []string) (err error) {
|
| 150 |
+
for _, flag := range flags {
|
| 151 |
+
if err = viper.BindPFlag(flag, cmd.Flags().Lookup(flag)); err != nil {
|
| 152 |
+
return
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
return
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
// deriveName returns the explicit value (if provided) or attempts to derive
|
| 160 |
+
// from the given path. Path is defaulted to current working directory, where
|
| 161 |
+
// a function configuration, if it exists and contains a name, is used.
|
| 162 |
+
func deriveName(explicitName string, path string) string {
|
| 163 |
+
// If the name was explicitly provided, use it.
|
| 164 |
+
if explicitName != "" {
|
| 165 |
+
return explicitName
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
// If the directory at path contains an initialized function, use the name therein
|
| 169 |
+
f, err := fn.NewFunction(path)
|
| 170 |
+
if err == nil && f.Name != "" {
|
| 171 |
+
return f.Name
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
return ""
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
// deriveNameAndAbsolutePathFromPath returns resolved function name and absolute path
|
| 178 |
+
// to the function project root. The input parameter path could be one of:
|
| 179 |
+
// 'relative/path/to/foo', '/absolute/path/to/foo', 'foo' or ”.
|
| 180 |
+
func deriveNameAndAbsolutePathFromPath(path string) (string, string) {
|
| 181 |
+
var absPath string
|
| 182 |
+
|
| 183 |
+
// If path is not specified, we would like to use current working dir
|
| 184 |
+
if path == "" {
|
| 185 |
+
path = cwd()
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
// Expand the passed function name to its absolute path
|
| 189 |
+
absPath, err := filepath.Abs(path)
|
| 190 |
+
if err != nil {
|
| 191 |
+
return "", ""
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
// Get the name of the function, which equals to name of the current directory
|
| 195 |
+
pathParts := strings.Split(strings.TrimRight(path, string(os.PathSeparator)), string(os.PathSeparator))
|
| 196 |
+
return pathParts[len(pathParts)-1], absPath
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// deriveImage returns the same image name which will be used.
|
| 200 |
+
// I.e. if the explicit name is empty, derive one from the configured registry
|
| 201 |
+
// (registry plus username) and the function's name.
|
| 202 |
+
//
|
| 203 |
+
// This is calculated preemptively here in the CLI (prior to invoking the
|
| 204 |
+
// client), only in order to provide information to the user via the prompt.
|
| 205 |
+
// The client will calculate this same value if the image override is not
|
| 206 |
+
// provided.
|
| 207 |
+
//
|
| 208 |
+
// Derivation logic:
|
| 209 |
+
// deriveImage attempts to arrive at a final, full image name:
|
| 210 |
+
//
|
| 211 |
+
// format: [registry]/[username]/[functionName]:[tag]
|
| 212 |
+
// example: quay.io/myname/my.function.name:tag.
|
| 213 |
+
//
|
| 214 |
+
// Registry can optionally be omitted, in which case DefaultRegistry
|
| 215 |
+
// will be prepended.
|
| 216 |
+
//
|
| 217 |
+
// If the image flag is provided, this value is used directly (the user supplied
|
| 218 |
+
// --image or $FUNC_IMAGE). Otherwise, the function at 'path' is loaded, and
|
| 219 |
+
// the Image name therein is used (i.e. it was previously calculated).
|
| 220 |
+
// Finally, the default registry is used, which is prepended to the function
|
| 221 |
+
// name, and appended with ':latest':
|
| 222 |
+
func deriveImage(explicitImage, defaultRegistry, path string) string {
|
| 223 |
+
if explicitImage != "" {
|
| 224 |
+
return explicitImage // use the explicit value provided.
|
| 225 |
+
}
|
| 226 |
+
f, err := fn.NewFunction(path)
|
| 227 |
+
if err != nil {
|
| 228 |
+
return "" // unable to derive due to load error (uninitialized?)
|
| 229 |
+
}
|
| 230 |
+
if f.Image != "" {
|
| 231 |
+
return f.Image // use value previously provided or derived.
|
| 232 |
+
}
|
| 233 |
+
// Use the func system's derivation logic.
|
| 234 |
+
// Errors deriving result in an empty return
|
| 235 |
+
derivedValue, _ := f.ImageName()
|
| 236 |
+
return derivedValue
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
func envFromCmd(cmd *cobra.Command) (*util.OrderedMap, []string, error) {
|
| 240 |
+
if cmd.Flags().Changed("env") {
|
| 241 |
+
env, err := cmd.Flags().GetStringArray("env")
|
| 242 |
+
if err != nil {
|
| 243 |
+
return nil, []string{}, fmt.Errorf("Invalid --env: %w", err)
|
| 244 |
+
}
|
| 245 |
+
return util.OrderedMapAndRemovalListFromArray(env, "=")
|
| 246 |
+
}
|
| 247 |
+
return util.NewOrderedMap(), []string{}, nil
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
func mergeEnvs(envs []fn.Env, envToUpdate *util.OrderedMap, envToRemove []string) ([]fn.Env, int, error) {
|
| 251 |
+
updated := sets.NewString()
|
| 252 |
+
|
| 253 |
+
var counter int
|
| 254 |
+
|
| 255 |
+
for i := range envs {
|
| 256 |
+
if envs[i].Name != nil {
|
| 257 |
+
value, present := envToUpdate.GetString(*envs[i].Name)
|
| 258 |
+
if present {
|
| 259 |
+
envs[i].Value = &value
|
| 260 |
+
updated.Insert(*envs[i].Name)
|
| 261 |
+
counter++
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
it := envToUpdate.Iterator()
|
| 267 |
+
for name, value, ok := it.NextString(); ok; name, value, ok = it.NextString() {
|
| 268 |
+
if !updated.Has(name) {
|
| 269 |
+
n := name
|
| 270 |
+
v := value
|
| 271 |
+
envs = append(envs, fn.Env{Name: &n, Value: &v})
|
| 272 |
+
counter++
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
for _, name := range envToRemove {
|
| 277 |
+
for i, envVar := range envs {
|
| 278 |
+
if *envVar.Name == name {
|
| 279 |
+
envs = append(envs[:i], envs[i+1:]...)
|
| 280 |
+
counter++
|
| 281 |
+
break
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
errMsg := fn.ValidateEnvs(envs)
|
| 287 |
+
if len(errMsg) > 0 {
|
| 288 |
+
return []fn.Env{}, 0, fmt.Errorf(strings.Join(errMsg, "\n"))
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
return envs, counter, nil
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
// setPathFlag ensures common text/wording when the --path flag is used
|
| 295 |
+
func setPathFlag(cmd *cobra.Command) {
|
| 296 |
+
cmd.Flags().StringP("path", "p", ".", "Path to the project directory (Env: $FUNC_PATH)")
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
// getPathFlag returns the value of the --path flag.
|
| 300 |
+
// The special value '.' is returned as the abolute path to the current
|
| 301 |
+
// working directory.
|
| 302 |
+
func getPathFlag() string {
|
| 303 |
+
path := viper.GetString("path")
|
| 304 |
+
if path == "." {
|
| 305 |
+
path = cwd()
|
| 306 |
+
}
|
| 307 |
+
return path
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
// cwd returns the current working directory or exits 1 printing the error.
|
| 311 |
+
func cwd() (cwd string) {
|
| 312 |
+
cwd, err := os.Getwd()
|
| 313 |
+
if err != nil {
|
| 314 |
+
panic(fmt.Sprintf("Unable to determine current working directory: %v", err))
|
| 315 |
+
}
|
| 316 |
+
return cwd
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
type Version struct {
|
| 320 |
+
// Date of compilation
|
| 321 |
+
Date string
|
| 322 |
+
// Version tag of the git commit, or 'tip' if no tag.
|
| 323 |
+
Vers string
|
| 324 |
+
// Hash of the currently active git commit on build.
|
| 325 |
+
Hash string
|
| 326 |
+
// Verbose printing enabled for the string representation.
|
| 327 |
+
Verbose bool
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
// Return the stringification of the Version struct, which takes into account
|
| 331 |
+
// the verbosity setting.
|
| 332 |
+
func (v Version) String() string {
|
| 333 |
+
if v.Verbose {
|
| 334 |
+
return v.StringVerbose()
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
// Ensure that the value returned is parseable as a semver, with the special
|
| 338 |
+
// value v0.0.0 as the default indicating there is no version information
|
| 339 |
+
// available.
|
| 340 |
+
if strings.HasPrefix(v.Vers, "v") {
|
| 341 |
+
// TODO: this is the naive approach, perhaps consider actually parse it
|
| 342 |
+
// using the semver lib
|
| 343 |
+
return v.Vers
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
// Any non-semver value is invalid, and thus indistinguishable from a
|
| 347 |
+
// nonexistent version value, so the default zero value of v0.0.0 is used.
|
| 348 |
+
return "v0.0.0"
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
// StringVerbose returns the verbose version of the version stringification.
|
| 352 |
+
// The format returned is [semver]-[hash]-[date] where the special value
|
| 353 |
+
// 'v0.0.0' and 'source' are used when version is not available and/or the
|
| 354 |
+
// libray has been built from source, respectively.
|
| 355 |
+
func (v Version) StringVerbose() string {
|
| 356 |
+
var (
|
| 357 |
+
vers = v.Vers
|
| 358 |
+
hash = v.Hash
|
| 359 |
+
date = v.Date
|
| 360 |
+
)
|
| 361 |
+
if vers == "" {
|
| 362 |
+
vers = "v0.0.0"
|
| 363 |
+
}
|
| 364 |
+
if hash == "" {
|
| 365 |
+
hash = "source"
|
| 366 |
+
}
|
| 367 |
+
if date == "" {
|
| 368 |
+
date = time.Now().Format(time.RFC3339)
|
| 369 |
+
}
|
| 370 |
+
funcVersion := fmt.Sprintf("%s-%s-%s", vers, hash, date)
|
| 371 |
+
return fmt.Sprintf("Version: %s\n"+
|
| 372 |
+
"SocatImage: %s\n"+
|
| 373 |
+
"TarImage: %s", funcVersion,
|
| 374 |
+
k8s.SocatImage,
|
| 375 |
+
k8s.TarImage)
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
// surveySelectDefault returns 'value' if defined and exists in 'options'.
|
| 379 |
+
// Otherwise, options[0] is returned if it exists. Empty string otherwise.
|
| 380 |
+
//
|
| 381 |
+
// Usage Example:
|
| 382 |
+
//
|
| 383 |
+
// languages := []string{ "go", "node", "rust" },
|
| 384 |
+
// survey.Select{
|
| 385 |
+
// Options: options,
|
| 386 |
+
// Default: surveySelectDefaut(cfg.Language, languages),
|
| 387 |
+
// }
|
| 388 |
+
//
|
| 389 |
+
// Summary:
|
| 390 |
+
//
|
| 391 |
+
// This protects against an incorrectly initialized survey.Select when the user
|
| 392 |
+
// has provided a nonexistant option (validation is handled elsewhere) or
|
| 393 |
+
// when a value is required but there exists no defaults (no default value on
|
| 394 |
+
// the associated flag).
|
| 395 |
+
//
|
| 396 |
+
// Explanation:
|
| 397 |
+
//
|
| 398 |
+
// The above example chooses the default for the Survey (--confirm) question
|
| 399 |
+
// in a way that works with user-provided flag and environment variable values.
|
| 400 |
+
//
|
| 401 |
+
// `cfg.Language` is the current value set in the config struct, which is
|
| 402 |
+
// populated from (in ascending order of precedence):
|
| 403 |
+
// static flag default, associated environment variable, or command flag.
|
| 404 |
+
// `languages` are the options which are being used by the survey select.
|
| 405 |
+
//
|
| 406 |
+
// This cascade allows for the Survey questions to be properly pre-initialzed
|
| 407 |
+
// with their associated environment variables or flags. For example,
|
| 408 |
+
// A user whose default language is set to 'node' using the global environment
|
| 409 |
+
// variable FUNC_LANGUAGE will have that option pre-selected when running
|
| 410 |
+
// `func create -c`.
|
| 411 |
+
//
|
| 412 |
+
// The 'survey' package expects the value of the Default member to exist
|
| 413 |
+
// in the 'Options' member. This is not possible when user-provided data is
|
| 414 |
+
// allowed for the default, hence this logic is necessary.
|
| 415 |
+
//
|
| 416 |
+
// For example, when the user is using prompts (--confirm) to select from a set
|
| 417 |
+
// of options, but the associated flag either has an unrecognized value, or no
|
| 418 |
+
// value at all, without this logic the resulting select prompt would be
|
| 419 |
+
// initialized with this as the default value, and the act of what appears to
|
| 420 |
+
// be choose the first option displayed does not overwrite the invalid default.
|
| 421 |
+
// It could perhaps be argued this is a shortcoming in the survey package, but
|
| 422 |
+
// it is also clearly an error to provide invalid data for a default.
|
| 423 |
+
func surveySelectDefault(value string, options []string) string {
|
| 424 |
+
for _, v := range options {
|
| 425 |
+
if value == v {
|
| 426 |
+
return v // The provided value is acceptable
|
| 427 |
+
}
|
| 428 |
+
}
|
| 429 |
+
if len(options) > 0 {
|
| 430 |
+
return options[0] // Sync with the option which will be shown by the UX
|
| 431 |
+
}
|
| 432 |
+
// Either the value is not an option or there are no options. Either of
|
| 433 |
+
// which should fail proper validation
|
| 434 |
+
return ""
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
// defaultTemplatedHelp evaluates the given command's help text as a template
|
| 438 |
+
// some commands define their own help command when additional values are
|
| 439 |
+
// required beyond these basics.
|
| 440 |
+
func defaultTemplatedHelp(cmd *cobra.Command, args []string) {
|
| 441 |
+
var (
|
| 442 |
+
body = cmd.Long + "\n\n" + cmd.UsageString()
|
| 443 |
+
t = template.New("help")
|
| 444 |
+
tpl = template.Must(t.Parse(body))
|
| 445 |
+
)
|
| 446 |
+
var data = struct{ Name string }{Name: cmd.Root().Use}
|
| 447 |
+
|
| 448 |
+
if err := tpl.Execute(cmd.OutOrStdout(), data); err != nil {
|
| 449 |
+
fmt.Fprintf(cmd.ErrOrStderr(), "unable to display help text: %v", err)
|
| 450 |
+
}
|
| 451 |
+
}
|
| 452 |
+
```
|
| 453 |
+
|
| 454 |
+
## `cmd/root_test.go` (changed lines (212, 213, 214, 215, 218, 219, 220, 221, 224, 225, 226, 227, 230, 231, 232, 233, 256, 257, 258, 259, 260, 261))
|
| 455 |
+
|
| 456 |
+
```go
|
| 457 |
+
package cmd
|
| 458 |
+
|
| 459 |
+
import (
|
| 460 |
+
"bytes"
|
| 461 |
+
"fmt"
|
| 462 |
+
"io"
|
| 463 |
+
"os"
|
| 464 |
+
"reflect"
|
| 465 |
+
"strings"
|
| 466 |
+
"testing"
|
| 467 |
+
|
| 468 |
+
"github.com/ory/viper"
|
| 469 |
+
"knative.dev/client/pkg/util"
|
| 470 |
+
|
| 471 |
+
fn "knative.dev/func"
|
| 472 |
+
. "knative.dev/func/testing"
|
| 473 |
+
)
|
| 474 |
+
|
| 475 |
+
func TestRoot_PersistentFlags(t *testing.T) {
|
| 476 |
+
tests := []struct {
|
| 477 |
+
name string
|
| 478 |
+
args []string
|
| 479 |
+
skipNamespace bool
|
| 480 |
+
}{
|
| 481 |
+
{
|
| 482 |
+
name: "provided as root flags",
|
| 483 |
+
args: []string{"--verbose", "--namespace=namespace", "list"},
|
| 484 |
+
},
|
| 485 |
+
{
|
| 486 |
+
name: "provided as sub-command flags",
|
| 487 |
+
args: []string{"list", "--verbose", "--namespace=namespace"},
|
| 488 |
+
},
|
| 489 |
+
{
|
| 490 |
+
name: "provided as sub-sub-command flags",
|
| 491 |
+
args: []string{"repositories", "list", "--verbose"},
|
| 492 |
+
skipNamespace: true, // NOTE: no sub-sub commands yet use namespace, so it is not checked.
|
| 493 |
+
},
|
| 494 |
+
}
|
| 495 |
+
|
| 496 |
+
for _, tt := range tests {
|
| 497 |
+
t.Run(tt.name, func(t *testing.T) {
|
| 498 |
+
_ = fromTempDirectory(t)
|
| 499 |
+
|
| 500 |
+
cmd := NewCreateCmd(NewClient) // Create a function
|
| 501 |
+
cmd.SetArgs([]string{"--language", "go", "myfunc"}) // providing language
|
| 502 |
+
if err := cmd.Execute(); err != nil { // fail on any errors
|
| 503 |
+
t.Fatal(err)
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
// Assert the persistent variables were propagated to the Client constructor
|
| 507 |
+
// when the command is actually invoked.
|
| 508 |
+
cmd = NewRootCmd(RootCommandConfig{NewClient: func(cfg ClientConfig, _ ...fn.Option) (*fn.Client, func()) {
|
| 509 |
+
if cfg.Namespace != "namespace" && !tt.skipNamespace {
|
| 510 |
+
t.Fatal("namespace not propagated")
|
| 511 |
+
}
|
| 512 |
+
if cfg.Verbose != true {
|
| 513 |
+
t.Fatal("verbose not propagated")
|
| 514 |
+
}
|
| 515 |
+
return fn.New(), func() {}
|
| 516 |
+
}})
|
| 517 |
+
cmd.SetArgs(tt.args)
|
| 518 |
+
if err := cmd.Execute(); err != nil {
|
| 519 |
+
t.Fatal(err)
|
| 520 |
+
}
|
| 521 |
+
})
|
| 522 |
+
}
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
func TestRoot_mergeEnvMaps(t *testing.T) {
|
| 526 |
+
|
| 527 |
+
a := "A"
|
| 528 |
+
b := "B"
|
| 529 |
+
v1 := "x"
|
| 530 |
+
v2 := "y"
|
| 531 |
+
|
| 532 |
+
type args struct {
|
| 533 |
+
envs []fn.Env
|
| 534 |
+
toUpdate *util.OrderedMap
|
| 535 |
+
toRemove []string
|
| 536 |
+
}
|
| 537 |
+
tests := []struct {
|
| 538 |
+
name string
|
| 539 |
+
args args
|
| 540 |
+
want []fn.Env
|
| 541 |
+
}{
|
| 542 |
+
{
|
| 543 |
+
"add new var to empty list",
|
| 544 |
+
args{
|
| 545 |
+
[]fn.Env{},
|
| 546 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v1}}),
|
| 547 |
+
[]string{},
|
| 548 |
+
},
|
| 549 |
+
[]fn.Env{{Name: &a, Value: &v1}},
|
| 550 |
+
},
|
| 551 |
+
{
|
| 552 |
+
"add new var",
|
| 553 |
+
args{
|
| 554 |
+
[]fn.Env{{Name: &b, Value: &v2}},
|
| 555 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v1}}),
|
| 556 |
+
[]string{},
|
| 557 |
+
},
|
| 558 |
+
[]fn.Env{{Name: &b, Value: &v2}, {Name: &a, Value: &v1}},
|
| 559 |
+
},
|
| 560 |
+
{
|
| 561 |
+
"update var",
|
| 562 |
+
args{
|
| 563 |
+
[]fn.Env{{Name: &a, Value: &v1}},
|
| 564 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v2}}),
|
| 565 |
+
[]string{},
|
| 566 |
+
},
|
| 567 |
+
[]fn.Env{{Name: &a, Value: &v2}},
|
| 568 |
+
},
|
| 569 |
+
{
|
| 570 |
+
"update multiple vars",
|
| 571 |
+
args{
|
| 572 |
+
[]fn.Env{{Name: &a, Value: &v1}, {Name: &b, Value: &v2}},
|
| 573 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v2}, {b, v1}}),
|
| 574 |
+
[]string{},
|
| 575 |
+
},
|
| 576 |
+
[]fn.Env{{Name: &a, Value: &v2}, {Name: &b, Value: &v1}},
|
| 577 |
+
},
|
| 578 |
+
{
|
| 579 |
+
"remove var",
|
| 580 |
+
args{
|
| 581 |
+
[]fn.Env{{Name: &a, Value: &v1}},
|
| 582 |
+
util.NewOrderedMap(),
|
| 583 |
+
[]string{a},
|
| 584 |
+
},
|
| 585 |
+
[]fn.Env{},
|
| 586 |
+
},
|
| 587 |
+
{
|
| 588 |
+
"remove multiple vars",
|
| 589 |
+
args{
|
| 590 |
+
[]fn.Env{{Name: &a, Value: &v1}, {Name: &b, Value: &v2}},
|
| 591 |
+
util.NewOrderedMap(),
|
| 592 |
+
[]string{a, b},
|
| 593 |
+
},
|
| 594 |
+
[]fn.Env{},
|
| 595 |
+
},
|
| 596 |
+
{
|
| 597 |
+
"update and remove vars",
|
| 598 |
+
args{
|
| 599 |
+
[]fn.Env{{Name: &a, Value: &v1}, {Name: &b, Value: &v2}},
|
| 600 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v2}}),
|
| 601 |
+
[]string{b},
|
| 602 |
+
},
|
| 603 |
+
[]fn.Env{{Name: &a, Value: &v2}},
|
| 604 |
+
},
|
| 605 |
+
}
|
| 606 |
+
for _, tt := range tests {
|
| 607 |
+
t.Run(tt.name, func(t *testing.T) {
|
| 608 |
+
got, _, err := mergeEnvs(tt.args.envs, tt.args.toUpdate, tt.args.toRemove)
|
| 609 |
+
if err != nil {
|
| 610 |
+
t.Errorf("mergeEnvs() for initial vars %v and toUpdate %v and toRemove %v got error %v",
|
| 611 |
+
tt.args.envs, tt.args.toUpdate, tt.args.toRemove, err)
|
| 612 |
+
}
|
| 613 |
+
if !reflect.DeepEqual(got, tt.want) {
|
| 614 |
+
|
| 615 |
+
gotString := "{ "
|
| 616 |
+
for _, e := range got {
|
| 617 |
+
gotString += fmt.Sprintf("{ %s: %s } ", *e.Name, *e.Value)
|
| 618 |
+
}
|
| 619 |
+
gotString += "}"
|
| 620 |
+
|
| 621 |
+
wantString := "{ "
|
| 622 |
+
for _, e := range tt.want {
|
| 623 |
+
wantString += fmt.Sprintf("{ %s: %s } ", *e.Name, *e.Value)
|
| 624 |
+
}
|
| 625 |
+
wantString += "}"
|
| 626 |
+
|
| 627 |
+
t.Errorf("mergeEnvs() = got: %s, want %s", gotString, wantString)
|
| 628 |
+
}
|
| 629 |
+
})
|
| 630 |
+
}
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
// TestRoot_CommandNameParameterized confirmst that the command name, as
|
| 634 |
+
// printed in help text, is parameterized based on the constructor parameters
|
| 635 |
+
// of the root command. This allows, for example, to have help text correct
|
| 636 |
+
// when both embedded as a plugin or standalone.
|
| 637 |
+
func TestRoot_CommandNameParameterized(t *testing.T) {
|
| 638 |
+
expectedSynopsis := "%v [-v|--verbose] <command> [args]"
|
| 639 |
+
|
| 640 |
+
tests := []string{
|
| 641 |
+
"func", // standalone
|
| 642 |
+
"kn func", // kn plugin
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
for _, testName := range tests {
|
| 646 |
+
var (
|
| 647 |
+
cmd = NewRootCmd(RootCommandConfig{Name: testName})
|
| 648 |
+
out = strings.Builder{}
|
| 649 |
+
)
|
| 650 |
+
cmd.SetArgs([]string{}) // Do not use test command args
|
| 651 |
+
cmd.SetOut(&out)
|
| 652 |
+
if err := cmd.Help(); err != nil {
|
| 653 |
+
t.Fatal(err)
|
| 654 |
+
}
|
| 655 |
+
if cmd.Use != testName {
|
| 656 |
+
t.Fatalf("expected command Use '%v', got '%v'", testName, cmd.Use)
|
| 657 |
+
}
|
| 658 |
+
if !strings.Contains(out.String(), fmt.Sprintf(expectedSynopsis, testName)) {
|
| 659 |
+
t.Logf("Testing '%v'\n", testName)
|
| 660 |
+
t.Log(out.String())
|
| 661 |
+
t.Fatalf("Help text does not include substituted name '%v'", testName)
|
| 662 |
+
}
|
| 663 |
+
}
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
func TestVerbose(t *testing.T) {
|
| 667 |
+
tests := []struct {
|
| 668 |
+
name string
|
| 669 |
+
args []string
|
| 670 |
+
want string
|
| 671 |
+
wantLF int
|
| 672 |
+
}{
|
| 673 |
+
{
|
| 674 |
+
name: "verbose as version's flag",
|
| 675 |
+
args: []string{"version", "-v"},
|
| 676 |
+
want: "Version: v0.42.0-cafe-1970-01-01",
|
| 677 |
+
wantLF: 3,
|
| 678 |
+
},
|
| 679 |
+
{
|
| 680 |
+
name: "no verbose",
|
| 681 |
+
args: []string{"version"},
|
| 682 |
+
want: "v0.42.0",
|
| 683 |
+
wantLF: 1,
|
| 684 |
+
},
|
| 685 |
+
{
|
| 686 |
+
name: "verbose as root's flag",
|
| 687 |
+
args: []string{"--verbose", "version"},
|
| 688 |
+
want: "Version: v0.42.0-cafe-1970-01-01",
|
| 689 |
+
wantLF: 3,
|
| 690 |
+
},
|
| 691 |
+
}
|
| 692 |
+
for _, tt := range tests {
|
| 693 |
+
t.Run(tt.name, func(t *testing.T) {
|
| 694 |
+
viper.Reset()
|
| 695 |
+
|
| 696 |
+
var out bytes.Buffer
|
| 697 |
+
|
| 698 |
+
cmd := NewRootCmd(RootCommandConfig{
|
| 699 |
+
Name: "func",
|
| 700 |
+
Version: Version{
|
| 701 |
+
Date: "1970-01-01",
|
| 702 |
+
Vers: "v0.42.0",
|
| 703 |
+
Hash: "cafe",
|
| 704 |
+
}})
|
| 705 |
+
|
| 706 |
+
cmd.SetArgs(tt.args)
|
| 707 |
+
cmd.SetOut(&out)
|
| 708 |
+
if err := cmd.Execute(); err != nil {
|
| 709 |
+
t.Fatal(err)
|
| 710 |
+
}
|
| 711 |
+
|
| 712 |
+
outLines := strings.Split(out.String(), "\n")
|
| 713 |
+
if len(outLines)-1 != tt.wantLF {
|
| 714 |
+
t.Errorf("expected output with %v line breaks but got %v:", tt.wantLF, len(outLines)-1)
|
| 715 |
+
}
|
| 716 |
+
if outLines[0] != tt.want {
|
| 717 |
+
t.Errorf("expected output: %q but got: %q", tt.want, outLines[0])
|
| 718 |
+
}
|
| 719 |
+
})
|
| 720 |
+
}
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
// Helpers
|
| 724 |
+
// -------
|
| 725 |
+
|
| 726 |
+
// pipe the output of stdout to a buffer whose value is returned
|
| 727 |
+
// from the returned function. Call pipe() to start piping output
|
| 728 |
+
// to the buffer, call the returned function to access the data in
|
| 729 |
+
// the buffer.
|
| 730 |
+
func piped(t *testing.T) func() string {
|
| 731 |
+
t.Helper()
|
| 732 |
+
var (
|
| 733 |
+
o = os.Stdout
|
| 734 |
+
c = make(chan error, 1)
|
| 735 |
+
b strings.Builder
|
| 736 |
+
)
|
| 737 |
+
|
| 738 |
+
r, w, err := os.Pipe()
|
| 739 |
+
if err != nil {
|
| 740 |
+
t.Fatal(err)
|
| 741 |
+
}
|
| 742 |
+
|
| 743 |
+
os.Stdout = w
|
| 744 |
+
|
| 745 |
+
go func() {
|
| 746 |
+
_, err := io.Copy(&b, r)
|
| 747 |
+
r.Close()
|
| 748 |
+
c <- err
|
| 749 |
+
}()
|
| 750 |
+
|
| 751 |
+
return func() string {
|
| 752 |
+
os.Stdout = o
|
| 753 |
+
w.Close()
|
| 754 |
+
err := <-c
|
| 755 |
+
if err != nil {
|
| 756 |
+
t.Fatal(err)
|
| 757 |
+
}
|
| 758 |
+
return strings.TrimSpace(b.String())
|
| 759 |
+
}
|
| 760 |
+
}
|
| 761 |
+
|
| 762 |
+
// fromTempDirectory is a cli-specific test helper which
|
| 763 |
+
// - creates a temp directory and changes to it as the new working directory
|
| 764 |
+
// - creates a temp directory and uses it for XDG_CONFIG_HOME
|
| 765 |
+
// - removes temp directories on cleanup
|
| 766 |
+
// - resets viper on cleanup (the reason this is "cli-specific")
|
| 767 |
+
func fromTempDirectory(t *testing.T) string {
|
| 768 |
+
t.Helper()
|
| 769 |
+
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
| 770 |
+
d, done := Mktemp(t) // creates and CDs to 'tmp'
|
| 771 |
+
t.Cleanup(func() { done(); viper.Reset() })
|
| 772 |
+
return d
|
| 773 |
+
}
|
| 774 |
+
```
|
| 775 |
+
|
| 776 |
+
## `k8s/dialer.go` (changed lines (10, 25, 131, 141))
|
| 777 |
+
|
| 778 |
+
```go
|
| 779 |
+
package k8s
|
| 780 |
+
|
| 781 |
+
import (
|
| 782 |
+
"bytes"
|
| 783 |
+
"context"
|
| 784 |
+
"errors"
|
| 785 |
+
"fmt"
|
| 786 |
+
"io"
|
| 787 |
+
"net"
|
| 788 |
+
"sync"
|
| 789 |
+
"time"
|
| 790 |
+
|
| 791 |
+
coreV1 "k8s.io/api/core/v1"
|
| 792 |
+
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 793 |
+
"k8s.io/apimachinery/pkg/fields"
|
| 794 |
+
"k8s.io/apimachinery/pkg/util/rand"
|
| 795 |
+
"k8s.io/apimachinery/pkg/watch"
|
| 796 |
+
"k8s.io/client-go/kubernetes"
|
| 797 |
+
"k8s.io/client-go/kubernetes/scheme"
|
| 798 |
+
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
| 799 |
+
restclient "k8s.io/client-go/rest"
|
| 800 |
+
"k8s.io/client-go/tools/remotecommand"
|
| 801 |
+
)
|
| 802 |
+
|
| 803 |
+
var SocatImage = "quay.io/boson/alpine-socat:1.7.4.3-r1-non-root"
|
| 804 |
+
|
| 805 |
+
// NewInClusterDialer creates context dialer that will dial TCP connections via POD running in k8s cluster.
|
| 806 |
+
// This is useful when accessing k8s services that are not exposed outside cluster (e.g. openshift image registry).
|
| 807 |
+
//
|
| 808 |
+
// Usage:
|
| 809 |
+
//
|
| 810 |
+
// dialer, err := k8s.NewInClusterDialer(ctx)
|
| 811 |
+
// if err != nil {
|
| 812 |
+
// return err
|
| 813 |
+
// }
|
| 814 |
+
// defer dialer.Close()
|
| 815 |
+
//
|
| 816 |
+
// transport := &http.Transport{
|
| 817 |
+
// DialContext: dialer.DialContext,
|
| 818 |
+
// }
|
| 819 |
+
//
|
| 820 |
+
// var client = http.Client{
|
| 821 |
+
// Transport: transport,
|
| 822 |
+
// }
|
| 823 |
+
func NewInClusterDialer(ctx context.Context) (*contextDialer, error) {
|
| 824 |
+
c := &contextDialer{
|
| 825 |
+
detachChan: make(chan struct{}),
|
| 826 |
+
}
|
| 827 |
+
err := c.startDialerPod(ctx)
|
| 828 |
+
if err != nil {
|
| 829 |
+
return nil, err
|
| 830 |
+
}
|
| 831 |
+
return c, nil
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
type contextDialer struct {
|
| 835 |
+
coreV1 v1.CoreV1Interface
|
| 836 |
+
restConf *restclient.Config
|
| 837 |
+
podName string
|
| 838 |
+
namespace string
|
| 839 |
+
detachChan chan struct{}
|
| 840 |
+
}
|
| 841 |
+
|
| 842 |
+
func (c *contextDialer) DialContext(ctx context.Context, network string, addr string) (net.Conn, error) {
|
| 843 |
+
if !(network == "tcp" || network == "tcp4" || network == "tcp6") {
|
| 844 |
+
return nil, fmt.Errorf("unsupported network: %q", network)
|
| 845 |
+
}
|
| 846 |
+
|
| 847 |
+
execDone := make(chan struct{})
|
| 848 |
+
pr, pw, conn := newConn(execDone)
|
| 849 |
+
|
| 850 |
+
go func() {
|
| 851 |
+
defer close(execDone)
|
| 852 |
+
errOut := bytes.NewBuffer(nil)
|
| 853 |
+
err := c.exec(addr, pr, pw, errOut)
|
| 854 |
+
if err != nil {
|
| 855 |
+
err = fmt.Errorf("failed to exec in pod: %w (stderr: %q)", err, errOut.String())
|
| 856 |
+
_ = pr.CloseWithError(err)
|
| 857 |
+
_ = pw.CloseWithError(err)
|
| 858 |
+
}
|
| 859 |
+
}()
|
| 860 |
+
|
| 861 |
+
return conn, nil
|
| 862 |
+
}
|
| 863 |
+
|
| 864 |
+
func (c *contextDialer) Close() error {
|
| 865 |
+
// closing the channel will cause stdin of the attached container to return EOF
|
| 866 |
+
// as a result the pod exits -- it transits to Completed state
|
| 867 |
+
close(c.detachChan)
|
| 868 |
+
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*1)
|
| 869 |
+
defer cancel()
|
| 870 |
+
delOpts := metaV1.DeleteOptions{}
|
| 871 |
+
|
| 872 |
+
return c.coreV1.Pods(c.namespace).Delete(ctx, c.podName, delOpts)
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
func (c *contextDialer) startDialerPod(ctx context.Context) (err error) {
|
| 876 |
+
cliConf := GetClientConfig()
|
| 877 |
+
c.restConf, err = cliConf.ClientConfig()
|
| 878 |
+
if err != nil {
|
| 879 |
+
return
|
| 880 |
+
}
|
| 881 |
+
c.restConf.WarningHandler = restclient.NoWarnings{}
|
| 882 |
+
|
| 883 |
+
err = setConfigDefaults(c.restConf)
|
| 884 |
+
if err != nil {
|
| 885 |
+
return
|
| 886 |
+
}
|
| 887 |
+
|
| 888 |
+
client, err := kubernetes.NewForConfig(c.restConf)
|
| 889 |
+
if err != nil {
|
| 890 |
+
return
|
| 891 |
+
}
|
| 892 |
+
c.coreV1 = client.CoreV1()
|
| 893 |
+
|
| 894 |
+
c.namespace, err = GetNamespace("")
|
| 895 |
+
if err != nil {
|
| 896 |
+
return
|
| 897 |
+
}
|
| 898 |
+
|
| 899 |
+
pods := client.CoreV1().Pods(c.namespace)
|
| 900 |
+
|
| 901 |
+
c.podName = "in-cluster-dialer-" + rand.String(5)
|
| 902 |
+
|
| 903 |
+
defer func() {
|
| 904 |
+
if err != nil {
|
| 905 |
+
c.Close()
|
| 906 |
+
}
|
| 907 |
+
}()
|
| 908 |
+
|
| 909 |
+
pod := &coreV1.Pod{
|
| 910 |
+
ObjectMeta: metaV1.ObjectMeta{
|
| 911 |
+
Name: c.podName,
|
| 912 |
+
Labels: nil,
|
| 913 |
+
Annotations: nil,
|
| 914 |
+
},
|
| 915 |
+
Spec: coreV1.PodSpec{
|
| 916 |
+
Containers: []coreV1.Container{
|
| 917 |
+
{
|
| 918 |
+
Name: c.podName,
|
| 919 |
+
Image: SocatImage,
|
| 920 |
+
Stdin: true,
|
| 921 |
+
StdinOnce: true,
|
| 922 |
+
Command: []string{"socat", "-u", "-", "OPEN:/dev/null"},
|
| 923 |
+
SecurityContext: defaultSecurityContext(),
|
| 924 |
+
},
|
| 925 |
+
},
|
| 926 |
+
DNSPolicy: coreV1.DNSClusterFirst,
|
| 927 |
+
RestartPolicy: coreV1.RestartPolicyNever,
|
| 928 |
+
},
|
| 929 |
+
}
|
| 930 |
+
creatOpts := metaV1.CreateOptions{}
|
| 931 |
+
|
| 932 |
+
ready := podReady(ctx, c.coreV1, c.podName, c.namespace)
|
| 933 |
+
|
| 934 |
+
_, err = pods.Create(ctx, pod, creatOpts)
|
| 935 |
+
if err != nil {
|
| 936 |
+
return
|
| 937 |
+
}
|
| 938 |
+
|
| 939 |
+
select {
|
| 940 |
+
case err = <-ready:
|
| 941 |
+
case <-ctx.Done():
|
| 942 |
+
err = ctx.Err()
|
| 943 |
+
case <-time.After(time.Minute * 1):
|
| 944 |
+
err = errors.New("timeout")
|
| 945 |
+
}
|
| 946 |
+
|
| 947 |
+
if err != nil {
|
| 948 |
+
return fmt.Errorf("failed to start dialer container: %w", err)
|
| 949 |
+
}
|
| 950 |
+
|
| 951 |
+
// attaching to the stdin to automatically Complete the pod on exit
|
| 952 |
+
go func() {
|
| 953 |
+
_ = attach(c.coreV1.RESTClient(), c.restConf, c.podName, c.namespace, emptyBlockingReader(c.detachChan), io.Discard, io.Discard)
|
| 954 |
+
}()
|
| 955 |
+
|
| 956 |
+
return nil
|
| 957 |
+
}
|
| 958 |
+
|
| 959 |
+
// reader that returns no data and blocks until
|
| 960 |
+
// the channel is closed or data are sent to the channel
|
| 961 |
+
type emptyBlockingReader chan struct{}
|
| 962 |
+
|
| 963 |
+
func (e emptyBlockingReader) Read(p []byte) (n int, err error) {
|
| 964 |
+
<-e
|
| 965 |
+
return 0, io.EOF
|
| 966 |
+
}
|
| 967 |
+
|
| 968 |
+
func (c *contextDialer) exec(hostPort string, in io.Reader, out, errOut io.Writer) error {
|
| 969 |
+
|
| 970 |
+
restClient := c.coreV1.RESTClient()
|
| 971 |
+
req := restClient.Post().
|
| 972 |
+
Resource("pods").
|
| 973 |
+
Name(c.podName).
|
| 974 |
+
Namespace(c.namespace).
|
| 975 |
+
SubResource("exec")
|
| 976 |
+
req.VersionedParams(&coreV1.PodExecOptions{
|
| 977 |
+
Command: []string{"socat", "-", fmt.Sprintf("TCP:%s", hostPort)},
|
| 978 |
+
Container: c.podName,
|
| 979 |
+
Stdin: true,
|
| 980 |
+
Stdout: true,
|
| 981 |
+
Stderr: true,
|
| 982 |
+
TTY: false,
|
| 983 |
+
}, scheme.ParameterCodec)
|
| 984 |
+
|
| 985 |
+
executor, err := remotecommand.NewSPDYExecutor(c.restConf, "POST", req.URL())
|
| 986 |
+
if err != nil {
|
| 987 |
+
return err
|
| 988 |
+
}
|
| 989 |
+
|
| 990 |
+
return executor.Stream(remotecommand.StreamOptions{
|
| 991 |
+
Stdin: in,
|
| 992 |
+
Stdout: out,
|
| 993 |
+
Stderr: errOut,
|
| 994 |
+
Tty: false,
|
| 995 |
+
})
|
| 996 |
+
}
|
| 997 |
+
|
| 998 |
+
func attach(restClient restclient.Interface, restConf *restclient.Config, podName, namespace string, in io.Reader, out, errOut io.Writer) error {
|
| 999 |
+
req := restClient.Post().
|
| 1000 |
+
Resource("pods").
|
| 1001 |
+
Name(podName).
|
| 1002 |
+
Namespace(namespace).
|
| 1003 |
+
SubResource("attach")
|
| 1004 |
+
req.VersionedParams(&coreV1.PodAttachOptions{
|
| 1005 |
+
Container: podName,
|
| 1006 |
+
Stdin: true,
|
| 1007 |
+
Stdout: true,
|
| 1008 |
+
Stderr: true,
|
| 1009 |
+
TTY: false,
|
| 1010 |
+
}, scheme.ParameterCodec)
|
| 1011 |
+
|
| 1012 |
+
executor, err := remotecommand.NewSPDYExecutor(restConf, "POST", req.URL())
|
| 1013 |
+
if err != nil {
|
| 1014 |
+
return err
|
| 1015 |
+
}
|
| 1016 |
+
|
| 1017 |
+
return executor.Stream(remotecommand.StreamOptions{
|
| 1018 |
+
Stdin: in,
|
| 1019 |
+
Stdout: out,
|
| 1020 |
+
Stderr: errOut,
|
| 1021 |
+
Tty: false,
|
| 1022 |
+
})
|
| 1023 |
+
}
|
| 1024 |
+
|
| 1025 |
+
func podReady(ctx context.Context, core v1.CoreV1Interface, podName, namespace string) (errChan <-chan error) {
|
| 1026 |
+
d := make(chan error)
|
| 1027 |
+
errChan = d
|
| 1028 |
+
|
| 1029 |
+
pods := core.Pods(namespace)
|
| 1030 |
+
|
| 1031 |
+
nameSelector := fields.OneTermEqualSelector("metadata.name", podName).String()
|
| 1032 |
+
listOpts := metaV1.ListOptions{
|
| 1033 |
+
Watch: true,
|
| 1034 |
+
FieldSelector: nameSelector,
|
| 1035 |
+
}
|
| 1036 |
+
watcher, err := pods.Watch(ctx, listOpts)
|
| 1037 |
+
if err != nil {
|
| 1038 |
+
return
|
| 1039 |
+
}
|
| 1040 |
+
|
| 1041 |
+
go func() {
|
| 1042 |
+
defer watcher.Stop()
|
| 1043 |
+
ch := watcher.ResultChan()
|
| 1044 |
+
for event := range ch {
|
| 1045 |
+
pod, ok := event.Object.(*coreV1.Pod)
|
| 1046 |
+
if !ok {
|
| 1047 |
+
continue
|
| 1048 |
+
}
|
| 1049 |
+
|
| 1050 |
+
if event.Type == watch.Modified {
|
| 1051 |
+
for _, status := range pod.Status.ContainerStatuses {
|
| 1052 |
+
if status.Ready {
|
| 1053 |
+
d <- nil
|
| 1054 |
+
return
|
| 1055 |
+
}
|
| 1056 |
+
if status.State.Waiting != nil {
|
| 1057 |
+
switch status.State.Waiting.Reason {
|
| 1058 |
+
case "ErrImagePull",
|
| 1059 |
+
"CreateContainerError",
|
| 1060 |
+
"CreateContainerConfigError",
|
| 1061 |
+
"InvalidImageName",
|
| 1062 |
+
"CrashLoopBackOff",
|
| 1063 |
+
"ImagePullBackOff":
|
| 1064 |
+
d <- fmt.Errorf("reason: %v, message: %v",
|
| 1065 |
+
status.State.Waiting.Reason,
|
| 1066 |
+
status.State.Waiting.Message)
|
| 1067 |
+
return
|
| 1068 |
+
default:
|
| 1069 |
+
continue
|
| 1070 |
+
}
|
| 1071 |
+
}
|
| 1072 |
+
}
|
| 1073 |
+
}
|
| 1074 |
+
}
|
| 1075 |
+
}()
|
| 1076 |
+
|
| 1077 |
+
return
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
+
func setConfigDefaults(config *restclient.Config) error {
|
| 1081 |
+
gv := coreV1.SchemeGroupVersion
|
| 1082 |
+
config.GroupVersion = &gv
|
| 1083 |
+
config.APIPath = "/api"
|
| 1084 |
+
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
| 1085 |
+
|
| 1086 |
+
if config.UserAgent == "" {
|
| 1087 |
+
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
| 1088 |
+
}
|
| 1089 |
+
|
| 1090 |
+
return nil
|
| 1091 |
+
}
|
| 1092 |
+
|
| 1093 |
+
type addr struct{}
|
| 1094 |
+
|
| 1095 |
+
func (a addr) Network() string {
|
| 1096 |
+
return "pod-stdio"
|
| 1097 |
+
}
|
| 1098 |
+
|
| 1099 |
+
func (a addr) String() string {
|
| 1100 |
+
return "pod-stdio"
|
| 1101 |
+
}
|
| 1102 |
+
|
| 1103 |
+
type conn struct {
|
| 1104 |
+
pr *io.PipeReader
|
| 1105 |
+
pw *io.PipeWriter
|
| 1106 |
+
execDone <-chan struct{}
|
| 1107 |
+
}
|
| 1108 |
+
|
| 1109 |
+
func (c conn) Read(b []byte) (n int, err error) {
|
| 1110 |
+
return c.pr.Read(b)
|
| 1111 |
+
}
|
| 1112 |
+
|
| 1113 |
+
func (c conn) Write(b []byte) (n int, err error) {
|
| 1114 |
+
return c.pw.Write(b)
|
| 1115 |
+
}
|
| 1116 |
+
|
| 1117 |
+
func (c conn) Close() error {
|
| 1118 |
+
err := c.pw.Close()
|
| 1119 |
+
if err != nil {
|
| 1120 |
+
return fmt.Errorf("failed to close writer: %w", err)
|
| 1121 |
+
}
|
| 1122 |
+
<-c.execDone
|
| 1123 |
+
err = c.pr.Close()
|
| 1124 |
+
if err != nil {
|
| 1125 |
+
return fmt.Errorf("failed to close reader: %w", err)
|
| 1126 |
+
}
|
| 1127 |
+
return nil
|
| 1128 |
+
}
|
| 1129 |
+
|
| 1130 |
+
func (c conn) LocalAddr() net.Addr {
|
| 1131 |
+
return addr{}
|
| 1132 |
+
}
|
| 1133 |
+
|
| 1134 |
+
func (c conn) RemoteAddr() net.Addr {
|
| 1135 |
+
return addr{}
|
| 1136 |
+
}
|
| 1137 |
+
|
| 1138 |
+
func (c conn) SetDeadline(t time.Time) error { return nil }
|
| 1139 |
+
|
| 1140 |
+
func (c conn) SetReadDeadline(t time.Time) error { return nil }
|
| 1141 |
+
|
| 1142 |
+
func (c conn) SetWriteDeadline(t time.Time) error { return nil }
|
| 1143 |
+
|
| 1144 |
+
func newConn(execDone <-chan struct{}) (*io.PipeReader, *io.PipeWriter, conn) {
|
| 1145 |
+
pr0, pw0 := io.Pipe()
|
| 1146 |
+
pr1, pw1 := io.Pipe()
|
| 1147 |
+
rwc := conn{pr: pr0, pw: pw1, execDone: execDone}
|
| 1148 |
+
return pr1, pw0, rwc
|
| 1149 |
+
}
|
| 1150 |
+
|
| 1151 |
+
func NewLazyInitInClusterDialer() *lazyInitInClusterDialer {
|
| 1152 |
+
return &lazyInitInClusterDialer{}
|
| 1153 |
+
}
|
| 1154 |
+
|
| 1155 |
+
type lazyInitInClusterDialer struct {
|
| 1156 |
+
contextDialer *contextDialer
|
| 1157 |
+
initErr error
|
| 1158 |
+
o sync.Once
|
| 1159 |
+
}
|
| 1160 |
+
|
| 1161 |
+
func (l *lazyInitInClusterDialer) DialContext(ctx context.Context, network string, addr string) (net.Conn, error) {
|
| 1162 |
+
l.o.Do(func() {
|
| 1163 |
+
l.contextDialer, l.initErr = NewInClusterDialer(ctx)
|
| 1164 |
+
})
|
| 1165 |
+
if l.initErr != nil {
|
| 1166 |
+
return nil, l.initErr
|
| 1167 |
+
}
|
| 1168 |
+
return l.contextDialer.DialContext(ctx, network, addr)
|
| 1169 |
+
}
|
| 1170 |
+
|
| 1171 |
+
func (l *lazyInitInClusterDialer) Close() error {
|
| 1172 |
+
if l.contextDialer != nil {
|
| 1173 |
+
return l.contextDialer.Close()
|
| 1174 |
+
}
|
| 1175 |
+
return nil
|
| 1176 |
+
}
|
| 1177 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/pre_context.md
ADDED
|
@@ -0,0 +1,1169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context before the fix
|
| 2 |
+
|
| 3 |
+
## `cmd/root.go` (changed lines (12, 364, 365))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package cmd
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"fmt"
|
| 10 |
+
"os"
|
| 11 |
+
"path/filepath"
|
| 12 |
+
"strings"
|
| 13 |
+
"text/template"
|
| 14 |
+
"time"
|
| 15 |
+
|
| 16 |
+
"knative.dev/func/cmd/templates"
|
| 17 |
+
|
| 18 |
+
"github.com/ory/viper"
|
| 19 |
+
"github.com/spf13/cobra"
|
| 20 |
+
"golang.org/x/term"
|
| 21 |
+
"k8s.io/apimachinery/pkg/util/sets"
|
| 22 |
+
"knative.dev/client/pkg/util"
|
| 23 |
+
fn "knative.dev/func"
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
type RootCommandConfig struct {
|
| 27 |
+
Name string // usually `func` or `kn func`
|
| 28 |
+
Version
|
| 29 |
+
NewClient ClientFactory
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// NewRootCmd creates the root of the command tree defines the command name, description, globally
|
| 33 |
+
// available flags, etc. It has no action of its own, such that running the
|
| 34 |
+
// resultant binary with no arguments prints the help/usage text.
|
| 35 |
+
func NewRootCmd(config RootCommandConfig) *cobra.Command {
|
| 36 |
+
cmd := &cobra.Command{
|
| 37 |
+
// Use must be set to exactly config.Name, as this field is overloaded to
|
| 38 |
+
// be used in subcommand help text as the command with possible prefix:
|
| 39 |
+
Use: config.Name,
|
| 40 |
+
Short: "Serverless functions",
|
| 41 |
+
SilenceErrors: true, // we explicitly handle errors in Execute()
|
| 42 |
+
SilenceUsage: true, // no usage dump on error
|
| 43 |
+
Long: `Knative serverless functions
|
| 44 |
+
|
| 45 |
+
Create, build and deploy Knative functions
|
| 46 |
+
|
| 47 |
+
SYNOPSIS
|
| 48 |
+
{{.Use}} [-v|--verbose] <command> [args]
|
| 49 |
+
|
| 50 |
+
EXAMPLES
|
| 51 |
+
|
| 52 |
+
o Create a Node function in the current directory
|
| 53 |
+
$ {{.Use}} create --language node .
|
| 54 |
+
|
| 55 |
+
o Deploy the function defined in the current working directory to the
|
| 56 |
+
currently connected cluster, specifying a container registry in place of
|
| 57 |
+
quay.io/user for the function's container.
|
| 58 |
+
$ {{.Use}} deploy --registry quay.io.user
|
| 59 |
+
|
| 60 |
+
o Invoke the function defined in the current working directory with an example
|
| 61 |
+
request.
|
| 62 |
+
$ {{.Use}} invoke
|
| 63 |
+
|
| 64 |
+
For more examples, see '{{.Use}} [command] --help'.`,
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
// Environment Variables
|
| 68 |
+
// Evaluated first after static defaults, set all flags to be associated with
|
| 69 |
+
// a version prefixed by "FUNC_"
|
| 70 |
+
viper.AutomaticEnv() // read in environment variables for FUNC_<flag>
|
| 71 |
+
viper.SetEnvPrefix("func") // ensure that all have the prefix
|
| 72 |
+
|
| 73 |
+
// Flags
|
| 74 |
+
// persistent flags are available to all subcommands implicitly
|
| 75 |
+
// Note they are bound immediately here as opposed to other subcommands
|
| 76 |
+
// because this root command is not actually executed during tests, and
|
| 77 |
+
// therefore PreRunE and other event-based listeners are not invoked.
|
| 78 |
+
cmd.PersistentFlags().BoolP("verbose", "v", false, "Print verbose logs ($FUNC_VERBOSE)")
|
| 79 |
+
if err := viper.BindPFlag("verbose", cmd.PersistentFlags().Lookup("verbose")); err != nil {
|
| 80 |
+
fmt.Fprintf(os.Stderr, "error binding flag: %v\n", err)
|
| 81 |
+
}
|
| 82 |
+
cmd.PersistentFlags().StringP("namespace", "n", "", "The namespace on the cluster used for remote commands. By default, the namespace func.yaml is used or the currently active namespace if not set in the configuration. (Env: $FUNC_NAMESPACE)")
|
| 83 |
+
if err := viper.BindPFlag("namespace", cmd.PersistentFlags().Lookup("namespace")); err != nil {
|
| 84 |
+
fmt.Fprintf(os.Stderr, "error binding flag: %v\n", err)
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
// Version
|
| 88 |
+
cmd.Version = config.Version.String()
|
| 89 |
+
cmd.SetVersionTemplate(`{{printf "%s\n" .Version}}`)
|
| 90 |
+
|
| 91 |
+
// Client
|
| 92 |
+
// Use the provided ClientFactory or default to NewClient
|
| 93 |
+
newClient := config.NewClient
|
| 94 |
+
if newClient == nil {
|
| 95 |
+
newClient = NewClient
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
// Grouped commands
|
| 99 |
+
groups := templates.CommandGroups{
|
| 100 |
+
{
|
| 101 |
+
Header: "Main Commands:",
|
| 102 |
+
Commands: []*cobra.Command{
|
| 103 |
+
NewBuildCmd(newClient),
|
| 104 |
+
NewConfigCmd(defaultLoaderSaver),
|
| 105 |
+
NewCreateCmd(newClient),
|
| 106 |
+
NewDeleteCmd(newClient),
|
| 107 |
+
NewDeployCmd(newClient),
|
| 108 |
+
NewInfoCmd(newClient),
|
| 109 |
+
NewInvokeCmd(newClient),
|
| 110 |
+
NewLanguagesCmd(newClient),
|
| 111 |
+
NewListCmd(newClient),
|
| 112 |
+
NewRepositoryCmd(newClient),
|
| 113 |
+
NewRunCmd(newClient),
|
| 114 |
+
NewTemplatesCmd(newClient),
|
| 115 |
+
},
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
Header: "Other Commands:",
|
| 119 |
+
Commands: []*cobra.Command{
|
| 120 |
+
NewCompletionCmd(),
|
| 121 |
+
NewVersionCmd(config.Version),
|
| 122 |
+
},
|
| 123 |
+
},
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
// Add all commands to the root command, and initialize
|
| 127 |
+
groups.AddTo(cmd)
|
| 128 |
+
groups.SetRootUsage(cmd, nil)
|
| 129 |
+
|
| 130 |
+
return cmd
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
// Helpers
|
| 134 |
+
// ------------------------------------------
|
| 135 |
+
|
| 136 |
+
// interactiveTerminal returns whether or not the currently attached process
|
| 137 |
+
// terminal is interactive. Used for determining whether or not to
|
| 138 |
+
// interactively prompt the user to confirm default choices, etc.
|
| 139 |
+
func interactiveTerminal() bool {
|
| 140 |
+
return term.IsTerminal(int(os.Stdin.Fd()))
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
// bindFunc which conforms to the cobra PreRunE method signature
|
| 144 |
+
type bindFunc func(*cobra.Command, []string) error
|
| 145 |
+
|
| 146 |
+
// bindEnv returns a bindFunc that binds env vars to the named flags.
|
| 147 |
+
func bindEnv(flags ...string) bindFunc {
|
| 148 |
+
return func(cmd *cobra.Command, args []string) (err error) {
|
| 149 |
+
for _, flag := range flags {
|
| 150 |
+
if err = viper.BindPFlag(flag, cmd.Flags().Lookup(flag)); err != nil {
|
| 151 |
+
return
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
return
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
// deriveName returns the explicit value (if provided) or attempts to derive
|
| 159 |
+
// from the given path. Path is defaulted to current working directory, where
|
| 160 |
+
// a function configuration, if it exists and contains a name, is used.
|
| 161 |
+
func deriveName(explicitName string, path string) string {
|
| 162 |
+
// If the name was explicitly provided, use it.
|
| 163 |
+
if explicitName != "" {
|
| 164 |
+
return explicitName
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
// If the directory at path contains an initialized function, use the name therein
|
| 168 |
+
f, err := fn.NewFunction(path)
|
| 169 |
+
if err == nil && f.Name != "" {
|
| 170 |
+
return f.Name
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
return ""
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
// deriveNameAndAbsolutePathFromPath returns resolved function name and absolute path
|
| 177 |
+
// to the function project root. The input parameter path could be one of:
|
| 178 |
+
// 'relative/path/to/foo', '/absolute/path/to/foo', 'foo' or ”.
|
| 179 |
+
func deriveNameAndAbsolutePathFromPath(path string) (string, string) {
|
| 180 |
+
var absPath string
|
| 181 |
+
|
| 182 |
+
// If path is not specified, we would like to use current working dir
|
| 183 |
+
if path == "" {
|
| 184 |
+
path = cwd()
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// Expand the passed function name to its absolute path
|
| 188 |
+
absPath, err := filepath.Abs(path)
|
| 189 |
+
if err != nil {
|
| 190 |
+
return "", ""
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
// Get the name of the function, which equals to name of the current directory
|
| 194 |
+
pathParts := strings.Split(strings.TrimRight(path, string(os.PathSeparator)), string(os.PathSeparator))
|
| 195 |
+
return pathParts[len(pathParts)-1], absPath
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
// deriveImage returns the same image name which will be used.
|
| 199 |
+
// I.e. if the explicit name is empty, derive one from the configured registry
|
| 200 |
+
// (registry plus username) and the function's name.
|
| 201 |
+
//
|
| 202 |
+
// This is calculated preemptively here in the CLI (prior to invoking the
|
| 203 |
+
// client), only in order to provide information to the user via the prompt.
|
| 204 |
+
// The client will calculate this same value if the image override is not
|
| 205 |
+
// provided.
|
| 206 |
+
//
|
| 207 |
+
// Derivation logic:
|
| 208 |
+
// deriveImage attempts to arrive at a final, full image name:
|
| 209 |
+
//
|
| 210 |
+
// format: [registry]/[username]/[functionName]:[tag]
|
| 211 |
+
// example: quay.io/myname/my.function.name:tag.
|
| 212 |
+
//
|
| 213 |
+
// Registry can optionally be omitted, in which case DefaultRegistry
|
| 214 |
+
// will be prepended.
|
| 215 |
+
//
|
| 216 |
+
// If the image flag is provided, this value is used directly (the user supplied
|
| 217 |
+
// --image or $FUNC_IMAGE). Otherwise, the function at 'path' is loaded, and
|
| 218 |
+
// the Image name therein is used (i.e. it was previously calculated).
|
| 219 |
+
// Finally, the default registry is used, which is prepended to the function
|
| 220 |
+
// name, and appended with ':latest':
|
| 221 |
+
func deriveImage(explicitImage, defaultRegistry, path string) string {
|
| 222 |
+
if explicitImage != "" {
|
| 223 |
+
return explicitImage // use the explicit value provided.
|
| 224 |
+
}
|
| 225 |
+
f, err := fn.NewFunction(path)
|
| 226 |
+
if err != nil {
|
| 227 |
+
return "" // unable to derive due to load error (uninitialized?)
|
| 228 |
+
}
|
| 229 |
+
if f.Image != "" {
|
| 230 |
+
return f.Image // use value previously provided or derived.
|
| 231 |
+
}
|
| 232 |
+
// Use the func system's derivation logic.
|
| 233 |
+
// Errors deriving result in an empty return
|
| 234 |
+
derivedValue, _ := f.ImageName()
|
| 235 |
+
return derivedValue
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
func envFromCmd(cmd *cobra.Command) (*util.OrderedMap, []string, error) {
|
| 239 |
+
if cmd.Flags().Changed("env") {
|
| 240 |
+
env, err := cmd.Flags().GetStringArray("env")
|
| 241 |
+
if err != nil {
|
| 242 |
+
return nil, []string{}, fmt.Errorf("Invalid --env: %w", err)
|
| 243 |
+
}
|
| 244 |
+
return util.OrderedMapAndRemovalListFromArray(env, "=")
|
| 245 |
+
}
|
| 246 |
+
return util.NewOrderedMap(), []string{}, nil
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
func mergeEnvs(envs []fn.Env, envToUpdate *util.OrderedMap, envToRemove []string) ([]fn.Env, int, error) {
|
| 250 |
+
updated := sets.NewString()
|
| 251 |
+
|
| 252 |
+
var counter int
|
| 253 |
+
|
| 254 |
+
for i := range envs {
|
| 255 |
+
if envs[i].Name != nil {
|
| 256 |
+
value, present := envToUpdate.GetString(*envs[i].Name)
|
| 257 |
+
if present {
|
| 258 |
+
envs[i].Value = &value
|
| 259 |
+
updated.Insert(*envs[i].Name)
|
| 260 |
+
counter++
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
it := envToUpdate.Iterator()
|
| 266 |
+
for name, value, ok := it.NextString(); ok; name, value, ok = it.NextString() {
|
| 267 |
+
if !updated.Has(name) {
|
| 268 |
+
n := name
|
| 269 |
+
v := value
|
| 270 |
+
envs = append(envs, fn.Env{Name: &n, Value: &v})
|
| 271 |
+
counter++
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
for _, name := range envToRemove {
|
| 276 |
+
for i, envVar := range envs {
|
| 277 |
+
if *envVar.Name == name {
|
| 278 |
+
envs = append(envs[:i], envs[i+1:]...)
|
| 279 |
+
counter++
|
| 280 |
+
break
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
errMsg := fn.ValidateEnvs(envs)
|
| 286 |
+
if len(errMsg) > 0 {
|
| 287 |
+
return []fn.Env{}, 0, fmt.Errorf(strings.Join(errMsg, "\n"))
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
return envs, counter, nil
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
// setPathFlag ensures common text/wording when the --path flag is used
|
| 294 |
+
func setPathFlag(cmd *cobra.Command) {
|
| 295 |
+
cmd.Flags().StringP("path", "p", ".", "Path to the project directory (Env: $FUNC_PATH)")
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
// getPathFlag returns the value of the --path flag.
|
| 299 |
+
// The special value '.' is returned as the abolute path to the current
|
| 300 |
+
// working directory.
|
| 301 |
+
func getPathFlag() string {
|
| 302 |
+
path := viper.GetString("path")
|
| 303 |
+
if path == "." {
|
| 304 |
+
path = cwd()
|
| 305 |
+
}
|
| 306 |
+
return path
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
// cwd returns the current working directory or exits 1 printing the error.
|
| 310 |
+
func cwd() (cwd string) {
|
| 311 |
+
cwd, err := os.Getwd()
|
| 312 |
+
if err != nil {
|
| 313 |
+
panic(fmt.Sprintf("Unable to determine current working directory: %v", err))
|
| 314 |
+
}
|
| 315 |
+
return cwd
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
type Version struct {
|
| 319 |
+
// Date of compilation
|
| 320 |
+
Date string
|
| 321 |
+
// Version tag of the git commit, or 'tip' if no tag.
|
| 322 |
+
Vers string
|
| 323 |
+
// Hash of the currently active git commit on build.
|
| 324 |
+
Hash string
|
| 325 |
+
// Verbose printing enabled for the string representation.
|
| 326 |
+
Verbose bool
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
// Return the stringification of the Version struct, which takes into account
|
| 330 |
+
// the verbosity setting.
|
| 331 |
+
func (v Version) String() string {
|
| 332 |
+
if v.Verbose {
|
| 333 |
+
return v.StringVerbose()
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
// Ensure that the value returned is parseable as a semver, with the special
|
| 337 |
+
// value v0.0.0 as the default indicating there is no version information
|
| 338 |
+
// available.
|
| 339 |
+
if strings.HasPrefix(v.Vers, "v") {
|
| 340 |
+
// TODO: this is the naive approach, perhaps consider actually parse it
|
| 341 |
+
// using the semver lib
|
| 342 |
+
return v.Vers
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// Any non-semver value is invalid, and thus indistinguishable from a
|
| 346 |
+
// nonexistent version value, so the default zero value of v0.0.0 is used.
|
| 347 |
+
return "v0.0.0"
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
// StringVerbose returns the verbose version of the version stringification.
|
| 351 |
+
// The format returned is [semver]-[hash]-[date] where the special value
|
| 352 |
+
// 'v0.0.0' and 'source' are used when version is not available and/or the
|
| 353 |
+
// libray has been built from source, respectively.
|
| 354 |
+
func (v Version) StringVerbose() string {
|
| 355 |
+
var (
|
| 356 |
+
vers = v.Vers
|
| 357 |
+
hash = v.Hash
|
| 358 |
+
date = v.Date
|
| 359 |
+
)
|
| 360 |
+
if vers == "" {
|
| 361 |
+
vers = "v0.0.0"
|
| 362 |
+
}
|
| 363 |
+
if hash == "" {
|
| 364 |
+
hash = "source"
|
| 365 |
+
}
|
| 366 |
+
if date == "" {
|
| 367 |
+
date = time.Now().Format(time.RFC3339)
|
| 368 |
+
}
|
| 369 |
+
return fmt.Sprintf("%s-%s-%s", vers, hash, date)
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
// surveySelectDefault returns 'value' if defined and exists in 'options'.
|
| 373 |
+
// Otherwise, options[0] is returned if it exists. Empty string otherwise.
|
| 374 |
+
//
|
| 375 |
+
// Usage Example:
|
| 376 |
+
//
|
| 377 |
+
// languages := []string{ "go", "node", "rust" },
|
| 378 |
+
// survey.Select{
|
| 379 |
+
// Options: options,
|
| 380 |
+
// Default: surveySelectDefaut(cfg.Language, languages),
|
| 381 |
+
// }
|
| 382 |
+
//
|
| 383 |
+
// Summary:
|
| 384 |
+
//
|
| 385 |
+
// This protects against an incorrectly initialized survey.Select when the user
|
| 386 |
+
// has provided a nonexistant option (validation is handled elsewhere) or
|
| 387 |
+
// when a value is required but there exists no defaults (no default value on
|
| 388 |
+
// the associated flag).
|
| 389 |
+
//
|
| 390 |
+
// Explanation:
|
| 391 |
+
//
|
| 392 |
+
// The above example chooses the default for the Survey (--confirm) question
|
| 393 |
+
// in a way that works with user-provided flag and environment variable values.
|
| 394 |
+
//
|
| 395 |
+
// `cfg.Language` is the current value set in the config struct, which is
|
| 396 |
+
// populated from (in ascending order of precedence):
|
| 397 |
+
// static flag default, associated environment variable, or command flag.
|
| 398 |
+
// `languages` are the options which are being used by the survey select.
|
| 399 |
+
//
|
| 400 |
+
// This cascade allows for the Survey questions to be properly pre-initialzed
|
| 401 |
+
// with their associated environment variables or flags. For example,
|
| 402 |
+
// A user whose default language is set to 'node' using the global environment
|
| 403 |
+
// variable FUNC_LANGUAGE will have that option pre-selected when running
|
| 404 |
+
// `func create -c`.
|
| 405 |
+
//
|
| 406 |
+
// The 'survey' package expects the value of the Default member to exist
|
| 407 |
+
// in the 'Options' member. This is not possible when user-provided data is
|
| 408 |
+
// allowed for the default, hence this logic is necessary.
|
| 409 |
+
//
|
| 410 |
+
// For example, when the user is using prompts (--confirm) to select from a set
|
| 411 |
+
// of options, but the associated flag either has an unrecognized value, or no
|
| 412 |
+
// value at all, without this logic the resulting select prompt would be
|
| 413 |
+
// initialized with this as the default value, and the act of what appears to
|
| 414 |
+
// be choose the first option displayed does not overwrite the invalid default.
|
| 415 |
+
// It could perhaps be argued this is a shortcoming in the survey package, but
|
| 416 |
+
// it is also clearly an error to provide invalid data for a default.
|
| 417 |
+
func surveySelectDefault(value string, options []string) string {
|
| 418 |
+
for _, v := range options {
|
| 419 |
+
if value == v {
|
| 420 |
+
return v // The provided value is acceptable
|
| 421 |
+
}
|
| 422 |
+
}
|
| 423 |
+
if len(options) > 0 {
|
| 424 |
+
return options[0] // Sync with the option which will be shown by the UX
|
| 425 |
+
}
|
| 426 |
+
// Either the value is not an option or there are no options. Either of
|
| 427 |
+
// which should fail proper validation
|
| 428 |
+
return ""
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
// defaultTemplatedHelp evaluates the given command's help text as a template
|
| 432 |
+
// some commands define their own help command when additional values are
|
| 433 |
+
// required beyond these basics.
|
| 434 |
+
func defaultTemplatedHelp(cmd *cobra.Command, args []string) {
|
| 435 |
+
var (
|
| 436 |
+
body = cmd.Long + "\n\n" + cmd.UsageString()
|
| 437 |
+
t = template.New("help")
|
| 438 |
+
tpl = template.Must(t.Parse(body))
|
| 439 |
+
)
|
| 440 |
+
var data = struct{ Name string }{Name: cmd.Root().Use}
|
| 441 |
+
|
| 442 |
+
if err := tpl.Execute(cmd.OutOrStdout(), data); err != nil {
|
| 443 |
+
fmt.Fprintf(cmd.ErrOrStderr(), "unable to display help text: %v", err)
|
| 444 |
+
}
|
| 445 |
+
}
|
| 446 |
+
```
|
| 447 |
+
|
| 448 |
+
## `cmd/root_test.go` (changed lines (212, 213, 214, 215, 217, 218, 219, 220, 222, 223, 224, 225, 227, 228, 229, 230, 252, 253, 254))
|
| 449 |
+
|
| 450 |
+
```go
|
| 451 |
+
package cmd
|
| 452 |
+
|
| 453 |
+
import (
|
| 454 |
+
"bytes"
|
| 455 |
+
"fmt"
|
| 456 |
+
"io"
|
| 457 |
+
"os"
|
| 458 |
+
"reflect"
|
| 459 |
+
"strings"
|
| 460 |
+
"testing"
|
| 461 |
+
|
| 462 |
+
"github.com/ory/viper"
|
| 463 |
+
"knative.dev/client/pkg/util"
|
| 464 |
+
|
| 465 |
+
fn "knative.dev/func"
|
| 466 |
+
. "knative.dev/func/testing"
|
| 467 |
+
)
|
| 468 |
+
|
| 469 |
+
func TestRoot_PersistentFlags(t *testing.T) {
|
| 470 |
+
tests := []struct {
|
| 471 |
+
name string
|
| 472 |
+
args []string
|
| 473 |
+
skipNamespace bool
|
| 474 |
+
}{
|
| 475 |
+
{
|
| 476 |
+
name: "provided as root flags",
|
| 477 |
+
args: []string{"--verbose", "--namespace=namespace", "list"},
|
| 478 |
+
},
|
| 479 |
+
{
|
| 480 |
+
name: "provided as sub-command flags",
|
| 481 |
+
args: []string{"list", "--verbose", "--namespace=namespace"},
|
| 482 |
+
},
|
| 483 |
+
{
|
| 484 |
+
name: "provided as sub-sub-command flags",
|
| 485 |
+
args: []string{"repositories", "list", "--verbose"},
|
| 486 |
+
skipNamespace: true, // NOTE: no sub-sub commands yet use namespace, so it is not checked.
|
| 487 |
+
},
|
| 488 |
+
}
|
| 489 |
+
|
| 490 |
+
for _, tt := range tests {
|
| 491 |
+
t.Run(tt.name, func(t *testing.T) {
|
| 492 |
+
_ = fromTempDirectory(t)
|
| 493 |
+
|
| 494 |
+
cmd := NewCreateCmd(NewClient) // Create a function
|
| 495 |
+
cmd.SetArgs([]string{"--language", "go", "myfunc"}) // providing language
|
| 496 |
+
if err := cmd.Execute(); err != nil { // fail on any errors
|
| 497 |
+
t.Fatal(err)
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
// Assert the persistent variables were propagated to the Client constructor
|
| 501 |
+
// when the command is actually invoked.
|
| 502 |
+
cmd = NewRootCmd(RootCommandConfig{NewClient: func(cfg ClientConfig, _ ...fn.Option) (*fn.Client, func()) {
|
| 503 |
+
if cfg.Namespace != "namespace" && !tt.skipNamespace {
|
| 504 |
+
t.Fatal("namespace not propagated")
|
| 505 |
+
}
|
| 506 |
+
if cfg.Verbose != true {
|
| 507 |
+
t.Fatal("verbose not propagated")
|
| 508 |
+
}
|
| 509 |
+
return fn.New(), func() {}
|
| 510 |
+
}})
|
| 511 |
+
cmd.SetArgs(tt.args)
|
| 512 |
+
if err := cmd.Execute(); err != nil {
|
| 513 |
+
t.Fatal(err)
|
| 514 |
+
}
|
| 515 |
+
})
|
| 516 |
+
}
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
func TestRoot_mergeEnvMaps(t *testing.T) {
|
| 520 |
+
|
| 521 |
+
a := "A"
|
| 522 |
+
b := "B"
|
| 523 |
+
v1 := "x"
|
| 524 |
+
v2 := "y"
|
| 525 |
+
|
| 526 |
+
type args struct {
|
| 527 |
+
envs []fn.Env
|
| 528 |
+
toUpdate *util.OrderedMap
|
| 529 |
+
toRemove []string
|
| 530 |
+
}
|
| 531 |
+
tests := []struct {
|
| 532 |
+
name string
|
| 533 |
+
args args
|
| 534 |
+
want []fn.Env
|
| 535 |
+
}{
|
| 536 |
+
{
|
| 537 |
+
"add new var to empty list",
|
| 538 |
+
args{
|
| 539 |
+
[]fn.Env{},
|
| 540 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v1}}),
|
| 541 |
+
[]string{},
|
| 542 |
+
},
|
| 543 |
+
[]fn.Env{{Name: &a, Value: &v1}},
|
| 544 |
+
},
|
| 545 |
+
{
|
| 546 |
+
"add new var",
|
| 547 |
+
args{
|
| 548 |
+
[]fn.Env{{Name: &b, Value: &v2}},
|
| 549 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v1}}),
|
| 550 |
+
[]string{},
|
| 551 |
+
},
|
| 552 |
+
[]fn.Env{{Name: &b, Value: &v2}, {Name: &a, Value: &v1}},
|
| 553 |
+
},
|
| 554 |
+
{
|
| 555 |
+
"update var",
|
| 556 |
+
args{
|
| 557 |
+
[]fn.Env{{Name: &a, Value: &v1}},
|
| 558 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v2}}),
|
| 559 |
+
[]string{},
|
| 560 |
+
},
|
| 561 |
+
[]fn.Env{{Name: &a, Value: &v2}},
|
| 562 |
+
},
|
| 563 |
+
{
|
| 564 |
+
"update multiple vars",
|
| 565 |
+
args{
|
| 566 |
+
[]fn.Env{{Name: &a, Value: &v1}, {Name: &b, Value: &v2}},
|
| 567 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v2}, {b, v1}}),
|
| 568 |
+
[]string{},
|
| 569 |
+
},
|
| 570 |
+
[]fn.Env{{Name: &a, Value: &v2}, {Name: &b, Value: &v1}},
|
| 571 |
+
},
|
| 572 |
+
{
|
| 573 |
+
"remove var",
|
| 574 |
+
args{
|
| 575 |
+
[]fn.Env{{Name: &a, Value: &v1}},
|
| 576 |
+
util.NewOrderedMap(),
|
| 577 |
+
[]string{a},
|
| 578 |
+
},
|
| 579 |
+
[]fn.Env{},
|
| 580 |
+
},
|
| 581 |
+
{
|
| 582 |
+
"remove multiple vars",
|
| 583 |
+
args{
|
| 584 |
+
[]fn.Env{{Name: &a, Value: &v1}, {Name: &b, Value: &v2}},
|
| 585 |
+
util.NewOrderedMap(),
|
| 586 |
+
[]string{a, b},
|
| 587 |
+
},
|
| 588 |
+
[]fn.Env{},
|
| 589 |
+
},
|
| 590 |
+
{
|
| 591 |
+
"update and remove vars",
|
| 592 |
+
args{
|
| 593 |
+
[]fn.Env{{Name: &a, Value: &v1}, {Name: &b, Value: &v2}},
|
| 594 |
+
util.NewOrderedMapWithKVStrings([][]string{{a, v2}}),
|
| 595 |
+
[]string{b},
|
| 596 |
+
},
|
| 597 |
+
[]fn.Env{{Name: &a, Value: &v2}},
|
| 598 |
+
},
|
| 599 |
+
}
|
| 600 |
+
for _, tt := range tests {
|
| 601 |
+
t.Run(tt.name, func(t *testing.T) {
|
| 602 |
+
got, _, err := mergeEnvs(tt.args.envs, tt.args.toUpdate, tt.args.toRemove)
|
| 603 |
+
if err != nil {
|
| 604 |
+
t.Errorf("mergeEnvs() for initial vars %v and toUpdate %v and toRemove %v got error %v",
|
| 605 |
+
tt.args.envs, tt.args.toUpdate, tt.args.toRemove, err)
|
| 606 |
+
}
|
| 607 |
+
if !reflect.DeepEqual(got, tt.want) {
|
| 608 |
+
|
| 609 |
+
gotString := "{ "
|
| 610 |
+
for _, e := range got {
|
| 611 |
+
gotString += fmt.Sprintf("{ %s: %s } ", *e.Name, *e.Value)
|
| 612 |
+
}
|
| 613 |
+
gotString += "}"
|
| 614 |
+
|
| 615 |
+
wantString := "{ "
|
| 616 |
+
for _, e := range tt.want {
|
| 617 |
+
wantString += fmt.Sprintf("{ %s: %s } ", *e.Name, *e.Value)
|
| 618 |
+
}
|
| 619 |
+
wantString += "}"
|
| 620 |
+
|
| 621 |
+
t.Errorf("mergeEnvs() = got: %s, want %s", gotString, wantString)
|
| 622 |
+
}
|
| 623 |
+
})
|
| 624 |
+
}
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
// TestRoot_CommandNameParameterized confirmst that the command name, as
|
| 628 |
+
// printed in help text, is parameterized based on the constructor parameters
|
| 629 |
+
// of the root command. This allows, for example, to have help text correct
|
| 630 |
+
// when both embedded as a plugin or standalone.
|
| 631 |
+
func TestRoot_CommandNameParameterized(t *testing.T) {
|
| 632 |
+
expectedSynopsis := "%v [-v|--verbose] <command> [args]"
|
| 633 |
+
|
| 634 |
+
tests := []string{
|
| 635 |
+
"func", // standalone
|
| 636 |
+
"kn func", // kn plugin
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
for _, testName := range tests {
|
| 640 |
+
var (
|
| 641 |
+
cmd = NewRootCmd(RootCommandConfig{Name: testName})
|
| 642 |
+
out = strings.Builder{}
|
| 643 |
+
)
|
| 644 |
+
cmd.SetArgs([]string{}) // Do not use test command args
|
| 645 |
+
cmd.SetOut(&out)
|
| 646 |
+
if err := cmd.Help(); err != nil {
|
| 647 |
+
t.Fatal(err)
|
| 648 |
+
}
|
| 649 |
+
if cmd.Use != testName {
|
| 650 |
+
t.Fatalf("expected command Use '%v', got '%v'", testName, cmd.Use)
|
| 651 |
+
}
|
| 652 |
+
if !strings.Contains(out.String(), fmt.Sprintf(expectedSynopsis, testName)) {
|
| 653 |
+
t.Logf("Testing '%v'\n", testName)
|
| 654 |
+
t.Log(out.String())
|
| 655 |
+
t.Fatalf("Help text does not include substituted name '%v'", testName)
|
| 656 |
+
}
|
| 657 |
+
}
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
func TestVerbose(t *testing.T) {
|
| 661 |
+
tests := []struct {
|
| 662 |
+
name string
|
| 663 |
+
args []string
|
| 664 |
+
want string
|
| 665 |
+
}{
|
| 666 |
+
{
|
| 667 |
+
name: "verbose as version's flag",
|
| 668 |
+
args: []string{"version", "-v"},
|
| 669 |
+
want: "v0.42.0-cafe-1970-01-01\n",
|
| 670 |
+
},
|
| 671 |
+
{
|
| 672 |
+
name: "no verbose",
|
| 673 |
+
args: []string{"version"},
|
| 674 |
+
want: "v0.42.0\n",
|
| 675 |
+
},
|
| 676 |
+
{
|
| 677 |
+
name: "verbose as root's flag",
|
| 678 |
+
args: []string{"--verbose", "version"},
|
| 679 |
+
want: "v0.42.0-cafe-1970-01-01\n",
|
| 680 |
+
},
|
| 681 |
+
}
|
| 682 |
+
for _, tt := range tests {
|
| 683 |
+
t.Run(tt.name, func(t *testing.T) {
|
| 684 |
+
viper.Reset()
|
| 685 |
+
|
| 686 |
+
var out bytes.Buffer
|
| 687 |
+
|
| 688 |
+
cmd := NewRootCmd(RootCommandConfig{
|
| 689 |
+
Name: "func",
|
| 690 |
+
Version: Version{
|
| 691 |
+
Date: "1970-01-01",
|
| 692 |
+
Vers: "v0.42.0",
|
| 693 |
+
Hash: "cafe",
|
| 694 |
+
}})
|
| 695 |
+
|
| 696 |
+
cmd.SetArgs(tt.args)
|
| 697 |
+
cmd.SetOut(&out)
|
| 698 |
+
if err := cmd.Execute(); err != nil {
|
| 699 |
+
t.Fatal(err)
|
| 700 |
+
}
|
| 701 |
+
|
| 702 |
+
if out.String() != tt.want {
|
| 703 |
+
t.Errorf("expected output: %q but got: %q", tt.want, out.String())
|
| 704 |
+
}
|
| 705 |
+
})
|
| 706 |
+
}
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
// Helpers
|
| 710 |
+
// -------
|
| 711 |
+
|
| 712 |
+
// pipe the output of stdout to a buffer whose value is returned
|
| 713 |
+
// from the returned function. Call pipe() to start piping output
|
| 714 |
+
// to the buffer, call the returned function to access the data in
|
| 715 |
+
// the buffer.
|
| 716 |
+
func piped(t *testing.T) func() string {
|
| 717 |
+
t.Helper()
|
| 718 |
+
var (
|
| 719 |
+
o = os.Stdout
|
| 720 |
+
c = make(chan error, 1)
|
| 721 |
+
b strings.Builder
|
| 722 |
+
)
|
| 723 |
+
|
| 724 |
+
r, w, err := os.Pipe()
|
| 725 |
+
if err != nil {
|
| 726 |
+
t.Fatal(err)
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
os.Stdout = w
|
| 730 |
+
|
| 731 |
+
go func() {
|
| 732 |
+
_, err := io.Copy(&b, r)
|
| 733 |
+
r.Close()
|
| 734 |
+
c <- err
|
| 735 |
+
}()
|
| 736 |
+
|
| 737 |
+
return func() string {
|
| 738 |
+
os.Stdout = o
|
| 739 |
+
w.Close()
|
| 740 |
+
err := <-c
|
| 741 |
+
if err != nil {
|
| 742 |
+
t.Fatal(err)
|
| 743 |
+
}
|
| 744 |
+
return strings.TrimSpace(b.String())
|
| 745 |
+
}
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
// fromTempDirectory is a cli-specific test helper which
|
| 749 |
+
// - creates a temp directory and changes to it as the new working directory
|
| 750 |
+
// - creates a temp directory and uses it for XDG_CONFIG_HOME
|
| 751 |
+
// - removes temp directories on cleanup
|
| 752 |
+
// - resets viper on cleanup (the reason this is "cli-specific")
|
| 753 |
+
func fromTempDirectory(t *testing.T) string {
|
| 754 |
+
t.Helper()
|
| 755 |
+
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
| 756 |
+
d, done := Mktemp(t) // creates and CDs to 'tmp'
|
| 757 |
+
t.Cleanup(func() { done(); viper.Reset() })
|
| 758 |
+
return d
|
| 759 |
+
}
|
| 760 |
+
```
|
| 761 |
+
|
| 762 |
+
## `k8s/dialer.go` (changed lines (10, 26, 27, 132, 133, 134, 135, 136, 147, 148))
|
| 763 |
+
|
| 764 |
+
```go
|
| 765 |
+
package k8s
|
| 766 |
+
|
| 767 |
+
import (
|
| 768 |
+
"bytes"
|
| 769 |
+
"context"
|
| 770 |
+
"errors"
|
| 771 |
+
"fmt"
|
| 772 |
+
"io"
|
| 773 |
+
"net"
|
| 774 |
+
"os"
|
| 775 |
+
"sync"
|
| 776 |
+
"time"
|
| 777 |
+
|
| 778 |
+
coreV1 "k8s.io/api/core/v1"
|
| 779 |
+
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 780 |
+
"k8s.io/apimachinery/pkg/fields"
|
| 781 |
+
"k8s.io/apimachinery/pkg/util/rand"
|
| 782 |
+
"k8s.io/apimachinery/pkg/watch"
|
| 783 |
+
"k8s.io/client-go/kubernetes"
|
| 784 |
+
"k8s.io/client-go/kubernetes/scheme"
|
| 785 |
+
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
| 786 |
+
restclient "k8s.io/client-go/rest"
|
| 787 |
+
"k8s.io/client-go/tools/remotecommand"
|
| 788 |
+
)
|
| 789 |
+
|
| 790 |
+
var socatImage = "quay.io/boson/alpine-socat:1.7.4.3-r1-non-root"
|
| 791 |
+
|
| 792 |
+
// NewInClusterDialer creates context dialer that will dial TCP connections via POD running in k8s cluster.
|
| 793 |
+
// This is useful when accessing k8s services that are not exposed outside cluster (e.g. openshift image registry).
|
| 794 |
+
//
|
| 795 |
+
// Usage:
|
| 796 |
+
//
|
| 797 |
+
// dialer, err := k8s.NewInClusterDialer(ctx)
|
| 798 |
+
// if err != nil {
|
| 799 |
+
// return err
|
| 800 |
+
// }
|
| 801 |
+
// defer dialer.Close()
|
| 802 |
+
//
|
| 803 |
+
// transport := &http.Transport{
|
| 804 |
+
// DialContext: dialer.DialContext,
|
| 805 |
+
// }
|
| 806 |
+
//
|
| 807 |
+
// var client = http.Client{
|
| 808 |
+
// Transport: transport,
|
| 809 |
+
// }
|
| 810 |
+
func NewInClusterDialer(ctx context.Context) (*contextDialer, error) {
|
| 811 |
+
c := &contextDialer{
|
| 812 |
+
detachChan: make(chan struct{}),
|
| 813 |
+
}
|
| 814 |
+
err := c.startDialerPod(ctx)
|
| 815 |
+
if err != nil {
|
| 816 |
+
return nil, err
|
| 817 |
+
}
|
| 818 |
+
return c, nil
|
| 819 |
+
}
|
| 820 |
+
|
| 821 |
+
type contextDialer struct {
|
| 822 |
+
coreV1 v1.CoreV1Interface
|
| 823 |
+
restConf *restclient.Config
|
| 824 |
+
podName string
|
| 825 |
+
namespace string
|
| 826 |
+
detachChan chan struct{}
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
func (c *contextDialer) DialContext(ctx context.Context, network string, addr string) (net.Conn, error) {
|
| 830 |
+
if !(network == "tcp" || network == "tcp4" || network == "tcp6") {
|
| 831 |
+
return nil, fmt.Errorf("unsupported network: %q", network)
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
execDone := make(chan struct{})
|
| 835 |
+
pr, pw, conn := newConn(execDone)
|
| 836 |
+
|
| 837 |
+
go func() {
|
| 838 |
+
defer close(execDone)
|
| 839 |
+
errOut := bytes.NewBuffer(nil)
|
| 840 |
+
err := c.exec(addr, pr, pw, errOut)
|
| 841 |
+
if err != nil {
|
| 842 |
+
err = fmt.Errorf("failed to exec in pod: %w (stderr: %q)", err, errOut.String())
|
| 843 |
+
_ = pr.CloseWithError(err)
|
| 844 |
+
_ = pw.CloseWithError(err)
|
| 845 |
+
}
|
| 846 |
+
}()
|
| 847 |
+
|
| 848 |
+
return conn, nil
|
| 849 |
+
}
|
| 850 |
+
|
| 851 |
+
func (c *contextDialer) Close() error {
|
| 852 |
+
// closing the channel will cause stdin of the attached container to return EOF
|
| 853 |
+
// as a result the pod exits -- it transits to Completed state
|
| 854 |
+
close(c.detachChan)
|
| 855 |
+
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*1)
|
| 856 |
+
defer cancel()
|
| 857 |
+
delOpts := metaV1.DeleteOptions{}
|
| 858 |
+
|
| 859 |
+
return c.coreV1.Pods(c.namespace).Delete(ctx, c.podName, delOpts)
|
| 860 |
+
}
|
| 861 |
+
|
| 862 |
+
func (c *contextDialer) startDialerPod(ctx context.Context) (err error) {
|
| 863 |
+
cliConf := GetClientConfig()
|
| 864 |
+
c.restConf, err = cliConf.ClientConfig()
|
| 865 |
+
if err != nil {
|
| 866 |
+
return
|
| 867 |
+
}
|
| 868 |
+
c.restConf.WarningHandler = restclient.NoWarnings{}
|
| 869 |
+
|
| 870 |
+
err = setConfigDefaults(c.restConf)
|
| 871 |
+
if err != nil {
|
| 872 |
+
return
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
client, err := kubernetes.NewForConfig(c.restConf)
|
| 876 |
+
if err != nil {
|
| 877 |
+
return
|
| 878 |
+
}
|
| 879 |
+
c.coreV1 = client.CoreV1()
|
| 880 |
+
|
| 881 |
+
c.namespace, err = GetNamespace("")
|
| 882 |
+
if err != nil {
|
| 883 |
+
return
|
| 884 |
+
}
|
| 885 |
+
|
| 886 |
+
pods := client.CoreV1().Pods(c.namespace)
|
| 887 |
+
|
| 888 |
+
c.podName = "in-cluster-dialer-" + rand.String(5)
|
| 889 |
+
|
| 890 |
+
defer func() {
|
| 891 |
+
if err != nil {
|
| 892 |
+
c.Close()
|
| 893 |
+
}
|
| 894 |
+
}()
|
| 895 |
+
|
| 896 |
+
img := socatImage
|
| 897 |
+
if i, ok := os.LookupEnv("SOCAT_IMAGE"); ok {
|
| 898 |
+
img = i
|
| 899 |
+
}
|
| 900 |
+
|
| 901 |
+
pod := &coreV1.Pod{
|
| 902 |
+
ObjectMeta: metaV1.ObjectMeta{
|
| 903 |
+
Name: c.podName,
|
| 904 |
+
Labels: nil,
|
| 905 |
+
Annotations: nil,
|
| 906 |
+
},
|
| 907 |
+
Spec: coreV1.PodSpec{
|
| 908 |
+
Containers: []coreV1.Container{
|
| 909 |
+
{
|
| 910 |
+
Name: c.podName,
|
| 911 |
+
Image: img,
|
| 912 |
+
Stdin: true,
|
| 913 |
+
StdinOnce: true,
|
| 914 |
+
Command: []string{"socat", "-u", "-", "OPEN:/dev/null"},
|
| 915 |
+
SecurityContext: defaultSecurityContext(),
|
| 916 |
+
},
|
| 917 |
+
},
|
| 918 |
+
DNSPolicy: coreV1.DNSClusterFirst,
|
| 919 |
+
RestartPolicy: coreV1.RestartPolicyNever,
|
| 920 |
+
},
|
| 921 |
+
}
|
| 922 |
+
creatOpts := metaV1.CreateOptions{}
|
| 923 |
+
|
| 924 |
+
ready := podReady(ctx, c.coreV1, c.podName, c.namespace)
|
| 925 |
+
|
| 926 |
+
_, err = pods.Create(ctx, pod, creatOpts)
|
| 927 |
+
if err != nil {
|
| 928 |
+
return
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
select {
|
| 932 |
+
case err = <-ready:
|
| 933 |
+
case <-ctx.Done():
|
| 934 |
+
err = ctx.Err()
|
| 935 |
+
case <-time.After(time.Minute * 1):
|
| 936 |
+
err = errors.New("timeout")
|
| 937 |
+
}
|
| 938 |
+
|
| 939 |
+
if err != nil {
|
| 940 |
+
return fmt.Errorf("failed to start dialer container: %w", err)
|
| 941 |
+
}
|
| 942 |
+
|
| 943 |
+
// attaching to the stdin to automatically Complete the pod on exit
|
| 944 |
+
go func() {
|
| 945 |
+
_ = attach(c.coreV1.RESTClient(), c.restConf, c.podName, c.namespace, emptyBlockingReader(c.detachChan), io.Discard, io.Discard)
|
| 946 |
+
}()
|
| 947 |
+
|
| 948 |
+
return nil
|
| 949 |
+
}
|
| 950 |
+
|
| 951 |
+
// reader that returns no data and blocks until
|
| 952 |
+
// the channel is closed or data are sent to the channel
|
| 953 |
+
type emptyBlockingReader chan struct{}
|
| 954 |
+
|
| 955 |
+
func (e emptyBlockingReader) Read(p []byte) (n int, err error) {
|
| 956 |
+
<-e
|
| 957 |
+
return 0, io.EOF
|
| 958 |
+
}
|
| 959 |
+
|
| 960 |
+
func (c *contextDialer) exec(hostPort string, in io.Reader, out, errOut io.Writer) error {
|
| 961 |
+
|
| 962 |
+
restClient := c.coreV1.RESTClient()
|
| 963 |
+
req := restClient.Post().
|
| 964 |
+
Resource("pods").
|
| 965 |
+
Name(c.podName).
|
| 966 |
+
Namespace(c.namespace).
|
| 967 |
+
SubResource("exec")
|
| 968 |
+
req.VersionedParams(&coreV1.PodExecOptions{
|
| 969 |
+
Command: []string{"socat", "-", fmt.Sprintf("TCP:%s", hostPort)},
|
| 970 |
+
Container: c.podName,
|
| 971 |
+
Stdin: true,
|
| 972 |
+
Stdout: true,
|
| 973 |
+
Stderr: true,
|
| 974 |
+
TTY: false,
|
| 975 |
+
}, scheme.ParameterCodec)
|
| 976 |
+
|
| 977 |
+
executor, err := remotecommand.NewSPDYExecutor(c.restConf, "POST", req.URL())
|
| 978 |
+
if err != nil {
|
| 979 |
+
return err
|
| 980 |
+
}
|
| 981 |
+
|
| 982 |
+
return executor.Stream(remotecommand.StreamOptions{
|
| 983 |
+
Stdin: in,
|
| 984 |
+
Stdout: out,
|
| 985 |
+
Stderr: errOut,
|
| 986 |
+
Tty: false,
|
| 987 |
+
})
|
| 988 |
+
}
|
| 989 |
+
|
| 990 |
+
func attach(restClient restclient.Interface, restConf *restclient.Config, podName, namespace string, in io.Reader, out, errOut io.Writer) error {
|
| 991 |
+
req := restClient.Post().
|
| 992 |
+
Resource("pods").
|
| 993 |
+
Name(podName).
|
| 994 |
+
Namespace(namespace).
|
| 995 |
+
SubResource("attach")
|
| 996 |
+
req.VersionedParams(&coreV1.PodAttachOptions{
|
| 997 |
+
Container: podName,
|
| 998 |
+
Stdin: true,
|
| 999 |
+
Stdout: true,
|
| 1000 |
+
Stderr: true,
|
| 1001 |
+
TTY: false,
|
| 1002 |
+
}, scheme.ParameterCodec)
|
| 1003 |
+
|
| 1004 |
+
executor, err := remotecommand.NewSPDYExecutor(restConf, "POST", req.URL())
|
| 1005 |
+
if err != nil {
|
| 1006 |
+
return err
|
| 1007 |
+
}
|
| 1008 |
+
|
| 1009 |
+
return executor.Stream(remotecommand.StreamOptions{
|
| 1010 |
+
Stdin: in,
|
| 1011 |
+
Stdout: out,
|
| 1012 |
+
Stderr: errOut,
|
| 1013 |
+
Tty: false,
|
| 1014 |
+
})
|
| 1015 |
+
}
|
| 1016 |
+
|
| 1017 |
+
func podReady(ctx context.Context, core v1.CoreV1Interface, podName, namespace string) (errChan <-chan error) {
|
| 1018 |
+
d := make(chan error)
|
| 1019 |
+
errChan = d
|
| 1020 |
+
|
| 1021 |
+
pods := core.Pods(namespace)
|
| 1022 |
+
|
| 1023 |
+
nameSelector := fields.OneTermEqualSelector("metadata.name", podName).String()
|
| 1024 |
+
listOpts := metaV1.ListOptions{
|
| 1025 |
+
Watch: true,
|
| 1026 |
+
FieldSelector: nameSelector,
|
| 1027 |
+
}
|
| 1028 |
+
watcher, err := pods.Watch(ctx, listOpts)
|
| 1029 |
+
if err != nil {
|
| 1030 |
+
return
|
| 1031 |
+
}
|
| 1032 |
+
|
| 1033 |
+
go func() {
|
| 1034 |
+
defer watcher.Stop()
|
| 1035 |
+
ch := watcher.ResultChan()
|
| 1036 |
+
for event := range ch {
|
| 1037 |
+
pod, ok := event.Object.(*coreV1.Pod)
|
| 1038 |
+
if !ok {
|
| 1039 |
+
continue
|
| 1040 |
+
}
|
| 1041 |
+
|
| 1042 |
+
if event.Type == watch.Modified {
|
| 1043 |
+
for _, status := range pod.Status.ContainerStatuses {
|
| 1044 |
+
if status.Ready {
|
| 1045 |
+
d <- nil
|
| 1046 |
+
return
|
| 1047 |
+
}
|
| 1048 |
+
if status.State.Waiting != nil {
|
| 1049 |
+
switch status.State.Waiting.Reason {
|
| 1050 |
+
case "ErrImagePull",
|
| 1051 |
+
"CreateContainerError",
|
| 1052 |
+
"CreateContainerConfigError",
|
| 1053 |
+
"InvalidImageName",
|
| 1054 |
+
"CrashLoopBackOff",
|
| 1055 |
+
"ImagePullBackOff":
|
| 1056 |
+
d <- fmt.Errorf("reason: %v, message: %v",
|
| 1057 |
+
status.State.Waiting.Reason,
|
| 1058 |
+
status.State.Waiting.Message)
|
| 1059 |
+
return
|
| 1060 |
+
default:
|
| 1061 |
+
continue
|
| 1062 |
+
}
|
| 1063 |
+
}
|
| 1064 |
+
}
|
| 1065 |
+
}
|
| 1066 |
+
}
|
| 1067 |
+
}()
|
| 1068 |
+
|
| 1069 |
+
return
|
| 1070 |
+
}
|
| 1071 |
+
|
| 1072 |
+
func setConfigDefaults(config *restclient.Config) error {
|
| 1073 |
+
gv := coreV1.SchemeGroupVersion
|
| 1074 |
+
config.GroupVersion = &gv
|
| 1075 |
+
config.APIPath = "/api"
|
| 1076 |
+
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
| 1077 |
+
|
| 1078 |
+
if config.UserAgent == "" {
|
| 1079 |
+
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
| 1080 |
+
}
|
| 1081 |
+
|
| 1082 |
+
return nil
|
| 1083 |
+
}
|
| 1084 |
+
|
| 1085 |
+
type addr struct{}
|
| 1086 |
+
|
| 1087 |
+
func (a addr) Network() string {
|
| 1088 |
+
return "pod-stdio"
|
| 1089 |
+
}
|
| 1090 |
+
|
| 1091 |
+
func (a addr) String() string {
|
| 1092 |
+
return "pod-stdio"
|
| 1093 |
+
}
|
| 1094 |
+
|
| 1095 |
+
type conn struct {
|
| 1096 |
+
pr *io.PipeReader
|
| 1097 |
+
pw *io.PipeWriter
|
| 1098 |
+
execDone <-chan struct{}
|
| 1099 |
+
}
|
| 1100 |
+
|
| 1101 |
+
func (c conn) Read(b []byte) (n int, err error) {
|
| 1102 |
+
return c.pr.Read(b)
|
| 1103 |
+
}
|
| 1104 |
+
|
| 1105 |
+
func (c conn) Write(b []byte) (n int, err error) {
|
| 1106 |
+
return c.pw.Write(b)
|
| 1107 |
+
}
|
| 1108 |
+
|
| 1109 |
+
func (c conn) Close() error {
|
| 1110 |
+
err := c.pw.Close()
|
| 1111 |
+
if err != nil {
|
| 1112 |
+
return fmt.Errorf("failed to close writer: %w", err)
|
| 1113 |
+
}
|
| 1114 |
+
<-c.execDone
|
| 1115 |
+
err = c.pr.Close()
|
| 1116 |
+
if err != nil {
|
| 1117 |
+
return fmt.Errorf("failed to close reader: %w", err)
|
| 1118 |
+
}
|
| 1119 |
+
return nil
|
| 1120 |
+
}
|
| 1121 |
+
|
| 1122 |
+
func (c conn) LocalAddr() net.Addr {
|
| 1123 |
+
return addr{}
|
| 1124 |
+
}
|
| 1125 |
+
|
| 1126 |
+
func (c conn) RemoteAddr() net.Addr {
|
| 1127 |
+
return addr{}
|
| 1128 |
+
}
|
| 1129 |
+
|
| 1130 |
+
func (c conn) SetDeadline(t time.Time) error { return nil }
|
| 1131 |
+
|
| 1132 |
+
func (c conn) SetReadDeadline(t time.Time) error { return nil }
|
| 1133 |
+
|
| 1134 |
+
func (c conn) SetWriteDeadline(t time.Time) error { return nil }
|
| 1135 |
+
|
| 1136 |
+
func newConn(execDone <-chan struct{}) (*io.PipeReader, *io.PipeWriter, conn) {
|
| 1137 |
+
pr0, pw0 := io.Pipe()
|
| 1138 |
+
pr1, pw1 := io.Pipe()
|
| 1139 |
+
rwc := conn{pr: pr0, pw: pw1, execDone: execDone}
|
| 1140 |
+
return pr1, pw0, rwc
|
| 1141 |
+
}
|
| 1142 |
+
|
| 1143 |
+
func NewLazyInitInClusterDialer() *lazyInitInClusterDialer {
|
| 1144 |
+
return &lazyInitInClusterDialer{}
|
| 1145 |
+
}
|
| 1146 |
+
|
| 1147 |
+
type lazyInitInClusterDialer struct {
|
| 1148 |
+
contextDialer *contextDialer
|
| 1149 |
+
initErr error
|
| 1150 |
+
o sync.Once
|
| 1151 |
+
}
|
| 1152 |
+
|
| 1153 |
+
func (l *lazyInitInClusterDialer) DialContext(ctx context.Context, network string, addr string) (net.Conn, error) {
|
| 1154 |
+
l.o.Do(func() {
|
| 1155 |
+
l.contextDialer, l.initErr = NewInClusterDialer(ctx)
|
| 1156 |
+
})
|
| 1157 |
+
if l.initErr != nil {
|
| 1158 |
+
return nil, l.initErr
|
| 1159 |
+
}
|
| 1160 |
+
return l.contextDialer.DialContext(ctx, network, addr)
|
| 1161 |
+
}
|
| 1162 |
+
|
| 1163 |
+
func (l *lazyInitInClusterDialer) Close() error {
|
| 1164 |
+
if l.contextDialer != nil {
|
| 1165 |
+
return l.contextDialer.Close()
|
| 1166 |
+
}
|
| 1167 |
+
return nil
|
| 1168 |
+
}
|
| 1169 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/task.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "synthesis-task-v1",
|
| 3 |
+
"task": {
|
| 4 |
+
"pair_id": "morefixes-110ab7950a2c0b2c6f28",
|
| 5 |
+
"dataset_id": "morefixes",
|
| 6 |
+
"dataset_item_id": "morefixes-110ab7950a2c0b2c6f28",
|
| 7 |
+
"project_id": "morefixes__knative__func",
|
| 8 |
+
"language": "go",
|
| 9 |
+
"backend": "codeql"
|
| 10 |
+
},
|
| 11 |
+
"changed_go_files": [
|
| 12 |
+
"cmd/root.go",
|
| 13 |
+
"cmd/root_test.go",
|
| 14 |
+
"k8s/dialer.go"
|
| 15 |
+
],
|
| 16 |
+
"patch_units": {
|
| 17 |
+
"before": [
|
| 18 |
+
"cmd/root.go",
|
| 19 |
+
"cmd/root_test.go",
|
| 20 |
+
"k8s/dialer.go"
|
| 21 |
+
],
|
| 22 |
+
"after": [
|
| 23 |
+
"cmd/root.go",
|
| 24 |
+
"cmd/root_test.go",
|
| 25 |
+
"k8s/dialer.go"
|
| 26 |
+
]
|
| 27 |
+
},
|
| 28 |
+
"runtime_assets": {
|
| 29 |
+
"before": {
|
| 30 |
+
"database": "assets/08284f23afbd2e56b5f3944acdb0c0975290472be54b872e2c20886e0b65c32f/database",
|
| 31 |
+
"cache_key": "08284f23afbd2e56b5f3944acdb0c0975290472be54b872e2c20886e0b65c32f",
|
| 32 |
+
"codeql_version": "2.26.4"
|
| 33 |
+
},
|
| 34 |
+
"after": {
|
| 35 |
+
"database": "assets/a8bac0a3442c882bbb51475fbca20f21b952efe6c1c0ac256b33e3ba4f4ea70c/database",
|
| 36 |
+
"cache_key": "a8bac0a3442c882bbb51475fbca20f21b952efe6c1c0ac256b33e3ba4f4ea70c",
|
| 37 |
+
"codeql_version": "2.26.4"
|
| 38 |
+
},
|
| 39 |
+
"refine": {
|
| 40 |
+
"database": "assets/b6216b5c2d77b05bec8f32b5782769a2951f4c42109340ba350a5ccabd90b13d/database",
|
| 41 |
+
"cache_key": "b6216b5c2d77b05bec8f32b5782769a2951f4c42109340ba350a5ccabd90b13d",
|
| 42 |
+
"codeql_version": "2.26.4"
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"benchmark_contract": {
|
| 46 |
+
"agent_visible": true,
|
| 47 |
+
"reference_query_location": "references/morefixes-110ab7950a2c0b2c6f28/query/ (do not mount into agent)",
|
| 48 |
+
"evaluator_location": "evaluator/morefixes-110ab7950a2c0b2c6f28/ (do not mount into agent)"
|
| 49 |
+
}
|
| 50 |
+
}
|
tasks/codeql_go_benchmark_top30_v1/morefixes-110ab7950a2c0b2c6f28/task_prompt.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Go CodeQL detector synthesis
|
| 2 |
+
|
| 3 |
+
You are cc operating in `/work`. Starting only from the supplied patch,
|
| 4 |
+
before/after Go context, CodeQL references, and validation tools, synthesize a semantic CodeQL
|
| 5 |
+
detector for the vulnerability fixed by the patch. This is one fresh session. You may iterate inside
|
| 6 |
+
this session, but no later framework repair or resume will occur.
|
| 7 |
+
|
| 8 |
+
## Inputs and owned outputs
|
| 9 |
+
|
| 10 |
+
- Read `patch.diff`, `go_patch.diff`, `pre_context.md`, and `post_context.md`.
|
| 11 |
+
- Read `references/codeql/convergence_protocol.md` and
|
| 12 |
+
`references/codeql/go_api.md` before experimenting. Read the remaining
|
| 13 |
+
`references/codeql/` files for the selected mechanism.
|
| 14 |
+
- Use `scripts/search_codeql_api.sh` to inspect the pinned official libraries when an API detail is
|
| 15 |
+
uncertain. Do not guess predicate names or build a large family of inspection queries.
|
| 16 |
+
- Complete the design contract in `state.json` and `scope_statement.md` before final validation.
|
| 17 |
+
- Replace `query/vulnerability.ql`; add only genuinely shared `.qll` helpers when useful. Keep the
|
| 18 |
+
fixed offline dependency in `query/qlpack.yml`.
|
| 19 |
+
- Preserve the exact `expected_query_id` from `config.json` as the query's sole `@id`. This
|
| 20 |
+
task-unique metadata must never be used in a query predicate.
|
| 21 |
+
- Use `scripts/compile_query.sh`, `scripts/run_before.sh`, and `scripts/run_after.sh`.
|
| 22 |
+
- Finish by writing `summary.json` with `status`, `query_path`, `query_kind`, `build_passed`,
|
| 23 |
+
`before_findings`, `after_findings`, `validation_completed`, and a concise `notes` field.
|
| 24 |
+
|
| 25 |
+
## Required reasoning contract
|
| 26 |
+
|
| 27 |
+
Before coding, record this mapping in `state.json`:
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
vulnerable operation / trigger / patch safety condition
|
| 31 |
+
→ CodeQL-observable evidence
|
| 32 |
+
→ syntax, control-flow, local value-flow, global taint/value-flow, or interprocedural mechanism
|
| 33 |
+
→ source, sink/report site, guard/barrier and query predicates
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Choose the lowest mechanism that can actually prove the condition. Guard-sensitive patches require
|
| 37 |
+
real path/control-flow semantics; provenance-sensitive patches require value flow. Do not replace
|
| 38 |
+
either with source-text matching or with the mere presence of patch-added syntax.
|
| 39 |
+
|
| 40 |
+
## Mandatory convergence contract
|
| 41 |
+
|
| 42 |
+
The rollout has a 50-minute hard wall-clock ceiling and must be finalized by minute 43. Minutes
|
| 43 |
+
43–50 are an emergency shutdown buffer, not exploration time. A sophisticated unfinished query is
|
| 44 |
+
a failure; an early compilable semantic candidate can be improved. Follow the checkpoints in
|
| 45 |
+
`references/codeql/convergence_protocol.md`:
|
| 46 |
+
|
| 47 |
+
1. Record the mechanism contract, then replace the placeholder in `query/vulnerability.ql`
|
| 48 |
+
immediately. Do not wait until every CodeQL API detail is known.
|
| 49 |
+
2. Use at most three distinct scratch `.ql` files. Prefer repeatedly editing one
|
| 50 |
+
`query/scratch.ql`. After two failed variants of one API assumption, inspect the exact bundled
|
| 51 |
+
definition with `scripts/search_codeql_api.sh` or simplify the mechanism.
|
| 52 |
+
3. Obtain a compiling minimal main query before broadening it. Compile the main query after every
|
| 53 |
+
meaningful mechanism change.
|
| 54 |
+
4. Move in order from compile → relevant before finding → after elimination → final contract. Do
|
| 55 |
+
not continue API exploration after the intended before/after differential is established.
|
| 56 |
+
5. Run `scripts/check_progress.sh` at each checkpoint. It reports elapsed time, the minute-43
|
| 57 |
+
finalization deadline, and the minute-50 hard timeout. When it prints `finalize_now`, stop all
|
| 58 |
+
exploration, preserve the best compiling query, finish the contract files, and exit.
|
| 59 |
+
|
| 60 |
+
## Semantic and generalization rules
|
| 61 |
+
|
| 62 |
+
- Report at the vulnerable call, operator, access, or sink.
|
| 63 |
+
- Do not use a patch-local path, line, commit hash, label, or local variable name as the primary
|
| 64 |
+
matching condition. Stable library/framework APIs or public project APIs are allowed only when
|
| 65 |
+
`scope_statement.md` explains why they define the intended vulnerability family.
|
| 66 |
+
- The safety condition introduced by the patch must be represented by the query.
|
| 67 |
+
- A lower after warning count is not enough: inspect SARIF and ensure at least one intended before
|
| 68 |
+
finding is in a patch-overlapping semantic unit and the corresponding finding disappears after.
|
| 69 |
+
- Avoid broad proxy queries that report an enclosing function or unrelated API merely because it
|
| 70 |
+
changed in the patch.
|
| 71 |
+
|
| 72 |
+
## Final validation protocol
|
| 73 |
+
|
| 74 |
+
1. Compile the final query.
|
| 75 |
+
2. Run it on before and inspect `raw/before.sarif` for the intended report location.
|
| 76 |
+
3. Run the identical query on after and inspect `raw/after.sarif`.
|
| 77 |
+
4. Recheck query metadata, query kind/select signature, report locality, design-to-code consistency,
|
| 78 |
+
and absence of patch-local hardcoding.
|
| 79 |
+
5. Update `state.json`, `scope_statement.md`, and write valid `summary.json`.
|
| 80 |
+
|
| 81 |
+
Do not modify the runtime databases, references, patch, context, or validation scripts except for
|
| 82 |
+
normal CodeQL-generated database caches produced by the provided run scripts.
|
tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/patch.diff
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/internal/auth/sasl.go b/internal/auth/sasl.go
|
| 2 |
+
index 06417ce..2103ab7 100644
|
| 3 |
+
--- a/internal/auth/sasl.go
|
| 4 |
+
+++ b/internal/auth/sasl.go
|
| 5 |
+
@@ -81,6 +81,9 @@ func (s *SASLAuth) CreateSASL(mech string, remoteAddr net.Addr, successCb func(i
|
| 6 |
+
if identity == "" {
|
| 7 |
+
identity = username
|
| 8 |
+
}
|
| 9 |
+
+ if identity != username {
|
| 10 |
+
+ return ErrInvalidAuthCred
|
| 11 |
+
+ }
|
| 12 |
+
|
| 13 |
+
err := s.AuthPlain(username, password)
|
| 14 |
+
if err != nil {
|
| 15 |
+
diff --git a/internal/auth/sasl_test.go b/internal/auth/sasl_test.go
|
| 16 |
+
index 625f0bb..fcc193a 100644
|
| 17 |
+
--- a/internal/auth/sasl_test.go
|
| 18 |
+
+++ b/internal/auth/sasl_test.go
|
| 19 |
+
@@ -75,13 +75,13 @@ func TestCreateSASL(t *testing.T) {
|
| 20 |
+
|
| 21 |
+
t.Run("PLAIN with authorization identity", func(t *testing.T) {
|
| 22 |
+
srv := a.CreateSASL("PLAIN", &net.TCPAddr{}, func(id string) error {
|
| 23 |
+
- if id != "user1a" {
|
| 24 |
+
+ if id != "user1" {
|
| 25 |
+
t.Fatal("Wrong authorization identity passed:", id)
|
| 26 |
+
}
|
| 27 |
+
return nil
|
| 28 |
+
})
|
| 29 |
+
|
| 30 |
+
- _, _, err := srv.Next([]byte("user1a\x00user1\x00aa"))
|
| 31 |
+
+ _, _, err := srv.Next([]byte("user1\x00user1\x00aa"))
|
| 32 |
+
if err != nil {
|
| 33 |
+
t.Error("Unexpected error:", err)
|
| 34 |
+
}
|
tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/post_context.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context after the fix
|
| 2 |
+
|
| 3 |
+
## `internal/auth/sasl.go` (changed lines (84, 85, 86))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
/*
|
| 7 |
+
Maddy Mail Server - Composable all-in-one email server.
|
| 8 |
+
Copyright © 2019-2020 Max Mazurov <fox.cpp@disroot.org>, Maddy Mail Server contributors
|
| 9 |
+
|
| 10 |
+
This program is free software: you can redistribute it and/or modify
|
| 11 |
+
it under the terms of the GNU General Public License as published by
|
| 12 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 13 |
+
(at your option) any later version.
|
| 14 |
+
|
| 15 |
+
This program is distributed in the hope that it will be useful,
|
| 16 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 17 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 18 |
+
GNU General Public License for more details.
|
| 19 |
+
|
| 20 |
+
You should have received a copy of the GNU General Public License
|
| 21 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
package auth
|
| 25 |
+
|
| 26 |
+
import (
|
| 27 |
+
"errors"
|
| 28 |
+
"fmt"
|
| 29 |
+
"net"
|
| 30 |
+
|
| 31 |
+
"github.com/emersion/go-sasl"
|
| 32 |
+
"github.com/foxcpp/maddy/framework/config"
|
| 33 |
+
modconfig "github.com/foxcpp/maddy/framework/config/module"
|
| 34 |
+
"github.com/foxcpp/maddy/framework/log"
|
| 35 |
+
"github.com/foxcpp/maddy/framework/module"
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
var (
|
| 39 |
+
ErrUnsupportedMech = errors.New("Unsupported SASL mechanism")
|
| 40 |
+
ErrInvalidAuthCred = errors.New("auth: invalid credentials")
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
// SASLAuth is a wrapper that initializes sasl.Server using authenticators that
|
| 44 |
+
// call maddy module objects.
|
| 45 |
+
//
|
| 46 |
+
// It supports reporting of multiple authorization identities so multiple
|
| 47 |
+
// accounts can be associated with a single set of credentials.
|
| 48 |
+
type SASLAuth struct {
|
| 49 |
+
Log log.Logger
|
| 50 |
+
OnlyFirstID bool
|
| 51 |
+
|
| 52 |
+
Plain []module.PlainAuth
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
func (s *SASLAuth) SASLMechanisms() []string {
|
| 56 |
+
var mechs []string
|
| 57 |
+
|
| 58 |
+
if len(s.Plain) != 0 {
|
| 59 |
+
mechs = append(mechs, sasl.Plain, sasl.Login)
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
return mechs
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
func (s *SASLAuth) AuthPlain(username, password string) error {
|
| 66 |
+
if len(s.Plain) == 0 {
|
| 67 |
+
return ErrUnsupportedMech
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
var lastErr error
|
| 71 |
+
for _, p := range s.Plain {
|
| 72 |
+
lastErr = p.AuthPlain(username, password)
|
| 73 |
+
if lastErr == nil {
|
| 74 |
+
return nil
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
return fmt.Errorf("no auth. provider accepted creds, last err: %w", lastErr)
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// CreateSASL creates the sasl.Server instance for the corresponding mechanism.
|
| 82 |
+
func (s *SASLAuth) CreateSASL(mech string, remoteAddr net.Addr, successCb func(identity string) error) sasl.Server {
|
| 83 |
+
switch mech {
|
| 84 |
+
case sasl.Plain:
|
| 85 |
+
return sasl.NewPlainServer(func(identity, username, password string) error {
|
| 86 |
+
if identity == "" {
|
| 87 |
+
identity = username
|
| 88 |
+
}
|
| 89 |
+
if identity != username {
|
| 90 |
+
return ErrInvalidAuthCred
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
err := s.AuthPlain(username, password)
|
| 94 |
+
if err != nil {
|
| 95 |
+
s.Log.Error("authentication failed", err, "username", username, "src_ip", remoteAddr)
|
| 96 |
+
return ErrInvalidAuthCred
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
return successCb(identity)
|
| 100 |
+
})
|
| 101 |
+
case sasl.Login:
|
| 102 |
+
return sasl.NewLoginServer(func(username, password string) error {
|
| 103 |
+
err := s.AuthPlain(username, password)
|
| 104 |
+
if err != nil {
|
| 105 |
+
s.Log.Error("authentication failed", err, "username", username, "src_ip", remoteAddr)
|
| 106 |
+
return ErrInvalidAuthCred
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
return successCb(username)
|
| 110 |
+
})
|
| 111 |
+
}
|
| 112 |
+
return FailingSASLServ{Err: ErrUnsupportedMech}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
// AddProvider adds the SASL authentication provider to its mapping by parsing
|
| 116 |
+
// the 'auth' configuration directive.
|
| 117 |
+
func (s *SASLAuth) AddProvider(m *config.Map, node config.Node) error {
|
| 118 |
+
var any interface{}
|
| 119 |
+
if err := modconfig.ModuleFromNode("auth", node.Args, node, m.Globals, &any); err != nil {
|
| 120 |
+
return err
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
hasAny := false
|
| 124 |
+
if plainAuth, ok := any.(module.PlainAuth); ok {
|
| 125 |
+
s.Plain = append(s.Plain, plainAuth)
|
| 126 |
+
hasAny = true
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
if !hasAny {
|
| 130 |
+
return config.NodeErr(node, "auth: specified module does not provide any SASL mechanism")
|
| 131 |
+
}
|
| 132 |
+
return nil
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
type FailingSASLServ struct{ Err error }
|
| 136 |
+
|
| 137 |
+
func (s FailingSASLServ) Next([]byte) ([]byte, bool, error) {
|
| 138 |
+
return nil, true, s.Err
|
| 139 |
+
}
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
## `internal/auth/sasl_test.go` (changed lines (78, 84))
|
| 143 |
+
|
| 144 |
+
```go
|
| 145 |
+
/*
|
| 146 |
+
Maddy Mail Server - Composable all-in-one email server.
|
| 147 |
+
Copyright © 2019-2020 Max Mazurov <fox.cpp@disroot.org>, Maddy Mail Server contributors
|
| 148 |
+
|
| 149 |
+
This program is free software: you can redistribute it and/or modify
|
| 150 |
+
it under the terms of the GNU General Public License as published by
|
| 151 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 152 |
+
(at your option) any later version.
|
| 153 |
+
|
| 154 |
+
This program is distributed in the hope that it will be useful,
|
| 155 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 156 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 157 |
+
GNU General Public License for more details.
|
| 158 |
+
|
| 159 |
+
You should have received a copy of the GNU General Public License
|
| 160 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 161 |
+
*/
|
| 162 |
+
|
| 163 |
+
package auth
|
| 164 |
+
|
| 165 |
+
import (
|
| 166 |
+
"errors"
|
| 167 |
+
"net"
|
| 168 |
+
"testing"
|
| 169 |
+
|
| 170 |
+
"github.com/foxcpp/maddy/framework/module"
|
| 171 |
+
"github.com/foxcpp/maddy/internal/testutils"
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
type mockAuth struct {
|
| 175 |
+
db map[string]bool
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
func (m mockAuth) AuthPlain(username, _ string) error {
|
| 179 |
+
ok := m.db[username]
|
| 180 |
+
if !ok {
|
| 181 |
+
return errors.New("invalid creds")
|
| 182 |
+
}
|
| 183 |
+
return nil
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
func TestCreateSASL(t *testing.T) {
|
| 187 |
+
a := SASLAuth{
|
| 188 |
+
Log: testutils.Logger(t, "saslauth"),
|
| 189 |
+
Plain: []module.PlainAuth{
|
| 190 |
+
&mockAuth{
|
| 191 |
+
db: map[string]bool{
|
| 192 |
+
"user1": true,
|
| 193 |
+
},
|
| 194 |
+
},
|
| 195 |
+
},
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
t.Run("XWHATEVER", func(t *testing.T) {
|
| 199 |
+
srv := a.CreateSASL("XWHATEVER", &net.TCPAddr{}, func(string) error { return nil })
|
| 200 |
+
_, _, err := srv.Next([]byte(""))
|
| 201 |
+
if err == nil {
|
| 202 |
+
t.Error("No error for XWHATEVER use")
|
| 203 |
+
}
|
| 204 |
+
})
|
| 205 |
+
|
| 206 |
+
t.Run("PLAIN", func(t *testing.T) {
|
| 207 |
+
srv := a.CreateSASL("PLAIN", &net.TCPAddr{}, func(id string) error {
|
| 208 |
+
if id != "user1" {
|
| 209 |
+
t.Fatal("Wrong auth. identities passed to callback:", id)
|
| 210 |
+
}
|
| 211 |
+
return nil
|
| 212 |
+
})
|
| 213 |
+
|
| 214 |
+
_, _, err := srv.Next([]byte("\x00user1\x00aa"))
|
| 215 |
+
if err != nil {
|
| 216 |
+
t.Error("Unexpected error:", err)
|
| 217 |
+
}
|
| 218 |
+
})
|
| 219 |
+
|
| 220 |
+
t.Run("PLAIN with authorization identity", func(t *testing.T) {
|
| 221 |
+
srv := a.CreateSASL("PLAIN", &net.TCPAddr{}, func(id string) error {
|
| 222 |
+
if id != "user1" {
|
| 223 |
+
t.Fatal("Wrong authorization identity passed:", id)
|
| 224 |
+
}
|
| 225 |
+
return nil
|
| 226 |
+
})
|
| 227 |
+
|
| 228 |
+
_, _, err := srv.Next([]byte("user1\x00user1\x00aa"))
|
| 229 |
+
if err != nil {
|
| 230 |
+
t.Error("Unexpected error:", err)
|
| 231 |
+
}
|
| 232 |
+
})
|
| 233 |
+
}
|
| 234 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/pre_context.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context before the fix
|
| 2 |
+
|
| 3 |
+
## `internal/auth/sasl.go` (changed lines (84,))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
/*
|
| 7 |
+
Maddy Mail Server - Composable all-in-one email server.
|
| 8 |
+
Copyright © 2019-2020 Max Mazurov <fox.cpp@disroot.org>, Maddy Mail Server contributors
|
| 9 |
+
|
| 10 |
+
This program is free software: you can redistribute it and/or modify
|
| 11 |
+
it under the terms of the GNU General Public License as published by
|
| 12 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 13 |
+
(at your option) any later version.
|
| 14 |
+
|
| 15 |
+
This program is distributed in the hope that it will be useful,
|
| 16 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 17 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 18 |
+
GNU General Public License for more details.
|
| 19 |
+
|
| 20 |
+
You should have received a copy of the GNU General Public License
|
| 21 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
package auth
|
| 25 |
+
|
| 26 |
+
import (
|
| 27 |
+
"errors"
|
| 28 |
+
"fmt"
|
| 29 |
+
"net"
|
| 30 |
+
|
| 31 |
+
"github.com/emersion/go-sasl"
|
| 32 |
+
"github.com/foxcpp/maddy/framework/config"
|
| 33 |
+
modconfig "github.com/foxcpp/maddy/framework/config/module"
|
| 34 |
+
"github.com/foxcpp/maddy/framework/log"
|
| 35 |
+
"github.com/foxcpp/maddy/framework/module"
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
var (
|
| 39 |
+
ErrUnsupportedMech = errors.New("Unsupported SASL mechanism")
|
| 40 |
+
ErrInvalidAuthCred = errors.New("auth: invalid credentials")
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
// SASLAuth is a wrapper that initializes sasl.Server using authenticators that
|
| 44 |
+
// call maddy module objects.
|
| 45 |
+
//
|
| 46 |
+
// It supports reporting of multiple authorization identities so multiple
|
| 47 |
+
// accounts can be associated with a single set of credentials.
|
| 48 |
+
type SASLAuth struct {
|
| 49 |
+
Log log.Logger
|
| 50 |
+
OnlyFirstID bool
|
| 51 |
+
|
| 52 |
+
Plain []module.PlainAuth
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
func (s *SASLAuth) SASLMechanisms() []string {
|
| 56 |
+
var mechs []string
|
| 57 |
+
|
| 58 |
+
if len(s.Plain) != 0 {
|
| 59 |
+
mechs = append(mechs, sasl.Plain, sasl.Login)
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
return mechs
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
func (s *SASLAuth) AuthPlain(username, password string) error {
|
| 66 |
+
if len(s.Plain) == 0 {
|
| 67 |
+
return ErrUnsupportedMech
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
var lastErr error
|
| 71 |
+
for _, p := range s.Plain {
|
| 72 |
+
lastErr = p.AuthPlain(username, password)
|
| 73 |
+
if lastErr == nil {
|
| 74 |
+
return nil
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
return fmt.Errorf("no auth. provider accepted creds, last err: %w", lastErr)
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// CreateSASL creates the sasl.Server instance for the corresponding mechanism.
|
| 82 |
+
func (s *SASLAuth) CreateSASL(mech string, remoteAddr net.Addr, successCb func(identity string) error) sasl.Server {
|
| 83 |
+
switch mech {
|
| 84 |
+
case sasl.Plain:
|
| 85 |
+
return sasl.NewPlainServer(func(identity, username, password string) error {
|
| 86 |
+
if identity == "" {
|
| 87 |
+
identity = username
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
err := s.AuthPlain(username, password)
|
| 91 |
+
if err != nil {
|
| 92 |
+
s.Log.Error("authentication failed", err, "username", username, "src_ip", remoteAddr)
|
| 93 |
+
return ErrInvalidAuthCred
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
return successCb(identity)
|
| 97 |
+
})
|
| 98 |
+
case sasl.Login:
|
| 99 |
+
return sasl.NewLoginServer(func(username, password string) error {
|
| 100 |
+
err := s.AuthPlain(username, password)
|
| 101 |
+
if err != nil {
|
| 102 |
+
s.Log.Error("authentication failed", err, "username", username, "src_ip", remoteAddr)
|
| 103 |
+
return ErrInvalidAuthCred
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
return successCb(username)
|
| 107 |
+
})
|
| 108 |
+
}
|
| 109 |
+
return FailingSASLServ{Err: ErrUnsupportedMech}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
// AddProvider adds the SASL authentication provider to its mapping by parsing
|
| 113 |
+
// the 'auth' configuration directive.
|
| 114 |
+
func (s *SASLAuth) AddProvider(m *config.Map, node config.Node) error {
|
| 115 |
+
var any interface{}
|
| 116 |
+
if err := modconfig.ModuleFromNode("auth", node.Args, node, m.Globals, &any); err != nil {
|
| 117 |
+
return err
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
hasAny := false
|
| 121 |
+
if plainAuth, ok := any.(module.PlainAuth); ok {
|
| 122 |
+
s.Plain = append(s.Plain, plainAuth)
|
| 123 |
+
hasAny = true
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
if !hasAny {
|
| 127 |
+
return config.NodeErr(node, "auth: specified module does not provide any SASL mechanism")
|
| 128 |
+
}
|
| 129 |
+
return nil
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
type FailingSASLServ struct{ Err error }
|
| 133 |
+
|
| 134 |
+
func (s FailingSASLServ) Next([]byte) ([]byte, bool, error) {
|
| 135 |
+
return nil, true, s.Err
|
| 136 |
+
}
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
## `internal/auth/sasl_test.go` (changed lines (78, 79, 84, 85))
|
| 140 |
+
|
| 141 |
+
```go
|
| 142 |
+
/*
|
| 143 |
+
Maddy Mail Server - Composable all-in-one email server.
|
| 144 |
+
Copyright © 2019-2020 Max Mazurov <fox.cpp@disroot.org>, Maddy Mail Server contributors
|
| 145 |
+
|
| 146 |
+
This program is free software: you can redistribute it and/or modify
|
| 147 |
+
it under the terms of the GNU General Public License as published by
|
| 148 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 149 |
+
(at your option) any later version.
|
| 150 |
+
|
| 151 |
+
This program is distributed in the hope that it will be useful,
|
| 152 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 153 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 154 |
+
GNU General Public License for more details.
|
| 155 |
+
|
| 156 |
+
You should have received a copy of the GNU General Public License
|
| 157 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 158 |
+
*/
|
| 159 |
+
|
| 160 |
+
package auth
|
| 161 |
+
|
| 162 |
+
import (
|
| 163 |
+
"errors"
|
| 164 |
+
"net"
|
| 165 |
+
"testing"
|
| 166 |
+
|
| 167 |
+
"github.com/foxcpp/maddy/framework/module"
|
| 168 |
+
"github.com/foxcpp/maddy/internal/testutils"
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
type mockAuth struct {
|
| 172 |
+
db map[string]bool
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
func (m mockAuth) AuthPlain(username, _ string) error {
|
| 176 |
+
ok := m.db[username]
|
| 177 |
+
if !ok {
|
| 178 |
+
return errors.New("invalid creds")
|
| 179 |
+
}
|
| 180 |
+
return nil
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
func TestCreateSASL(t *testing.T) {
|
| 184 |
+
a := SASLAuth{
|
| 185 |
+
Log: testutils.Logger(t, "saslauth"),
|
| 186 |
+
Plain: []module.PlainAuth{
|
| 187 |
+
&mockAuth{
|
| 188 |
+
db: map[string]bool{
|
| 189 |
+
"user1": true,
|
| 190 |
+
},
|
| 191 |
+
},
|
| 192 |
+
},
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
t.Run("XWHATEVER", func(t *testing.T) {
|
| 196 |
+
srv := a.CreateSASL("XWHATEVER", &net.TCPAddr{}, func(string) error { return nil })
|
| 197 |
+
_, _, err := srv.Next([]byte(""))
|
| 198 |
+
if err == nil {
|
| 199 |
+
t.Error("No error for XWHATEVER use")
|
| 200 |
+
}
|
| 201 |
+
})
|
| 202 |
+
|
| 203 |
+
t.Run("PLAIN", func(t *testing.T) {
|
| 204 |
+
srv := a.CreateSASL("PLAIN", &net.TCPAddr{}, func(id string) error {
|
| 205 |
+
if id != "user1" {
|
| 206 |
+
t.Fatal("Wrong auth. identities passed to callback:", id)
|
| 207 |
+
}
|
| 208 |
+
return nil
|
| 209 |
+
})
|
| 210 |
+
|
| 211 |
+
_, _, err := srv.Next([]byte("\x00user1\x00aa"))
|
| 212 |
+
if err != nil {
|
| 213 |
+
t.Error("Unexpected error:", err)
|
| 214 |
+
}
|
| 215 |
+
})
|
| 216 |
+
|
| 217 |
+
t.Run("PLAIN with authorization identity", func(t *testing.T) {
|
| 218 |
+
srv := a.CreateSASL("PLAIN", &net.TCPAddr{}, func(id string) error {
|
| 219 |
+
if id != "user1a" {
|
| 220 |
+
t.Fatal("Wrong authorization identity passed:", id)
|
| 221 |
+
}
|
| 222 |
+
return nil
|
| 223 |
+
})
|
| 224 |
+
|
| 225 |
+
_, _, err := srv.Next([]byte("user1a\x00user1\x00aa"))
|
| 226 |
+
if err != nil {
|
| 227 |
+
t.Error("Unexpected error:", err)
|
| 228 |
+
}
|
| 229 |
+
})
|
| 230 |
+
}
|
| 231 |
+
```
|
tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/task.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "synthesis-task-v1",
|
| 3 |
+
"task": {
|
| 4 |
+
"pair_id": "morefixes-1218ce956f8120d59555",
|
| 5 |
+
"dataset_id": "morefixes",
|
| 6 |
+
"dataset_item_id": "morefixes-1218ce956f8120d59555",
|
| 7 |
+
"project_id": "morefixes__foxcpp__maddy",
|
| 8 |
+
"language": "go",
|
| 9 |
+
"backend": "codeql"
|
| 10 |
+
},
|
| 11 |
+
"changed_go_files": [
|
| 12 |
+
"internal/auth/sasl.go",
|
| 13 |
+
"internal/auth/sasl_test.go"
|
| 14 |
+
],
|
| 15 |
+
"patch_units": {
|
| 16 |
+
"before": [
|
| 17 |
+
"internal/auth/sasl.go",
|
| 18 |
+
"internal/auth/sasl_test.go"
|
| 19 |
+
],
|
| 20 |
+
"after": [
|
| 21 |
+
"internal/auth/sasl.go",
|
| 22 |
+
"internal/auth/sasl_test.go"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
"runtime_assets": {
|
| 26 |
+
"before": {
|
| 27 |
+
"database": "assets/297a2997b5dbaf0c3f2ec5bd076a5c48f0f78f39868fa1885a46527d767c2b57/database",
|
| 28 |
+
"cache_key": "297a2997b5dbaf0c3f2ec5bd076a5c48f0f78f39868fa1885a46527d767c2b57",
|
| 29 |
+
"codeql_version": "2.26.4"
|
| 30 |
+
},
|
| 31 |
+
"after": {
|
| 32 |
+
"database": "assets/7100a54fd5d68f59a609a4c488783ac815450be284e9be4fcbcf7bec2f8f9ff2/database",
|
| 33 |
+
"cache_key": "7100a54fd5d68f59a609a4c488783ac815450be284e9be4fcbcf7bec2f8f9ff2",
|
| 34 |
+
"codeql_version": "2.26.4"
|
| 35 |
+
},
|
| 36 |
+
"refine": {
|
| 37 |
+
"database": "assets/4d3b2f52ade6fd693fb89b668e2930cde2c10d683d8746040152bcbd1b0c9b08/database",
|
| 38 |
+
"cache_key": "4d3b2f52ade6fd693fb89b668e2930cde2c10d683d8746040152bcbd1b0c9b08",
|
| 39 |
+
"codeql_version": "2.26.4"
|
| 40 |
+
}
|
| 41 |
+
},
|
| 42 |
+
"benchmark_contract": {
|
| 43 |
+
"agent_visible": true,
|
| 44 |
+
"reference_query_location": "references/morefixes-1218ce956f8120d59555/query/ (do not mount into agent)",
|
| 45 |
+
"evaluator_location": "evaluator/morefixes-1218ce956f8120d59555/ (do not mount into agent)"
|
| 46 |
+
}
|
| 47 |
+
}
|
tasks/codeql_go_benchmark_top30_v1/morefixes-1218ce956f8120d59555/task_prompt.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Go CodeQL detector synthesis
|
| 2 |
+
|
| 3 |
+
You are cc operating in `/work`. Starting only from the supplied patch,
|
| 4 |
+
before/after Go context, CodeQL references, and validation tools, synthesize a semantic CodeQL
|
| 5 |
+
detector for the vulnerability fixed by the patch. This is one fresh session. You may iterate inside
|
| 6 |
+
this session, but no later framework repair or resume will occur.
|
| 7 |
+
|
| 8 |
+
## Inputs and owned outputs
|
| 9 |
+
|
| 10 |
+
- Read `patch.diff`, `go_patch.diff`, `pre_context.md`, and `post_context.md`.
|
| 11 |
+
- Read `references/codeql/convergence_protocol.md` and
|
| 12 |
+
`references/codeql/go_api.md` before experimenting. Read the remaining
|
| 13 |
+
`references/codeql/` files for the selected mechanism.
|
| 14 |
+
- Use `scripts/search_codeql_api.sh` to inspect the pinned official libraries when an API detail is
|
| 15 |
+
uncertain. Do not guess predicate names or build a large family of inspection queries.
|
| 16 |
+
- Complete the design contract in `state.json` and `scope_statement.md` before final validation.
|
| 17 |
+
- Replace `query/vulnerability.ql`; add only genuinely shared `.qll` helpers when useful. Keep the
|
| 18 |
+
fixed offline dependency in `query/qlpack.yml`.
|
| 19 |
+
- Preserve the exact `expected_query_id` from `config.json` as the query's sole `@id`. This
|
| 20 |
+
task-unique metadata must never be used in a query predicate.
|
| 21 |
+
- Use `scripts/compile_query.sh`, `scripts/run_before.sh`, and `scripts/run_after.sh`.
|
| 22 |
+
- Finish by writing `summary.json` with `status`, `query_path`, `query_kind`, `build_passed`,
|
| 23 |
+
`before_findings`, `after_findings`, `validation_completed`, and a concise `notes` field.
|
| 24 |
+
|
| 25 |
+
## Required reasoning contract
|
| 26 |
+
|
| 27 |
+
Before coding, record this mapping in `state.json`:
|
| 28 |
+
|
| 29 |
+
```text
|
| 30 |
+
vulnerable operation / trigger / patch safety condition
|
| 31 |
+
→ CodeQL-observable evidence
|
| 32 |
+
→ syntax, control-flow, local value-flow, global taint/value-flow, or interprocedural mechanism
|
| 33 |
+
→ source, sink/report site, guard/barrier and query predicates
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Choose the lowest mechanism that can actually prove the condition. Guard-sensitive patches require
|
| 37 |
+
real path/control-flow semantics; provenance-sensitive patches require value flow. Do not replace
|
| 38 |
+
either with source-text matching or with the mere presence of patch-added syntax.
|
| 39 |
+
|
| 40 |
+
## Mandatory convergence contract
|
| 41 |
+
|
| 42 |
+
The rollout has a 50-minute hard wall-clock ceiling and must be finalized by minute 43. Minutes
|
| 43 |
+
43–50 are an emergency shutdown buffer, not exploration time. A sophisticated unfinished query is
|
| 44 |
+
a failure; an early compilable semantic candidate can be improved. Follow the checkpoints in
|
| 45 |
+
`references/codeql/convergence_protocol.md`:
|
| 46 |
+
|
| 47 |
+
1. Record the mechanism contract, then replace the placeholder in `query/vulnerability.ql`
|
| 48 |
+
immediately. Do not wait until every CodeQL API detail is known.
|
| 49 |
+
2. Use at most three distinct scratch `.ql` files. Prefer repeatedly editing one
|
| 50 |
+
`query/scratch.ql`. After two failed variants of one API assumption, inspect the exact bundled
|
| 51 |
+
definition with `scripts/search_codeql_api.sh` or simplify the mechanism.
|
| 52 |
+
3. Obtain a compiling minimal main query before broadening it. Compile the main query after every
|
| 53 |
+
meaningful mechanism change.
|
| 54 |
+
4. Move in order from compile → relevant before finding → after elimination → final contract. Do
|
| 55 |
+
not continue API exploration after the intended before/after differential is established.
|
| 56 |
+
5. Run `scripts/check_progress.sh` at each checkpoint. It reports elapsed time, the minute-43
|
| 57 |
+
finalization deadline, and the minute-50 hard timeout. When it prints `finalize_now`, stop all
|
| 58 |
+
exploration, preserve the best compiling query, finish the contract files, and exit.
|
| 59 |
+
|
| 60 |
+
## Semantic and generalization rules
|
| 61 |
+
|
| 62 |
+
- Report at the vulnerable call, operator, access, or sink.
|
| 63 |
+
- Do not use a patch-local path, line, commit hash, label, or local variable name as the primary
|
| 64 |
+
matching condition. Stable library/framework APIs or public project APIs are allowed only when
|
| 65 |
+
`scope_statement.md` explains why they define the intended vulnerability family.
|
| 66 |
+
- The safety condition introduced by the patch must be represented by the query.
|
| 67 |
+
- A lower after warning count is not enough: inspect SARIF and ensure at least one intended before
|
| 68 |
+
finding is in a patch-overlapping semantic unit and the corresponding finding disappears after.
|
| 69 |
+
- Avoid broad proxy queries that report an enclosing function or unrelated API merely because it
|
| 70 |
+
changed in the patch.
|
| 71 |
+
|
| 72 |
+
## Final validation protocol
|
| 73 |
+
|
| 74 |
+
1. Compile the final query.
|
| 75 |
+
2. Run it on before and inspect `raw/before.sarif` for the intended report location.
|
| 76 |
+
3. Run the identical query on after and inspect `raw/after.sarif`.
|
| 77 |
+
4. Recheck query metadata, query kind/select signature, report locality, design-to-code consistency,
|
| 78 |
+
and absence of patch-local hardcoding.
|
| 79 |
+
5. Update `state.json`, `scope_statement.md`, and write valid `summary.json`.
|
| 80 |
+
|
| 81 |
+
Do not modify the runtime databases, references, patch, context, or validation scripts except for
|
| 82 |
+
normal CodeQL-generated database caches produced by the provided run scripts.
|
tasks/codeql_go_benchmark_top30_v1/morefixes-14446e68cdc53bc98807/patch.diff
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/internal/handlers/userinfo.go b/internal/handlers/userinfo.go
|
| 2 |
+
index c430d4f85..fa30e5683 100644
|
| 3 |
+
--- a/internal/handlers/userinfo.go
|
| 4 |
+
+++ b/internal/handlers/userinfo.go
|
| 5 |
+
@@ -1,11 +1,8 @@
|
| 6 |
+
package handlers
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
- "encoding/json"
|
| 10 |
+
"net/http"
|
| 11 |
+
|
| 12 |
+
- "google.golang.org/protobuf/encoding/protojson"
|
| 13 |
+
-
|
| 14 |
+
"github.com/pomerium/datasource/pkg/directory"
|
| 15 |
+
"github.com/pomerium/pomerium/internal/httputil"
|
| 16 |
+
"github.com/pomerium/pomerium/pkg/grpc/identity"
|
| 17 |
+
@@ -39,15 +36,9 @@ func (data UserInfoData) ToJSON() map[string]any {
|
| 18 |
+
m := map[string]any{}
|
| 19 |
+
m["csrfToken"] = data.CSRFToken
|
| 20 |
+
m["isImpersonated"] = data.IsImpersonated
|
| 21 |
+
- if bs, err := protojson.Marshal(data.Session); err == nil {
|
| 22 |
+
- m["session"] = json.RawMessage(bs)
|
| 23 |
+
- }
|
| 24 |
+
- if bs, err := protojson.Marshal(data.User); err == nil {
|
| 25 |
+
- m["user"] = json.RawMessage(bs)
|
| 26 |
+
- }
|
| 27 |
+
- if bs, err := protojson.Marshal(data.Profile); err == nil {
|
| 28 |
+
- m["profile"] = json.RawMessage(bs)
|
| 29 |
+
- }
|
| 30 |
+
+ m["session"] = data.sessionJSON()
|
| 31 |
+
+ m["user"] = data.userJSON()
|
| 32 |
+
+ m["profile"] = data.profileJSON()
|
| 33 |
+
m["isEnterprise"] = data.IsEnterprise
|
| 34 |
+
if data.DirectoryUser != nil {
|
| 35 |
+
m["directoryUser"] = data.DirectoryUser
|
| 36 |
+
@@ -62,6 +53,62 @@ func (data UserInfoData) ToJSON() map[string]any {
|
| 37 |
+
return m
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
+func (data UserInfoData) profileJSON() map[string]any {
|
| 41 |
+
+ if data.Profile == nil {
|
| 42 |
+
+ return nil
|
| 43 |
+
+ }
|
| 44 |
+
+
|
| 45 |
+
+ m := map[string]any{}
|
| 46 |
+
+ claims := make(map[string]any)
|
| 47 |
+
+ for k, v := range data.Profile.GetClaims().AsMap() {
|
| 48 |
+
+ claims[k] = v
|
| 49 |
+
+ }
|
| 50 |
+
+ m["claims"] = m
|
| 51 |
+
+ return m
|
| 52 |
+
+}
|
| 53 |
+
+
|
| 54 |
+
+func (data UserInfoData) sessionJSON() map[string]any {
|
| 55 |
+
+ if data.Session == nil {
|
| 56 |
+
+ return nil
|
| 57 |
+
+ }
|
| 58 |
+
+
|
| 59 |
+
+ m := map[string]any{}
|
| 60 |
+
+ claims := make(map[string]any)
|
| 61 |
+
+ for k, vs := range data.Session.GetClaims() {
|
| 62 |
+
+ claims[k] = vs.AsSlice()
|
| 63 |
+
+ }
|
| 64 |
+
+ m["claims"] = claims
|
| 65 |
+
+ var deviceCredentials []any
|
| 66 |
+
+ for _, dc := range data.Session.GetDeviceCredentials() {
|
| 67 |
+
+ deviceCredentials = append(deviceCredentials, map[string]any{
|
| 68 |
+
+ "typeId": dc.GetTypeId(),
|
| 69 |
+
+ "id": dc.GetId(),
|
| 70 |
+
+ })
|
| 71 |
+
+ }
|
| 72 |
+
+ m["deviceCredentials"] = deviceCredentials
|
| 73 |
+
+ m["expiresAt"] = data.Session.GetExpiresAt().AsTime()
|
| 74 |
+
+ m["id"] = data.Session.GetId()
|
| 75 |
+
+ m["userId"] = data.Session.GetUserId()
|
| 76 |
+
+ return m
|
| 77 |
+
+}
|
| 78 |
+
+
|
| 79 |
+
+func (data UserInfoData) userJSON() map[string]any {
|
| 80 |
+
+ if data.User == nil {
|
| 81 |
+
+ return nil
|
| 82 |
+
+ }
|
| 83 |
+
+
|
| 84 |
+
+ m := map[string]any{}
|
| 85 |
+
+ claims := make(map[string]any)
|
| 86 |
+
+ for k, vs := range data.User.GetClaims() {
|
| 87 |
+
+ claims[k] = vs.AsSlice()
|
| 88 |
+
+ }
|
| 89 |
+
+ m["claims"] = claims
|
| 90 |
+
+ m["deviceCredentialIds"] = data.User.GetDeviceCredentialIds()
|
| 91 |
+
+ m["id"] = data.User.GetId()
|
| 92 |
+
+ m["name"] = data.User.GetName()
|
| 93 |
+
+ return m
|
| 94 |
+
+}
|
| 95 |
+
+
|
| 96 |
+
// UserInfo returns a handler that renders the user info page.
|
| 97 |
+
func UserInfo(data UserInfoData) http.Handler {
|
| 98 |
+
return httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {
|
tasks/codeql_go_benchmark_top30_v1/morefixes-14446e68cdc53bc98807/post_context.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Patch-overlapping Go context after the fix
|
| 2 |
+
|
| 3 |
+
## `internal/handlers/userinfo.go` (changed lines (4, 6, 39, 40, 41, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111))
|
| 4 |
+
|
| 5 |
+
```go
|
| 6 |
+
package handlers
|
| 7 |
+
|
| 8 |
+
import (
|
| 9 |
+
"net/http"
|
| 10 |
+
|
| 11 |
+
"github.com/pomerium/datasource/pkg/directory"
|
| 12 |
+
"github.com/pomerium/pomerium/internal/httputil"
|
| 13 |
+
"github.com/pomerium/pomerium/pkg/grpc/identity"
|
| 14 |
+
"github.com/pomerium/pomerium/pkg/grpc/session"
|
| 15 |
+
"github.com/pomerium/pomerium/pkg/grpc/user"
|
| 16 |
+
"github.com/pomerium/pomerium/ui"
|
| 17 |
+
"github.com/pomerium/webauthn"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
// UserInfoData is the data for the UserInfo page.
|
| 21 |
+
type UserInfoData struct {
|
| 22 |
+
CSRFToken string
|
| 23 |
+
IsImpersonated bool
|
| 24 |
+
Session *session.Session
|
| 25 |
+
User *user.User
|
| 26 |
+
Profile *identity.Profile
|
| 27 |
+
|
| 28 |
+
IsEnterprise bool
|
| 29 |
+
DirectoryUser *directory.User
|
| 30 |
+
DirectoryGroups []*directory.Group
|
| 31 |
+
|
| 32 |
+
WebAuthnCreationOptions *webauthn.PublicKeyCredentialCreationOptions
|
| 33 |
+
WebAuthnRequestOptions *webauthn.PublicKeyCredentialRequestOptions
|
| 34 |
+
WebAuthnURL string
|
| 35 |
+
|
| 36 |
+
BrandingOptions httputil.BrandingOptions
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
// ToJSON converts the data into a JSON map.
|
| 40 |
+
func (data UserInfoData) ToJSON() map[string]any {
|
| 41 |
+
m := map[string]any{}
|
| 42 |
+
m["csrfToken"] = data.CSRFToken
|
| 43 |
+
m["isImpersonated"] = data.IsImpersonated
|
| 44 |
+
m["session"] = data.sessionJSON()
|
| 45 |
+
m["user"] = data.userJSON()
|
| 46 |
+
m["profile"] = data.profileJSON()
|
| 47 |
+
m["isEnterprise"] = data.IsEnterprise
|
| 48 |
+
if data.DirectoryUser != nil {
|
| 49 |
+
m["directoryUser"] = data.DirectoryUser
|
| 50 |
+
}
|
| 51 |
+
if len(data.DirectoryGroups) > 0 {
|
| 52 |
+
m["directoryGroups"] = data.DirectoryGroups
|
| 53 |
+
}
|
| 54 |
+
m["webAuthnCreationOptions"] = data.WebAuthnCreationOptions
|
| 55 |
+
m["webAuthnRequestOptions"] = data.WebAuthnRequestOptions
|
| 56 |
+
m["webAuthnUrl"] = data.WebAuthnURL
|
| 57 |
+
httputil.AddBrandingOptionsToMap(m, data.BrandingOptions)
|
| 58 |
+
return m
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
func (data UserInfoData) profileJSON() map[string]any {
|
| 62 |
+
if data.Profile == nil {
|
| 63 |
+
return nil
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
m := map[string]any{}
|
| 67 |
+
claims := make(map[string]any)
|
| 68 |
+
for k, v := range data.Profile.GetClaims().AsMap() {
|
| 69 |
+
claims[k] = v
|
| 70 |
+
}
|
| 71 |
+
m["claims"] = m
|
| 72 |
+
return m
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
func (data UserInfoData) sessionJSON() map[string]any {
|
| 76 |
+
if data.Session == nil {
|
| 77 |
+
return nil
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
m := map[string]any{}
|
| 81 |
+
claims := make(map[string]any)
|
| 82 |
+
for k, vs := range data.Session.GetClaims() {
|
| 83 |
+
claims[k] = vs.AsSlice()
|
| 84 |
+
}
|
| 85 |
+
m["claims"] = claims
|
| 86 |
+
var deviceCredentials []any
|
| 87 |
+
for _, dc := range data.Session.GetDeviceCredentials() {
|
| 88 |
+
deviceCredentials = append(deviceCredentials, map[string]any{
|
| 89 |
+
"typeId": dc.GetTypeId(),
|
| 90 |
+
"id": dc.GetId(),
|
| 91 |
+
})
|
| 92 |
+
}
|
| 93 |
+
m["deviceCredentials"] = deviceCredentials
|
| 94 |
+
m["expiresAt"] = data.Session.GetExpiresAt().AsTime()
|
| 95 |
+
m["id"] = data.Session.GetId()
|
| 96 |
+
m["userId"] = data.Session.GetUserId()
|
| 97 |
+
return m
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
func (data UserInfoData) userJSON() map[string]any {
|
| 101 |
+
if data.User == nil {
|
| 102 |
+
return nil
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
m := map[string]any{}
|
| 106 |
+
claims := make(map[string]any)
|
| 107 |
+
for k, vs := range data.User.GetClaims() {
|
| 108 |
+
claims[k] = vs.AsSlice()
|
| 109 |
+
}
|
| 110 |
+
m["claims"] = claims
|
| 111 |
+
m["deviceCredentialIds"] = data.User.GetDeviceCredentialIds()
|
| 112 |
+
m["id"] = data.User.GetId()
|
| 113 |
+
m["name"] = data.User.GetName()
|
| 114 |
+
return m
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
// UserInfo returns a handler that renders the user info page.
|
| 118 |
+
func UserInfo(data UserInfoData) http.Handler {
|
| 119 |
+
return httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {
|
| 120 |
+
return ui.ServePage(w, r, "UserInfo", "User Info Dashboard", data.ToJSON())
|
| 121 |
+
})
|
| 122 |
+
}
|
| 123 |
+
```
|