Skip to content

Commit 0aeec97

Browse files
authored
Update README.md, fix CI for new changes (#58)
Adds Quickstart to README.md, fixes the CI: 1) Adds automatic acceptance of new Conda ToS 2) Reconfigures cached file locations based on output structure.
1 parent 90e5692 commit 0aeec97

File tree

11 files changed

+161
-82
lines changed

11 files changed

+161
-82
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,4 +374,4 @@
374374
],
375375
"type": "sink"
376376
}
377-
]
377+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,4 @@
231231
"sink_args": [],
232232
"type": "source"
233233
}
234-
]
234+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,4 @@
183183
"path"
184184
]
185185
}
186-
]
186+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,4 @@
225225
],
226226
"type": "taint-propagator"
227227
}
228-
]
228+
]

.github/workflows/CI_pipeline.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
activate-environment: iris
6464
auto-update-conda: true
6565

66-
- name: Set up Java ${{ matrix.java_version }}
66+
- name: Set up Java version ${{ matrix.java_version }}
6767
uses: actions/setup-java@v4
6868
with:
6969
distribution: 'temurin'
@@ -165,11 +165,8 @@ jobs:
165165
166166
- name: Relocate cached output for ${{ matrix.project_slug }}
167167
run: |
168-
mkdir output/${{ matrix.project_slug }}/test/analysis/${{ matrix.cwe }}
169-
mv .github/cached_output/${{ matrix.project_slug }}/test/common/llm_labelled_source_func_params.json output/${{ matrix.project_slug }}/test/analysis/${{ matrix.cwe }}
170-
mv .github/cached_output/${{ matrix.project_slug }}/test/cwe-022/llm_labelled_sink_apis.json output/${{ matrix.project_slug }}/test/analysis/${{ matrix.cwe }}
171-
mv .github/cached_output/${{ matrix.project_slug }}/test/cwe-022/llm_labelled_source_apis.json output/${{ matrix.project_slug }}/test/analysis/${{ matrix.cwe }}
172-
mv .github/cached_output/${{ matrix.project_slug }}/test/cwe-022/llm_labelled_taint_prop_apis.json output/${{ matrix.project_slug }}/test/analysis/${{ matrix.cwe }}
168+
mkdir -p output/${{ matrix.project_slug }}/test/analysis/${{ matrix.cwe }}
169+
mv .github/cached_output/perwendel__spark_CVE-2018-9159_2.7.1/test/* output/${{ matrix.project_slug }}/test/analysis/${{ matrix.cwe }}/
173170
174171
- name: Build project ${{ matrix.project_slug }}
175172
run: |

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ Lastly, add the path of this executable to your `PATH` environment variable:
9090
export PATH="$PWD/codeql:$PATH"
9191
```
9292

93-
**Note:** Also adjust the environment variable `CODEQL_QUERY_VERSION` in `src/config.py` according to the instructions therein. For instance, for CodeQL v2.15.0, this should be `0.8.0`.
94-
9593
### Visualizer
9694

9795
IRIS comes with a visualizer to view the SARIF output files. More detailed instructions can be found in the [docs](https://iris-sast.github.io/iris/features/visualizer.html).
@@ -106,6 +104,24 @@ IRIS comes with a visualizer to view the SARIF output files. More detailed instr
106104
4. **Select a project**: Choose a project from the dropdown to load its analysis results
107105
5. **Filter and explore**: Use the CWE and model filters to explore specific vulnerabilities
108106

107+
## ⚡ Quickstart
108+
109+
Make sure you have followed all of the environment setup instructions before proceeding!
110+
111+
To quickly try IRIS on the example project `perwendel__spark_CVE-2018-9159_2.7.1`, run the following commands:
112+
113+
```sh
114+
# Build the project
115+
python scripts/fetch_and_build.py --filter perwendel__spark_CVE-2018-9159_2.7.1
116+
117+
# Generate the CodeQL database
118+
python scripts/build_codeql_dbs.py --project perwendel__spark_CVE-2018-9159_2.7.1
119+
120+
# Run IRIS analysis
121+
python src/iris.py --query cwe-022wLLM --run-id test --llm qwen2.5-coder-7b perwendel__spark_CVE-2018-9159_2.7.1
122+
```
123+
124+
This will build the project, generate the CodeQL database, and analyze it for CWE-022 vulnerabilities using the specified LLM (qwen2.5-coder-7b). The output of these three steps will be stored under `data/build-info/`, `data/codeql-dbs/`, and `output/` respectively.
109125

110126
## 💫 Contributions
111127
We welcome any contributions, pull requests, or issues!

docs/environment-setup/native.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,3 @@ Lastly, add the path of this executable to your `PATH` environment variable:
5656
```sh
5757
export PATH="$PWD/codeql:$PATH"
5858
```
59-
60-
**Note:** Also adjust the environment variable `CODEQL_QUERY_VERSION` in `src/config.py` according to the instructions therein. For instance, for CodeQL v2.15.0, this should be `0.8.0`.

src/codeql_vul.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def run_codeql_query(self):
116116
sp.run(cmd + ["--format=csv"])
117117

118118
def run_simple_codeql_query(self, query, target_csv_path=None, suffix=None, dyn_queries={}):
119-
runner = CodeQLQueryRunner(self.project_name, self.project_output_path, self.project_codeql_db_path, self.master_logger)
119+
runner = CodeQLQueryRunner(self.project_output_path, self.project_codeql_db_path, self.master_logger)
120120
runner.run(query, target_csv_path, suffix, dyn_queries)
121121

122122
def extract_class_locations(self):

src/iris.py

Lines changed: 113 additions & 60 deletions
Large diffs are not rendered by default.

src/modules/codeql_query_runner.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@
1111
import math
1212
import random
1313

14-
from src.config import CODEQL_DIR, CODEQL_QUERY_VERSION
14+
from src.config import CODEQL_DIR
1515
from src.queries import QUERIES
1616

1717
CODEQL = f"{CODEQL_DIR}/codeql"
18-
CODEQL_CUSTOM_QUERY_DIR = f"{CODEQL_DIR}/qlpacks/codeql/java-queries/{CODEQL_QUERY_VERSION}/myqueries"
1918

2019
ENTRY_SCRIPT_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../")
2120

2221
class CodeQLQueryRunner:
23-
def __init__(self, project_name, project_output_path, project_codeql_db_path, project_logger):
24-
self.project_name = project_name
25-
self.project_codeql_db_path = project_codeql_db_path
22+
def __init__(self, project_output_path, project_codeql_db_path, project_logger):
2623
self.project_output_path = project_output_path
24+
self.project_codeql_db_path = project_codeql_db_path
2725
self.project_logger = project_logger
2826

2927
def run(self, query, target_csv_path=None, suffix=None, dyn_queries={}):
@@ -40,7 +38,7 @@ def run(self, query, target_csv_path=None, suffix=None, dyn_queries={}):
4038

4139
# 1. Create the directory in CodeQL's queries path
4240
suffix_dir = "" if suffix is None else f"/{suffix}"
43-
codeql_query_dir = f"{CODEQL_CUSTOM_QUERY_DIR}/{self.project_name}/{query}{suffix_dir}"
41+
codeql_query_dir = f"{self.project_output_path}/myqueries/{query}{suffix_dir}"
4442
os.makedirs(codeql_query_dir, exist_ok=True)
4543

4644
# 2. Copy the basic queries and supporting queries to the codeql directory

0 commit comments

Comments
 (0)