Skip to content

Commit 4af4a65

Browse files
Apply suggestions from code review
Co-authored-by: Copilot <[email protected]>
1 parent 72a154c commit 4af4a65

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/seclab_taskflows/mcp_servers/codeql_python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ It will most likely look similar to this:
1717
- create a folder named 'data'
1818
- create or update your `.env` file in the root of this project with values for:
1919
```
20-
COPILOT_TOKEN= # a fine-grained GitHub personal access token with permssion for "copilot chat"
20+
COPILOT_TOKEN= # a fine-grained GitHub personal access token with permission for "copilot chat"
2121
CODEQL_DBS_BASE_PATH="/workspaces/seclab-taskflows/data/codeql_databases" #path to folder with your CodeQL databases
2222
2323
# Example values for a local setup, run with `python -m seclab_taskflow_agent -t seclab_taskflows.taskflows.audit.remote_sources_local`

src/seclab_taskflows/mcp_servers/codeql_python/codeql_sqlite_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SPDX-FileCopyrightText: 2025 GitHub
22
# SPDX-License-Identifier: MIT
33

4-
from sqlalchemy import String, Text, Integer, ForeignKey, Column
5-
from sqlalchemy.orm import DeclarativeBase, mapped_column, Mapped, relationship
4+
from sqlalchemy import Text
5+
from sqlalchemy.orm import DeclarativeBase, mapped_column, Mapped
66
from typing import Optional
77

88
class Base(DeclarativeBase):

src/seclab_taskflows/mcp_servers/codeql_python/mcp_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import json
2121
from sqlalchemy import create_engine
2222
from sqlalchemy.orm import Session
23-
from pathlib import Path
23+
2424
import zipfile
2525
import httpx
2626
import aiofiles
@@ -88,7 +88,7 @@ def store_new_source(self, repo, source_location, type, notes, update = False):
8888
with Session(self.engine) as session:
8989
existing = session.query(Source).filter_by(repo = repo, source_location = source_location).first()
9090
if existing:
91-
existing.notes += notes
91+
existing.notes = (existing.notes or "") + notes
9292
session.commit()
9393
return f"Updated notes for source at {source_location} in {repo}."
9494
else:
@@ -120,7 +120,7 @@ def _csv_parse(raw):
120120
for j, k in enumerate(keys):
121121
this_obj[k.strip()] = row[j + 2]
122122
results.append(this_obj)
123-
except csv.Error as e:
123+
except (csv.Error, IndexError, ValueError) as e:
124124
return ["Error: CSV parsing error: " + str(e)]
125125
return results
126126

@@ -218,7 +218,7 @@ def clear_codeql_repo(owner: str, repo: str):
218218

219219
@mcp.tool()
220220
def get_file_contents(
221-
file_uri: str = Field(description="The file URI to get contents for. The URI scheme is defined as `file://path` and `file://path:region`. Examples of file URI: `file:///path/to/file:1:2:3:4`, `file:///path/to/file`. File URIs optionally contain a region definition that looks like `start_line:start_column:end_line:end_column` which will limit the contents returned to the specified region, for example `file:///path/to/file:1:2:3:4` indicates a file region of `1:2:3:4` which would return the content of the file starting at line 1, column 1 and ending at line 3 column 4. Line and column indices are 1-based, meaning line and column values start at 1. If the region is ommitted the full contents of the file will be returned, for example `file:///path/to/file` returns the full contents of `/path/to/file`."),
221+
file_uri: str = Field(description="The file URI to get contents for. The URI scheme is defined as `file://path` and `file://path:region`. Examples of file URI: `file:///path/to/file:1:2:3:4`, `file:///path/to/file`. File URIs optionally contain a region definition that looks like `start_line:start_column:end_line:end_column` which will limit the contents returned to the specified region, for example `file:///path/to/file:1:2:3:4` indicates a file region of `1:2:3:4` which would return the content of the file starting at line 1, column 1 and ending at line 3 column 4. Line and column indices are 1-based, meaning line and column values start at 1. If the region is omitted the full contents of the file will be returned, for example `file:///path/to/file` returns the full contents of `/path/to/file`."),
222222
database_path: str = Field(description="The path to the CodeQL database.")):
223223
"""Get the contents of a file URI from a CodeQL database path."""
224224

src/seclab_taskflows/taskflows/audit/remote_sources_local.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ taskflow:
5454
async_limit: 5
5555
max_steps: 100
5656
name: source analysis
57-
description: Identify actions that untrusted users are allowed performed the source.
57+
description: Identify actions that untrusted users are allowed perform the source.
5858
agents:
5959
- seclab_taskflows.personalities.auditer
6060
user_prompt: |

src/seclab_taskflows/toolboxes/codeql_python.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ server_prompt: |
6262
`start_line:start_column:end_line:end_column` which will limit the contents
6363
returned to the specified region. For example `file:///path/to/file:1:2:3:4`
6464
indicates a file region of `1:2:3:4` which would return the content of the
65-
file starting at line 1, column 1 and ending at line 3 column 4. These line
65+
file starting at line 1, column 2 and ending at line 3, column 4. These line
6666
and column indices are 1-based, meaning line and column values start at 1.
6767
6868
If the region is ommitted the full contents of the file will be returned,
@@ -75,5 +75,5 @@ server_prompt: |
7575
with a region definition such as: `file:///path/to/file:1:0:4:0`.
7676
7777
When unsure how to fetch a specific region, fall back to fetching the full file
78-
contents for a file by ommitting the region definition, for example
78+
contents for a file by omitting the region definition, for example
7979
`file:///path/to/file`

0 commit comments

Comments
 (0)