Skip to content

Commit 5d66b79

Browse files
committed
refactor(redteam): rewrite agent in Go, drop Node.js runtime
1 parent a74a34a commit 5d66b79

17 files changed

Lines changed: 635 additions & 1349 deletions

.github/workflows/build-redteam-image.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v4
2121

22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.22'
26+
27+
- name: Build redteam agent
28+
run: |
29+
cd redteam
30+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o redteam-agent .
31+
2232
- name: Set up Docker Buildx
2333
uses: docker/setup-buildx-action@v3
2434

redteam/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules/
2+
redteam-agent

redteam/Dockerfile

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,19 @@
1-
# Stage 1: Install runtime dependencies
2-
FROM node:20-alpine AS deps
3-
WORKDIR /app
4-
COPY package.json package-lock.json* ./
5-
RUN npm ci --production
6-
7-
# Stage 2: Runtime with security testing tools
81
FROM alpine:3.19
92

103
RUN apk add --no-cache \
114
bash curl jq \
125
python3 \
13-
nodejs \
146
nmap nmap-ncat \
157
strace ltrace \
168
iptables nftables \
179
gcc musl-dev linux-headers \
1810
procps util-linux \
1911
ca-certificates
2012

21-
# Agent harness (pre-compiled dist/)
22-
COPY package.json /opt/redteam/
23-
COPY dist/ /opt/redteam/
24-
COPY --from=deps /app/node_modules /opt/redteam/node_modules
25-
26-
# cw binary — build externally and place in build context as cw-binary
27-
# To build: cd codewire-cli && CGO_ENABLED=0 go build -o ../pentest/redteam/cw-binary ./cmd/cw
13+
COPY redteam-agent /usr/local/bin/redteam-agent
2814
COPY cw-binary /usr/local/bin/cw
29-
30-
# Seed knowledge
3115
COPY seeds/ /opt/redteam/seeds/
3216

33-
# Configuration
34-
COPY system-prompt.md strategies.json /opt/redteam/
35-
COPY entrypoint.sh /opt/redteam/
36-
37-
RUN chmod +x /opt/redteam/entrypoint.sh /usr/local/bin/cw
17+
RUN chmod +x /usr/local/bin/redteam-agent /usr/local/bin/cw
3818

39-
ENTRYPOINT ["/opt/redteam/entrypoint.sh"]
19+
ENTRYPOINT ["redteam-agent"]

redteam/agent.ts

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

redteam/cw-binary

21 MB
Binary file not shown.

0 commit comments

Comments
 (0)