Skip to content

Commit efbde89

Browse files
Merge pull request #34 from kevinbackhouse/scripts
Move scripts to their own directory
2 parents 4d8c3db + 7c5b497 commit efbde89

File tree

5 files changed

+40
-34
lines changed

5 files changed

+40
-34
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This repository contains example taskflows to use with the [SecLab Taskflow Agen
44

55
## Running with docker script
66

7-
The recommended way of running the taskflows in this repo is by creating a codespace, and running the script [`run_seclab_agent.sh`](https://github.com/GitHubSecurityLab/seclab-taskflows/blob/main/src/run_seclab_agent.sh) to run a docker container of the `seclab-taskflow-agent` as outlined [here](https://github.com/GitHubSecurityLab/seclab-taskflow-agent/tree/main?tab=readme-ov-file#deploying-from-docker). Note that this script needs to be run from the `src` directory, and the `.env` file with the environment variables for the custom MCP servers to store data needs to be in the same directory.
7+
The recommended way of running the taskflows in this repo is by creating a codespace, and running the script [`run_seclab_agent.sh`](scripts/run_seclab_agent.sh) to run a docker container of the `seclab-taskflow-agent` as outlined [here](https://github.com/GitHubSecurityLab/seclab-taskflow-agent/tree/main?tab=readme-ov-file#deploying-from-docker). Note that this script needs to be run from the main directory of the repo, and the `.env` file with the environment variables for the custom MCP servers to store data needs to be in the same directory.
88

9-
First, create a directory named `data` and a `.env` file in the `src` directory. For [`run_seclab_agent.sh`](https://github.com/GitHubSecurityLab/seclab-taskflows/blob/main/src/run_seclab_agent.sh) you can use:
9+
First, create a `.env` file in the main directory of the repo. For [`run_seclab_agent.sh`](scripts/run_seclab_agent.sh) you can use:
1010

1111
```
1212
MEMCACHE_STATE_DIR=/app/data
@@ -16,7 +16,7 @@ LOG_DIR=/app/logs
1616
```
1717

1818

19-
The `MEMCACHE_STATE_DIR` is needed to persist some intermediate data in the memcache, `DATA_DIR` is needed for various mcp servers to store intermediate results, and `LOG_DIR` is used to store log files generated by the servers. These can be set in a `.env` file in the `src` directory. If no environment variables are set for the custom MCP servers, relevant folders will be created automatically. The location depends on the platform, and is set by [`platformdirs`](https://pypi.org/project/platformdirs/).
19+
The `MEMCACHE_STATE_DIR` is needed to persist some intermediate data in the memcache, `DATA_DIR` is needed for various mcp servers to store intermediate results, and `LOG_DIR` is used to store log files generated by the servers. These can be set in a `.env` file in the main directory. If no environment variables are set for the custom MCP servers, relevant folders will be created automatically. The location depends on the platform, and is set by [`platformdirs`](https://pypi.org/project/platformdirs/).
2020

2121
In addition, AI API endpoints and secrets also need to be configured via [environment variables or Codespace secrets](https://github.com/GitHubSecurityLab/seclab-taskflow-agent?tab=readme-ov-file#configuration). In particular, the environment variables `AI_API_TOKEN` and `AI_API_ENDPOINT` need to be set to the appropriate AI API endpoints and credentials. If not set, the default `AI_API_ENDPOINT` is GitHub models:
2222

@@ -31,8 +31,7 @@ Individual taskflows may need additional setup, please refer to the `README.md`
3131
After setting the relevant env vars, run an example taskflow with:
3232

3333
```bash
34-
cd src
35-
./run_seclab_agent.sh -t seclab_taskflows.taskflows.audit.ghsa_variant_analysis_demo -g repo=github/cmark-gfm -g ghsa=GHSA-c944-cv5f-hpvr
34+
./scripts/run_seclab_agent.sh python -m seclab_taskflow_agent -t seclab_taskflows.taskflows.audit.ghsa_variant_analysis_demo -g repo=github/cmark-gfm -g ghsa=GHSA-c944-cv5f-hpvr
3635
```
3736

3837
## Background

scripts/audit/run_audit.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: 2025 GitHub
3+
# SPDX-License-Identifier: MIT
4+
5+
set -e
6+
7+
if [ -z "$1" ]; then
8+
echo "Usage: $0 <repo>";
9+
exit 1;
10+
fi
11+
12+
python -m seclab_taskflow_agent -t seclab_taskflows.taskflows.audit.fetch_source_code -g repo="$1"
13+
python -m seclab_taskflow_agent -t seclab_taskflows.taskflows.audit.identify_applications -g repo="$1"
14+
python -m seclab_taskflow_agent -t seclab_taskflows.taskflows.audit.gather_web_entry_point_info -g repo="$1"
15+
python -m seclab_taskflow_agent -t seclab_taskflows.taskflows.audit.classify_application_local -g repo="$1"
16+
python -m seclab_taskflow_agent -t seclab_taskflows.taskflows.audit.audit_issue_local_iter -g repo="$1"

scripts/run_seclab_agent.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: 2025 GitHub
3+
# SPDX-License-Identifier: MIT
4+
5+
if [ ! -f ".env" ]; then
6+
touch ".env"
7+
fi
8+
9+
mkdir -p .local
10+
mkdir -p logs
11+
mkdir -p data
12+
13+
# Note: this uses the trick described [here](https://unix.stackexchange.com/a/646335)
14+
# to pass extra command line arguments into `bash -c`.
15+
docker run -i \
16+
--mount type=bind,src="$PWD",dst=/app \
17+
--mount type=bind,src="$PWD/.local",dst=/root/.local \
18+
-e GH_TOKEN="$GH_TOKEN" -e AI_API_TOKEN="$AI_API_TOKEN" --entrypoint /bin/bash \
19+
"ghcr.io/githubsecuritylab/seclab-taskflow-agent" \
20+
-c 'pip install -q -e /app && exec "$@"' this-is-bash-dollar-zero "$@"

src/run_audit.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/run_seclab_agent.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)